Here is the generated SwiftBugParser code (portions of comments ommitted; four errors noted):
// $ANTLR start "tag"
// \\SwiftBug.g:16:1: tag : COLON '1' .. '9' '0' .. '9' ( 'A' .. 'Z' )? ;
public final void tag() throws RecognitionException {
try {
// \\SwiftBug.g:16:5: ( COLON '1' .. '9' '0' .. '9' ( 'A' .. 'Z' )? )
// \\SwiftBug.g:16:8: COLON '1' .. '9' '0' .. '9' ( 'A' .. 'Z' )?
{
match(input,COLON,FOLLOW_COLON_in_tag68);
matchRange('1','9'); // FIRST ERROR, LINE 193
matchRange('0','9'); // SECOND ERROR, LINE 195
// \\SwiftBug.g:16:32: ( 'A' .. 'Z' )?
int alt2=2;
int LA2_0 = input.LA(1);
if ( () ) { // THIRD ERROR, LINE 201
alt2=1;
}
switch (alt2) {
case 1 :
// \\SwiftBug.g:
{
if ( ) { // FOURTH ERROR, LINE 208
input.consume();
state.errorRecovery=false;
}
else {
MismatchedSetException mse = new MismatchedSetException(null,input);
throw mse;
}
}
break;
}
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
// do for sure before leaving
}
return ;
}
// $ANTLR end "tag"
I am getting these four Java compilation errors:
Description Resource Path Location Type
The method matchRange(char, char) is undefined for the type SwiftBugParser SwiftBugParser.java /SwiftMessage/antlr-generated line 193 Java Problem
The method matchRange(char, char) is undefined for the type SwiftBugParser SwiftBugParser.java /SwiftMessage/antlr-generated line 195 Java Problem
Syntax error on token "(", Expression expected after this token SwiftBugParser.java /SwiftMessage/antlr-generated line 201 Java Problem
Syntax error on token "(", Expression expected after this token SwiftBugParser.java /SwiftMessage/antlr-generated line 208 Java Problem
The declaration is public class SwiftBugParser extends Parser, so I am not sure why matchRange is not understood.
I can see that there is no boolean expression being evaluated for the third and fourth errors. Perhaps the ? (match 0 or 1 instances) is a problem.
I am getting four Java compile error on a grammar.
I'm using Eclipse Indigo SR2 and these plugins:
I am having Eclipse place the generated Java code in a package antlr-generated. The build path for antlr-generated includes antlr-3.4-complete.jar.
Here is my grammar (line numbers added):
Here is the generated SwiftBugParser code (portions of comments ommitted; four errors noted):
I am getting these four Java compilation errors:
The declaration is
public class SwiftBugParser extends Parser
, so I am not sure why matchRange is not understood.I can see that there is no boolean expression being evaluated for the third and fourth errors. Perhaps the ? (match 0 or 1 instances) is a problem.