Skip to main content

arity_parser/
parser.rs

1pub(crate) mod bracket_balancer;
2pub(crate) mod context;
3pub mod core;
4pub(crate) mod cursor;
5pub(crate) mod diagnostics;
6pub(crate) mod events;
7/// Expression-level helpers. Low-level surface consumed by the `arity` crate;
8/// not covered by semver stability guarantees.
9pub mod expr;
10pub(crate) mod lexer;
11pub(crate) mod recovery;
12pub mod reparse;
13/// Roxygen sub-lexing and classification helpers. Low-level surface consumed
14/// by the `arity` crate; not covered by semver stability guarantees.
15pub mod roxygen;
16pub(crate) mod structural;
17pub(crate) mod tree_builder;
18pub(crate) mod validate;
19
20pub use core::{
21    ParseDiagnostic, ParseOptions, ParseOutput, parse, parse_with_options, reconstruct,
22};
23pub use reparse::{
24    Edit, ReparseKind, Reparsed, apply_edits, diff_edit, edits_produce, map_range_through_edit,
25    map_range_through_edits, reparse, reparse_edits, reparse_edits_with_options,
26    reparse_with_options,
27};
28pub use validate::{has_r_invalid_name, is_single_expression};
29
30/// Lex `input` and return the number of tokens produced.
31///
32/// A benchmark-only entry point (`benches/lex.rs`): the lexer and its token
33/// type stay crate-internal, so the bench observes only the count while the
34/// full token vector is still built and dropped per call. Hidden from docs;
35/// not covered by semver stability guarantees.
36#[doc(hidden)]
37pub fn lex_token_count(input: &str) -> usize {
38    lexer::lex_with_md(input, false).len()
39}