logos icon indicating copy to clipboard operation
logos copied to clipboard

How to debug logos?

Open sergeyt opened this issue 4 years ago • 2 comments

#[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"

sergeyt avatar Jun 15 '20 04:06 sergeyt

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 avatar Jun 23 '20 14:06 maciejhirsz

@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

sergeyt avatar Jun 23 '20 17:06 sergeyt