glr: comment changes

* data/skeletons/glr.c: A bit more doc.
(yypstates): Rename yyst (only occurrence) to yys (commonly used for
yyGLRState).
* data/skeletons/glr2.cc: Ditto.
Prefer '\n' to "\n".
This commit is contained in:
Akim Demaille
2020-12-25 08:52:28 +01:00
parent 32bb53870b
commit 7dc942dca3
2 changed files with 15 additions and 10 deletions

View File

@@ -2651,6 +2651,7 @@ b4_dollar_popdef])[]dnl
/* DEBUGGING ONLY */
#if ]b4_api_PREFIX[DEBUG
/* Print *YYS and its predecessors. */
static void
yy_yypstack (yyGLRState* yys)
{
@@ -2662,22 +2663,25 @@ yy_yypstack (yyGLRState* yys)
YY_FPRINTF ((stderr, "%d@@%ld", yys->yylrState, YY_CAST (long, yys->yyposn)));
}
/* Print YYS (possibly NULL) and its predecessors. */
static void
yypstates (yyGLRState* yyst)
yypstates (yyGLRState* yys)
{
if (yyst == YY_NULLPTR)
if (yys == YY_NULLPTR)
YY_FPRINTF ((stderr, "<null>"));
else
yy_yypstack (yyst);
yy_yypstack (yys);
YY_FPRINTF ((stderr, "\n"));
}
/* Print the stack #YYK. */
static void
yypstack (yyGLRStack* yystackp, YYPTRDIFF_T yyk)
{
yypstates (yystackp->yytops.yystates[yyk]);
}
/* Print all the stacks. */
static void
yypdumpstack (yyGLRStack* yystackp)
{

View File

@@ -1820,7 +1820,7 @@ public:
yyreportTree (*yyx0, 2);
std::cerr << "\nOption 2,\n";
yyreportTree (*yyx1, 2);
std::cerr << "\n";
std::cerr << '\n';
#endif
yyparser.error (]b4_locations_if([*yylocp, ])[YY_("syntax is ambiguous"));
@@ -1829,14 +1829,15 @@ public:
/* DEBUGGING ONLY */
#if ]b4_api_PREFIX[DEBUG
/* Print YYS (possibly NULL) and its predecessors. */
void
yypstates (const glr_state* yyst)
yypstates (const glr_state* yys)
{
if (yyst != YY_NULLPTR)
yyst->yy_yypstack();
if (yys != YY_NULLPTR)
yys->yy_yypstack();
else
std::cerr << "<null>";
std::cerr << "\n";
std::cerr << '\n';
}
#endif
@@ -2778,7 +2779,7 @@ yygetToken (int& yycharp, ]b4_namespace_ref[::]b4_parser_class[& yyparser, glr_s
}
catch (const ]b4_namespace_ref[::]b4_parser_class[::syntax_error& yyexc)
{
YY_DEBUG_STREAM << "Caught exception: " << yyexc.what() << "\n";]b4_locations_if([
YY_DEBUG_STREAM << "Caught exception: " << yyexc.what() << '\n';]b4_locations_if([
yylloc = yyexc.location;])[
yyparser.error (]b4_locations_if([yylloc, ])[yyexc.what ());
// Map errors caught in the scanner to the error token, so that error
@@ -2993,7 +2994,7 @@ b4_dollar_popdef])[]dnl
while (true)
{
const state_num yystate = yystack.firstTopState()->yylrState;
YY_DEBUG_STREAM << "Entering state " << yystate << "\n";
YY_DEBUG_STREAM << "Entering state " << yystate << '\n';
if (yystate == YYFINAL)
goto yyacceptlab;
if (yyisDefaultedState (yystate))