use self::lexeme::Lexeme;
use self::location::Location;
pub mod lexeme;
pub mod location;
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct Token {
pub location: Location,
pub lexeme: Lexeme,
pub length: u32,
}
impl Token {
pub fn new(location: Location, lexeme: Lexeme, length: u32) -> Self {
Self {
location,
lexeme,
length,
}
}
}
impl std::fmt::Display for Token {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "{}:{}", self.location, self.lexeme)
}
}