Skip to main content

badness_parser/
parser.rs

1//! The lexer, the event-stream parser, and the green-tree builder.
2//!
3//! The pipeline follows rust-analyzer: `lex` produces a flat token
4//! stream, the parser emits a flat list of [`events::Event`]s, and
5//! [`tree_builder::build_tree`] replays tokens + events into a rowan green
6//! tree.
7//!
8//! `build_tree` is a straight replay and makes no attachment decisions of its
9//! own — trivia is already placed by the time it runs. Comment binding is the
10//! grammar's (`grammar::trivia::binding_run`), which decides where a `%` run
11//! attaches while the walk still has the context to say.
12
13pub mod conditional;
14pub mod core;
15pub(crate) mod events;
16pub(crate) mod grammar;
17pub mod lexer;
18pub(crate) mod tree_builder;
19
20pub use core::{
21    Parse, SyntaxError, parse, parse_with_declarations, parse_with_flavor, reconstruct,
22};
23pub use grammar::is_def_prefix_command;
24pub use lexer::{LatexFlavor, LexConfig, Token, lex};