[antlr-interest] parameterized maps as arguments to rules??
Benjamin Niemann
pink at odahoda.de
Mon Jun 18 12:12:35 PDT 2007
David A Weiser wrote:
> I have the beginning of a rule:
> formalParameterDecls returns [HashMap<String,String> params].
>
> But I get a compilation error because of:
> public static class formalParameters_return extends
> ParserRuleReturnScope {
> public HashMap<String;
> public String> params;
> };
>
> In the java file for the grammar parser. Am I to assume that java 1.5
> features aren't supported, or am I just going about this wrong?
The implementation of parameter parsing rather dump: it just splits the list
by commas. It does not treat generics or any other construct in any of the
target languages specially.
You'll have to create a typedef for HashMap<String,String> and use that for
the params type.
Oops, java does not have typedef, right? Mmm... Perhaps use "Object params"
and cast it to HashMap<String,String> later...
HTH
--
Benjamin Niemann
Email: pink at odahoda dot de
WWW: http://pink.odahoda.de/
More information about the antlr-interest
mailing list