[antlr-interest] Returning an array type
Austin Hastings
Austin_Hastings at Yahoo.com
Mon Oct 15 03:44:46 PDT 2007
Oliver had the same problem earlier this week. I think it's just a
square-bracket problem, and if you use List<byte> or new Array() you can
get around it.
=Austin
Gavin Lambert wrote:
> At 17:53 15/10/2007, Rick Mann wrote:
> >I tried to do this:
> >
> >foo returns [byte[] outBytes] : ... ;
> >
> >But the generated code was
> >
> >byte outBytes = 0;
> >
> >Is it not possible to use an array type?
>
> Not at the moment, no. ANTLR currently swallows the brackets.
>
> You could try using List<byte>, though it's possible that will have
> the same problem. Failing that, you'll probably need to return a
> custom class/struct instead; or if you've got a simple case
> (non-nested), you could use a member variable.
>
>
>
More information about the antlr-interest
mailing list