Hi
I have the following in a tree grammar that works as I expect:
columnNameList returns [List names]
: ^(COLUMN_NAMES ids+=ID+)
{
$names = new ArrayList();
for( Object tree : $ids ) {
$names.add(
((CommonTree)tree).getText().toUpperCase() );
}
}
;
What I am wondering is if there is a built in way in ANTLR to loop over the
list of ID tokens, to perform some common function, and then return that list.
I guess I am wondering if there is some built in 'collect' function similar to
the collect method that is available on collections in languages like Groovy or
Smalltalk.
I would prefer something like the following instead:
$names = $ids.collect{ it.text.toUpperCase() }
How is this usually handled?
David Weiler-Thiessen
Nestlé Purina PetCare
phone: 306-933-0232
cell: 306-291-9770
This e-mail, its electronic document attachments, and the contents of its
website linkages may contain confidential information. This information is
intended solely for use by the individual or entity to whom it is addressed. If
you have received this information in error, please notify the sender
immediately and promptly destroy the material and any accompanying attachments
from your system.
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.