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_declarations_resolved;pub use core::parse_with_flavor;pub use core::reconstruct;pub use edit::Edit;pub use edit::apply_edits;pub use edit::diff_edit;pub use edit::try_apply_edits;pub use lexer::LatexFlavor;pub use lexer::LexConfig;pub use lexer::ParseCtx;pub use lexer::Token;pub use lexer::lex;pub use lexer::lex_with;pub use reparse::ReparseBase;pub use reparse::ReparseTier;pub use reparse::Reparsed;pub use reparse::reparse;pub use reparse::reparse_edits;
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.
- edit
- Byte-range text edits.
- lexer
- Lossless lexer for LaTeX surface syntax.
- reparse
- Incremental reparse: splice a small edit into the previous green tree instead of re-parsing the whole text.
Functions§
- is_
def_ prefix_ command - Kept at this path for parser and formatter callers.
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.