I am using lezer grammar to write custom grammar for my expressions. I am sharing a snippet of my custom grammar as :
...
NodeA {
CalcFunction | AggregatorFunction
}
CalcFunction {
"CALC" "(" CalcParameters ")"
}
AggregatorFunction {
Identifier "(" AggregatorParameters ")"
}
@tokens {
Identifier { $[a-zA-Z_.0-9]+ }
}
Then problem is when I am at NodeA
token, I can either write CalcFunction or AggregatorFunction. But when I am trying to type “CAL” (eventually wants to go to CalcFunction
), but grammar parses AggregatorFunction as its node due to Identifier being present. Later when “CALC” is completed, it immediately parses to “CalcFunction” which kind of breaks my autocomplete logic. What I want is if there is such ambiguous situation, can it not show both tokens (not sure if this is possible) or other to not determine both nodes until finalized.
Any suggestions around this would be very helpful. TIA.