[antlr-interest] Problems with Antlr3 rewrite rules
Shmuel Siegel
ssiegel at finjan.com
Sun Jun 3 04:57:32 PDT 2007
I have upgraded my production grammar from 3.0b6 to the release version.
I am having two problems with the rewrite rules. Hopefully I just missed
a specification change.
* Problem 1: When I have subclauses that do rewrites, the final
rewrite gets a null pointer exception. The following rule used to work
but now throws an exception. I avoid the exception if I extract the
parenthesized sub-rule and make it a named rule.
assignEntityAttr:
(
thisNode->thisNode
| symbolTableElement->symbolTableElement
| positionalElement->positionalElement
)
'.' a='attr' op='=' attr=attrValue
-> ^(ASSIGN[$op] ^($assignEntityAttr PROPERTY[$a]) $attr)
;
* Problem 1: Tree construction seems to have changed. I used to be
able to write
* ^($ent PROPERTY[$a]) where $ent was itself a tree. When
I do it now, I keep the head of the $ent tree but its children are
replaced by the PROPERTY token.
What has changed since b6?
Shmuel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20070603/3ea470d2/attachment.html
More information about the antlr-interest
mailing list