Expand description
Lexer — logos-generated DFA producing a stream of LexToken.
Reference: spec 0001 §4.1. Every significant token carries its byte range; trivia (whitespace + comments) is surfaced as regular tokens so the parser can attach it to the enclosing node.
Case insensitivity is handled per-keyword via ignore(case) on the
logos derive; the text of the token preserves the original casing so
the formatter can honour user preference when requested.
Structs§
- LexError
- A lexer-level diagnostic: a code (matching
DiagCodediscriminants incyrs-diag) plus a message and byte range. Emitted byvalidate_tokensfor errors that can only be detected after the DFA run — unterminated literals, invalid escape sequences, etc. - LexToken
- A single lexed token: kind, original text, and byte range.
Functions§
- lex
- Tokenise an entire source string. Unknown bytes become
SyntaxKind::ERRORtokens that preserve their range; the lexer never panics on input. - validate_
tokens - Scan a token stream for lex-level errors that the DFA cannot express directly: