[antlr-interest] A question about treeprser?

Terence Parr parrt at cs.usfca.edu
Mon Dec 13 10:05:45 PST 2004



On Dec 12, 2004, at 6:12 PM, achilles7686 wrote:
>  I want to have the pr_ModuleParList rule return an StringBuffer
> result ,but I don't know how to assign the return value when it is
> enclosed .
>
>
> pr_TTCN3Module returns [StringBuffer output]
> {
> output=new StringBuffer();
> StringBuffer retStr;
> }
> :
> 	#(
> 	TTCN3Module
> 	retStr=pr_TTCN3ModuleId
> 	 ( pr_ModuleParList )*
> 	)
> {
>         output.append(retStr);
> };

Howdy.  Not sure I understand the question, but try having 
pr_ModuleParList return a StringBuffer like the others.  Then, in the 
loop do this:

( retStr=pr_ModuleParList {output.append(x);} )*

Ter
--
CS Professor & Grad Director, University of San Francisco
Creator, ANTLR Parser Generator, http://www.antlr.org
Cofounder, http://www.jguru.com
Cofounder, http://www.knowspam.net enjoy email again!





 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/antlr-interest/

<*> To unsubscribe from this group, send an email to:
    antlr-interest-unsubscribe at yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 





More information about the antlr-interest mailing list