[antlr-interest] java.g - a couple of issues

Davin McCall davmac at deakin.edu.au
Wed Mar 16 15:01:42 PST 2005


Hi,
We're using Michael Studman's java 1.5 grammar as a base for our own and 
have noticed the following issues. We've got fixes but I wanted to both 
highlight the issues to the community and see if anyone else has 
comments (especially in regards to whether the fixes are correct :-) ).

1. Single line comments without a terminating newline at the end of a 
file cause a parse error, due to the requirement that the comment is 
followed by a line-end.

It seems to be possible to just remove that requirement (and also the 
call to newline()) and then everything works fine (ie. the match is 
greedy anyway).

2. Arrays aren't allowed as wildcard bounds (they should be).

For instance, "? extends Thread[]" as a wildcard in some declaration 
causes a parse error. A possible fix is to add "arraySpecOpt" in to the 
"typeArgumentBounds" target.

Davin



More information about the antlr-interest mailing list