[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 0/5] glr.cc: support syntax_error exceptions
From: |
Akim Demaille |
Subject: |
Re: [PATCH 0/5] glr.cc: support syntax_error exceptions |
Date: |
Sat, 5 Jan 2019 10:44:06 +0100 |
Hi Askar!
> Le 5 janv. 2019 à 02:11, Askar Safin <address@hidden> a écrit :
>
>> Good catch, thanks! I believe this patch is much better than my previous
>> failed attempt.
> It seems it is buggy again. :)
> I checked out 20ad776a1ed2d95495b1706492e3ccf5441f9f0f from
> https://github.com/akimd/bison . Then I built that attached example from
> https://lists.gnu.org/archive/html/bison-patches/2019-01/msg00000.html . And
> typed this:
>
> echo 2 + 2 % | ./a.out && echo Accepted || echo Rejected
>
> And got this:
>
> Invalid character: %
> 4
> Rejected
>
> But with %skeleton "lalr1.cc" I got this:
>
> Invalid character: %
> Rejected
>
> So, it seems current solution is buggy, but I am not sure. Because I don't
> know how GLR parsers supposed to work. Maybe current behavior is correct.
This time, it's something deeper in the implementation of glr.c itself, which I
don't master, and am very afraid to break. It does appear that it manages to
run a few more reductions after an error, which is surprising: I would
definitely call this a bug.
You can see that same behavior with a simple "1+2(" for instance.
You'll have to live with this, until a good fix is found.
BTW: your scanner for operators and parens is wrong.