logos
logos copied to clipboard
How to debug logos?
#[derive(Logos, Clone, PartialEq, Debug)]
pub enum Token {
#[error]
Error,
// identifiers
#[regex("[a-zA-Z_][a-zA-Z0-9_\\.]*", |lex| String::from(lex.slice()))]
Id(String),
// i'd like to skip spaces after function, space is an operator in excel formula
#[regex(r"[a-zA-Z_][a-zA-Z0-9_\\.]*[ \t\r\n\f]*\([ \t\r\n\f]*", |lex| String::from(lex.slice()))]
Func(String),
}
How to make Func working?
I got Error token when parsing simple input "x"
This should work just fine, do you have the input you are trying to lex and what the expected sequence of tokens should be?
@maciejhirsz i've just tried to parse "x" identifier, but got Error
token. I am using latest version 0.11.4
. if needed I can make a repo with repro