[antlr-interest] Ways of collecting result templates
Imre András
iar73 at freemail.hu
Sat Dec 6 18:59:39 PST 2008
Hi,
My grammar processes an assignment list. Collecting result templates in the following way works:
prog : (s+=assignment)+ -> template(in={$s}) "<in>";
The above handles the assignment list as a whole. Now I'd like to do something with each assignment individually. I changed the grammar:
prog : assignmentList -> template(in={$assignmentList.st}) "<in>";
assignmentList : assignment al=assignmentList? -> template(in={$assignment.st}, in2={$al.st}) "[<in>]<\n><in2>";
This results in an error: java.lang.IllegalArgumentException: cannot embed template anonymous in itself
Is there a way to solve this with anonymous templates, or do I have to say goodbye to inline templates at this point?
Thanks,
András
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20081207/4c4bb1b5/attachment.html
More information about the antlr-interest
mailing list