1extern crate self as antlr4_runtime;
4
5#[doc(hidden)]
7pub const __ANTLR4_RUST_CODEGEN_API: u32 = 6;
8
9#[doc(hidden)]
11#[macro_export]
12macro_rules! __antlr4_rust_require_codegen_api {
13 (1, $generator_version:literal) => {};
14 (2, $generator_version:literal) => {};
15 (3, $generator_version:literal) => {};
16 (4, $generator_version:literal) => {};
17 (5, $generator_version:literal) => {};
18 (6, $generator_version:literal) => {};
19 ($requested:literal, $generator_version:literal) => {
20 compile_error!(concat!(
21 "antlr4-rust generated-code API mismatch: antlr4-rust-gen v",
22 $generator_version,
23 " emitted generated-code API revision ",
24 stringify!($requested),
25 ", but the selected antlr-rust-runtime supports revisions 1, 2, 3, 4, 5, and 6; regenerate \
26 this recognizer with a compatible antlr4-rust-gen or select a compatible \
27 antlr-rust-runtime dependency"
28 ));
29 };
30}
31
32pub mod atn;
33pub mod byte_stream;
34pub mod char_stream;
35pub mod dfa;
36pub mod errors;
37pub mod generated;
38pub mod int_stream;
39pub mod lexer;
40pub mod parser;
41#[cfg(feature = "perf-counters")]
42pub mod perf;
43pub mod prediction;
44pub mod recognizer;
45pub mod semir;
46pub mod token;
47pub mod token_stream;
48pub mod tree;
49pub mod tree_pattern;
50pub mod vocabulary;
51pub mod xpath;
52
53pub use atn::parser::{ParserAtnPrediction, ParserAtnSimulator, ParserAtnSimulatorError};
54pub use byte_stream::ByteStream;
55pub use char_stream::{CharStream, InputStream, PositionSummary, TextInterval};
56pub use dfa::{DfaStateId, DfaTransition, ParserDfa, ParserDfaStateView, ParserDfaStats};
57pub use errors::{AntlrError, ConsoleErrorListener, ErrorListener, SyntaxErrorEvent};
58pub use generated::{GeneratedLexer, GeneratedParser, GrammarMetadata};
59pub use int_stream::{EOF, IntStream, UNKNOWN_SOURCE_NAME};
60pub use lexer::{
61 BaseLexer, Lexer, LexerCustomAction, LexerLifecycleCtx, LexerMode, LexerPredicate, LexerSemCtx,
62 LexerSemIrCtx, LexerSemanticAction, LexerSemanticPredicate, LexerSemantics,
63};
64pub use parser::{
65 BailErrorStrategy, BaseParser, EnterRuleEvent, ExpectedTokenSet, NoSemanticHooks,
66 ParseListener, Parser, ParserAction, ParserMemberAction, ParserPredicate, ParserReturnAction,
67 ParserRuleArg, ParserRuntimeOptions, ParserSemCtx, ParserSemanticAction,
68 ParserSemanticPredicate, ParserSemantics, PredictionMode, RecognitionArenaStats, SemanticHooks,
69 UnknownSemanticPolicy, grow_generated_rule_stack,
70};
71#[cfg(feature = "perf-counters")]
72pub use perf::{dump as dump_prediction_perf_counters, reset as reset_prediction_perf_counters};
73pub use prediction::{ContextId, PredictionContextStats, SemanticContext};
74pub use recognizer::{Recognizer, RecognizerData};
75pub use token::{
76 DEFAULT_CHANNEL, HIDDEN_CHANNEL, INVALID_TOKEN_TYPE, MAX_TOKEN_OFFSET, TOKEN_EOF, Token,
77 TokenChannel, TokenId, TokenIter, TokenSink, TokenSource, TokenSpec, TokenStore,
78 TokenStoreError, TokenView,
79};
80pub use token_stream::CommonTokenStream;
81pub use tree::{
82 AsRuleNode, ErrorNodeView, FromRuleNode, GeneratedAttrs, MissingChildError, Node, NodeChildren,
83 NodeId, NodeKind, ParseTree, ParseTreeDescendants, ParseTreeListener, ParseTreeStats,
84 ParseTreeStorage, ParseTreeVisitor, ParseTreeWalker, ParsedFile, ParserRuleContext,
85 RuleNodeView, TerminalNodeView,
86};
87pub use tree_pattern::{
88 ParseTreeMatch, ParseTreePattern, ParseTreePatternError, ParseTreePatternMatcher, PatternLexer,
89 lex_pattern_chunk,
90};
91pub use vocabulary::Vocabulary;
92pub use xpath::{XPath, XPathError};
93
94pub fn java_style_list<T: std::fmt::Display>(items: &[T]) -> String {
102 let mut out = String::from("[");
103 for (index, item) in items.iter().enumerate() {
104 if index > 0 {
105 out.push_str(", ");
106 }
107 use std::fmt::Write;
108 write!(out, "{item}").expect("writing to a string cannot fail");
109 }
110 out.push(']');
111 out
112}