mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-20 17:53:02 +00:00
* data/bison.c++: Correct error recovery. Make the user able to
initialize the starting location.
This commit is contained in:
@@ -1,3 +1,8 @@
|
|||||||
|
2002-02-08 Robert Anisko <robert@lrde.epita.fr>
|
||||||
|
|
||||||
|
* data/bison.c++: Correct error recovery. Make the user able to
|
||||||
|
initialize the starting location.
|
||||||
|
|
||||||
2002-02-07 Akim Demaille <akim@epita.fr>
|
2002-02-07 Akim Demaille <akim@epita.fr>
|
||||||
|
|
||||||
* tests/input.at: New.
|
* tests/input.at: New.
|
||||||
|
|||||||
@@ -30,7 +30,7 @@
|
|||||||
#include "stack.hh"
|
#include "stack.hh"
|
||||||
#include "location.hh"
|
#include "location.hh"
|
||||||
|
|
||||||
b4_prologue
|
#include <string>
|
||||||
|
|
||||||
/* Enabling traces. */
|
/* Enabling traces. */
|
||||||
#ifndef YYDEBUG
|
#ifndef YYDEBUG
|
||||||
@@ -45,6 +45,8 @@ b4_prologue
|
|||||||
/* Using locations. */
|
/* Using locations. */
|
||||||
#define YYLSP_NEEDED b4_locations_flag
|
#define YYLSP_NEEDED b4_locations_flag
|
||||||
|
|
||||||
|
b4_prologue
|
||||||
|
|
||||||
// FIXME: This should be defined in traits, not here.
|
// FIXME: This should be defined in traits, not here.
|
||||||
typedef b4_stype yystype;
|
typedef b4_stype yystype;
|
||||||
|
|
||||||
@@ -80,7 +82,13 @@ namespace yy
|
|||||||
typedef Stack< SemanticType > SemanticStack;
|
typedef Stack< SemanticType > SemanticStack;
|
||||||
typedef Stack< LocationType > LocationStack;
|
typedef Stack< LocationType > LocationStack;
|
||||||
|
|
||||||
|
#if YYLSP_NEEDED
|
||||||
|
b4_name (bool debug,
|
||||||
|
LocationType initlocation) : debug_ (debug),
|
||||||
|
initlocation_ (initlocation)
|
||||||
|
#else
|
||||||
b4_name (bool debug) : debug_ (debug)
|
b4_name (bool debug) : debug_ (debug)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -155,6 +163,9 @@ namespace yy
|
|||||||
/* @$ and $$. */
|
/* @$ and $$. */
|
||||||
SemanticType value;
|
SemanticType value;
|
||||||
LocationType location;
|
LocationType location;
|
||||||
|
|
||||||
|
/* Initial location. */
|
||||||
|
LocationType initlocation_;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -197,6 +208,9 @@ yy::b4_name::parse ()
|
|||||||
/* Start. */
|
/* Start. */
|
||||||
state_ = 0;
|
state_ = 0;
|
||||||
looka_ = empty_;
|
looka_ = empty_;
|
||||||
|
#if YYLSP_NEEDED
|
||||||
|
location = initlocation_;
|
||||||
|
#endif
|
||||||
YYDPRINTF ((stderr, "Starting parse\n"));
|
YYDPRINTF ((stderr, "Starting parse\n"));
|
||||||
|
|
||||||
/* New state. */
|
/* New state. */
|
||||||
@@ -272,6 +286,12 @@ yy::b4_name::parse ()
|
|||||||
|
|
||||||
semantic_stack_.push (value);
|
semantic_stack_.push (value);
|
||||||
location_stack_.push (location);
|
location_stack_.push (location);
|
||||||
|
|
||||||
|
/* Count tokens shifted since error; after three, turn off error
|
||||||
|
status. */
|
||||||
|
if (errstatus)
|
||||||
|
--errstatus;
|
||||||
|
|
||||||
state_ = n_;
|
state_ = n_;
|
||||||
goto yynewstate;
|
goto yynewstate;
|
||||||
|
|
||||||
@@ -379,8 +399,8 @@ yy::b4_name::parse ()
|
|||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
message = "parse error";
|
message = "parse error";
|
||||||
|
error_ ();
|
||||||
}
|
}
|
||||||
error_ ();
|
|
||||||
goto yyerrlab1;
|
goto yyerrlab1;
|
||||||
|
|
||||||
/* Error raised explicitly by an action. */
|
/* Error raised explicitly by an action. */
|
||||||
|
|||||||
Reference in New Issue
Block a user