Method in Generated <GrammarName>Lexer
class:
public override string SerializedAtn { get { return new string(_serializedATN); } }
Method in base Recognizer class from which the Lexer is derived:
public virtual int[] SerializedAtn
Same error is in the <GrammarName>Parser
.
Please advise. I am not sure if the grammar itself has anything to do with it.
Somewhere in v4 that changed from string
to int[]
. The compilation error you now get is because you're using a different ANTLR runtime version than the version you used to generate your parser classes. Always use the same versions. I recommend using the most recent:
<PackageReference Include="Antlr4.Runtime.Standard" Version="4.11.1" />
and use this to generate your parser classes: www.antlr.org/download/antlr-4.11.1-complete.jar
Ah, I see kaby76 suggest not do download the JAR but to use a Antlr4BuildTasks for it (I'm sure that suggest is sound, I just don't have much experience in ANTLR development + C#). Whatever you decide to do, make sure that the underlying version of the ANTLR tool (whether that is the tool included in the JAR or the the tool from the Antlr4BuildTasks) is the same as the ANTLR runtime version. The fact that the versions do not match is (most likely) the issue you are facing now.