[antlr-interest] getTree() returns Object, whereas .tree allows access to correct object type

Kenny MacDermid kenny at kmdconsulting.ca
Thu Sep 27 16:51:45 PDT 2007


Hello,

I was wondering if there is a known reason why I can't use:

parser.rule().getTree().toStringTree();

and instead have to use:

parser.rule().tree.toStringTree();

I have specified a ASTLabelType in the options. Should this not also
be used for the generated return value?

The generated code is:

    public static class rule_return extends ParserRuleReturnScope {
        CommonTree tree;
        public Object getTree() { return tree; }
    };

Thanks,

Kenny


More information about the antlr-interest mailing list