Expand description
Token representation, kinds, flags, and binary-search offset lookup.
Structs§
- Token
- Compact 12-byte lossless lexical token referencing a byte span
[start, end)insrc.
Enums§
- Token
Kind - Lexical kind of a Rust source token (edition-independent, context-free).
Constants§
- HAS_
ERROR - Flag set on a
Tokenwhen lexical recovery occurred (e.g. unclosed literal or block comment, empty/overlong char literal, missing digits after base/exponent prefix, invalid raw identifier, or unrecognized source character). - JOINT_
NEXT - Flag set on a single-character punctuation
Tokenwhen the immediately following token is also a single-character punctuation token with zero intervening trivia (self.end == next.start).
Functions§
- token_
at - Finds the index of the token covering
byte(token.start <= byte < token.end) usingO(log N)binary search over a contiguous or monotonic slice of tokens.