Expand description
Types and functions to parse a token stream into a cascade.
Structs§
- Property
- Represents a CSS property that starts with a sequence of tokens which usually is the name, a colon, another sequence of tokens which usually is the value and finally ends with a semicolon. The semicolon is the parser’s anchor point: it starts by locating the semicolon and then parses backwards until it has collected the name.
- Rule
- Represents a CSS rule that starts with a preamble which usually contains the
selectors and ends with a
{ ... }delimited group.
Enums§
- Error
- Type of error that is returned during validation.
- Item
- Represents a CSS item: either a property or a rule.
Functions§
- parse
- Parses the given token stream and returns a vector of items. These items
might be missing fields. Use
validate(items)to check for any errors. In addition, this function does not recursively parse rules. - parse_
property - Parses a single property and zero or more preceeding rules from the given slice of tokens.
- parse_
rules - Parses zero or more rules from the given slice of tokens.
- validate
- Validates the given parse and returns any errors that it encounters.