-
Hi, I'm implementing a grammar and running into an issue where the parser treats a function name as an Identifier instead of a FunctionCall when the argument list is incomplete, like this: hier is my grammar,
**when the Input 52 + myfunc(1, ) // incomplete** the result **but when the input correct is 52 + myfunc(1, 2 ) the output look** |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 6 replies
-
Hey @sho94os, unfortunately, influencing the error recovery by itself is not possible. There are however a few grammar changes you can perform in order to prevent issues like these. For example, I would always recommend to parse identifiers and function calls in one rule. See langium-lox for example. I've adjusted your grammar slightly in a few places. It now works as expected. See this playground link. |
Beta Was this translation helpful? Give feedback.
Hey @sho94os,
unfortunately, influencing the error recovery by itself is not possible. There are however a few grammar changes you can perform in order to prevent issues like these. For example, I would always recommend to parse identifiers and function calls in one rule. See langium-lox for example.
I've adjusted your grammar slightly in a few places. It now works as expected. See this playground link.