hmm
This commit is contained in:
parent
0c30f0022d
commit
d7795e52f9
10 changed files with 275 additions and 30 deletions
|
|
@ -2,7 +2,7 @@ use logos::{Lexer, Logos};
|
|||
|
||||
#[derive(Logos, Debug, Clone, PartialEq)]
|
||||
#[logos(skip r"[ \t\r\n\f]+")] // Skips whitespace
|
||||
pub enum Token<'source> {
|
||||
pub enum Token<'src> {
|
||||
#[token("false", |_| false)]
|
||||
#[token("true", |_| true)]
|
||||
Bool(bool),
|
||||
|
|
@ -37,11 +37,11 @@ pub enum Token<'source> {
|
|||
#[token("}")]
|
||||
BraceEnd,
|
||||
|
||||
#[regex("[0-9]+", |lex| lex.slice().parse::<isize>().unwrap())]
|
||||
Integer(isize),
|
||||
#[regex("[0-9]+", |lex| lex.slice().parse::<i64>().unwrap())]
|
||||
Integer(i64),
|
||||
|
||||
#[regex(r"[_a-zA-Z][_0-9a-zA-Z]*")]
|
||||
Ident(&'source str),
|
||||
Ident(&'src str),
|
||||
|
||||
#[regex(r#""([^"\\\x00-\x1F]|\\(["\\bnfrt/]|u[a-fA-F0-9]{4}))*""#, |lex| lex.slice().to_owned())]
|
||||
String(String),
|
||||
|
|
@ -51,7 +51,7 @@ pub enum Token<'source> {
|
|||
#[token("var")]
|
||||
#[token("if")]
|
||||
#[token("else")]
|
||||
Keyword(&'source str),
|
||||
Keyword(&'src str),
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue