[antlr-interest] Bug in antlr4

Chris Moller moller at mollerware.com
Sat Sep 29 16:47:49 PDT 2012


I just rebuilt all the classes:

    java -jar /usr/local/lib/antlr-4.0b1-complete.jar Java.g4
    javac ExtractInterfaceTool.java ExtractInterfaceListener.java
    JavaBaseListener.java JavaLexer.java JavaListener.java JavaParser.java


and reran it:

    java -cp .:/usr/local/lib/antlr-4.0b1-complete.jar:$CLASSPATH
    ExtractInterfaceTool Demo.java
    interface IDemo {
             void f(intx,Stringy);
             int[] g();
             List<Map<String,Integer>>[] h();
    }

and get the same result.

Fedora release 15 (Lovelock) and java-1.6.0-openjdk

II tried looking at the Java antlr created, looking for anything 
obvious, but (a) I'm not a Java guy, and (b) I dead-ended at some antlr 
classes and haven't brought down the source code.  If you like, I'll 
poke at it some more, but refer to (a).

cm

On 09/29/12 19:06, Terence Parr wrote:
> Hi. I just ran and it seems ok:
>
> $ java ExtractInterfaceTool Demo.java
> interface IDemo {
> 	void f(int x, String y);
> 	int[ ] g(/*no args*/);
> 	List<Map<String, Integer>>[] h();
> }
>
> and with 4.0b1 jar specifically:
>
> $ java -cp .:~/tmp/antlr-4.0b1-complete.jar:$CLASSPATH ExtractInterfaceTool Demo.java
> interface IDemo {
> 	void f(int x, String y);
> 	int[ ] g(/*no args*/);
> 	List<Map<String, Integer>>[] h();
> }
>
> not sure what is happening. i'm using java 1.6 on mac os x 10.7.5.
>
> Ter
> On Sep 21, 2012, at 6:16 AM, Chris Moller wrote:
>
>> I just found what I'm fairly sure is a previously unfound bug in v4. Is
>> there a list for that?  Or just go straight to github bugs?
>>
>> FWIW, the bug is from the ExtractInterfaceTool example in the pragprog
>> manual.  Per the manual, the result is supposed to be:
>>
>>     interface IDemo {
>>     void f(int x, String y);
>>     int[ ] g(/*no args*/);
>>     List<Map<String, Integer>>[] h();
>>     }
>>
>>
>> and the actual is:
>>
>>     interface IDemo {
>>     void f(intx,Stringy);
>>     int[] g();
>>     List<Map<String,Integer>>[] h();
>>     }
>>
>>
>> The spaces are missing between the types and the parms of method f().
>> Also, more trivially, the comment from the arg list of g() is missing.
>>
>> List: http://www.antlr.org/mailman/listinfo/antlr-interest
>> Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address
>
>




More information about the antlr-interest mailing list