selector function

StyleSheet selector(
  1. Object input, {
  2. List<Message>? errors,
})

Parse the input CSS selector into a tree. The input can be a String, or List<int> of bytes and returns a StyleSheet AST. The optional errors list will contain each error/warning as a Message.

Implementation

// TODO(jmesserly): should rename "parseSelector" and return Selector
StyleSheet selector(Object input, {List<Message>? errors}) {
  var source = _inputAsString(input);

  _createMessages(errors: errors);

  var file = SourceFile.fromString(source);
  return (_Parser(file, source)..tokenizer.inSelector = true).parseSelector();
}