[antlr-interest] Nested Generics - Java Grammar

Aravinda Dassanayake aravinda777 at gmail.com
Mon Aug 25 22:44:21 PDT 2008


Hi all,

I have a little problem with the available Java grammar. It has trouble
dealing with nested generics.

eg:

HashMap<String, ArrayList<String>> cat_map = new HashMap<String,
ArrayList<String>>();

It warns about the multiple '>' characters like;

line 72:11 no viable alternative at input 'Element'
line 74:8 no viable alternative at input 'HashMap'
line 74:41 mismatched input '>>' expecting '>'
line 74:52 mismatched input '=' expecting '('
line 74:52 mismatched input '=' expecting ';'
line 74:91 mismatched input '>>' expecting '>' etc

Is there a refined version of the grammar to support this type of scenario,
or what is the possible workaround?

Regards,

Aravinda Dassanayake

+94715320257

aravinda777 at yahoo.com
aravinda777 at gmail.com

http://aravindad.blogspot.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20080826/4a3f94fb/attachment.html 


More information about the antlr-interest mailing list