[antlr-interest] Line and Column information lost during AST creation

Christophe Boutter boutter at ps.uni-sb.de
Fri Jan 5 05:16:25 PST 2007


Xue Yong Zhi wrote:
>> I've done that too. I call:
>> setASTNodeClass("modesteditor.core.antlrparser.ASTWithOffsetInfos");
>>
>> That gives me the following error message:
>> Can't find/access AST Node
>> typemodesteditor.core.antlrparser.ASTWithOffsetInfos
>>
> 
> It can be as simple as your ASTWithOffsetInfos is not a public class, or
> in a wrong package.

Actually it is a public class and in the same package as the parser.

> Antlr uses reflection to find ASTWithOffsetInfos.

After having read some things about reflection I thought it should work
but didn't.

Now I've set it up with ASTLabeType="ASTWithOffsetInfos" as a parser
option. And in order not to get some cast errors I had to set the node
class type manually for the AST factory with:
astFactory.setASTNodeClass(ASTWithOffsetInfos.class);

Shouldn't that be set along with the ASTLabelType option? Or has that
something to do with the fact that one wants to be able to generate
heterogenous trees?

Thanks Xue Yong Zhi for the help.

Chris
-- 
Try not to become a man of success, but rather try to become a man of value.
-- Albert Einstein


More information about the antlr-interest mailing list