bison-patches
[Top][All Lists]
Advanced

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

{maint}: parsers: rename YY_NULL as YY_NULLPTR to avoid conflicts with F


From: Akim Demaille
Subject: {maint}: parsers: rename YY_NULL as YY_NULLPTR to avoid conflicts with Flex
Date: Fri, 8 Nov 2013 10:54:41 +0100

commit 8d0b7cef7df7fead44b9574cee342de336008625
Author: Akim Demaille <address@hidden>
Date:   Fri Nov 8 10:52:15 2013 +0100

    parsers: rename YY_NULL as YY_NULLPTR to avoid conflicts with Flex
    
    Flex also defines YY_NULL (to 0).  Avoid gratuitous conflicts.
    
    * data/c.m4 (b4_null_define): Rename YY_NULL as YY_NULLPTR.
    
    * data/glr.c, data/lalr1.cc, data/location.cc, data/variant.hh,
    * data/yacc.c, src/parse-gram.c, tests/actions.at, tests/c++.at,
    * tests/cxx-type.at, tests/glr-regression.at, tests/headers.at,
    * tests/push.at, tests/regression.at:
    Adjust.

diff --git a/data/c.m4 b/data/c.m4
index 9b739bc..b0524ef 100644
--- a/data/c.m4
+++ b/data/c.m4
@@ -269,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
 ])
@@ -285,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)
 # -------------------------------------------------------------
diff --git a/data/glr.c b/data/glr.c
index 725453b..5069f61 100644
--- a/data/glr.c
+++ b/data/glr.c
@@ -672,7 +672,7 @@ static void yyexpandGLRStack (yyGLRStack* yystackp);
 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);
 }
@@ -715,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;
     }
@@ -747,7 +747,7 @@ yyuserAction (yyRuleNum yyn, size_t yyrhslen, 
yyGLRStackItem* yyvsp,
               yyGLRStack* yystackp,
               YYSTYPE* yyvalp]b4_locuser_formals[)
 {
-  yybool yynormal YY_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);
@@ -834,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
 
@@ -987,7 +987,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)
@@ -1017,8 +1017,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);
 }
 
@@ -1057,10 +1057,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);
         }
@@ -1068,18 +1068,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);
@@ -1103,7 +1103,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;
 }
 
@@ -1111,9 +1111,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
@@ -1122,12 +1122,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
@@ -1137,7 +1137,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)
             {
@@ -1201,7 +1201,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.  */
@@ -1261,7 +1261,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];
@@ -1313,13 +1313,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));
@@ -1352,7 +1352,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];
@@ -1379,7 +1379,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];
@@ -1389,7 +1389,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])))
@@ -1400,7 +1400,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;
 
@@ -1408,7 +1408,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;
     }
@@ -1472,9 +1472,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;
@@ -1595,7 +1595,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;
@@ -1666,7 +1666,7 @@ yyresolveLocations (yyGLRState* yys1, int yyn1,
           yyGLRStackItem yyrhsloc[1 + YYMAXRHS];
           int yynrhs;
           yySemanticOption *yyoption = yys1->yysemantics.yyfirstVal;
-          YYASSERT (yyoption != YY_NULL);
+          YYASSERT (yyoption != YY_NULLPTR);
           yynrhs = yyrhsLength (yyoption->yyrule);
           if (yynrhs > 0)
             {
@@ -1725,7 +1725,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;
 
@@ -1767,7 +1767,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])
               {
@@ -1794,14 +1794,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;
@@ -1821,10 +1821,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;
@@ -1832,10 +1832,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;
@@ -1850,7 +1850,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",
@@ -1972,13 +1972,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
@@ -2034,7 +2034,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;
                 }
@@ -2112,7 +2112,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
@@ -2153,10 +2153,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);
@@ -2164,7 +2164,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];
@@ -2188,14 +2188,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)                                                          \
@@ -2438,7 +2438,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;
@@ -2470,7 +2470,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);
@@ -2484,7 +2484,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
diff --git a/data/lalr1.cc b/data/lalr1.cc
index cb61ebb..9703e44 100644
--- a/data/lalr1.cc
+++ b/data/lalr1.cc
@@ -735,7 +735,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:
@@ -860,7 +860,7 @@ b4_dollar_popdef])[]dnl
     YY_STACK_PRINT ();
 
     // Shift the result of the reduction.
-    yypush_ (YY_NULL, yylhs);
+    yypush_ (YY_NULLPTR, yylhs);
     goto yynewstate;
 
   /*--------------------------------------.
@@ -989,11 +989,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;
@@ -1075,7 +1075,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)                         \
diff --git a/data/location.cc b/data/location.cc
index 9a60f25..e80742a 100644
--- a/data/location.cc
+++ b/data/location.cc
@@ -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)
     {
diff --git a/data/variant.hh b/data/variant.hh
index 76c3e60..633c29a 100644
--- a/data/variant.hh
+++ b/data/variant.hh
@@ -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:
diff --git a/data/yacc.c b/data/yacc.c
index 822656b..aed7f06 100644
--- a/data/yacc.c
+++ b/data/yacc.c
@@ -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;
diff --git a/src/parse-gram.c b/src/parse-gram.c
index b48ed6f..9e279f5 100644
--- a/src/parse-gram.c
+++ b/src/parse-gram.c
@@ -80,11 +80,11 @@
 
 #line 82 "src/parse-gram.c" /* yacc.c:339  */
 
-# 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
 
@@ -639,7 +639,7 @@ static const char *const yytname[] =
   "symbols.1", "generic_symlist", "generic_symlist_item", "tag",
   "symbol_def", "symbol_defs.1", "grammar", "rules_or_grammar_declaration",
   "rules", "address@hidden", "rhses.1", "rhs", "named_ref.opt", "variable", 
"value",
-  "id", "id_colon", "symbol", "string_as_id", "epilogue.opt", YY_NULL
+  "id", "id_colon", "symbol", "string_as_id", "epilogue.opt", YY_NULLPTR
 };
 #endif
 
@@ -1569,11 +1569,11 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
                 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
@@ -1628,7 +1628,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;
diff --git a/tests/actions.at b/tests/actions.at
index 6c1ecbc..a9846d4 100644
--- a/tests/actions.at
+++ b/tests/actions.at
@@ -596,7 +596,7 @@ thing:
 ;
 %%
 /* Alias to ARGV[1]. */
-const char *source = YY_NULL;
+const char *source = YY_NULLPTR;
 
 ]AT_YYERROR_DEFINE[
 
diff --git a/tests/c++.at b/tests/c++.at
index ac68dc0..e403c55 100644
--- a/tests/c++.at
+++ b/tests/c++.at
@@ -796,11 +796,11 @@ item:
 // Not just 'E', otherwise we reduce when 'E' is the lookahead, and
 // then the stack is emptied, defeating the point of the test.
 | 'E' 'a' { YYUSE($][1); $][$ = $][2; }
-| 'R'     { ]AT_VARIANT_IF([], [$][$ = YY_NULL; delete $][1]; )[YYERROR; }
+| 'R'     { ]AT_VARIANT_IF([], [$][$ = YY_NULLPTR; delete $][1]; )[YYERROR; }
 | 'p'     { $][$ = $][1; }
 | 's'     { $][$ = $][1; throw std::runtime_error ("reduction"); }
-| 'T'     { ]AT_VARIANT_IF([], [$][$ = YY_NULL; delete $][1]; )[YYABORT; }
-| error   { ]AT_VARIANT_IF([], [$][$ = YY_NULL; ])[yyerrok; }
+| 'T'     { ]AT_VARIANT_IF([], [$][$ = YY_NULLPTR; delete $][1]; )[YYABORT; }
+| error   { ]AT_VARIANT_IF([], [$][$ = YY_NULLPTR; ])[yyerrok; }
 ;
 %%
 
@@ -868,7 +868,7 @@ main (int argc, const char *argv[])
   {
     std::cerr << "unknown exception caught" << std::endl;
   }
-  Object::log (YY_NULL, "end");
+  Object::log (YY_NULLPTR, "end");
   assert (Object::empty());
   return res;
 }
diff --git a/tests/cxx-type.at b/tests/cxx-type.at
index 2c37c17..196ac0b 100644
--- a/tests/cxx-type.at
+++ b/tests/cxx-type.at
@@ -94,19 +94,19 @@ prog :
 
 stmt : expr ';'  $2     { $$ = ]$[1; }
      | decl      $3
-     | error ';'        { $$ = new_nterm ("<error>", YY_NULL, YY_NULL, 
YY_NULL); }
+     | error ';'        { $$ = new_nterm ("<error>", YY_NULLPTR, YY_NULLPTR, 
YY_NULLPTR); }
      | '@'              { YYACCEPT; }
      ;
 
 expr : ID
      | TYPENAME '(' expr ')'
-                        { $$ = new_nterm ("<cast>(%s,%s)", ]$[3, ]$[1, 
YY_NULL); }
-     | expr '+' expr    { $$ = new_nterm ("+(%s,%s)", ]$[1, ]$[3, YY_NULL); }
-     | expr '=' expr    { $$ = new_nterm ("=(%s,%s)", ]$[1, ]$[3, YY_NULL); }
+                        { $$ = new_nterm ("<cast>(%s,%s)", ]$[3, ]$[1, 
YY_NULLPTR); }
+     | expr '+' expr    { $$ = new_nterm ("+(%s,%s)", ]$[1, ]$[3, YY_NULLPTR); 
}
+     | expr '=' expr    { $$ = new_nterm ("=(%s,%s)", ]$[1, ]$[3, YY_NULLPTR); 
}
      ;
 
 decl : TYPENAME declarator ';'
-                        { $$ = new_nterm ("<declare>(%s,%s)", ]$[1, ]$[2, 
YY_NULL); }
+                        { $$ = new_nterm ("<declare>(%s,%s)", ]$[1, ]$[2, 
YY_NULLPTR); }
      | TYPENAME declarator '=' expr ';'
                         { $$ = new_nterm ("<init-declare>(%s,%s,%s)", ]$[1,
                                           ]$[2, ]$[4); }
@@ -195,7 +195,7 @@ main (int argc, char **argv)
               {
                 colNum += 1;
                 tok = c;
-                yylval = YY_NULL;
+                yylval = YY_NULLPTR;
               }]AT_LOCATION_IF([[
             yylloc.last_column = colNum-1;]])[
             return tok;
@@ -287,7 +287,7 @@ m4_bmatch([$2], [stmtMerge],
 [[static YYSTYPE
 stmtMerge (YYSTYPE x0, YYSTYPE x1)
 {
-  return new_nterm ("<OR>(%s,%s)", x0, x1, YY_NULL);
+  return new_nterm ("<OR>(%s,%s)", x0, x1, YY_NULLPTR);
 }
 ]])
 )
diff --git a/tests/glr-regression.at b/tests/glr-regression.at
index 064b37b..b1444bb 100644
--- a/tests/glr-regression.at
+++ b/tests/glr-regression.at
@@ -67,7 +67,7 @@ static YYSTYPE exprMerge (YYSTYPE x0, YYSTYPE x1)
   return 0;
 }
 
-const char *input = YY_NULL;
+const char *input = YY_NULLPTR;
 
 int
 main (int argc, const char* argv[])
@@ -304,7 +304,7 @@ MergeRule (int x0, int x1)
 }
 ]AT_YYERROR_DEFINE[
 
-FILE *input = YY_NULL;
+FILE *input = YY_NULLPTR;
 
 int P[] = { P1, P2 };
 int O[] = { O1, O2 };
diff --git a/tests/headers.at b/tests/headers.at
index 9b71c03..f32e2a1 100644
--- a/tests/headers.at
+++ b/tests/headers.at
@@ -229,7 +229,7 @@ AT_CHECK([[$PERL -n -0777 -e '
       |YY_IGNORE_MAYBE_UNINITIALIZED_(?:BEGIN|END)
       |YY_INITIAL_VALUE
       |YY_\w+_INCLUDED
-      |YY_NULL
+      |YY_NULLPTR
       |(defined|if)\ YYDEBUG
       )\b}{}gx;
   while (/^(.*YY.*)$/gm)
diff --git a/tests/push.at b/tests/push.at
index 7dde295..d39ca56 100644
--- a/tests/push.at
+++ b/tests/push.at
@@ -57,12 +57,12 @@ main (void)
   /* yypstate_delete used to leak ps->yyss if the stack was reallocated but the
      parse did not return on success, syntax error, or memory exhaustion.  */
   ps = yypstate_new ();
-  assert (yypush_parse (ps, 'a', YY_NULL) == YYPUSH_MORE);
+  assert (yypush_parse (ps, 'a', YY_NULLPTR) == YYPUSH_MORE);
   yypstate_delete (ps);
 
   ps = yypstate_new ();
-  assert (yypush_parse (ps, 'a', YY_NULL) == YYPUSH_MORE);
-  assert (yypush_parse (ps, 'b', YY_NULL) == YYPUSH_MORE);
+  assert (yypush_parse (ps, 'a', YY_NULLPTR) == YYPUSH_MORE);
+  assert (yypush_parse (ps, 'b', YY_NULLPTR) == YYPUSH_MORE);
   yypstate_delete (ps);
 
   return 0;
@@ -111,11 +111,11 @@ main (void)
     {
       yypstate *ps = yypstate_new ();
       assert (ps);
-      assert (yypstate_new () == YY_NULL);
+      assert (yypstate_new () == YY_NULLPTR);
       ]m4_if([$1], [[both]], [[assert (yyparse () == 2)]])[;
       yychar = 0;
       assert (yypush_parse (ps) == 0);
-      assert (yypstate_new () == YY_NULL);
+      assert (yypstate_new () == YY_NULLPTR);
       ]m4_if([$1], [[both]], [[assert (yyparse () == 2)]])[;
       yypstate_delete (ps);
     }
diff --git a/tests/regression.at b/tests/regression.at
index b9ca94c..223dc06 100644
--- a/tests/regression.at
+++ b/tests/regression.at
@@ -770,7 +770,7 @@ static const yytype_uint8 yyrline[] =
 static const char *const yytname[] =
 {
   "$end", "error", "$undefined", "\"if\"", "\"const\"", "\"then\"",
-  "\"else\"", "$accept", "statement", "struct_stat", "if", "else", YY_NULL
+  "\"else\"", "$accept", "statement", "struct_stat", "if", "else", YY_NULLPTR
 };
 static const yytype_uint16 yytoknum[] =
 {




reply via email to

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