bison-patches
[Top][All Lists]
Advanced

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

Re: yyerrok is missing in C++ parser


From: Joel E. Denny
Subject: Re: yyerrok is missing in C++ parser
Date: Tue, 12 Aug 2008 17:03:28 -0400 (EDT)

On Tue, 12 Aug 2008, Laurence Finston wrote:

> On Mon, 11 Aug 2008, kogorman wrote:
> 
> > Nope,  I grep for yyerrok on all files in the directory, and see only my own
> > code and
> > things directly generated from it.  I do not see a #define or other
> > definiton.

Thanks for the report.

There are a few macros missing in this area.  The following patch should 
fix this.  It's perhaps not the C++ way to do things because it uses 
#define, but I see no simple alternative given that yyerrstatus_ and 
yychar are local to the parse function.

I'm in a hurry and haven't yet tested the patch.  Would you please let me 
know if it works for you?  Just copy and paste the new code into either 
the lalr1.cc skeleton file or into your Bison-generated parser source 
code.  You can paste it right above the YYACCEPT definition.

diff --git a/data/lalr1.cc b/data/lalr1.cc
index 7ecc525..cbb5949 100644
--- a/data/lalr1.cc
+++ b/data/lalr1.cc
@@ -367,6 +367,10 @@ do {                                       \
 
 #endif /* !YYDEBUG */
 
+#define yyerrok         (yyerrstatus_ = 0)
+#define yyclearin       (yychar = yyempty_)
+#define YYRECOVERING()  (!!yyerrstatus_)
+
 #define YYACCEPT       goto yyacceptlab
 #define YYABORT                goto yyabortlab
 #define YYERROR                goto yyerrorlab




reply via email to

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