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")]
55#[path = "migration/trivia_transfer.rs"]
56/// Internal support for carrying lexer trivia onto lowered syntax.
57mod trivia_transfer;
58
59#[cfg(feature = "tree-sitter")]
60pub use treesitter::{
61    ParseError, RealtimeParser, TreeSitterParser, parse_file, parse_file_recovering, parse_tokens,
62};
63
64pub use parse::{
65    FragmentParseError, Parse, ParseStream, Parser, TokenParseError, migrate, parse_fragment_str,
66    parse_with, parse2,
67};
68
69pub use body::{Body, Terminated};
70pub use cell_stream::{
71    CellStream, CellStreamError, CellTokenGroup, CellTokenStream, CellTokenTree, FramedCells,
72    Tokenize, frame_recovering,
73};
74pub use cst::{
75    CSTNodeClassLabel, ChildCursor, ExternalCstChild, ExternalCstNode, Migrate, MigrateError, Token,
76};
77pub use delimited::Delimited;
78pub use expansion::ProcMacro;
79pub use expansion::{LiteralReturnTypes, LiteralReturnTypesError};
80#[doc(hidden)]
81pub use lexer::{__qualified_identifier_spans, __quote_fragment};
82pub use lexer::{LexError, LexErrorKind, lex, lex_recovering, lex_str, lex_str_recovering};
83#[doc(hidden)]
84pub use m2_syn_macros::__SyntaxWalk;
85#[doc(hidden)]
86pub use m2_syn_macros::__syntax_token_walk;
87#[doc(hidden)]
88pub use m2_syn_macros::__syntax_walk_function;
89#[doc(hidden)]
90pub use m2_syn_macros::token as __m2_syn_token;
91pub use m2_syn_macros::{Spanned, parse_quote_m2, quote_m2};
92pub use native::{
93    CompletedNativeCell, NativeCellParser, NativeCellState, NativeParseError, NativeParser,
94    parse_native, parse_native_recovering,
95};
96pub(crate) use nodes::*;
97pub use nodes::{fold, visit, visit_mut};
98pub use parsed_file::ParsedFile;
99pub use pretty::{
100    PrettyDetail, PrettyDetailRole, PrettyEdge, PrettyNode, PrettyNodeRole, PrettyOptions,
101    PrettyReport, PrettyTree, format_pretty_cell_tokens, format_pretty_tokens, format_pretty_tree,
102};
103pub use punctuated::{Punctuated, SeparatedPair};
104pub use realtime::{
105    NativeCellBoundary, NativeRealtimeCell, NativeRealtimeEditError, NativeRealtimeParser,
106};
107pub use recovery::Recovered;
108pub use span::{
109    File, LineColumn, LineColumnRange, Offset, Source, SourceId, Span, Spanned, TextEdit,
110};
111pub use these_macros_should_be_illegal::qf;
112#[doc(hidden)]
113pub use token_stream::delim::parse_delimiter;
114pub use token_stream::delim::{
115    Delimiter, DelimiterKind, DelimiterToken, DelimiterValue, DoubleSpan,
116};
117pub use token_stream::{
118    CommentTrivia, IdentToken, LeadingTrivia, Lex, LiteralKind, LiteralToken, Punct, Terminal,
119    TokenGroup, TokenStream, TokenTree, TrailingTrivia, Trivia, TriviaKind,
120};