[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Java parser throws ArrayIndexOutOfBoundsException if first token lea

From: Tim Landscheidt
Subject: Re: Java parser throws ArrayIndexOutOfBoundsException if first token leads to syntax error
Date: Mon, 13 Feb 2012 16:29:02 +0000
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux)

Akim Demaille <address@hidden> wrote:

> [...]
>> diff --git a/data/lalr1.java b/data/lalr1.java
>> index 57ff993..a40d6c2 100644
>> --- a/data/lalr1.java
>> +++ b/data/lalr1.java
>> @@ -686,7 +686,7 @@ m4_popdef([b4_at_dollar])])dnl
>>               }

>>             /* Pop the current state because it cannot handle the error 
>> token.  */
>> -            if (yystack.height == 1)
>> +            if (yystack.height == 0)

> Is this O(1)?  We keep the height of the stack up to
> date ourselves?  I'm surprised we don't rely on some
> Java container to do this for us.

What do you mean by O(1) in this case?  The parser logic
here is shared with the C++ skeleton (and yacc.c looks
similar as well).  The stack implementation doesn't look
very frightening performance-wise.

>>               return false;

>>             ]b4_locations_if([yyerrloc = yystack.locationAt (0);])[

> The fix is straightforward, but the test suite contribution
> does require some paper work.  Could you please follow the
> instructions in the attached file?  Thanks in advance!

I have done so (and mentioned the files touched by the two
trivial fixes before to be on the safe side).


reply via email to

[Prev in Thread] Current Thread [Next in Thread]