Skip to main content

m2_syn/
lib.rs

1#![doc = include_str!("../README.md")]
2#![warn(missing_docs)]
3
4extern crate self as m2_syn;
5
6pub use m2_syn_macros::syntax;
7
8// Files are grouped by the stage they belong to — `lex/`, `parser/`,
9// `migration/`, `schema/` — while the module paths stay flat, so `#[path]` carries the
10// grouping without renaming anything the rest of the crate refers to.
11
12// Declared first: these macros are textually scoped, so every module below
13// must come after their definitions.
14#[macro_use]
15#[path = "schema/macros.rs"]
16mod macros;
17
18#[path = "parser/body.rs"]
19mod body;
20#[path = "lex/cell_stream.rs"]
21mod cell_stream;
22#[path = "migration/cst.rs"]
23mod cst;
24#[path = "parser/delimited.rs"]
25mod delimited;
26#[path = "lex/lexer.rs"]
27pub mod lexer;
28/// Generated typed Macaulay2 syntax nodes and literal-token types.
29#[macro_use]
30#[path = "schema/nodes.rs"]
31pub mod nodes;
32mod expansion;
33#[path = "parser/native.rs"]
34pub mod native;
35#[path = "parser/parse.rs"]
36pub mod parse;
37mod parsed_file;
38pub mod pretty;
39#[path = "parser/punctuated.rs"]
40pub mod punctuated;
41#[path = "parser/realtime.rs"]
42mod realtime;
43mod recovery;
44/// Internal support for span.
45mod span;
46#[path = "lex/token_stream.rs"]
47/// Internal support for token stream.
48mod token_stream;
49
50#[cfg(feature = "tree-sitter")]
51#[path = "migration/treesitter.rs"]
52pub mod treesitter;
53
54#[cfg(feature = "tree-sitter")]
55pub use treesitter::{
56    ParseError, RealtimeParser, TreeSitterParser, parse_file, parse_file_recovering, parse_tokens,
57};
58
59pub use parse::{
60    FragmentParseError, Parse, ParseStream, Parser, TokenParseError, migrate, parse_fragment_str,
61    parse_with, parse2,
62};
63
64pub use body::{Body, Terminated};
65pub use cell_stream::{
66    CellStream, CellStreamError, CellTokenGroup, CellTokenStream, CellTokenTree, Tokenize,
67};
68pub use cst::{
69    CSTNodeClassLabel, ChildCursor, ExternalCstChild, ExternalCstNode, Migrate, MigrateError, Token,
70};
71pub use delimited::Delimited;
72pub use expansion::ProcMacro;
73pub use expansion::{LiteralReturnTypes, LiteralReturnTypesError};
74#[doc(hidden)]
75pub use lexer::{__qualified_identifier_spans, __quote_fragment};
76pub use lexer::{LexError, LexErrorKind, lex, lex_recovering, lex_str, lex_str_recovering};
77#[doc(hidden)]
78pub use m2_syn_macros::__SyntaxWalk;
79#[doc(hidden)]
80pub use m2_syn_macros::__syntax_token_walk;
81#[doc(hidden)]
82pub use m2_syn_macros::__syntax_walk_function;
83#[doc(hidden)]
84pub use m2_syn_macros::token as __m2_syn_token;
85pub use m2_syn_macros::{Spanned, parse_quote_m2, quote_m2};
86pub use native::{
87    CompletedNativeCell, NativeCellParser, NativeCellState, NativeParseError, NativeParser,
88    parse_native, parse_native_recovering,
89};
90pub(crate) use nodes::*;
91pub use nodes::{fold, visit, visit_mut};
92pub use parsed_file::ParsedFile;
93pub use pretty::{
94    PrettyDetail, PrettyDetailRole, PrettyEdge, PrettyNode, PrettyNodeRole, PrettyOptions,
95    PrettyReport, PrettyTree, format_pretty_cell_tokens, format_pretty_tokens, format_pretty_tree,
96};
97pub use punctuated::{Punctuated, SeparatedPair};
98pub use realtime::{
99    NativeCellBoundary, NativeRealtimeCell, NativeRealtimeEditError, NativeRealtimeParser,
100};
101pub use recovery::Recovered;
102pub use span::{
103    File, LineColumn, LineColumnRange, Offset, Source, SourceId, Span, Spanned, TextEdit,
104};
105pub use these_macros_should_be_illegal::qf;
106#[doc(hidden)]
107pub use token_stream::delim::parse_delimiter;
108pub use token_stream::delim::{
109    Delimiter, DelimiterKind, DelimiterToken, DelimiterValue, DoubleSpan,
110};
111pub use token_stream::{
112    CommentTrivia, IdentToken, LeadingTrivia, Lex, LiteralKind, LiteralToken, Punct, Terminal,
113    TokenGroup, TokenStream, TokenTree, TrailingTrivia, Trivia, TriviaKind,
114};