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 mod edit;
16pub(crate) mod events;
17pub(crate) mod grammar;
18pub mod lexer;
19pub mod reparse;
20pub(crate) mod tree_builder;
21
22pub use core::{
23 Parse, SyntaxError, parse, parse_with_declarations, parse_with_declarations_resolved,
24 parse_with_flavor, reconstruct,
25};
26pub use edit::{Edit, apply_edits, diff_edit, try_apply_edits};
27pub use grammar::is_def_prefix_command;
28pub use lexer::{LatexFlavor, LexConfig, ParseCtx, Token, lex, lex_with};
29pub use reparse::{ReparseBase, ReparseTier, Reparsed, reparse, reparse_edits};
30
31#[doc(hidden)]
32pub use reparse::fingerprint;