[antlr-interest] Java string array issue in v3.

Johannes Luber jaluber at gmx.de
Fri Jun 15 14:35:12 PDT 2007


Ted Villalba wrote:
> Hi.
> Not sure, I might be doing something wrong here, but this seems like a bug.
> I'm trying to pass a string array to the start of my tree, but when I
> compile my tree grammar the String array gets compiled
> into a String.
> So in treeGrammar.g my start symbol is rule "start"
>  
> start[HashMap fieldMap, String[] fqls]
> @init{
> etc etc...
> }

IIRC, the problem is that arrays rely on "[]" which are part of the
ANTLR grammar and that this is falsely attributed to be a parameter for
a rule. As far as I know there is no way to prevent this behaviour right
now. A workaround would be to declare flqs as object and cast it in Java
to a String array.

Best regards,
Johannes Luber


More information about the antlr-interest mailing list