Skip to main content

m2_syn/
lib.rs

1#![doc = include_str!("../README.md")]
2#![warn(missing_docs)]
3#![warn(clippy::missing_errors_doc, clippy::missing_panics_doc)]
4
5extern crate self as m2_syn;
6
7// Files are grouped by the stage they belong to — `lex/`, `parser/`, `cst/`,
8// `schema/` — while the module paths stay flat, so `#[path]` carries the
9// grouping without renaming anything the rest of the crate refers to.
10
11// Declared first: these macros are textually scoped, so every module below
12// must come after their definitions.
13#[macro_use]
14#[path = "schema/macros.rs"]
15mod macros;
16
17#[path = "parser/body.rs"]
18mod body;
19#[path = "cst/cst.rs"]
20mod cst;
21#[path = "parser/delimited.rs"]
22mod delimited;
23#[path = "lex/lexer.rs"]
24pub mod lexer;
25#[path = "parser/native.rs"]
26pub mod native;
27#[path = "schema/nodes.rs"]
28mod nodes;
29#[path = "parser/parse.rs"]
30pub mod parse;
31mod parsed_file;
32pub mod pretty;
33#[path = "parser/punctuated.rs"]
34pub mod punctuated;
35mod recovery;
36mod span;
37#[path = "lex/token_stream.rs"]
38mod token_stream;
39
40#[path = "cst/treesitter.rs"]
41pub mod treesitter;
42
43pub use treesitter::{
44    ParseError, RealtimeParser, TreeSitterParser, parse_file, parse_file_recovering, parse_tokens,
45};
46
47pub use parse::{
48    FragmentParseError, Parse, ParseStream, Parser, TokenParseError, parse_fragment_str,
49    parse_with, parse2, reconstruct,
50};
51
52pub use body::{Body, Terminated};
53pub use cst::{
54    CSTNodeClassLabel, ChildCursor, ExternalCstChild, ExternalCstNode, Reconstruct,
55    ReconstructError, Token,
56};
57pub use delimited::Delimited;
58#[doc(hidden)]
59pub use lexer::{__qualified_identifier_spans, __quote_fragment};
60pub use lexer::{LexError, LexErrorKind, lex, lex_recovering, lex_str, lex_str_recovering};
61#[doc(hidden)]
62pub use m2_syn_macros::token as __m2_syn_token;
63pub use m2_syn_macros::{Spanned, parse_quote_m2, quote_m2, syntax};
64pub use native::{NativeParseError, NativeParser, parse_native, parse_native_recovering};
65pub use nodes::*;
66pub use nodes::{fold, visit, visit_mut};
67pub use parsed_file::ParsedFile;
68pub use pretty::{
69    PrettyNode, PrettyOptions, PrettyReport, PrettyTree, format_pretty_tokens, format_pretty_tree,
70};
71pub use punctuated::{PunctPair, Punctuated};
72pub use recovery::Recovered;
73pub use span::{Offset, Span, Spanned, TextEdit};
74#[doc(hidden)]
75pub use token_stream::delim::parse_delimiter;
76pub use token_stream::delim::{
77    Delimiter, DelimiterKind, DelimiterToken, DelimiterValue, DoubleSpan,
78};
79pub use token_stream::{
80    EocToken, IdentToken, Lex, LiteralKind, LiteralToken, Punct, TokenGroup, TokenStream,
81    TokenTree, Trivia, TriviaKind,
82};