pub struct ParserAtn { /* private fields */ }Expand description
Immutable packed parser ATN.
Generated parsers borrow a static word stream directly. Deserialization of ordinary ANTLR v4 integer metadata produces the same layout in one owned allocation.
Implementations§
Source§impl ParserAtn
impl ParserAtn
Sourcepub fn from_static(words: &'static [u32]) -> Result<Self, ParserAtnError>
pub fn from_static(words: &'static [u32]) -> Result<Self, ParserAtnError>
Validates and borrows generator-emitted packed data without allocating.
Sourcepub fn from_owned(words: Vec<u32>) -> Result<Self, ParserAtnError>
pub fn from_owned(words: Vec<u32>) -> Result<Self, ParserAtnError>
Validates one owned packed stream.
Sourcepub fn format_version(&self) -> u32
pub fn format_version(&self) -> u32
Canonical generator/runtime format version carried by this ATN.
pub const fn max_token_type(&self) -> i32
pub const fn state_count(&self) -> usize
pub const fn transition_count(&self) -> usize
pub const fn decision_count(&self) -> usize
pub const fn rule_count(&self) -> usize
pub fn state(&self, state_number: usize) -> Option<ParserAtnState<'_>>
pub fn state_by_id(&self, id: AtnStateId) -> Option<ParserAtnState<'_>>
pub const fn states(&self) -> ParserAtnStates<'_> ⓘ
pub fn transition(&self, id: TransitionId) -> Option<ParserTransition<'_>>
pub const fn decision_to_state(&self) -> ParserStateIdTable<'_>
pub const fn rule_to_start_state(&self) -> ParserStateIdTable<'_>
pub const fn rule_to_stop_state(&self) -> ParserStateIdTable<'_>
Sourcepub fn packed_words(&self) -> &[u32]
pub fn packed_words(&self) -> &[u32]
Returns the exact generator-emitted representation.
Sourcepub fn token_set(&self, index: usize) -> Option<ParserIntervalSet<'_>>
pub fn token_set(&self, index: usize) -> Option<ParserIntervalSet<'_>>
Returns one immutable parser token set by its packed metadata index.
Generated rule bodies use this to share the same adaptive membership representation as ATN prediction instead of embedding a second set.
pub fn stats(&self) -> ParserAtnStats
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ParserAtn
impl RefUnwindSafe for ParserAtn
impl Send for ParserAtn
impl Sync for ParserAtn
impl Unpin for ParserAtn
impl UnsafeUnpin for ParserAtn
impl UnwindSafe for ParserAtn
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more