grammars-v4 icon indicating copy to clipboard operation
grammars-v4 copied to clipboard

[javascript] parser is too greedy for some new expressions

Open meraedit opened this issue 1 year ago • 0 comments

Expressions like new a.B().call() are parsed incorrectly as new (singleExpression a.B().call) arguments

I tried to reorder the productions (similarly to #2178), but without success. Adding a semantic predicate fails when generating the parser with "The following sets of rules are mutually left-recursive [singleExpression]".

It seems to me that the only way is to break down the single expression such as the Arguments/call expression cannot follow the new operator: https://262.ecma-international.org/5.1/#sec-11.2 But this is a big change in the grammar...

meraedit avatar Apr 29 '24 17:04 meraedit