|
| struct | Ident |
| | <ident-token>, which represents a CSS identifier, which is an unquoted string. More...
|
| struct | Function |
| | <function-token>, which indicates the start of a function call. More...
|
| struct | AtKeyword |
| | <at-keyword-token>, representing @ followed by an identifier. More...
|
| struct | Hash |
| | <hash-token>, representing a CSS identifier that starts with a #. More...
|
| struct | String |
| | <string-token>, which represents a quoted string, either with double or single quotes ("foo" or 'foo'). More...
|
| struct | BadString |
| | <bad-string-token>, which is generated when a string contains an unescaped newline. More...
|
| struct | Url |
| | <url-token>, which represents a url() function. More...
|
| struct | BadUrl |
| | <bad-url-token>, which represents an invalid url() function. More...
|
| struct | Delim |
| | <delim-token>, which contains a single character. More...
|
| struct | Number |
| | <number-token>, which represents a number, either integer or floating point. More...
|
| struct | Percentage |
| | <percentage-token>, which represents a percentage such as '50'. More...
|
| struct | Dimension |
| | <dimension-token>, which represents a dimension such as '50px'. More...
|
| struct | Whitespace |
| | <whitespace-token>, which contains one or more whitespace characters in the source. More...
|
| struct | CDO |
| | <CDO-token>, which represents <!
More...
|
| struct | CDC |
| | <CDC-token>, which represents --> in the source. More...
|
| struct | Colon |
| | <colon-token>, which represents ':' in the source. More...
|
| struct | Semicolon |
| | <semicolon-token>, which represents ';' in the source. More...
|
| struct | Comma |
| | <comma-token>, which represents ',' in the source. More...
|
| struct | SquareBracket |
| | <[-token>, which represents [ in the source. More...
|
| struct | Parenthesis |
| | <(-token>, which represents ( in the source. More...
|
| struct | CurlyBracket |
| | <{-token>, which represents { in the source. More...
|
| struct | CloseSquareBracket |
| | <]-token>, which represents ] in the source. More...
|
| struct | CloseParenthesis |
| | <)-token>, which represents ) in the source. More...
|
| struct | CloseCurlyBracket |
| | <}-token>, which represents } in the source. More...
|
| struct | ErrorToken |
| | Special error token, used to mark named parsing errors. More...
|
| struct | EofToken |
| | <EOF-token>, which marks the end of the input stream and is always output at the end of a token list. More...
|
|
| | Token (TokenValue &&value, size_t offset) |
| | Construct a new Token object, taking ownership of a TokenValue, at a given offset within the source string.
|
| TokenIndex | tokenIndex () const |
| | Returns the token type.
|
|
FileOffset | offset () const |
| | Returns the offset within the source string where this token starts.
|
| template<typename T> |
| bool | is () const |
| | Check if the token is of the given type.
|
| template<typename T> |
| T & | get () & |
| | Get the token value as a reference.
|
| template<typename T> |
| const T & | get () const & |
| | Get the token value as a const-reference.
|
| template<typename T> |
| T && | get () && |
| | Get the token value as an rvalue-reference for move semantics.
|
| template<typename T> |
| T * | tryGet () |
| | Get the token value as a pointer, or nullptr if the token is not of the given type.
|
| template<typename T> |
| const T * | tryGet () const |
| | Get the token value as a const-pointer, or nullptr if the token is not of the given type.
|
| template<typename Visitor> |
| auto | visit (Visitor &&visitor) const |
| | Visit the token value using a visitor, which internally uses std::visit.
|
|
bool | isParseError () const |
| | Returns true if this token is a type of parse error.
|
|
bool | operator== (const Token &other) const |
| | Equality operator.
|
A CSS token, which are created as a first step when parsing a CSS string.
See https://www.w3.org/TR/css-syntax-3/#tokenization for more details.
| donner::css::Token::Token |
( |
TokenValue && | value, |
|
|
size_t | offset ) |
|
inline |
Construct a new Token object, taking ownership of a TokenValue, at a given offset within the source string.
This allows creating a Token from any CSS Tokens documented above.
For example, to create a token of a given type:
Token(TokenValue &&value, size_t offset)
Construct a new Token object, taking ownership of a TokenValue, at a given offset within the source s...
Definition Token.h:769
The tokenizer automatically creates tokens using this API.
- Parameters
-
| value | Token value. |
| offset | Offset within the source string where this token starts. |