[Top][All Lists]

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

Modification to glr.c to report parse errors properly

From: Paul Hilfinger
Subject: Modification to glr.c to report parse errors properly
Date: Thu, 14 Nov 2002 15:26:28 -0800

The test shows that a GLR parser running on a normal LALR
grammar and given an erroneous input that causes an unrecoverable
parse error can fail to report the error.  This was because the
yyerrflag indicator on the parsing stack was only being set on failure
only under certain conditions, whereas it should always be set.  I
have checked in the patch below.

P. Hilfinger


2002-11-14  Paul Hilfinger  <address@hidden>

        * data/glr.c (yyFail): Always set yyerrflag.  Corrects regression
        on test.

Index: data/glr.c
RCS file: /cvsroot/bison/bison/data/glr.c,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -p -r1.36 -r1.37
--- data/glr.c  13 Nov 2002 09:49:49 -0000      1.36
+++ data/glr.c  14 Nov 2002 23:18:55 -0000      1.37
@@ -594,12 +594,12 @@ static void yyfreeGLRStack (yyGLRStack* 
 static void
 yyFail (yyGLRStack* yystack]b4_pure_formals[, const char* yyformat, ...)
+  yystack->yyerrflag = 1;
   if (yyformat != NULL)
       char yymsg[256];
       va_list yyap;
       va_start (yyap, yyformat);
-      yystack->yyerrflag = 1;
       vsprintf (yymsg, yyformat, yyap);
       yyerror (]b4_yyerror_args[yymsg);

reply via email to

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