1extern crate self as antlr4_runtime;
4
5pub mod atn;
6pub mod byte_stream;
7pub mod char_stream;
8pub mod dfa;
9pub mod errors;
10pub mod generated;
11pub mod int_stream;
12pub mod lexer;
13pub mod parser;
14#[cfg(feature = "perf-counters")]
15pub mod perf;
16pub mod prediction;
17pub mod recognizer;
18pub mod semir;
19pub mod token;
20pub mod token_stream;
21pub mod tree;
22pub mod tree_pattern;
23pub mod vocabulary;
24pub mod xpath;
25
26pub use atn::parser::{ParserAtnPrediction, ParserAtnSimulator, ParserAtnSimulatorError};
27pub use byte_stream::ByteStream;
28pub use char_stream::{CharStream, InputStream, PositionSummary, TextInterval};
29pub use dfa::{DfaStateId, DfaTransition, ParserDfa, ParserDfaStateView, ParserDfaStats};
30pub use errors::{AntlrError, ConsoleErrorListener, ErrorListener};
31pub use generated::{GeneratedLexer, GeneratedParser, GrammarMetadata};
32pub use int_stream::{EOF, IntStream, UNKNOWN_SOURCE_NAME};
33pub use lexer::{
34 BaseLexer, Lexer, LexerCustomAction, LexerLifecycleCtx, LexerMode, LexerPredicate, LexerSemCtx,
35};
36pub use parser::{
37 BailErrorStrategy, BaseParser, ExpectedTokenSet, NoSemanticHooks, Parser, ParserAction,
38 ParserMemberAction, ParserPredicate, ParserReturnAction, ParserRuleArg, ParserRuntimeOptions,
39 ParserSemCtx, ParserSemanticAction, ParserSemanticPredicate, ParserSemantics, PredictionMode,
40 RecognitionArenaStats, SemanticHooks, UnknownSemanticPolicy,
41};
42#[cfg(feature = "perf-counters")]
43pub use perf::{dump as dump_prediction_perf_counters, reset as reset_prediction_perf_counters};
44pub use prediction::{ContextId, PredictionContextStats, SemanticContext};
45pub use recognizer::{Recognizer, RecognizerData};
46pub use token::{
47 DEFAULT_CHANNEL, HIDDEN_CHANNEL, INVALID_TOKEN_TYPE, MAX_TOKEN_OFFSET, TOKEN_EOF, Token,
48 TokenChannel, TokenId, TokenIter, TokenSink, TokenSource, TokenSpec, TokenStore,
49 TokenStoreError, TokenView,
50};
51pub use token_stream::CommonTokenStream;
52pub use tree::{
53 AsRuleNode, ErrorNodeView, FromRuleNode, GeneratedAttrs, MissingChildError, Node, NodeChildren,
54 NodeId, NodeKind, ParseTree, ParseTreeDescendants, ParseTreeListener, ParseTreeStats,
55 ParseTreeStorage, ParseTreeVisitor, ParseTreeWalker, ParsedFile, ParserRuleContext,
56 RuleNodeView, TerminalNodeView,
57};
58pub use tree_pattern::{
59 ParseTreeMatch, ParseTreePattern, ParseTreePatternError, ParseTreePatternMatcher, PatternLexer,
60 lex_pattern_chunk,
61};
62pub use vocabulary::Vocabulary;
63pub use xpath::{XPath, XPathError};
64
65pub fn java_style_list<T: std::fmt::Display>(items: &[T]) -> String {
73 let mut out = String::from("[");
74 for (index, item) in items.iter().enumerate() {
75 if index > 0 {
76 out.push_str(", ");
77 }
78 use std::fmt::Write;
79 write!(out, "{item}").expect("writing to a string cannot fail");
80 }
81 out.push(']');
82 out
83}