dcsimg
ASTFactory error after upgrading 2.7.2
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

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

Re: ASTFactory error after upgrading 2.7.2

Posted By:   Terence_Parr  
Posted On:   Monday, August 4, 2003 10:40 AM

Hi. I believe you need to regenerate all of your .java files from the .g files and it should work. Make sure you are pointing at 2.7.2.
About | Sitemap | Contact