Skip to main content

xgrammar/parser/
parser_row.rs

1//! One history row of the Earley parser.
2
3use super::{capture_event::CaptureEvent, parser_state::ParserState};
4
5/// The parser state recorded at one input position: the scanable states, the completable
6/// parent pairs, whether the root rule is completed, and the capture events.
7#[derive(Debug, Clone, PartialEq)]
8pub struct ParserRow {
9    /// The scanable states.
10    pub states: Vec<ParserState>,
11    /// The `(referenced_rule_id, parent_state)` pairs awaiting completion.
12    pub completable_states: Vec<(i32, ParserState)>,
13    /// Whether the root rule is completed.
14    pub completed: bool,
15    /// The capture events recorded at this position.
16    pub capture_events: Vec<CaptureEvent>,
17}