marianoguerra/css/token does not have a README file

    HashKind

    pub(all) enum HashKind {
    Id
    Unrestricted
    } derive(Eq,
    Debug
    )

    Whether a #... can be an id selector, or only a hex colour.

    The distinction is the specification's and it is load-bearing: #1a2b3c is a colour but not a valid id, so #foo and #1a2b3c cannot be the same token if a selector parser is to reject the second.

    Token

    Token::is_trivia

    fn Token::is_trivia(self : Token) -> Bool

    Whether this token is skipped when looking for the next meaningful one.

    TokenKind

    pub(all) enum TokenKind {
    Ident(String)
    Function(String)
    AtKeyword(String)
    Hash(String, HashKind)
    Str(String)
    BadStr
    Url(String)
    BadUrl
    Number(String, Double, Bool)
    Percentage(String, Double)
    Dimension(String, Double, Bool, String)
    Whitespace
    Colon
    Semicolon
    Comma
    LBracket
    RBracket
    LParen
    RParen
    LBrace
    RBrace
    Cdo
    Cdc
    Comment(String)
    Delim(Char)
    Eof
    } derive(Eq,
    Debug
    )

    TokenKind::closer_for

    fn TokenKind::closer_for(self : TokenKind) -> TokenKind?

    The opener that this closer matches, if it is one.

    Used by error recovery, which has to know how deep it is before it can know whether a } ends the thing it is skipping.

    TokenKind::is_opener

    fn TokenKind::is_opener(self : TokenKind) -> Bool

    TokenKind::to_debug

    fn TokenKind::to_debug(self : TokenKind) -> String

    A stable one-line rendering of a token, for tests and for the oracle.

    Hand-written rather than derived because this string is an interface: the differential harness compares it, so it must not change when a variant is renamed or a field reordered. It is also the only place a Char or a Double gets formatted, which keeps backend differences in number printing confined to one function.

    dump

    fn dump(toks : Array[Token]) -> String

    A whole token stream, one token per line, for the differential harness.

    tokenize

    fn tokenize(src : String) -> Array[Token]

    Tokenize a whole stylesheet, ending with exactly one Eof.

    Source Files

    Powered by MoonBit

    Site sourceReport issuePackagesBuild queueSkillsStatistics

    © 2026 mooncakes.io