Open cyril-- opened 10 years ago
Yes, you found a bug.
You can also work around it by removing the +
characters which appear to be unintentionally added to the primary_expression
rule.
If you need it to work and also need those +
characters, then use PredictionMode.LlExactAmbigDetection
for now.
ExprParser parser = new ExprParser(tokens);
parser.Interpreter.PredictionMode = PredictionMode.LlExactAmbigDetection;
parser.root();
Oops you're right, the +
characters are indeed unintended in this rule.
Everything works as expected after I removed them.
Thank you.
Hello,
I'm afraid I found a bug in Antlr4 CS 4.3.0. Using the same grammar and the same input stream, the parsing succeeds in Java but fails in C# ("extraneous input"). The traces show that the C# version consumes all the left brackets in a row, and then complains about a right bracket. The Java version works as expected.
Here is my grammar:
And my test program (C#), showing the input stream:
The Java version:
Your help would be appreciated. Best regards,
Cyril.