Expand description
The lexer, the event-stream parser, and the green-tree builder.
The pipeline follows rust-analyzer: lex produces a flat token
stream, the parser emits a flat list of [events::Event]s, and
[tree_builder::build_tree] replays tokens + events into a rowan green
tree.
build_tree is a straight replay and makes no attachment decisions of its
own — trivia is already placed by the time it runs. Comment binding is the
grammar’s (grammar::trivia::binding_run), which decides where a % run
attaches while the walk still has the context to say.
Re-exports§
pub use core::Parse;pub use core::SyntaxError;pub use core::parse;pub use core::parse_with_declarations;pub use core::parse_with_flavor;pub use core::reconstruct;pub use lexer::LatexFlavor;pub use lexer::LexConfig;pub use lexer::Token;pub use lexer::lex;
Modules§
- conditional
- Static recognition of TeX conditional control words — which
\if…-named command opens a\fi-terminated conditional, and which\else/\or/\fidivides or closes one. - core
- The parser entry point and its output type.
- lexer
- A total, lossless lexer for LaTeX surface syntax.
Functions§
- is_
def_ prefix_ command - Re-exported at its historical path:
parser.rs’s façade and the formatter’s expl3 region gate both spell itgrammar::is_def_prefix_command. The TeX\def-family primitives, whose next token is always the control sequence being (re)defined. A control-symbol name would otherwise be misparsed as live syntax —\def\[{…}/\def\]{…}(a document class restyling display math, stacks-project issue #65) reads as a math opener,\def\\{…}as a line break — so [Parser::command] consumes it as a plain token inside the\def’s node. A control-word name already parses benignly as a generic command and keeps its current shape. A closed, curated set read as a static fact, mirroring [is_definition_body_command]; the definition is never executed.