reading the chumsky docs helps actually, wild /s
This commit is contained in:
parent
4a2ba05bd1
commit
2810913aae
3 changed files with 41 additions and 74 deletions
|
|
@ -5,6 +5,8 @@ use logos::{Lexer, Logos};
|
|||
#[derive(Logos, Debug, Clone, PartialEq)]
|
||||
#[logos(skip r"[ \t\r\n\f]+")] // Skip whitespace
|
||||
pub enum Token<'src> {
|
||||
Error,
|
||||
|
||||
#[token("false", |_| false)]
|
||||
#[token("true", |_| true)]
|
||||
Bool(bool),
|
||||
|
|
@ -79,6 +81,7 @@ impl fmt::Display for Token<'_> {
|
|||
Token::Ident(s) => write!(f, "{s}"),
|
||||
Token::String(s) => write!(f, "{s}"),
|
||||
Token::Keyword(s) => write!(f, "{s}"),
|
||||
Token::Error => write!(f, "<error>")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue