[antlr-interest] v3: strange debugging message in new java.g grammar
Dieter Frej
dieter_frej at gmx.net
Mon Jul 10 12:14:30 PDT 2006
Hi everybody,
since Terence wrote that the new Java grammar was not tested
exhaustively, I thought I could do that. So I wrote the following small
program and ran it (java JCKParsing.java 2>err.txt).
String file =
"/home/db/jck/JCK-compiler-15a/tests/lang/FP/fpl001/fpl00101m8/fpl00101m8.java";
try {
CharStream cs = new ANTLRFileStream(file);
JavaParserLexer lexer = new JavaParserLexer(cs);
CommonTokenStream tokens = new CommonTokenStream();
tokens.setTokenSource(lexer);
JavaParser parser = new JavaParser(tokens);
parser.compilationUnit();
} catch (IOException ioe) {
System.err.println("(ioe): |" + ioe.getMessage() + "|");
} catch (NoViableAltException nvae) {
System.err.println("(nvae): |" + nvae.getMessage() + "|");
} catch (MismatchedTokenException mte) {
System.err.println("(mte): |" + mte.getMessage() + "|");
} catch (RecognitionException re) {
System.err.println("(re): |" + re.getMessage() + "|");
}
I got the following in my err.txt and I have no idea where this came
from because it does not look like an exception (they should all be
handled).
/home/db/jck/JCK-compiler-15a/tests/lang/FP/fpl001/fpl00101m8/fpl00101m8.java
[compilationUnit, typeDeclaration, classOrInterfaceDeclaration,
classDeclaration, normalClassDeclaration, classBody,
classBodyDeclaration, memberDecl]: line
20:18 decision=<<132:1: memberDecl : ( (
genericMethodOrConstructorDecl )=> genericMethodOrConstructorDecl | (
methodDeclaration )=> methodDeclaration | (
fieldDeclaration )=> fieldDeclaration | ( 'void' Identifier
voidMethodDeclaratorRest )=> 'void' Identifier voidMethodDeclaratorRest
| ( Identifier construct
orDeclaratorRest )=> Identifier constructorDeclaratorRest | (
interfaceDeclaration )=> interfaceDeclaration | classDeclaration );>>
state 15 (decision=36) n
o viable alt; token=[@106,466:468='int',<59>,20:18]
[compilationUnit, typeDeclaration, classOrInterfaceDeclaration,
classDeclaration, normalClassDeclaration, classBody,
classBodyDeclaration, memberDecl, const
ructorDeclaratorRest, formalParameters]: line 20:53 mismatched token:
[@119,501:508='strictfp',<54>,20:53]; expecting type ')'
---------------
Any comments on this?
- Didi
More information about the antlr-interest
mailing list