Closed osa1 closed 1 year ago
It turns out this is already supported. We should update README to reflect that. Currently it reads like let bindings should come before rules.
However, we don't allow let bindings in rule { }
blocks, and also in lexer definitions without named rules. Maybe we could allow this.
Currently let bindings need to come before rules. This is inconvenient in large lexers. For example, I'm working on a Rust lexer, and I currently have these let bindings:
There will be more in the final version. Ideally I shouldn't have to declare regexes specific to parsing numbers before everything else. I should be able to declare common regexes for numbers right before the rules for lexing numbers.