[antlr-interest] parameterized maps as arguments to rules??
scott at javadude.com
scott at javadude.com
Mon Jun 18 12:25:16 PDT 2007
[I hate having to hit "reply all" on this list and then adjusting the TO
and CC! Grrrr!!!]
You could create a subclass of HashMap like
public class MyMap extends HashMap<String, String> {}
That's effectively a typedef for it...
-- Scott
> 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