Posted By:
Slawek_Kolasinski
Posted On:
Thursday, April 21, 2005 04:12 AM
Hi, When I'm using my own classes for AST nodes ANTLR generates code which doesn't compile. I wanted to make a TreeParser like this .... | #(BIND name3:NAME exp4:expr) { #expr = #([DOT, "primitive"], #[NAME, "INTERNAL_BIND"], #name3); } .... ANTLR generated something like this: ... name3 = (AST)_t; AST name3_AST_in = null; name3_AST = (myast.NameNode)astFactory.create(name3,"myast.NameNode"); ... Java complains about not having ASTFactory.create(AST,String)
More>>
Hi,
When I'm using my own classes for AST nodes ANTLR generates code which doesn't compile. I wanted to make a TreeParser like this
....
| #(BIND name3:NAME exp4:expr)
{
#expr = #([DOT, "primitive"], #[NAME, "INTERNAL_BIND"], #name3);
}
....
ANTLR generated something like this:
...
name3 = (AST)_t;
AST name3_AST_in = null;
name3_AST = (myast.NameNode)astFactory.create(name3,"myast.NameNode");
...
Java complains about not having ASTFactory.create(AST,String)
For now I've "patched" ASTFactory adding:
public AST create(AST tree, String className)
{
AST result = create(className);
result.initialize(tree);
return result;
}
Am I doing something wrong?
Can I expect this to be patched in next releases?
Regards,
Slawek Kolasinski
<<Less