Thanks for the helpful hints, Jim. Using the debugging method you described makes me think the statement rule's st isn't right - I'll have to do some more reading/learning since the only st that was used was in the "while" rule.
Kevin From: [email protected] [mailto:[email protected]] On Behalf Of Jim Idle Sent: Tuesday, December 01, 2009 11:49 AM To: antlr-interest Subject: Re: [antlr-interest] Help with a tree grammar: losing a list of statements $s is the correct reference, but it is a collection of whatever the statement rule returns, so you may need to use an iterator in your string template. , or it might just be that your statement rule isn't setting up its st properly. stats={$s} then ..., stats) ::= << ... <stats:{<it>}; separator="\n"> Your reference to $text is the text for the whole node, and so you get the while keyword too. So, check your statement rule generates a good st, then use $s=statement and just pass in $s.st to check that just one statement works, then go to s+= and see if that works, then add an iterator in the template and see if that works. Use small incremental changes to see where your problem lies, rather than just stabbing in the dark ;-) Also do not forget that you do not HAVE to use rewrite rules, you can create the template in an action, then repeatedly set the stats attribute in your loop, which will create a collection of StringTemplate. Jim -- 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.
List: http://www.antlr.org/mailman/listinfo/antlr-interest Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address
