[antlr-interest] Problem with AST tree with heterogeneous nodes

Marcin Rzeźnicki marcin.rzeznicki at gmail.com
Thu Jan 7 08:16:18 PST 2010


Hi all,
I have a curious problem when populating AST tree with custom nodes,
or to be more precise, with their constructors.
If, in the tree grammar (I basically construct AST tree in parser and
in the next step I rewrite it using tree walker), I am using:
STORE<UnresolvedLocal>[$ID, expressionResolver]

then constructor UnresolvedLocal(int ttype,	CommonTree id,
ExpressionResolver expressionResolver)
is picked up as expected

But, if I am using the following form:
STORE<LValueError> $lhs expression

then it gets transformed to:
new LValueError(stream_STORE.nextNode()), where nextNode() returns
Object, where I expected integer carrying token type to be used

Is this a bug of some kind? Can you explain it to me? Thank you very
much in advance


-- 
Greetings
Marcin Rzeźnicki


More information about the antlr-interest mailing list