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

Johannes Luber jaluber at gmx.de
Sat Oct 4 08:42:16 PDT 2008


Randall R Schulz schrieb:
> 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?

I think, that you must use "\[\]" or "\]" instead. Not sure which method
is the correct one.

Johannes
> 
> 
> Randall Schulz
> 
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address
> 



More information about the antlr-interest mailing list