pub struct AtnState {
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<Transition>,
}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<Transition>Implementations§
Source§impl AtnState
impl AtnState
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: Transition)
pub fn add_transition(&mut self, transition: Transition)
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§
impl Eq for AtnState
impl StructuralPartialEq for AtnState
Auto Trait Implementations§
impl Freeze for AtnState
impl RefUnwindSafe for AtnState
impl Send for AtnState
impl Sync for AtnState
impl Unpin for AtnState
impl UnsafeUnpin for AtnState
impl UnwindSafe for AtnState
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