logos
logos copied to clipboard
Sugar for case-insensitive tokens?
I wonder if you would consider adding some syntactic sugar procedural macros for "case insensitive tokens" -- the way we have #[token("foo")]
, if we want to match Foo
and FOO
and fOo
then we need #[regex("[Ff][Oo][Oo]")]
.
It's not a huge deal, but (e.g.) if you're lexing a DSL with lots of keywords, all of which are case-insensitive, it becomes a lot of typing (opportunity for mistakes) and much harder to read.
You can set the case insensitive flag on a group: (?i:foo)
: https://regex101.com/r/M8YjZ2/1
Wow, there's so much I don't know about regular expressions. Thank you!