grammars-v4
grammars-v4 copied to clipboard
[javascript] parser is too greedy for some new expressions
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...