Struct Token
pub struct Token {
pub token_type: TokenType,
pub location: SourceLocation,
}Expand description
A token produced by lexical analysis.
Fields§
§token_type: TokenType§location: SourceLocationImplementations§
§impl Token
impl Token
pub fn is_identifier(&self) -> bool
pub fn is_identifier(&self) -> bool
Is the token an identifier?
pub fn is_identifier_with_name(&self, expected_identifier: &str) -> bool
pub fn is_identifier_with_name(&self, expected_identifier: &str) -> bool
Is the token an identifier with the given name?
pub fn get_identifier(&self) -> Option<&String>
pub fn get_identifier(&self) -> Option<&String>
If the token is an identifier, returns its string. Otherwise returns None.
pub fn is_assignment(&self) -> bool
pub fn is_assignment(&self) -> bool
Does the token have one of the assignment token types?
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 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