Posted By:
kris_kvilekval
Posted On:
Tuesday, July 29, 2003 04:17 PM
After a recent upgrade to 2.7.2, the generated parser will not run anymore. Can someone shed some light on what I need to do now? Notice that the ASTFactory seems to take a string instead of a token. I guess it cannot find this class though it is definitely in the class directory. Thanks. Exception in thread "main" java.lang.IllegalArgumentException: Invalid class or can't make instance, IdentifierAST at antlr.ASTFactory.createUsingCtor(ASTFactory.java:251) at antlr.ASTFactory.create(ASTFactory.java:210) at mokan.compiler.KanParser.identifier(KanParser.java:446) at mokan.compiler.KanParser.packageDefinition(KanParser.java
More>>
After a recent upgrade to 2.7.2, the generated parser will not run anymore.
Can someone shed some light on what I need to do now?
Notice that the ASTFactory seems to take a string
instead of a token. I guess it cannot find this
class though it is definitely in the class directory.
Thanks.
Exception in thread "main" java.lang.IllegalArgumentException: Invalid class or can't make instance, IdentifierAST
at antlr.ASTFactory.createUsingCtor(ASTFactory.java:251)
at antlr.ASTFactory.create(ASTFactory.java:210)
at mokan.compiler.KanParser.identifier(KanParser.java:446)
at mokan.compiler.KanParser.packageDefinition(KanParser.java:299)
at mokan.compiler.KanParser.compilationUnit(KanParser.java:185)
at mokan.compiler.Type.parseFile(Type.java:311)
at mokan.compiler.Kanc.doFile(Kanc.java:119)
at mokan.compiler.Kanc.main(Kanc.java:83)
Below is the offending code before then after
// $ANTLR 2.7.1a2: "kan.g" -> "KanParser.java"$
...
public final void identifier() throws RecognitionException, TokenStreamException {
returnAST = null;
ASTPair currentAST = new ASTPair();
SymbolAST identifier_AST = null;
SymbolAST tmp5_AST = null;
if (inputState.guessing==0) {
tmp5_AST = (SymbolAST)astFactory.create(LT(1));
astFactory.addASTChild(currentAST, tmp5_AST);
}
After:
// $ANTLR 2.7.2: "kan.g" -> "KanParser.java"$
...
protected final void identifier() throws RecognitionException, TokenStreamException {
returnAST = null;
ASTPair currentAST = new ASTPair();
KanAST identifier_AST = null;
Token id = null;
IdentifierAST id_AST = null;
Token d = null;
IdentifierAST d_AST = null;
Token i = null;
KanAST i_AST = null;
StringBuffer buf = new StringBuffer();
try { // for error handling
id = LT(1);
id_AST = (IdentifierAST)astFactory.create(id,"IdentifierAST");
astFactory.addASTChild(currentAST, id_AST);
match(IDENT);
if ( inputState.guessing==0 ) {
buf.append(id_AST.getText());
}
<<Less