pub struct LexerAtnState {
pub state_number: usize,
pub rule_index: Option<usize>,
pub kind: AtnStateKind,
pub end_state: Option<usize>,
pub loop_back_state: Option<usize>,
pub non_greedy: bool,
pub precedence_rule_decision: bool,
pub left_recursive_rule: bool,
pub transitions: Vec<LexerTransition>,
}Expand description
A node in the ANTLR ATN graph.
Some ANTLR state subclasses carry references to paired states, such as a block-start state’s end state or a loop-end state’s loop-back state. This representation stores those links as state numbers so the graph remains easy to clone and serialize in tests.
Fields§
§state_number: usize§rule_index: Option<usize>§kind: AtnStateKind§end_state: Option<usize>§loop_back_state: Option<usize>§non_greedy: bool§precedence_rule_decision: bool§left_recursive_rule: bool§transitions: Vec<LexerTransition>Implementations§
Source§impl LexerAtnState
impl LexerAtnState
Sourcepub const fn new(state_number: usize, kind: AtnStateKind) -> Self
pub const fn new(state_number: usize, kind: AtnStateKind) -> Self
Creates an ATN state with no rule index and no outgoing transitions.
pub const fn with_rule_index(self, rule_index: usize) -> Self
Sourcepub fn add_transition(&mut self, transition: LexerTransition)
pub fn add_transition(&mut self, transition: LexerTransition)
Adds an outgoing transition in serialized order.
Transition order matters for alternatives and lexer priority, so the runtime preserves the order emitted by ANTLR.
pub fn is_rule_stop(&self) -> bool
Trait Implementations§
Source§impl Clone for LexerAtnState
impl Clone for LexerAtnState
Source§fn clone(&self) -> LexerAtnState
fn clone(&self) -> LexerAtnState
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for LexerAtnState
impl Debug for LexerAtnState
impl Eq for LexerAtnState
Source§impl PartialEq for LexerAtnState
impl PartialEq for LexerAtnState
impl StructuralPartialEq for LexerAtnState
Auto Trait Implementations§
impl Freeze for LexerAtnState
impl RefUnwindSafe for LexerAtnState
impl Send for LexerAtnState
impl Sync for LexerAtnState
impl Unpin for LexerAtnState
impl UnsafeUnpin for LexerAtnState
impl UnwindSafe for LexerAtnState
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