[antlr-interest] Antlr 2.7.2a2 Report

Terence Parr parrt at jguru.com
Wed Feb 6 09:37:45 PST 2002


On Wednesday, February 6, 2002, at 04:30  AM, Christian Ernst wrote:

> Robert Colquhoun wrote:
>
>> 1) This is a totally trivial thing, but when generating bitsets in the 
>> lexer:
>>
>>   private static final long[] mk_tokenSet_1() {
>>         long[] data = new long[8];
>>         data[0]=-576460752303432712L;
>>         for (int i = 1; i<=3; i++) { data[i]=-1L; }
>>         for (int i = 4; i<=7; i++) { data[i]=0L; }
>>         return data;
>>     }
>>
>> Initializing the array to 0L is not needed as java does this 
>> automatically(only matters for unicode with lots of bitsets, and even 
>> then not much).
>>
> You are right
> i checked that
>
> Terence could you add follwing for 2.7.2a3 ?
>
> JavaCodeGenerator.java
> Line 1287:
> -----------------------------
>                   // j-1 is last member of run
>                    println("\tfor (int i = "+i+"; i<="+(j-1)+"; i++) 
> { data[i]="+
>                            elems[i]+"L; }");
> ------------------------------
> to:
> -------------------------------
> // skip the generation of a loop if member are 0L which is Java default
> if ( elems[i] != 0 ) {
>                   // j-1 is last member of run
>                    println("\tfor (int i = "+i+"; i<="+(j-1)+"; i++) 
> { data[i]="+
>                            elems[i]+"L; }");
> }
> -------------------------------

For sure.  I am laughing because I was certainly intending to do that 
but apparently got caught up in the range computation ;)

I have added the other stuff to the list as well.

Ter

--
Chief Scientist & Co-founder, http://www.jguru.com
Creator, ANTLR Parser Generator: http://www.antlr.org


 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 



More information about the antlr-interest mailing list