[antlr-interest] "returns" Clause Including An Array?

Randall R Schulz rschulz at sonic.net
Sat Oct 4 08:05:13 PDT 2008


Hi,

I'd like to return an array from a parser rule (in a tree grammar, if it 
matters):

application
returns [ String appliedName, Term[] args ]
    :   ^(plainName argTerms?)
    {
        ...
    }
    ;


Unfortunately, the Java array declaration syntax, [], appears to be 
interfering with ANTLR's ability to parse the "returns" clause.

Is there a trick to get around this, or must I return a List and convert 
it to an array later on?


Randall Schulz


More information about the antlr-interest mailing list