-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Description
Antlr 4.9.1 parsers for grammars-v4/idl/IDL.g4 with the input shown below are producing different results. To be clear, the parsers should produce identical output, but they do not. The list of tokens is identical between Java and CSharp so the lexing is identical. There are no actions/semantic predicates in IDL.g4, and I have removed the custom error listener generated by my program for both targets, so it cannot be attributed to those possible issues. I believe there is a problem in one or the other Antlr4 runtimes.
I also tested this across the other targets. After renaming the parser symbol "exports", which conflicts with certain targets, the parsers produce different results: for Dart and Go, the input is accepted; for JavaScript and Python3, the input is rejected.
The error outputted by the parser is:
line 3:2 mismatched input 'interface' expecting {'@', 'typedef', 'custom', 'struct', 'native', 'eventtype', 'enum', 'home', 'exception', 'const', 'module', 'union', 'abstract', 'typeprefix', 'typeid', 'component', 'bitset', 'bitmask', '@annotation'}
To reproduce, use dotnet-antlr v2.2.0.
module HelloApp
{
interface Hello
{
string sayHello();
oneway void shutdown();
};
};