pub struct Token {
pub terminal: SymbolId,
pub resolution: Option<Resolution>,
}Expand description
A token with terminal symbol ID and optional conflict resolution.
Create with Token::new for simple tokens, Token::with_prec
for precedence terminals, or Token::with_resolution for conflict terminals.
Fields§
§terminal: SymbolIdThe terminal symbol ID.
resolution: Option<Resolution>How this token resolves shift/reduce conflicts, if at all.
Implementations§
Source§impl Token
impl Token
Sourcepub fn with_prec(terminal: SymbolId, prec: Precedence) -> Self
pub fn with_prec(terminal: SymbolId, prec: Precedence) -> Self
Create a token with precedence (for prec terminals).
Sourcepub fn with_resolution(terminal: SymbolId, resolution: Resolution) -> Self
pub fn with_resolution(terminal: SymbolId, resolution: Resolution) -> Self
Create a token with explicit resolution (for conflict terminals).
Trait Implementations§
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