[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[FYI] skeleton-c++-fix-error-recovery.patch
From: |
Robert Anisko |
Subject: |
[FYI] skeleton-c++-fix-error-recovery.patch |
Date: |
Fri, 8 Feb 2002 15:15:17 +0100 (CET) |
Index: ChangeLog
===================================================================
RCS file: /cvsroot/bison/bison/ChangeLog,v
retrieving revision 1.542
diff -u -r1.542 ChangeLog
--- ChangeLog 7 Feb 2002 17:18:48 -0000 1.542
+++ ChangeLog 8 Feb 2002 14:03:46 -0000
@@ -1,3 +1,8 @@
+2002-02-08 Robert Anisko <address@hidden>
+
+ * data/bison.c++: Correct error recovery. Make the user able to
+ initialize the starting location.
+
2002-02-07 Akim Demaille <address@hidden>
* tests/input.at: New.
Index: data/bison.c++
===================================================================
RCS file: /cvsroot/bison/bison/data/bison.c++,v
retrieving revision 1.8
diff -u -r1.8 bison.c++
--- data/bison.c++ 7 Feb 2002 16:41:23 -0000 1.8
+++ data/bison.c++ 8 Feb 2002 14:03:46 -0000
@@ -30,7 +30,7 @@
#include "stack.hh"
#include "location.hh"
-b4_prologue
+#include <string>
/* Enabling traces. */
#ifndef YYDEBUG
@@ -45,6 +45,8 @@
/* Using locations. */
#define YYLSP_NEEDED b4_locations_flag
+b4_prologue
+
// FIXME: This should be defined in traits, not here.
typedef b4_stype yystype;
@@ -80,7 +82,13 @@
typedef Stack< SemanticType > SemanticStack;
typedef Stack< LocationType > LocationStack;
+#if YYLSP_NEEDED
+ b4_name (bool debug,
+ LocationType initlocation) : debug_ (debug),
+ initlocation_ (initlocation)
+#else
b4_name (bool debug) : debug_ (debug)
+#endif
{
}
@@ -155,6 +163,9 @@
/* @$ and $$. */
SemanticType value;
LocationType location;
+
+ /* Initial location. */
+ LocationType initlocation_;
};
}
@@ -197,6 +208,9 @@
/* Start. */
state_ = 0;
looka_ = empty_;
+#if YYLSP_NEEDED
+ location = initlocation_;
+#endif
YYDPRINTF ((stderr, "Starting parse\n"));
/* New state. */
@@ -272,6 +286,12 @@
semantic_stack_.push (value);
location_stack_.push (location);
+
+ /* Count tokens shifted since error; after three, turn off error
+ status. */
+ if (errstatus)
+ --errstatus;
+
state_ = n_;
goto yynewstate;
@@ -379,8 +399,8 @@
else
#endif
message = "parse error";
+ error_ ();
}
- error_ ();
goto yyerrlab1;
/* Error raised explicitly by an action. */
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [FYI] skeleton-c++-fix-error-recovery.patch,
Robert Anisko <=