pub struct Token {
pub token_type: TokenType,
pub image: String,
pub begin_offset: usize,
pub end_offset: usize,
pub next: Option<usize>,
pub previous: Option<usize>,
}Expand description
A single token in the input stream
Tokens are the atomic units produced by the lexer. Each token has:
- A type (e.g., INTEGER, PLUS, EOF)
- An image (the actual text matched)
- Position information (begin/end offsets)
- Optional links to previous/next tokens
Fields§
§token_type: TokenTypeThe type of this token
image: StringThe actual text of this token
begin_offset: usizeAbsolute offset in the input where this token begins
end_offset: usizeAbsolute offset in the input where this token ends
next: Option<usize>Index of the next token (if any)
previous: Option<usize>Index of the previous token (if any)
Implementations§
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