It turns out that it was a known bug. Thanks to Maik Schmidt for pointing me to the fix. It worked.
- Andy -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Jim Idle Sent: Friday, November 04, 2011 9:16 AM To: ANTLR interest Subject: Re: [antlr-interest] This should be simple, but I can't find the right syntax (or is it a bug?) Try this and see if it makes any difference. <vals: {<it>}; separator="\n"> Also, is the rule borg definitely returning a template? Jim > -----Original Message----- > From: [email protected] [mailto:antlr-interest- > [email protected]] On Behalf Of Voelkel, Andy > Sent: Thursday, November 03, 2011 5:59 PM > To: 'ANTLR interest' > Subject: [antlr-interest] This should be simple, but I can't find the > right syntax (or is it a bug?) > > Hi, > > I'm trying to collect all the StringTemplates created by all instances > of one rule (borg) into a StringTemplate for a containing rule (prog). > But I can't seem to find the right syntax: > > options { > output = template; > language = CSharp3; > tokenVocab=Tree1; > ASTLabelType = CommonTree; > } > > public prog > : (b+=borg)+ -> template(vals = {$b}) > << > { // prog > <vals; separator = ","> > } > >> ; > > The syntax I tried above is one many approaches I've tried - none seem > to work. Antlr3 runs without error but the code won't compile. I hope > the intent is clear, as it is a pretty simple example. I've looked > back and forth in Terence's book trying to find something like this, > and in the examples, but so far I've struck out. It seems like a very > common thing to try to do! > > One strange thing is that when I look at the generated code, the list > for b (list_b) is declared as List<CommonTree>. But Terence's books > says is should be List<StringTemplate> when the output type is > template. Later in the generated code, when it tries to add to the > list, it tries to create a List<StringTemplate>, which seems right, > but causes a compiler error. It almost seems like a bug, but I > probably just don't understand. > > Can anyone help me with this? > > - Andy > > ________________________________ > > CONFIDENTIALITY NOTICE: This e-mail transmission, and any documents, > files or previous e-mail messages attached to it, may contain > information that is confidential and/or legally privileged. If you are > not the intended recipient, or a person responsible for delivering it > to the intended recipient, please DO NOT disclose the contents to > another person, store or copy the information in any medium, or use > any of the information contained in or attached to this transmission > for any purpose. If you have received this transmission in error, > please immediately notify the sender by reply email or at > [email protected], and destroy the original transmission and its > attachments without reading or saving in any manner. > > For further information about Plantronics - the Company, its products, > brands, partners, please visit our website www.plantronics.com. > > List: http://www.antlr.org/mailman/listinfo/antlr-interest > Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your- > email-address List: http://www.antlr.org/mailman/listinfo/antlr-interest Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address ________________________________ CONFIDENTIALITY NOTICE: This e-mail transmission, and any documents, files or previous e-mail messages attached to it, may contain information that is confidential and/or legally privileged. If you are not the intended recipient, or a person responsible for delivering it to the intended recipient, please DO NOT disclose the contents to another person, store or copy the information in any medium, or use any of the information contained in or attached to this transmission for any purpose. If you have received this transmission in error, please immediately notify the sender by reply email or at [email protected], and destroy the original transmission and its attachments without reading or saving in any manner. For further information about Plantronics - the Company, its products, brands, partners, please visit our website www.plantronics.com. 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.
