Open alessiostalla opened 4 years ago
I am facing a similar situation. My defined grammar is non-trivial, and the core.collectCandidates(index)
call seems to take a significantly long time when I attempt to run a relatively large script. What I am doing for a workaround is to break the script into parts and only parse the one which the caret locates.
In our case, scripts were not particularly big – it was a certain kind of recursive expression that caused exponential blowup when adding each new (simple) clause to it. I ended up monkey-patching the processRule method to throw an error when a given timeout is exceeded. It's not the ideal solution, as intermediate results are lost that way.
Our language makes antlr4-c3 take an exponentially long time as we add clauses to a relatively simple expression. It appears that the processRule method enters into a loop of recursive calls that go on for a very long time. Would it be possible to limit processRule with a timeout, or max number of calls?