parserino.css.selector
CSS selectors: syntax tree and parser.
The parser follows Selectors Level 4, for a static document: user-action and time pseudo-classes (:hover, :visited, ...) and pseudo-elements (::before) are valid but never match. It works at runtime and at compile time.
Namespace prefixes are predefined: html, svg, math, xlink, xml, xmlns.
Types 10
How a compound selector is related to the previous one
Kinds of simple selectors
Namespace of a type or attribute selector (svg|rect, [xlink|href]): the other members are the predefined prefixes
Operator of an attribute selector
Case sensitivity of the value of an attribute selector
Pseudo-classes without arguments that can match (:first-child is FirstChild)
A simple selector
SimpleKind kindAttrMatch matchAttrCase attrCasePseudoClass pseudobool insensitiveNsMatch nsconst(char)[] nameconst(char)[] rawNameuint knownIdconst(char)[] valuelong along bconst(SelectorList) * listconst(const(char)[])[] rangesA sequence of simple selectors (div.a[x])
A comma separated list of complex selectors
const(Complex)[] itemsbool looksForward() const @nogc nothrow pureDoes any selector need the following siblings or the children of the element? (`:last-child`, `:has()`, `:empty`, ...)bool needsDocument() const @nogc nothrow pureDoes any selector depend on the whole document? (`:lang()` on the `<meta>` default language, `:dir()` on the text of the ancestors with `dir=auto`)Functions 1
const(SelectorList) * parseSelector(const(char)[] input, ref Arena arena) @nogc nothrow pure @safe @trustedParse a selector list. It returns `null` on syntax errors or if out of memory. All the memory comes from `arena`.