pub enum Token {
Start {
kind: u32,
pos: u32,
},
End {
kind: u32,
pos: u32,
start_idx: u32,
},
Leaf {
kind: u32,
start: u32,
end: u32,
},
}Expand description
One parse-tree token. Internal nodes are bracketed by a matching
Start/End pair; terminal/metasymbol matches are stored as Leaf.
kind is grammar-specific: each parser assigns its own integer ids to
variables and terminal categories.
Variants§
Start
Opening marker of a successful rule match.
pos is the input position where matching started. The matching
End’s index is not stored on the Start — readers walk forward
and use the start_idx back-pointer on End to associate the pair.
End
Closing marker of a successful rule match.
pos is the end input position (exclusive). start_idx is the
index of the matching Start in ParserState::tokens.
Leaf
A terminal or metasymbol match.
Trait Implementations§
impl Copy for Token
impl Eq for Token
impl StructuralPartialEq for Token
Auto Trait Implementations§
impl Freeze for Token
impl RefUnwindSafe for Token
impl Send for Token
impl Sync for Token
impl Unpin for Token
impl UnsafeUnpin for Token
impl UnwindSafe for Token
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