-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CSharp and Java producing different error messages for expected tokens #3700
Comments
This needs to be solved since the build compares outputs--and soon the .tree files--across targets. |
This could be solved by converting the set to a naturally ordered list. |
I think there's more to it because the LA sets are not the same at all between CSharp and Java targets.
|
That bug is strange because many tests in the test suite check for errors... |
This is an old bug, but I am working out why there are differences because someone is trying to use grammars-v4/csharp (CSharp target) in StackOverflow (https://stackoverflow.com/questions/78424669/linking-visitmember-access-and-visitifstatement-methods-of-antlr4#comment138303496_78424669). (I created the desc.xml to describe what ports work for a grammar, and to try to prevent people from using bad ports. CSharp is not listed, but people ignore that anyway.) The CSharp code and Java code error recovery are not similar. antlr4/runtime/CSharp/src/DefaultErrorStrategy.cs Lines 573 to 574 in 380ce4b
antlr4/runtime/Java/src/org/antlr/v4/runtime/DefaultErrorStrategy.java Lines 480 to 488 in 380ce4b
"nextTokensContext" is not null, so Java does something completely different from CSharp. In fact, the code is not similar across targets. antlr4/runtime/Cpp/runtime/src/DefaultErrorStrategy.cpp Lines 209 to 210 in 380ce4b
antlr4/runtime/Dart/lib/src/error/src/error_strategy.dart Lines 546 to 558 in 380ce4b
antlr4/runtime/Go/antlr/v4/error_strategy.go Lines 364 to 365 in 380ce4b
antlr4/runtime/JavaScript/src/antlr4/error/DefaultErrorStrategy.js Lines 424 to 425 in 380ce4b
antlr4/runtime/Python3/src/antlr4/error/ErrorStrategy.py Lines 406 to 407 in 380ce4b
It seems the change in Java was for #1922 0803c74 but it wasn't applied across targets and they were available. https://github.com/antlr/antlr4/tree/0803c74eb255fe5e6fe5a6f11d879198d305e715/runtime . Sloppy coding. |
For:
Output:
Expected output:
The text was updated successfully, but these errors were encountered: