mirror of
https://forge.katzen.cafe/katzen-cafe/iowo.git
synced 2025-09-24 23:41:30 +02:00
lang: state with confusing error
This commit is contained in:
parent
198c74c7ae
commit
bfd4b3765f
5 changed files with 74 additions and 24 deletions
|
@ -14,7 +14,23 @@ pub enum Token<'a> {
|
|||
Let,
|
||||
#[token("in")]
|
||||
In,
|
||||
#[regex("[a-zA-Z0-9_\\-]+", |lex| lex.slice())]
|
||||
#[regex("[\\d]+", |lex| lex.slice())]
|
||||
Int(&'a str),
|
||||
#[regex("[+-]?([\\d]+\\.[\\d]*|[\\d]*\\.[\\d]+)", |lex| lex.slice())]
|
||||
Float(&'a str),
|
||||
// TODO: more bigger better more complex string lexing
|
||||
// TODO: templating?
|
||||
#[regex(r#""([^"\\]|\\["\\bnfrt]|u[a-fA-F0-9]{4})*""#, |lex| lex.slice())]
|
||||
String(&'a str),
|
||||
#[token("+")]
|
||||
Plus,
|
||||
#[token("-")]
|
||||
Minus,
|
||||
#[token("*")]
|
||||
Mult,
|
||||
#[token("/")]
|
||||
Div,
|
||||
#[regex("[a-zA-Z_]+[a-zA-Z0-9_\\-]*", |lex| lex.slice())]
|
||||
Word(&'a str),
|
||||
#[regex("\\$[a-zA-Z0-9_\\-]+", |lex| &lex.slice()[1..])]
|
||||
VarIdent(&'a str),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue