Merge remote-tracking branch 'origin/maint'

* origin/maint: (43 commits)
  maint: post-release administrivia
  version 3.0.2
  gnulib: update
  output: do not generate source files when late errors are caught
  output: record what generated files are source or report files
  output: do not generate source files when early errors are caught
  xml: also use "%empty" with html output
  style: formatting changes
  xml: also display %empty for empty right-hand sides
  reports: display %empty in the generated pointed-rules
  news: YYERROR vs variants
  style: scope reduction in lalr.cc
  lalr1.cc: formatting changes
  lalr1.cc: fix the support of YYERROR with variants
  tests: check $$'s destruction with variant, YYERROR, and no error recovery
  tests: simplify useless obfuscation
  skeletons: use better names when computing a "goto"
  maint: post-release administrivia
  version 3.0.1
  aver: it is no longer "protected against NDEBUG"
  ...

Conflicts:
  data/glr.c
This commit is contained in:
Akim Demaille
2013-12-09 10:43:37 +01:00
61 changed files with 839 additions and 554 deletions

View File

@@ -205,13 +205,32 @@ m4_define([b4_table_value_equals],
# b4_attribute_define
# -------------------
# Provide portability for __attribute__.
# Provide portable compiler "attributes".
m4_define([b4_attribute_define],
[#ifndef __attribute__
/* This feature is available in gcc versions 2.5 and later. */
# if (! defined __GNUC__ || __GNUC__ < 2 \
|| (__GNUC__ == 2 && __GNUC_MINOR__ < 5))
# define __attribute__(Spec) /* empty */
[#ifndef YY_ATTRIBUTE
# if (defined __GNUC__ \
&& (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \
|| defined __SUNPRO_C && 0x5110 <= __SUNPRO_C
# define YY_ATTRIBUTE(Spec) __attribute__(Spec)
# else
# define YY_ATTRIBUTE(Spec) /* empty */
# endif
#endif
#ifndef YY_ATTRIBUTE_PURE
# define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__))
#endif
#ifndef YY_ATTRIBUTE_UNUSED
# define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__))
#endif
#if !defined _Noreturn \
&& (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112)
# if defined _MSC_VER && 1200 <= _MSC_VER
# define _Noreturn __declspec (noreturn)
# else
# define _Noreturn YY_ATTRIBUTE ((__noreturn__))
# endif
#endif
@@ -250,14 +269,14 @@ m4_define([b4_attribute_define],
# b4_null_define
# --------------
# Portability issues: define a YY_NULL appropriate for the current
# Portability issues: define a YY_NULLPTR appropriate for the current
# language (C, C++98, or C++11).
m4_define([b4_null_define],
[# ifndef YY_NULL
[# ifndef YY_NULLPTR
# if defined __cplusplus && 201103L <= __cplusplus
# define YY_NULL nullptr
# define YY_NULLPTR nullptr
# else
# define YY_NULL 0
# define YY_NULLPTR 0
# endif
# endif[]dnl
])
@@ -266,7 +285,7 @@ m4_define([b4_null_define],
# b4_null
# -------
# Return a null pointer constant.
m4_define([b4_null], [YY_NULL])
m4_define([b4_null], [YY_NULLPTR])
# b4_integral_parser_table_define(TABLE-NAME, CONTENT, COMMENT)
# -------------------------------------------------------------
@@ -783,7 +802,7 @@ m4_define([b4_yy_location_print_define],
/* Print *YYLOCP on YYO. Private, do not rely on its existence. */
__attribute__((__unused__))
YY_ATTRIBUTE_UNUSED
]b4_function_define([yy_location_print_],
[static unsigned],
[[FILE *yyo], [yyo]],

View File

@@ -445,9 +445,9 @@ int yydebug;
struct yyGLRStack;
static void yypstack (struct yyGLRStack* yystackp, size_t yyk)
__attribute__ ((__unused__));
YY_ATTRIBUTE_UNUSED;
static void yypdumpstack (struct yyGLRStack* yystackp)
__attribute__ ((__unused__));
YY_ATTRIBUTE_UNUSED;
#else /* !]b4_api_PREFIX[DEBUG */
@@ -669,19 +669,15 @@ struct yyGLRStack {
static void yyexpandGLRStack (yyGLRStack* yystackp);
#endif
static void yyFail (yyGLRStack* yystackp]b4_pure_formals[, const char* yymsg)
__attribute__ ((__noreturn__));
static void
static _Noreturn void
yyFail (yyGLRStack* yystackp]b4_pure_formals[, const char* yymsg)
{
if (yymsg != YY_NULL)
if (yymsg != YY_NULLPTR)
yyerror (]b4_yyerror_args[yymsg);
YYLONGJMP (yystackp->yyexception_buffer, 1);
}
static void yyMemoryExhausted (yyGLRStack* yystackp)
__attribute__ ((__noreturn__));
static void
static _Noreturn void
yyMemoryExhausted (yyGLRStack* yystackp)
{
YYLONGJMP (yystackp->yyexception_buffer, 2);
@@ -702,7 +698,7 @@ yytokenName (yySymbol yytoken)
/** Fill in YYVSP[YYLOW1 .. YYLOW0-1] from the chain of states starting
* at YYVSP[YYLOW0].yystate.yypred. Leaves YYVSP[YYLOW1].yystate.yypred
* containing the pointer to the next state in the chain. */
static void yyfillin (yyGLRStackItem *, int, int) __attribute__ ((__unused__));
static void yyfillin (yyGLRStackItem *, int, int) YY_ATTRIBUTE_UNUSED;
static void
yyfillin (yyGLRStackItem *yyvsp, int yylow0, int yylow1)
{
@@ -719,7 +715,7 @@ yyfillin (yyGLRStackItem *yyvsp, int yylow0, int yylow1)
else
/* The effect of using yysval or yyloc (in an immediate rule) is
* undefined. */
yyvsp[i].yystate.yysemantics.yyfirstVal = YY_NULL;]b4_locations_if([[
yyvsp[i].yystate.yysemantics.yyfirstVal = YY_NULLPTR;]b4_locations_if([[
yyvsp[i].yystate.yyloc = s->yyloc;]])[
s = yyvsp[i].yystate.yypred = s->yypred;
}
@@ -729,7 +725,7 @@ yyfillin (yyGLRStackItem *yyvsp, int yylow0, int yylow1)
* YYVSP[YYLOW1 .. *YYLOW-1] as in yyfillin and set *YYLOW = YYLOW1.
* For convenience, always return YYLOW1. */
static inline int yyfill (yyGLRStackItem *, int *, int, yybool)
__attribute__ ((__unused__));
YY_ATTRIBUTE_UNUSED;
static inline int
yyfill (yyGLRStackItem *yyvsp, int *yylow, int yylow1, yybool yynormal)
{
@@ -751,8 +747,7 @@ yyuserAction (yyRuleNum yyn, size_t yyrhslen, yyGLRStackItem* yyvsp,
yyGLRStack* yystackp,
YYSTYPE* yyvalp]b4_locuser_formals[)
{
yybool yynormal __attribute__ ((__unused__)) =
(yystackp->yysplitPoint == YY_NULL);
yybool yynormal YY_ATTRIBUTE_UNUSED = (yystackp->yysplitPoint == YY_NULLPTR);
int yylow;
]b4_parse_param_use([yyvalp], [yylocp])dnl
[ YYUSE (yyrhslen);
@@ -839,7 +834,7 @@ yydestroyGLRState (char const *yymsg, yyGLRState *yys]b4_user_formals[)
YYFPRINTF (stderr, "%s unresolved", yymsg);
else
YYFPRINTF (stderr, "%s incomplete", yymsg);
YY_SYMBOL_PRINT ("", yystos[yys->yylrState], YY_NULL, &yys->yyloc);
YY_SYMBOL_PRINT ("", yystos[yys->yylrState], YY_NULLPTR, &yys->yyloc);
}
#endif
@@ -915,14 +910,18 @@ yygetLRActions (yyStateNum yystate, int yytoken,
}
}
/** Compute post-reduction state.
* \param yystate the current state
* \param yysym the nonterminal to push on the stack
*/
static inline yyStateNum
yyLRgotoState (yyStateNum yystate, yySymbol yylhs)
yyLRgotoState (yyStateNum yystate, yySymbol yysym)
{
int yyr = yypgoto[yylhs - YYNTOKENS] + yystate;
int yyr = yypgoto[yysym - YYNTOKENS] + yystate;
if (0 <= yyr && yyr <= YYLAST && yycheck[yyr] == yystate)
return yytable[yyr];
else
return yydefgoto[yylhs - YYNTOKENS];
return yydefgoto[yysym - YYNTOKENS];
}
static inline yybool
@@ -992,7 +991,7 @@ yyinitStateSet (yyGLRStateSet* yyset)
yyset->yystates = (yyGLRState**) YYMALLOC (16 * sizeof yyset->yystates[0]);
if (! yyset->yystates)
return yyfalse;
yyset->yystates[0] = YY_NULL;
yyset->yystates[0] = YY_NULLPTR;
yyset->yylookaheadNeeds =
(yybool*) YYMALLOC (16 * sizeof yyset->yylookaheadNeeds[0]);
if (! yyset->yylookaheadNeeds)
@@ -1022,8 +1021,8 @@ yyinitGLRStack (yyGLRStack* yystackp, size_t yysize)
if (!yystackp->yyitems)
return yyfalse;
yystackp->yynextFree = yystackp->yyitems;
yystackp->yysplitPoint = YY_NULL;
yystackp->yylastDeleted = YY_NULL;
yystackp->yysplitPoint = YY_NULLPTR;
yystackp->yylastDeleted = YY_NULLPTR;
return yyinitStateSet (&yystackp->yytops);
}
@@ -1062,10 +1061,10 @@ yyexpandGLRStack (yyGLRStack* yystackp)
{
yyGLRState* yys0 = &yyp0->yystate;
yyGLRState* yys1 = &yyp1->yystate;
if (yys0->yypred != YY_NULL)
if (yys0->yypred != YY_NULLPTR)
yys1->yypred =
YYRELOC (yyp0, yyp1, yys0->yypred, yystate);
if (! yys0->yyresolved && yys0->yysemantics.yyfirstVal != YY_NULL)
if (! yys0->yyresolved && yys0->yysemantics.yyfirstVal != YY_NULLPTR)
yys1->yysemantics.yyfirstVal =
YYRELOC (yyp0, yyp1, yys0->yysemantics.yyfirstVal, yyoption);
}
@@ -1073,18 +1072,18 @@ yyexpandGLRStack (yyGLRStack* yystackp)
{
yySemanticOption* yyv0 = &yyp0->yyoption;
yySemanticOption* yyv1 = &yyp1->yyoption;
if (yyv0->yystate != YY_NULL)
if (yyv0->yystate != YY_NULLPTR)
yyv1->yystate = YYRELOC (yyp0, yyp1, yyv0->yystate, yystate);
if (yyv0->yynext != YY_NULL)
if (yyv0->yynext != YY_NULLPTR)
yyv1->yynext = YYRELOC (yyp0, yyp1, yyv0->yynext, yyoption);
}
}
if (yystackp->yysplitPoint != YY_NULL)
if (yystackp->yysplitPoint != YY_NULLPTR)
yystackp->yysplitPoint = YYRELOC (yystackp->yyitems, yynewItems,
yystackp->yysplitPoint, yystate);
for (yyn = 0; yyn < yystackp->yytops.yysize; yyn += 1)
if (yystackp->yytops.yystates[yyn] != YY_NULL)
if (yystackp->yytops.yystates[yyn] != YY_NULLPTR)
yystackp->yytops.yystates[yyn] =
YYRELOC (yystackp->yyitems, yynewItems,
yystackp->yytops.yystates[yyn], yystate);
@@ -1108,7 +1107,7 @@ yyfreeGLRStack (yyGLRStack* yystackp)
static inline void
yyupdateSplit (yyGLRStack* yystackp, yyGLRState* yys)
{
if (yystackp->yysplitPoint != YY_NULL && yystackp->yysplitPoint > yys)
if (yystackp->yysplitPoint != YY_NULLPTR && yystackp->yysplitPoint > yys)
yystackp->yysplitPoint = yys;
}
@@ -1116,9 +1115,9 @@ yyupdateSplit (yyGLRStack* yystackp, yyGLRState* yys)
static inline void
yymarkStackDeleted (yyGLRStack* yystackp, size_t yyk)
{
if (yystackp->yytops.yystates[yyk] != YY_NULL)
if (yystackp->yytops.yystates[yyk] != YY_NULLPTR)
yystackp->yylastDeleted = yystackp->yytops.yystates[yyk];
yystackp->yytops.yystates[yyk] = YY_NULL;
yystackp->yytops.yystates[yyk] = YY_NULLPTR;
}
/** Undelete the last stack in *YYSTACKP that was marked as deleted. Can
@@ -1127,12 +1126,12 @@ yymarkStackDeleted (yyGLRStack* yystackp, size_t yyk)
static void
yyundeleteLastStack (yyGLRStack* yystackp)
{
if (yystackp->yylastDeleted == YY_NULL || yystackp->yytops.yysize != 0)
if (yystackp->yylastDeleted == YY_NULLPTR || yystackp->yytops.yysize != 0)
return;
yystackp->yytops.yystates[0] = yystackp->yylastDeleted;
yystackp->yytops.yysize = 1;
YYDPRINTF ((stderr, "Restoring last deleted stack as stack #0.\n"));
yystackp->yylastDeleted = YY_NULL;
yystackp->yylastDeleted = YY_NULLPTR;
}
static inline void
@@ -1142,7 +1141,7 @@ yyremoveDeletes (yyGLRStack* yystackp)
yyi = yyj = 0;
while (yyj < yystackp->yytops.yysize)
{
if (yystackp->yytops.yystates[yyi] == YY_NULL)
if (yystackp->yytops.yystates[yyi] == YY_NULLPTR)
{
if (yyi == yyj)
{
@@ -1206,7 +1205,7 @@ yyglrShiftDefer (yyGLRStack* yystackp, size_t yyk, yyStateNum yylrState,
yynewState->yyposn = yyposn;
yynewState->yyresolved = yyfalse;
yynewState->yypred = yystackp->yytops.yystates[yyk];
yynewState->yysemantics.yyfirstVal = YY_NULL;
yynewState->yysemantics.yyfirstVal = YY_NULLPTR;
yystackp->yytops.yystates[yyk] = yynewState;
/* Invokes YY_RESERVE_GLRSTACK. */
@@ -1266,7 +1265,7 @@ yydoAction (yyGLRStack* yystackp, size_t yyk, yyRuleNum yyrule,
{
int yynrhs = yyrhsLength (yyrule);
if (yystackp->yysplitPoint == YY_NULL)
if (yystackp->yysplitPoint == YY_NULLPTR)
{
/* Standard special case: single stack. */
yyGLRStackItem* yyrhs = (yyGLRStackItem*) yystackp->yytops.yystates[yyk];
@@ -1318,13 +1317,13 @@ yyglrReduce (yyGLRStack* yystackp, size_t yyk, yyRuleNum yyrule,
{
size_t yyposn = yystackp->yytops.yystates[yyk]->yyposn;
if (yyforceEval || yystackp->yysplitPoint == YY_NULL)
if (yyforceEval || yystackp->yysplitPoint == YY_NULLPTR)
{
YYSTYPE yysval;]b4_locations_if([[
YYLTYPE yyloc;]])[
YYRESULTTAG yyflag = yydoAction (yystackp, yyk, yyrule, &yysval]b4_locuser_args([&yyloc])[);
if (yyflag == yyerr && yystackp->yysplitPoint != YY_NULL)
if (yyflag == yyerr && yystackp->yysplitPoint != YY_NULLPTR)
{
YYDPRINTF ((stderr, "Parse on stack %lu rejected by rule #%d.\n",
(unsigned long int) yyk, yyrule - 1));
@@ -1357,7 +1356,7 @@ yyglrReduce (yyGLRStack* yystackp, size_t yyk, yyRuleNum yyrule,
"Now in state %d.\n",
(unsigned long int) yyk, yyrule - 1, yynewLRState));
for (yyi = 0; yyi < yystackp->yytops.yysize; yyi += 1)
if (yyi != yyk && yystackp->yytops.yystates[yyi] != YY_NULL)
if (yyi != yyk && yystackp->yytops.yystates[yyi] != YY_NULLPTR)
{
yyGLRState *yysplit = yystackp->yysplitPoint;
yyGLRState *yyp = yystackp->yytops.yystates[yyi];
@@ -1384,7 +1383,7 @@ yyglrReduce (yyGLRStack* yystackp, size_t yyk, yyRuleNum yyrule,
static size_t
yysplitStack (yyGLRStack* yystackp, size_t yyk)
{
if (yystackp->yysplitPoint == YY_NULL)
if (yystackp->yysplitPoint == YY_NULLPTR)
{
YYASSERT (yyk == 0);
yystackp->yysplitPoint = yystackp->yytops.yystates[yyk];
@@ -1394,7 +1393,7 @@ yysplitStack (yyGLRStack* yystackp, size_t yyk)
yyGLRState** yynewStates;
yybool* yynewLookaheadNeeds;
yynewStates = YY_NULL;
yynewStates = YY_NULLPTR;
if (yystackp->yytops.yycapacity
> (YYSIZEMAX / (2 * sizeof yynewStates[0])))
@@ -1405,7 +1404,7 @@ yysplitStack (yyGLRStack* yystackp, size_t yyk)
(yyGLRState**) YYREALLOC (yystackp->yytops.yystates,
(yystackp->yytops.yycapacity
* sizeof yynewStates[0]));
if (yynewStates == YY_NULL)
if (yynewStates == YY_NULLPTR)
yyMemoryExhausted (yystackp);
yystackp->yytops.yystates = yynewStates;
@@ -1413,7 +1412,7 @@ yysplitStack (yyGLRStack* yystackp, size_t yyk)
(yybool*) YYREALLOC (yystackp->yytops.yylookaheadNeeds,
(yystackp->yytops.yycapacity
* sizeof yynewLookaheadNeeds[0]));
if (yynewLookaheadNeeds == YY_NULL)
if (yynewLookaheadNeeds == YY_NULLPTR)
yyMemoryExhausted (yystackp);
yystackp->yytops.yylookaheadNeeds = yynewLookaheadNeeds;
}
@@ -1477,9 +1476,9 @@ yymergeOptionSets (yySemanticOption* yyy0, yySemanticOption* yyy1)
yySemanticOption* yyz1 = yys1->yysemantics.yyfirstVal;
while (yytrue)
{
if (yyz1 == *yyz0p || yyz1 == YY_NULL)
if (yyz1 == *yyz0p || yyz1 == YY_NULLPTR)
break;
else if (*yyz0p == YY_NULL)
else if (*yyz0p == YY_NULLPTR)
{
*yyz0p = yyz1;
break;
@@ -1600,7 +1599,7 @@ yyreportTree (yySemanticOption* yyx, int yyindent)
for (yyi = yynrhs, yys = yyx->yystate; 0 < yyi; yyi -= 1, yys = yys->yypred)
yystates[yyi] = yys;
if (yys == YY_NULL)
if (yys == YY_NULLPTR)
{
yyleftmost_state.yyposn = 0;
yystates[0] = &yyleftmost_state;
@@ -1719,7 +1718,7 @@ yyresolveValue (yyGLRState* yys, yyGLRStack* yystackp]b4_user_formals[)
YYRESULTTAG yyflag;]b4_locations_if([
YYLTYPE *yylocp = &yys->yyloc;])[
for (yypp = &yyoptionList->yynext; *yypp != YY_NULL; )
for (yypp = &yyoptionList->yynext; *yypp != YY_NULLPTR; )
{
yySemanticOption* yyp = *yypp;
@@ -1761,7 +1760,7 @@ yyresolveValue (yyGLRState* yys, yyGLRStack* yystackp]b4_user_formals[)
int yyprec = yydprec[yybest->yyrule];
yyflag = yyresolveAction (yybest, yystackp, &yysval]b4_locuser_args[);
if (yyflag == yyok)
for (yyp = yybest->yynext; yyp != YY_NULL; yyp = yyp->yynext)
for (yyp = yybest->yynext; yyp != YY_NULLPTR; yyp = yyp->yynext)
{
if (yyprec == yydprec[yyp->yyrule])
{
@@ -1788,14 +1787,14 @@ yyresolveValue (yyGLRState* yys, yyGLRStack* yystackp]b4_user_formals[)
yys->yysemantics.yysval = yysval;
}
else
yys->yysemantics.yyfirstVal = YY_NULL;
yys->yysemantics.yyfirstVal = YY_NULLPTR;
return yyflag;
}
static YYRESULTTAG
yyresolveStack (yyGLRStack* yystackp]b4_user_formals[)
{
if (yystackp->yysplitPoint != YY_NULL)
if (yystackp->yysplitPoint != YY_NULLPTR)
{
yyGLRState* yys;
int yyn;
@@ -1815,10 +1814,10 @@ yycompressStack (yyGLRStack* yystackp)
{
yyGLRState* yyp, *yyq, *yyr;
if (yystackp->yytops.yysize != 1 || yystackp->yysplitPoint == YY_NULL)
if (yystackp->yytops.yysize != 1 || yystackp->yysplitPoint == YY_NULLPTR)
return;
for (yyp = yystackp->yytops.yystates[0], yyq = yyp->yypred, yyr = YY_NULL;
for (yyp = yystackp->yytops.yystates[0], yyq = yyp->yypred, yyr = YY_NULLPTR;
yyp != yystackp->yysplitPoint;
yyr = yyp, yyp = yyq, yyq = yyp->yypred)
yyp->yypred = yyr;
@@ -1826,10 +1825,10 @@ yycompressStack (yyGLRStack* yystackp)
yystackp->yyspaceLeft += yystackp->yynextFree - yystackp->yyitems;
yystackp->yynextFree = ((yyGLRStackItem*) yystackp->yysplitPoint) + 1;
yystackp->yyspaceLeft -= yystackp->yynextFree - yystackp->yyitems;
yystackp->yysplitPoint = YY_NULL;
yystackp->yylastDeleted = YY_NULL;
yystackp->yysplitPoint = YY_NULLPTR;
yystackp->yylastDeleted = YY_NULLPTR;
while (yyr != YY_NULL)
while (yyr != YY_NULLPTR)
{
yystackp->yynextFree->yystate = *yyr;
yyr = yyr->yypred;
@@ -1844,7 +1843,7 @@ static YYRESULTTAG
yyprocessOneStack (yyGLRStack* yystackp, size_t yyk,
size_t yyposn]b4_pure_formals[)
{
while (yystackp->yytops.yystates[yyk] != YY_NULL)
while (yystackp->yytops.yystates[yyk] != YY_NULLPTR)
{
yyStateNum yystate = yystackp->yytops.yystates[yyk]->yylrState;
YYDPRINTF ((stderr, "Stack %lu Entering state %d\n",
@@ -1966,13 +1965,13 @@ yyreportSyntaxError (yyGLRStack* yystackp]b4_user_formals[)
#else
{
yySymbol yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);
size_t yysize0 = yytnamerr (YY_NULL, yytokenName (yytoken));
size_t yysize0 = yytnamerr (YY_NULLPTR, yytokenName (yytoken));
size_t yysize = yysize0;
yybool yysize_overflow = yyfalse;
char* yymsg = YY_NULL;
char* yymsg = YY_NULLPTR;
enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
/* Internationalized format string. */
const char *yyformat = YY_NULL;
const char *yyformat = YY_NULLPTR;
/* Arguments of yyformat. */
char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
/* Number of reported tokens (one for the "unexpected", one per
@@ -2028,7 +2027,7 @@ yyreportSyntaxError (yyGLRStack* yystackp]b4_user_formals[)
}
yyarg[yycount++] = yytokenName (yyx);
{
size_t yysz = yysize + yytnamerr (YY_NULL, yytokenName (yyx));
size_t yysz = yysize + yytnamerr (YY_NULLPTR, yytokenName (yyx));
yysize_overflow |= yysz < yysize;
yysize = yysz;
}
@@ -2106,7 +2105,7 @@ yyrecoverSyntaxError (yyGLRStack* yystackp]b4_user_formals[)
{
yySymbol yytoken;
if (yychar == YYEOF)
yyFail (yystackp][]b4_lpure_args[, YY_NULL);
yyFail (yystackp][]b4_lpure_args[, YY_NULLPTR);
if (yychar != YYEMPTY)
{]b4_locations_if([[
/* We throw away the lookahead, but the error range
@@ -2147,10 +2146,10 @@ yyrecoverSyntaxError (yyGLRStack* yystackp]b4_user_formals[)
/* Reduce to one stack. */
for (yyk = 0; yyk < yystackp->yytops.yysize; yyk += 1)
if (yystackp->yytops.yystates[yyk] != YY_NULL)
if (yystackp->yytops.yystates[yyk] != YY_NULLPTR)
break;
if (yyk >= yystackp->yytops.yysize)
yyFail (yystackp][]b4_lpure_args[, YY_NULL);
yyFail (yystackp][]b4_lpure_args[, YY_NULLPTR);
for (yyk += 1; yyk < yystackp->yytops.yysize; yyk += 1)
yymarkStackDeleted (yystackp, yyk);
yyremoveDeletes (yystackp);
@@ -2158,7 +2157,7 @@ yyrecoverSyntaxError (yyGLRStack* yystackp]b4_user_formals[)
/* Now pop stack until we find a state that shifts the error token. */
yystackp->yyerrState = 3;
while (yystackp->yytops.yystates[0] != YY_NULL)
while (yystackp->yytops.yystates[0] != YY_NULLPTR)
{
yyGLRState *yys = yystackp->yytops.yystates[0];
yyj = yypact[yys->yylrState];
@@ -2182,14 +2181,14 @@ yyrecoverSyntaxError (yyGLRStack* yystackp]b4_user_formals[)
}
}]b4_locations_if([[
yystackp->yyerror_range[1].yystate.yyloc = yys->yyloc;]])[
if (yys->yypred != YY_NULL)
if (yys->yypred != YY_NULLPTR)
yydestroyGLRState ("Error: popping", yys]b4_user_args[);
yystackp->yytops.yystates[0] = yys->yypred;
yystackp->yynextFree -= 1;
yystackp->yyspaceLeft += 1;
}
if (yystackp->yytops.yystates[0] == YY_NULL)
yyFail (yystackp][]b4_lpure_args[, YY_NULL);
if (yystackp->yytops.yystates[0] == YY_NULLPTR)
yyFail (yystackp][]b4_lpure_args[, YY_NULLPTR);
}
#define YYCHK1(YYE) \
@@ -2432,7 +2431,7 @@ b4_dollar_popdef])[]dnl
{
yyGLRState *yys = yystates[yyk];
]b4_locations_if([[ yystack.yyerror_range[1].yystate.yyloc = yys->yyloc;]]
)[ if (yys->yypred != YY_NULL)
)[ if (yys->yypred != YY_NULLPTR)
yydestroyGLRState ("Cleanup: popping", yys]b4_user_args[);
yystates[yyk] = yys->yypred;
yystack.yynextFree -= 1;
@@ -2464,7 +2463,7 @@ yy_yypstack (yyGLRState* yys)
static void
yypstates (yyGLRState* yyst)
{
if (yyst == YY_NULL)
if (yyst == YY_NULLPTR)
YYFPRINTF (stderr, "<null>");
else
yy_yypstack (yyst);
@@ -2478,7 +2477,7 @@ yypstack (yyGLRStack* yystackp, size_t yyk)
}
#define YYINDEX(YYX) \
((YYX) == YY_NULL ? -1 : (yyGLRStackItem*) (YYX) - yystackp->yyitems)
((YYX) == YY_NULLPTR ? -1 : (yyGLRStackItem*) (YYX) - yystackp->yyitems)
static void

View File

@@ -157,6 +157,7 @@ m4_define([b4_shared_declarations],
]b4_bison_locations_if([[# include "location.hh"]])])[
]b4_variant_if([b4_variant_includes])[
]b4_attribute_define[
]b4_YYDEBUG_define[
]b4_namespace_open[
@@ -183,14 +184,14 @@ b4_location_define])])[
#if ]b4_api_PREFIX[DEBUG
/// The current debugging stream.
std::ostream& debug_stream () const;
std::ostream& debug_stream () const YY_ATTRIBUTE_PURE;
/// Set the current debugging stream.
void set_debug_stream (std::ostream &);
/// Type for debugging levels.
typedef int debug_level_type;
/// The current debugging level.
debug_level_type debug_level () const;
debug_level_type debug_level () const YY_ATTRIBUTE_PURE;
/// Set the current debugging level.
void set_debug_level (debug_level_type l);
#endif
@@ -219,8 +220,8 @@ b4_location_define])])[
/// Compute post-reduction state.
/// \param yystate the current state
/// \param yylhs the nonterminal to push on the stack
state_type yy_lr_goto_state_ (state_type yystate, int yylhs);
/// \param yysym the nonterminal to push on the stack
state_type yy_lr_goto_state_ (state_type yystate, int yysym);
/// Whether the given \c yypact_ value indicates a defaulted state.
/// \param yyvalue the value to check
@@ -267,7 +268,7 @@ b4_location_define])])[
/// \brief Reclaim the memory associated to a symbol.
/// \param yymsg Why this token is reclaimed.
/// If null, print nothing.
/// \param s The symbol.
/// \param yysym The symbol.
template <typename Base>
void yy_destroy_ (const char* yymsg, basic_symbol<Base>& yysym) const;
@@ -341,13 +342,13 @@ b4_location_define])])[
enum
{
yyeof_ = 0,
yylast_ = ]b4_last[, //< Last index in yytable_.
yynnts_ = ]b4_nterms_number[, //< Number of nonterminal symbols.
yylast_ = ]b4_last[, ///< Last index in yytable_.
yynnts_ = ]b4_nterms_number[, ///< Number of nonterminal symbols.
yyempty_ = -2,
yyfinal_ = ]b4_final_state_number[, //< Termination state number.
yyfinal_ = ]b4_final_state_number[, ///< Termination state number.
yyterror_ = 1,
yyerrcode_ = 256,
yyntokens_ = ]b4_tokens_number[ //< Number of tokens.
yyntokens_ = ]b4_tokens_number[ ///< Number of tokens.
};
]b4_parse_param_vars[
@@ -670,13 +671,13 @@ m4_if(b4_prefix, [yy], [],
#endif // ]b4_api_PREFIX[DEBUG
inline ]b4_parser_class_name[::state_type
]b4_parser_class_name[::yy_lr_goto_state_ (state_type yystate, int yylhs)
]b4_parser_class_name[::yy_lr_goto_state_ (state_type yystate, int yysym)
{
int yyr = yypgoto_[yylhs - yyntokens_] + yystate;
int yyr = yypgoto_[yysym - yyntokens_] + yystate;
if (0 <= yyr && yyr <= yylast_ && yycheck_[yyr] == yystate)
return yytable_[yyr];
else
return yydefgoto_[yylhs - yyntokens_];
return yydefgoto_[yysym - yyntokens_];
}
inline bool
@@ -699,6 +700,7 @@ m4_if(b4_prefix, [yy], [],
// State.
int yyn;
/// Length of the RHS of the rule being reduced.
int yylen = 0;
// Error handling.
@@ -711,9 +713,6 @@ m4_if(b4_prefix, [yy], [],
/// The locations where the error started and ended.
stack_symbol_type yyerror_range[3];]])[
/// $$ and @@$.
stack_symbol_type yylhs;
/// The return value of parse ().
int yyresult;
@@ -734,7 +733,7 @@ b4_dollar_popdef])[]dnl
location values to have been already stored, initialize these
stacks with a primary value. */
yystack_.clear ();
yypush_ (YY_NULL, 0, yyla);
yypush_ (YY_NULLPTR, 0, yyla);
// A new symbol was pushed on the stack.
yynewstate:
@@ -814,52 +813,55 @@ b4_dollar_popdef])[]dnl
`-----------------------------*/
yyreduce:
yylen = yyr2_[yyn];
yylhs.state = yy_lr_goto_state_(yystack_[yylen].state, yyr1_[yyn]);]b4_variant_if([
/* Variants are always initialized to an empty instance of the
correct type. The default $$=$1 action is NOT applied when using
variants. */
b4_symbol_variant([[yyr1_@{yyn@}]], [yylhs.value], [build])],[
/* If YYLEN is nonzero, implement the default value of the action:
'$$ = $1'. Otherwise, use the top of the stack.
{
stack_symbol_type yylhs;
yylhs.state = yy_lr_goto_state_(yystack_[yylen].state, yyr1_[yyn]);]b4_variant_if([
/* Variants are always initialized to an empty instance of the
correct type. The default '$$ = $1' action is NOT applied
when using variants. */
b4_symbol_variant([[yyr1_@{yyn@}]], [yylhs.value], [build])], [
/* If YYLEN is nonzero, implement the default value of the
action: '$$ = $1'. Otherwise, use the top of the stack.
Otherwise, the following line sets YYLHS.VALUE to garbage.
This behavior is undocumented and Bison
users should not rely upon it. */
if (yylen)
yylhs.value = yystack_@{yylen - 1@}.value;
else
yylhs.value = yystack_@{0@}.value;])[
Otherwise, the following line sets YYLHS.VALUE to garbage.
This behavior is undocumented and Bison users should not rely
upon it. */
if (yylen)
yylhs.value = yystack_@{yylen - 1@}.value;
else
yylhs.value = yystack_@{0@}.value;])[
]b4_locations_if([dnl
[
// Compute the default @@$.
{
slice<stack_symbol_type, stack_type> slice (yystack_, yylen);
YYLLOC_DEFAULT (yylhs.location, slice, yylen);
}]])[
// Perform the reduction.
YY_REDUCE_PRINT (yyn);
try
// Compute the default @@$.
{
switch (yyn)
{
slice<stack_symbol_type, stack_type> slice (yystack_, yylen);
YYLLOC_DEFAULT (yylhs.location, slice, yylen);
}]])[
// Perform the reduction.
YY_REDUCE_PRINT (yyn);
try
{
switch (yyn)
{
]b4_user_actions[
default:
break;
}
}
catch (const syntax_error& yyexc)
{
error (yyexc);
YYERROR;
}
YY_SYMBOL_PRINT ("-> $$ =", yylhs);
yypop_ (yylen);
yylen = 0;
YY_STACK_PRINT ();
default:
break;
}
}
catch (const syntax_error& yyexc)
{
error (yyexc);
YYERROR;
}
YY_SYMBOL_PRINT ("-> $$ =", yylhs);
yypop_ (yylen);
yylen = 0;
YY_STACK_PRINT ();
// Shift the result of the reduction.
yypush_ (YY_NULL, yylhs);
// Shift the result of the reduction.
yypush_ (YY_NULLPTR, yylhs);
}
goto yynewstate;
/*--------------------------------------.
@@ -906,10 +908,7 @@ b4_dollar_popdef])[]dnl
code. */
if (false)
goto yyerrorlab;]b4_locations_if([[
yyerror_range[1].location = yystack_[yylen - 1].location;]])b4_variant_if([[
/* $$ was initialized before running the user action. */
YY_SYMBOL_PRINT ("Error: discarding", yylhs);
yylhs.~stack_symbol_type();]])[
yyerror_range[1].location = yystack_[yylen - 1].location;]])[
/* Do not reclaim the symbols of the rule whose action triggered
this YYERROR. */
yypop_ (yylen);
@@ -988,11 +987,11 @@ b4_dollar_popdef])[]dnl
// Do not try to display the values of the reclaimed symbols,
// as their printer might throw an exception.
if (!yyempty)
yy_destroy_ (YY_NULL, yyla);
yy_destroy_ (YY_NULLPTR, yyla);
while (1 < yystack_.size ())
{
yy_destroy_ (YY_NULL, yystack_[0]);
yy_destroy_ (YY_NULLPTR, yystack_[0]);
yypop_ ();
}
throw;
@@ -1074,7 +1073,7 @@ b4_error_verbose_if([state_type yystate, symbol_number_type yytoken],
}
}
char const* yyformat = YY_NULL;
char const* yyformat = YY_NULLPTR;
switch (yycount)
{
#define YYCASE_(N, S) \

View File

@@ -453,6 +453,19 @@ b4_define_state])[
return yyerrstatus_ == 0;
}
/** Compute post-reduction state.
* @@param yystate the current state
* @@param yysym the nonterminal to push on the stack
*/
private int yy_lr_goto_state_ (int yystate, int yysym)
{
int yyr = yypgoto_[yysym - yyntokens_] + yystate;
if (0 <= yyr && yyr <= yylast_ && yycheck_[yyr] == yystate)
return yytable_[yyr];
else
return yydefgoto_[yysym - yyntokens_];
}
private int yyaction (int yyn, YYStack yystack, int yylen) ]b4_maybe_throws([b4_throws])[
{
]b4_yystype[ yyval;
@@ -483,14 +496,7 @@ b4_define_state])[
yylen = 0;
/* Shift the result of the reduction. */
yyn = yyr1_[yyn];
int yystate = yypgoto_[yyn - yyntokens_] + yystack.stateAt (0);
if (0 <= yystate && yystate <= yylast_
&& yycheck_[yystate] == yystack.stateAt (0))
yystate = yytable_[yystate];
else
yystate = yydefgoto_[yyn - yyntokens_];
int yystate = yy_lr_goto_state_ (yystack.stateAt (0), yyr1_[yyn]);
yystack.push (yystate, yyval]b4_locations_if([, yyloc])[);
return YYNEWSTATE;
}

View File

@@ -27,7 +27,7 @@ m4_define([b4_position_define],
{
public:]m4_ifdef([b4_location_constructors], [[
/// Construct a position.
explicit position (]b4_percent_define_get([[filename_type]])[* f = YY_NULL,
explicit position (]b4_percent_define_get([[filename_type]])[* f = YY_NULLPTR,
unsigned int l = ]b4_location_initial_line[u,
unsigned int c = ]b4_location_initial_column[u)
: filename (f)
@@ -38,7 +38,7 @@ m4_define([b4_position_define],
]])[
/// Initialization.
void initialize (]b4_percent_define_get([[filename_type]])[* fn = YY_NULL,
void initialize (]b4_percent_define_get([[filename_type]])[* fn = YY_NULLPTR,
unsigned int l = ]b4_location_initial_line[u,
unsigned int c = ]b4_location_initial_column[u)
{
@@ -178,7 +178,7 @@ m4_define([b4_location_define],
])[
/// Initialization.
void initialize (]b4_percent_define_get([[filename_type]])[* f = YY_NULL,
void initialize (]b4_percent_define_get([[filename_type]])[* f = YY_NULLPTR,
unsigned int l = ]b4_location_initial_line[u,
unsigned int c = ]b4_location_initial_column[u)
{

View File

@@ -95,7 +95,7 @@ m4_define([b4_variant_define],
/// Empty construction.
variant ()]b4_parse_assert_if([
: yytname_ (YY_NULL)])[
: yytname_ (YY_NULLPTR)])[
{}
/// Construct and fill.
@@ -198,7 +198,7 @@ m4_define([b4_variant_define],
destroy ()
{
as<T> ().~T ();]b4_parse_assert_if([
yytname_ = YY_NULL;])[
yytname_ = YY_NULLPTR;])[
}
private:
@@ -320,7 +320,6 @@ b4_join(b4_symbol_if([$1], [has_type],
return symbol_type (b4_join([token::b4_symbol([$1], [id])],
b4_symbol_if([$1], [has_type], [v]),
b4_locations_if([l])));
}
])])])

View File

@@ -201,6 +201,8 @@
<xsl:if test="$point = 0">
<xsl:text> .</xsl:text>
</xsl:if>
<!-- RHS -->
<xsl:for-each select="rhs/symbol|rhs/empty">
<xsl:apply-templates select="."/>
<xsl:if test="$point = position()">
@@ -214,7 +216,9 @@
<xsl:value-of select="."/>
</xsl:template>
<xsl:template match="empty"/>
<xsl:template match="empty">
<xsl:text> %empty</xsl:text>
</xsl:template>
<xsl:template match="lookaheads">
<xsl:text> [</xsl:text>

View File

@@ -350,12 +350,7 @@
<xsl:if test="position() = $point + 1">
<xsl:text> .</xsl:text>
</xsl:if>
<xsl:if test="$itemset = 'true' and name(.) != 'empty'">
<xsl:apply-templates select="."/>
</xsl:if>
<xsl:if test="$itemset != 'true'">
<xsl:apply-templates select="."/>
</xsl:if>
<xsl:apply-templates select="."/>
<xsl:if test="position() = last() and position() = $point">
<xsl:text> .</xsl:text>
</xsl:if>

View File

@@ -532,12 +532,7 @@
<xsl:text> </xsl:text>
<span class="point">.</span>
</xsl:if>
<xsl:if test="$itemset = 'true' and name(.) != 'empty'">
<xsl:apply-templates select="."/>
</xsl:if>
<xsl:if test="$itemset != 'true'">
<xsl:apply-templates select="."/>
</xsl:if>
<xsl:apply-templates select="."/>
<xsl:if test="position() = last() and position() = $point">
<xsl:text> </xsl:text>
<span class="point">.</span>
@@ -563,7 +558,7 @@
</xsl:template>
<xsl:template match="empty">
<xsl:text> &#949;</xsl:text>
<xsl:text> %empty</xsl:text>
</xsl:template>
<xsl:template match="lookaheads">

View File

@@ -1108,11 +1108,11 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
]b4_lac_if([[yytype_int16 *yyesa, yytype_int16 **yyes,
YYSIZE_T *yyes_capacity, ]])[yytype_int16 *yyssp, int yytoken)
{
YYSIZE_T yysize0 = yytnamerr (YY_NULL, yytname[yytoken]);
YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]);
YYSIZE_T yysize = yysize0;
enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
/* Internationalized format string. */
const char *yyformat = YY_NULL;
const char *yyformat = YY_NULLPTR;
/* Arguments of yyformat. */
char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
/* Number of reported tokens (one for the "unexpected", one per
@@ -1187,7 +1187,7 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
}
yyarg[yycount++] = yytname[yyx];
{
YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULL, yytname[yyx]);
YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]);
if (! (yysize <= yysize1
&& yysize1 <= YYSTACK_ALLOC_MAXIMUM))
return 2;
@@ -1271,7 +1271,7 @@ static char yypstate_allocated = 0;]])b4_pull_if([
b4_function_define([[yyparse]], [[int]], b4_parse_param)[
{
return yypull_parse (YY_NULL]m4_ifset([b4_parse_param],
return yypull_parse (YY_NULLPTR]m4_ifset([b4_parse_param],
[[, ]b4_args(b4_parse_param)])[);
}
@@ -1313,10 +1313,10 @@ b4_function_define([[yyparse]], [[int]], b4_parse_param)[
{
yypstate *yyps;]b4_pure_if([], [[
if (yypstate_allocated)
return YY_NULL;]])[
return YY_NULLPTR;]])[
yyps = (yypstate *) malloc (sizeof *yyps);
if (!yyps)
return YY_NULL;
return YY_NULLPTR;
yyps->yynew = 1;]b4_pure_if([], [[
yypstate_allocated = 1;]])[
return yyps;