enum

TOML::TokenKind

Inherits Enum < Comparable < Value < Object

Token kinds emitted by the lexer.

The lexer is intentionally fine-grained for structural elements (so the parser does not need to look at characters), and coarse-grained for value atoms (Number, BareKeyOrAtom) — those are disambiguated by the parser based on context (a 1979 after = in a key/value pair could be an integer, a float, a date, or part of a datetime; only the parser can decide).

Trivia tokens (Whitespace, Newline, Comment) are emitted rather than skipped, because the AST keeps them attached to their nodes for byte-identical round-trips.

Constants

Whitespace = 0

Trivia.

Newline = 1
Comment = 2
Equal = 3

Structural punctuation.

Dot = 4
Comma = 5
LBracket = 6
RBracket = 7
LBrace = 8
RBrace = 9
BasicString = 10

Strings (delimiters included in the raw text).

MultilineBasicString = 11
LiteralString = 12
MultilineLiteralString = 13
BareKeyOrAtom = 14

An atom that can be a bare key (a-z A-Z 0-9 _ -) OR a value atom (integer, float, boolean, datetime, inf, nan, true, false). The parser disambiguates by context. We keep the raw text byte-for-byte so the serializer can re-emit it unchanged.

EOF = 15

End of input.

Instance methods

bare_key_or_atom?

Returns true if this enum value equals BareKeyOrAtom

Source
basic_string?

Returns true if this enum value equals BasicString

Source
comma?

Returns true if this enum value equals Comma

Source
comment?

Returns true if this enum value equals Comment

Source
dot?

Returns true if this enum value equals Dot

Source
eof?

Returns true if this enum value equals EOF

Source
equal?

Returns true if this enum value equals Equal

Source
l_brace?

Returns true if this enum value equals LBrace

Source
l_bracket?

Returns true if this enum value equals LBracket

Source
literal_string?

Returns true if this enum value equals LiteralString

Source
multiline_basic_string?

Returns true if this enum value equals MultilineBasicString

Source
multiline_literal_string?

Returns true if this enum value equals MultilineLiteralString

Source
newline?

Returns true if this enum value equals Newline

Source
r_brace?

Returns true if this enum value equals RBrace

Source
r_bracket?

Returns true if this enum value equals RBracket

Source
whitespace?

Returns true if this enum value equals Whitespace

Source