Lexi-Matic
A proc-macro for lexers similar to logos. Uses regex-automata DFA under the hood.
# use Lexer;
// An iterator of Result<(usize, Token, usize), lexi_matic::Error>.
let tokens = lex;
for t in tokens
Token Disambiguation
There are only two simple rules:
- Longer matches always win.
- If multiple patterns are matched for the longest match, the first pattern wins.
So if you have keywords and identifiers, specify the keywords first:
# use Lexer;
So import
would be Import
but import1
would be Ident
.