pub struct TermToken {
pub token_id: TokenID,
pub value: Value,
pub line_no: usize,
pub op_tab_index: Option<usize>,
}Expand description
A token produced by the TermLexer for Prolog-like term parsing.
Each TermToken encapsulates:
- the syntactic token kind (
token_id), - an associated semantic
Value, - the line number on which it was recognized, and
- an optional operator-table index used for precedence and associativity lookup.
Tokens are emitted by the lexer and consumed by the parser during syntax analysis.
Fields§
§token_id: TokenID§value: ValueThe associated value (if any).
line_no: usizeThe line number where the token was recognized.
op_tab_index: Option<usize>Optional operator definition index.
Implementations§
Source§impl TermToken
impl TermToken
Sourcepub fn new(token_id: TokenID, value: Value, line_no: usize) -> Self
pub fn new(token_id: TokenID, value: Value, line_no: usize) -> Self
Creates a new TermToken with the specified token ID, value, and line number.
§Parameters
token_id: Token identifier from the lexer’s token table.value: Optional value attached to the token.line_no: Source line number where this token was found.
The op_tab_index field is initialized to None by default.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for TermToken
impl RefUnwindSafe for TermToken
impl Send for TermToken
impl Sync for TermToken
impl Unpin for TermToken
impl UnwindSafe for TermToken
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