Case Insensitive lang support

We are working on parser to support an internal DSL. That DSL keywords are case-insensitive. Any idea how to support that in lezer?

There’s no real convenient way to do this, but an external tokenizer (or specializer) that does the matching is probably the easiest way to do this. Declare all the keywords, as well as the identifier token, as tokens produced by the external tokenizer, and define that to first match a word and then see if it is any of the keywords, returning either the identifier token id or the appropriate keyword token. The php mode takes this approach.

1 Like