Is it possible to do a multi-pass parser with Lezer & CodeMirror?

In NetLogo programming language, there is a need to know if an identifier is a procedure/function to properly parse its grammar structure. While we have the list of all built-in ones, the problem is with user-defined ones: they could appear AFTER their first appearance. Therefore, I wonder if there is any natural way to deal with without hacking into Lezer and add a pre-parsing pass?

For example.

to go
  haha 1 2 3

to haha [ a b c ]

Thanks in advance!

Another question we have is if Lezer supports anything beyond + & * like regular expressions. Like:

Statement {
  CommandName Argument[10]

Which will only match 10 repeated arguments without the need to manually specify it. To make it better, is it possible to make 10 a parameter so that we don’t need to write 10 different rules for 10 different numbers?


No. This kind of thing is fundamentally at odds with incremental parsing, and is not something Lezer can help with.

Nope, since that is not a common thing to need in a grammar, Lezer has no provision for that.

Thanks! Just another quick question. Is there a way to change the default behavior of “enter” when an autocomplete prompt is active? i.e. Let it do nothing instead of using the first prompt. Similarly, can we change the behavior of “Tab” to that instead of adding intent when the prompt is active?

Thanks again.

You can omit the default set of keybindings with the defaultKeymap option to autocompletion, and add your own custom keys instead.