[antlr-interest] Accumulation of return values (Java)
Thomas Karcher
thkarcher at gmx.de
Wed Jun 11 10:28:49 PDT 2008
Hi,
> text_block returns [Term result]
> : ^(TEXT name? phrase*)
> { $result = new Term(TEXT, $name.result, XXX); }
> ;
> 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.
Did you try something like
text_block returns [Term result]
: ^(TEXT name? phr+=phrase*)
{ $result = new Term(TEXT, $name.result, $phr); }
;
Then Term should have a "List" as last parameter type.
Thomas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Dies ist ein digital signierter Nachrichtenteil
Url : http://www.antlr.org/pipermail/antlr-interest/attachments/20080611/6933772a/attachment.bin
More information about the antlr-interest
mailing list