Expand description
Lexer that tokenizes .cabal source into CST nodes.
Hand-written lexer for .cabal files.
The lexer operates line-by-line, classifying each line and producing tokens that capture every byte of the input (via spans and trivia). The parser consumes these tokens to build the CST.
Key properties:
- Zero-copy: tokens are
Spanreferences into the source string. - Full coverage: every byte is accounted for by a token span or trivia piece.
- Indentation tracking: each token records its column position (tabs = 8).
Structs§
- Token
- A single token produced by the lexer.
- Trivia
Piece - A piece of trivia attached to a token.
Enums§
- Token
Kind - The kind of a token.
- Trivia
Kind - The kind of a trivia piece.