[antlr-interest] Accumulation of return values (Java)

Bill Andersen andersen at ontologyworks.com
Wed Jun 11 08:51:51 PDT 2008


Folks,

Say we have the following (AST) grammar snippet

text_block returns [Term result]
	: ^(TEXT name? phrase*)
		{ $result = new Term(TEXT, $name.result, XXX); }
	;

phrase returns [Term result]
	...

name returns [Term result]
	...

The question is, what ought to go in place of XXX in order to  
accumulate theTerm objects resulting from the recognition of  
individual 'phrase's into a list that can then be passed to the Term  
constructor?  I can't seem to find or figure out a syntax that works.   
Any help appreciated!

	.bill

Bill Andersen
Ontology Works, Inc. (www.ontologyworks.com)
3600 O'Donnell Street, Suite 600
Baltimore, MD 21224
Office: +1.410.675.1201
Cell: +1.443.858.6444
Fax: +1.410.675.1204






More information about the antlr-interest mailing list