[antlr-interest] Returning an array type
Gavin Lambert
antlr at mirality.co.nz
Sun Oct 14 23:43:42 PDT 2007
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