Expand description
Trivia-preserving parsing and formatting for logos + lalrpop pipelines.
TriviaLexerwraps anyIterator<Item = Result<(usize, Tok, usize), E>>and records comments/blank lines on the side while the parser sees only semantic tokens.attachplaces those trivia events on AST node spans as leading, trailing, or dangling comments.prettyis a smallDocIR with explicit trivia slots that the renderer resolves against aCommentMap.
Trivia is generic over a kind enum K so downstream crates can carry a
richer classification through every layer. The default K = BuiltinKind
covers the common line/block distinction without any extra wiring.
See the calc example for an end-to-end integration.
Modules§
Structs§
- Span
- Trivia
Event - Trivia
Lexer - Trivia
Piece - A trivia piece classified by the user’s token type.
- Trivia
Table
Enums§
- Builtin
Kind - Built-in trivia kinds for the common case where a language only needs to distinguish line from block comments.
- Trivia
- A piece of trivia recorded between two semantic tokens.
Traits§
- Classify
- Tokens that may carry trivia implement
Classifyso the lexer can split them off into a side table. - Trivia
Class - Layout properties a trivia kind exposes to the renderer.