bug-bison
[Top][All Lists]
Advanced

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

Re: Erroneous YYBACKUP skeleton


From: David Kastrup
Subject: Re: Erroneous YYBACKUP skeleton
Date: Mon, 10 Oct 2011 16:07:25 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)

David Kastrup <address@hidden> writes:

> Hi,
>
> digging around on the web, I found an example of a failing YYBACKUP test
> case in <URL:http://old.nabble.com/-PATCH--Update-TODO.-p20418035.html>
> which has made it into the Bison TODO.  Further digging revealed
> <URL:http://www.mail-archive.com/address@hidden/msg03249.html>.
>
> Combining the information from both, the problem definitely appears to
> be that YYBACKUP currently (as of bison 2.4.1, the version coming with
> Ubuntu 11.10) does not correctly revert the state after popping the
> stack.
>
> I have tried browsing Savannah, but it does not allow me to call the
> equivalent of "git grep YYBACKUP" on the repository, and the
> organisation of the skeleton source is so clever that I can't locate the
> file containing the definition of YYBACK myself.  The TODO entry,
> however, still is there.
>
> So I can report just my findings: The following changed macro does
> appear to do the trick:
>
> #define YYBACKUP(Token, Value)                                        \
> do                                                            \
>   if (yychar == YYEMPTY)                              \
>     {                                                         \
>       yychar = (Token);                                               \
>       yylval = (Value);                                               \
>       yytoken = YYTRANSLATE (yychar);                         \
>       YYPOPSTACK (yylen);                                             \

Adding yylen=0; after this line appears to be prudent as well, looking
at the rest of the code.

>       yystate = *yyssp; \
>       goto yybackup;                                          \
>     }                                                         \
>   else                                                                \
>     {                                                         \
>       yyerror (YY_("syntax error: cannot back up")); \
>       YYERROR;                                                        \
>     }                                                         \
> while (YYID (0))
> }

Is there anybody out here?

-- 
David Kastrup




reply via email to

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