I am using Antlr4cs-4.3.0 with Visual Studio 2012, .Net 4.5. I have successfully generated and exercised a parser produced from a simple grammar (calculator.g4) and thus feel that I have things properly setup in Visual Studio. I am now attempting to generate a parser for the Java.g4 grammar which I obtained from github.com/antlr/grammars-v4/java. The JavaLexer.cs file which is generated does not compile (see code and errors below) - persumably because it contains references to things which exist only in a java environment.
Any advise will be much appreciated.
Robert
private bool JavaLetterOrDigit_sempred(RuleContext _localctx, int predIndex) {
switch (predIndex) {
case 2: return Character.isJavaIdentifierPart(_input.LA(-1));
case 3: return Character.isJavaIdentifierPart(Character.toCodePoint((char)_input.LA(-2),
(char)_input.LA(-1)));
}
return true;
}
Error: The name 'Character' does not exist in the current context
Error: 'Antlr4.Runtime.ICharStream' does not contain a definition for 'LA' and no extension method 'LA' accepting a first argument of type 'Antlr4.Runtime.ICharStream' could be found (are you missing a using directive or an assembly reference?)