Enum cssparser::Token [] [src]

pub enum Token<'a> {
    Ident(Cow<'a, str>),
    AtKeyword(Cow<'a, str>),
    Hash(Cow<'a, str>),
    IDHash(Cow<'a, str>),
    QuotedString(Cow<'a, str>),
    UnquotedUrl(Cow<'a, str>),
    Delim(char),
    Number(NumericValue),
    Percentage(PercentageValue),
    Dimension(NumericValueCow<'a, str>),
    WhiteSpace(&'a str),
    Comment(&'a str),
    Colon,
    Semicolon,
    Comma,
    IncludeMatch,
    DashMatch,
    PrefixMatch,
    SuffixMatch,
    SubstringMatch,
    Column,
    CDO,
    CDC,
    Function(Cow<'a, str>),
    ParenthesisBlock,
    SquareBracketBlock,
    CurlyBracketBlock,
    BadUrl,
    BadString,
    CloseParenthesis,
    CloseSquareBracket,
    CloseCurlyBracket,
}

One of the pieces the CSS input is broken into.

Some components use CowString in order to borrow from the original input string and avoid allocating/copying when possible.

Variants

A <at-keyword-token>

The value does not include the @ marker.

A <hash-token> with the type flag set to "unrestricted"

The value does not include the # marker.

A <hash-token> with the type flag set to "id"

The value does not include the # marker.

A <string-token>

The value does not include the quotes.

A <url-token> or url( <string-token> ) function

The value does not include the url( ) markers or the quotes.

A <delim-token>

A comment.

The CSS Syntax spec does not generate tokens for comments, But we do, because we can (borrowed &str makes it cheap).

The value does not include the /* */ markers.

A : <colon-token>

A ; <semicolon-token>

A , <comma-token>

A <!-- <CDO-token>

A <function-token>

The value (name) does not include the ( marker.

A <(-token>

A <[-token>

A <{-token>

A <bad-url-token>

This token always indicates a parse error.

A <bad-string-token>

This token always indicates a parse error.

A <)-token>

When obtained from one of the Parser::next* methods, this token is always unmatched and indicates a parse error.

A <]-token>

When obtained from one of the Parser::next* methods, this token is always unmatched and indicates a parse error.

A <}-token>

When obtained from one of the Parser::next* methods, this token is always unmatched and indicates a parse error.

Methods

impl<'a> Token<'a>
[src]

Return whether this token represents a parse error.

BadUrl and BadString are tokenizer-level parse errors.

CloseParenthesis, CloseSquareBracket, and CloseCurlyBracket are unmatched and therefore parse errors when returned by one of the Parser::next* methods.

impl<'a> Token<'a>
[src]

Categorize a token into a type that determines when /**/ needs to be inserted between two tokens when serialized next to each other without whitespace in between.

See the TokenSerializationType::needs_separator_when_before method.

Trait Implementations

impl<'a> PartialEq for Token<'a>
[src]

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

impl<'a> Debug for Token<'a>
[src]

Formats the value using the given formatter.

impl<'a> Clone for Token<'a>
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl<'a> ToCss for Token<'a>
[src]

Serialize self in CSS syntax, writing to dest.

Serialize self in CSS syntax and return a string. Read more

Serialize self in CSS syntax and return a result compatible with std::fmt::Show. Read more