pub struct ParserAction { /* private fields */ }Expand description
Parser semantic action reached while recognizing one ATN path.
Generated parsers use source_state to dispatch back to the grammar action
rendered for that ATN action transition. The token interval is the current
rule’s input span at the action site, which covers common target templates
such as $text. Rule-init actions do not have an ATN action source state,
so they are marked separately and may carry an ATN state for expected-token
rendering.
Implementations§
Source§impl ParserAction
impl ParserAction
Sourcepub const fn new(
source_state: usize,
rule_index: usize,
start_index: usize,
stop_index: Option<usize>,
) -> Self
pub const fn new( source_state: usize, rule_index: usize, start_index: usize, stop_index: Option<usize>, ) -> Self
Creates an action event for a recognized parser path.
Sourcepub const fn new_rule_init(
rule_index: usize,
start_index: usize,
expected_state: Option<usize>,
) -> Self
pub const fn new_rule_init( rule_index: usize, start_index: usize, expected_state: Option<usize>, ) -> Self
Creates an action event for a rule-level @init action.
Sourcepub const fn source_state(&self) -> usize
pub const fn source_state(&self) -> usize
ATN state that owns the semantic-action transition.
Sourcepub const fn rule_index(&self) -> usize
pub const fn rule_index(&self) -> usize
Grammar rule index recorded by the serialized ATN action transition.
Sourcepub const fn start_index(&self) -> usize
pub const fn start_index(&self) -> usize
Token-stream index where the active rule began.
Sourcepub const fn stop_index(&self) -> Option<usize>
pub const fn stop_index(&self) -> Option<usize>
Last token-stream index consumed before the action was reached.
Sourcepub const fn is_rule_init(&self) -> bool
pub const fn is_rule_init(&self) -> bool
Reports whether this event represents a rule-level @init action.
Sourcepub const fn expected_state(&self) -> Option<usize>
pub const fn expected_state(&self) -> Option<usize>
ATN state used to compute expected-token display for this action.
Trait Implementations§
Source§impl Clone for ParserAction
impl Clone for ParserAction
Source§fn clone(&self) -> ParserAction
fn clone(&self) -> ParserAction
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ParserAction
impl Debug for ParserAction
Source§impl Ord for ParserAction
impl Ord for ParserAction
Source§fn cmp(&self, other: &ParserAction) -> Ordering
fn cmp(&self, other: &ParserAction) -> Ordering
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq for ParserAction
impl PartialEq for ParserAction
Source§fn eq(&self, other: &ParserAction) -> bool
fn eq(&self, other: &ParserAction) -> bool
self and other values to be equal, and is used by ==.