// @generated by antlr-rust-runtime v0.16.0 - do not edit
// project: https://github.com/ophi-dev/antlr-rust-runtime
#[allow(warnings, missing_docs, clippy::all, clippy::pedantic, clippy::nursery)]
#[rustfmt::skip]
mod __antlr4_rust_generated {
use antlr4_runtime::char_stream::CharStream;
use antlr4_runtime::recognizer::RecognizerData;
use antlr4_runtime::token::{TokenId, TokenSink, TokenSource, TokenStoreError};
use antlr4_runtime::atn::LexerAtn;
use antlr4_runtime::atn::lexer_dfa::CompiledLexerDfa;
use antlr4_runtime::atn::serialized::AtnDeserializer;
use antlr4_runtime::{BaseLexer, GeneratedLexer, GrammarMetadata, Lexer, Recognizer};
use std::sync::OnceLock;
pub const EOF: i32 = antlr4_runtime::TOKEN_EOF;
pub const ANYWHERE: i32 = 1;
pub const ROOT: i32 = 2;
pub const WILDCARD: i32 = 3;
pub const BANG: i32 = 4;
pub const ID: i32 = 5;
pub const STRING: i32 = 6;
pub const CHANNEL_DEFAULT_TOKEN_CHANNEL: i32 = 0;
pub const CHANNEL_HIDDEN: i32 = 1;
pub const MODE_DEFAULT_MODE: i32 = 0;
pub static METADATA: GrammarMetadata = GrammarMetadata::new(
"XPathLexer",
&["ANYWHERE", "ROOT", "WILDCARD", "BANG", "ID", "NameChar", "NameStartChar", "STRING"],
&[None, Some("\'//\'"), Some("\'/\'"), Some("\'*\'"), Some("\'!\'"), None, None],
&[None, Some("ANYWHERE"), Some("ROOT"), Some("WILDCARD"), Some("BANG"), Some("ID"), Some("STRING")],
&[None, None, None, None, None, None, None],
&["DEFAULT_TOKEN_CHANNEL", "HIDDEN"],
&["DEFAULT_MODE"],
&[4, 0, 6, 48, 6, -1, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, 4, 2, 5, 7, 5, 2, 6, 7, 6, 2, 7, 7, 7, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 2, 1, 2, 1, 3, 1, 3, 1, 4, 1, 4, 5, 4, 29, 8, 4, 10, 4, 12, 4, 32, 9, 4, 1, 5, 1, 5, 3, 5, 36, 8, 5, 1, 6, 1, 6, 1, 7, 1, 7, 5, 7, 42, 8, 7, 10, 7, 12, 7, 45, 9, 7, 1, 7, 1, 7, 0, 0, 8, 1, 1, 3, 2, 5, 3, 7, 4, 9, 5, 11, 0, 13, 0, 15, 6, 1, 0, 3, 5, 0, 48, 57, 95, 95, 183, 183, 768, 879, 8255, 8256, 13, 0, 65, 90, 97, 122, 192, 214, 216, 246, 248, 767, 880, 893, 895, 8191, 8204, 8205, 8304, 8591, 11264, 12271, 12289, 55295, 63744, 64975, 65008, 65535, 1, 0, 39, 39, 48, 0, 1, 1, 0, 0, 0, 0, 3, 1, 0, 0, 0, 0, 5, 1, 0, 0, 0, 0, 7, 1, 0, 0, 0, 0, 9, 1, 0, 0, 0, 0, 15, 1, 0, 0, 0, 1, 17, 1, 0, 0, 0, 3, 20, 1, 0, 0, 0, 5, 22, 1, 0, 0, 0, 7, 24, 1, 0, 0, 0, 9, 26, 1, 0, 0, 0, 11, 35, 1, 0, 0, 0, 13, 37, 1, 0, 0, 0, 15, 39, 1, 0, 0, 0, 17, 18, 5, 47, 0, 0, 18, 19, 5, 47, 0, 0, 19, 2, 1, 0, 0, 0, 20, 21, 5, 47, 0, 0, 21, 4, 1, 0, 0, 0, 22, 23, 5, 42, 0, 0, 23, 6, 1, 0, 0, 0, 24, 25, 5, 33, 0, 0, 25, 8, 1, 0, 0, 0, 26, 30, 3, 13, 6, 0, 27, 29, 3, 11, 5, 0, 28, 27, 1, 0, 0, 0, 29, 32, 1, 0, 0, 0, 30, 28, 1, 0, 0, 0, 30, 31, 1, 0, 0, 0, 31, 10, 1, 0, 0, 0, 32, 30, 1, 0, 0, 0, 33, 36, 3, 13, 6, 0, 34, 36, 7, 0, 0, 0, 35, 33, 1, 0, 0, 0, 35, 34, 1, 0, 0, 0, 36, 12, 1, 0, 0, 0, 37, 38, 7, 1, 0, 0, 38, 14, 1, 0, 0, 0, 39, 43, 5, 39, 0, 0, 40, 42, 8, 2, 0, 0, 41, 40, 1, 0, 0, 0, 42, 45, 1, 0, 0, 0, 43, 41, 1, 0, 0, 0, 43, 44, 1, 0, 0, 0, 44, 46, 1, 0, 0, 0, 45, 43, 1, 0, 0, 0, 46, 47, 5, 39, 0, 0, 47, 16, 1, 0, 0, 0, 4, 0, 30, 35, 43, 0],
);
pub fn metadata() -> &'static GrammarMetadata {
&METADATA
}
pub fn rule_names() -> &'static [&'static str] {
METADATA.rule_names()
}
static ATN_CELL: OnceLock<LexerAtn> = OnceLock::new();
/// Deserializes and caches the grammar ATN for all lexer instances.
fn atn() -> &'static LexerAtn {
ATN_CELL.get_or_init(|| {
let serialized = metadata().serialized_atn();
AtnDeserializer::new(&serialized)
.deserialize()
.expect("generated lexer contains a valid ANTLR serialized ATN")
})
}
static LEXER_DFA_DATA: &[u32] = &[1280852999,1,0,8,0,0,65535,4294967295,1,1,65535,0,2,2,65535,4294967295,1,1,65535,1,3,1,65535,2,4,3,65535,3,1,1,65535,4,1,1,65535,5,8,0,0,9986,0,0,1029,1514223920,2053201759,0,0,5,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,131071,4294967295,4294967295,196607,4294967295,4294901763,4294967295,327679,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,393215,327685,327685,327685,327685,327685,327685,327685,327685,327685,327685,327685,327685,4294901765,4294967295,4294967295,393215,327685,327685,327685,327685,327685,327685,327685,327685,327685,327685,327685,327685,4294901765,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,131074,131074,131074,131074,131074,131074,131074,131074,131074,131074,131074,131074,131074,131074,131074,131074,131074,131074,131074,393218,131074,131074,131074,131074,131074,131074,131074,131074,131074,131074,131074,131074,131074,131074,131074,131074,131074,131074,131074,131074,131074,131074,131074,131074,131074,131074,131074,131074,131074,131074,131074,131074,131074,131074,131074,131074,131074,131074,131074,131074,131074,131074,131074,131074,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,524287,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,327685,327685,327685,327685,327685,4294967295,4294967295,4294967295,393215,327685,327685,327685,327685,327685,327685,327685,327685,327685,327685,327685,327685,4294901765,4294967295,393215,393215,327685,327685,327685,327685,327685,327685,327685,327685,327685,327685,327685,327685,4294901765,4294967295,4294967295,4,11,192,214,5,216,246,5,248,767,5,880,893,5,895,8191,5,8204,8205,5,8304,8591,5,11264,12271,5,12289,55295,5,63744,64975,5,65008,65535,5,0,1,128,1114111,2,12,183,183,5,192,214,5,216,246,5,248,893,5,895,8191,5,8204,8205,5,8255,8256,5,8304,8591,5,11264,12271,5,12289,55295,5,63744,64975,5,65008,65535,5,6,3,0,0,2,0,0,1,0,0,4,0,0,7,0,0,0,0,0,8,4294967295,0,4294967295,0,4294967295,0,4294967295,0,4294967295,0,4294967295,0,4294967295,0,4294967295,0,0];
static LEXER_DFA_CELL: OnceLock<CompiledLexerDfa> = OnceLock::new();
/// Ahead-of-time lexer DFA tables compiled by antlr4-rust-gen, embedded so
/// runtime startup only deserializes them. Rebuilt from the ATN instead when
/// the embedded stream comes from a different runtime version.
fn lexer_dfa() -> &'static CompiledLexerDfa {
LEXER_DFA_CELL.get_or_init(|| {
CompiledLexerDfa::from_serialized(LEXER_DFA_DATA)
.unwrap_or_else(|| CompiledLexerDfa::compile(atn()))
})
}
#[derive(Clone, Debug)]
pub struct XPathLexer<I, H = antlr4_runtime::NoSemanticHooks>
where
I: CharStream,
H: antlr4_runtime::SemanticHooks,
{
base: BaseLexer<I>,
hooks: H,
}
impl<I> XPathLexer<I, antlr4_runtime::NoSemanticHooks>
where
I: CharStream,
{
pub fn new(input: I) -> Self {
Self::with_hooks(input, antlr4_runtime::NoSemanticHooks)
}
}
impl<I, H> XPathLexer<I, H>
where
I: CharStream,
H: antlr4_runtime::SemanticHooks,
{
pub fn with_hooks(input: I, hooks: H) -> Self {
let grammar_metadata = metadata();
let data = RecognizerData::new(
grammar_metadata.grammar_file_name(),
grammar_metadata.vocabulary(),
)
.with_rule_names(grammar_metadata.rule_names().iter().copied())
.with_channel_names(grammar_metadata.channel_names().iter().copied())
.with_mode_names(grammar_metadata.mode_names().iter().copied());
Self { base: BaseLexer::new(input, data).with_shared_dfa(atn()), hooks }
}
pub fn metadata() -> &'static GrammarMetadata {
metadata()
}
/// Adds a listener for lexer diagnostics.
pub fn add_error_listener<T>(&mut self, listener: T)
where
T: for<'a> antlr4_runtime::ErrorListener<dyn antlr4_runtime::Recognizer + 'a> + Send + 'static,
{
self.base.add_error_listener(listener);
}
/// Removes every lexer error listener, including the default console listener.
pub fn remove_error_listeners(&mut self) {
self.base.remove_error_listeners();
}
/// Routes every token through ATN interpretation instead of the compiled
/// lexer DFA, so the learned-DFA trace (`lexer_dfa_string`) observes each
/// match.
pub fn set_force_interpreted(&mut self, force_interpreted: bool) {
self.base.set_force_interpreted(force_interpreted);
}
/// Resets this lexer and any caller-owned lifecycle state for reuse.
pub fn reset(&mut self) {
if H::ENABLES_LEXER_LIFECYCLE {
antlr4_runtime::atn::lexer::reset_with_semantic_hooks(
&mut self.base,
&mut self.hooks,
);
} else {
self.base.reset();
}
}
/// Replaces the input stream and resets runtime and lifecycle state.
pub fn set_input_stream(&mut self, input: I) {
if H::ENABLES_LEXER_LIFECYCLE {
antlr4_runtime::atn::lexer::set_input_stream_with_semantic_hooks(
&mut self.base,
&mut self.hooks,
input,
);
} else {
self.base.set_input_stream(input);
}
}
/// Clears the learned lexer DFA shared by this grammar.
pub fn clear_dfa(&self) {
self.base.clear_dfa();
}
}
impl<I, H> GeneratedLexer for XPathLexer<I, H>
where
I: CharStream,
H: antlr4_runtime::SemanticHooks,
{
fn metadata() -> &'static GrammarMetadata {
metadata()
}
}
impl<I, H> Recognizer for XPathLexer<I, H>
where
I: CharStream,
H: antlr4_runtime::SemanticHooks,
{
fn data(&self) -> &antlr4_runtime::RecognizerData {
self.base.data()
}
fn data_mut(&mut self) -> &mut antlr4_runtime::RecognizerData {
self.base.data_mut()
}
}
impl<I, H> Lexer for XPathLexer<I, H>
where
I: CharStream,
H: antlr4_runtime::SemanticHooks,
{
fn mode(&self) -> i32 { self.base.mode() }
fn set_mode(&mut self, mode: i32) { self.base.set_mode(mode); }
fn push_mode(&mut self, mode: i32) { self.base.push_mode(mode); }
fn pop_mode(&mut self) -> Option<i32> { self.base.pop_mode() }
}
impl<I, H> TokenSource for XPathLexer<I, H>
where
I: CharStream,
H: antlr4_runtime::SemanticHooks,
{
fn next_token(&mut self, sink: &mut TokenSink<'_>) -> Result<TokenId, TokenStoreError> {
if H::ENABLES_LEXER_LIFECYCLE {
antlr4_runtime::atn::lexer::next_token_compiled_with_semantic_dispatch(&mut self.base, sink, atn(), lexer_dfa(), &mut self.hooks, |_, _| false, |_, _| None, antlr4_runtime::UnknownSemanticPolicy::AssumeTrue, |_, _, _| {})
} else {
antlr4_runtime::atn::lexer::next_token_compiled(&mut self.base, sink, atn(), lexer_dfa())
}
}
fn line(&self) -> usize { self.base.line() }
fn column(&self) -> usize { self.base.column() }
fn source_name(&self) -> &str { self.base.source_name() }
fn source_text(&self) -> Option<std::rc::Rc<str>> { self.base.source_text() }
fn drain_errors(&mut self) -> Vec<antlr4_runtime::token::TokenSourceError> {
self.base.drain_errors()
}
fn report_error(&self, source_error: &antlr4_runtime::token::TokenSourceError) -> bool {
antlr4_runtime::Recognizer::notify_error_listeners(
self,
source_error.line,
source_error.column,
&source_error.message,
None,
);
true
}
fn lexer_dfa_string(&self) -> String {
self.base.lexer_dfa_string()
}
}
}
#[allow(warnings, missing_docs, clippy::all, clippy::pedantic, clippy::nursery)]
pub use self::__antlr4_rust_generated::*;