function parseSelector(selector, context) {
  let astSelector
  try {
    astSelector = parser().astSync(selector)
  } catch (error) {
    context.report({
      loc: { line: 0, column: 0 },
      message: `Cannot parse selector: ${selector}.`
    })
    return {
      test: () => false
    }
  }

  try {
    const test = selectorsToVElementMatcher(astSelector.nodes)

    return {
      test(element) {
        return test(element, null)
      }
    }
  } catch (error) {
    if (error instanceof SelectorError) {
      context.report({
        loc: { line: 0, column: 0 },
        message: error.message
      })
      return {
        test: () => false
      }
    }
    throw error
  }
}
Parses CSS selectors and returns an object with a function that tests VElement.
@param {string} selector CSS selector
@param {RuleContext} context - The rule context.
@returns {VElementSelector}