Hello fellow ANTLRs, I have a problem with obtaining text and positions for
one of my rules ion a tree walker, and since I ran out of ideas on what
might be wrong I am here to ask :-)
My rule looks like this:
memberExpression returns [ Expression expression = null ]
@after { post ($expression, $memberExpression.start,
$memberExpression.text); }
: ^( BYINDEX parenLeftHandSideExpression expressionSt ) {
$expression = new NIndexRefExpression (0, 0,
$parenLeftHandSideExpression.expression, $expressionSt.statement);
}
| ^( BYFIELD parenLeftHandSideExpression Identifier ) {
$expression = new NFieldRefExpression (0, 0,
$parenLeftHandSideExpression.expression, $Identifier.text);
}
;
and the problem is that $memberExpression.text returns empty string, caused
by the fact that $memberExpression.start has the start/stop indexes as -1.
I have a second rule for something else, which looks very similar, and that
one (as well as all others) work perfectly fine, the $rule.text containing
the text corresponding to what the rule matched.
Any ideas why this may be happening?
-Jan
List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe:
http://www.antlr.org/mailman/options/antlr-interest/your-email-address
--
You received this message because you are subscribed to the Google Groups
"il-antlr-interest" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/il-antlr-interest?hl=en.