bison-patches
[Top][All Lists]
Advanced

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

[PATCH 5/5] style: rename YYNOMEM as YYENOMEM


From: Akim Demaille
Subject: [PATCH 5/5] style: rename YYNOMEM as YYENOMEM
Date: Sat, 11 Apr 2020 08:47:43 +0200

This is clearer.

* data/skeletons/glr.c, data/skeletons/yacc.c (YYNOMEM): Rename as...
(YYENOMEM): here.
---
 TODO                  |  2 +-
 data/skeletons/glr.c  |  8 ++++----
 data/skeletons/yacc.c | 38 +++++++++++++++++++-------------------
 src/parse-gram.c      | 20 ++++++++++----------
 4 files changed, 34 insertions(+), 34 deletions(-)

diff --git a/TODO b/TODO
index 1c5c11ec..554283df 100644
--- a/TODO
+++ b/TODO
@@ -5,7 +5,7 @@ should not have to dispatch to several APIs.
 
 ** Documentation
 - yyexpected_tokens in all the languages.
-- YYNOMEM
+- YYENOMEM
 - i18n in Java
 - symbol.type_get should be kind_get, and it's not documented.
 
diff --git a/data/skeletons/glr.c b/data/skeletons/glr.c
index 9f7619d3..10ee46c4 100644
--- a/data/skeletons/glr.c
+++ b/data/skeletons/glr.c
@@ -427,7 +427,7 @@ YYLTYPE yylloc;]])[
 int yynerrs;
 int yychar;])[
 
-enum { YYNOMEM = -2 };
+enum { YYENOMEM = -2 };
 
 static const int YYEOF = 0;
 static const int YYEMPTY = -2;
@@ -2192,8 +2192,8 @@ yy_syntax_error_arguments (const yyGLRStack* yystackp,
         yyarg[yycount] = yytoken;
       ++yycount;
       yyn = yyexpected_tokens (yystackp, yyarg ? yyarg + 1 : yyarg, yyargn - 
1);
-      if (yyn == YYNOMEM)
-        return YYNOMEM;
+      if (yyn == YYENOMEM)
+        return YYENOMEM;
       else
         yycount += yyn;
     }
@@ -2228,7 +2228,7 @@ yyreportSyntaxError (yyGLRStack* 
yystackp]b4_user_formals[)
   /* Actual size of YYARG. */
   int yycount
     = yy_syntax_error_arguments (yystackp, yyarg, YYARGS_MAX);
-  if (yycount == YYNOMEM)
+  if (yycount == YYENOMEM)
     yyMemoryExhausted (yystackp);
 
   switch (yycount)
diff --git a/data/skeletons/yacc.c b/data/skeletons/yacc.c
index a8d524bf..2c47cf21 100644
--- a/data/skeletons/yacc.c
+++ b/data/skeletons/yacc.c
@@ -711,7 +711,7 @@ static const ]b4_int_type_for([b4_toknum])[ yytoknum[] =
 
 ]b4_parser_tables_define[
 
-enum { YYNOMEM = -2 };
+enum { YYENOMEM = -2 };
 
 #define yyerrok         (yyerrstatus = 0)
 #define yyclearin       (yychar = YYEMPTY)
@@ -882,7 +882,7 @@ static char yypstate_allocated = 0;]])])[
    *YYTOP, and *YYCAPACITY to reflect the new capacity and memory
    location.  If *YYBOTTOM != YYBOTTOM_NO_FREE, then free the old stack
    using YYSTACK_FREE.  Return 0 if successful or if no reallocation is
-   required.  Return YYNOMEM if memory is exhausted.  */
+   required.  Return YYENOMEM if memory is exhausted.  */
 static int
 yy_lac_stack_realloc (YYPTRDIFF_T *yycapacity, YYPTRDIFF_T yyadd,
 #if ]b4_api_PREFIX[DEBUG
@@ -907,7 +907,7 @@ yy_lac_stack_realloc (YYPTRDIFF_T *yycapacity, YYPTRDIFF_T 
yyadd,
         {
           YYDPRINTF ((stderr, "%smax size exceeded%s", yydebug_prefix,
                       yydebug_suffix));
-          return YYNOMEM;
+          return YYENOMEM;
         }
       if (YYMAXDEPTH < yyalloc)
         yyalloc = YYMAXDEPTH;
@@ -919,7 +919,7 @@ yy_lac_stack_realloc (YYPTRDIFF_T *yycapacity, YYPTRDIFF_T 
yyadd,
         {
           YYDPRINTF ((stderr, "%srealloc failed%s", yydebug_prefix,
                       yydebug_suffix));
-          return YYNOMEM;
+          return YYENOMEM;
         }
       if (*yytop != yytop_empty)
         {
@@ -975,7 +975,7 @@ do {                                                        
            \
       yy_lac_established = 1;                                           \
       switch (yy_lac (yyesa, &yyes, &yyes_capacity, yyssp, yytoken))    \
         {                                                               \
-        case YYNOMEM:                                                   \
+        case YYENOMEM:                                                  \
           goto yyexhaustedlab;                                          \
         case 1:                                                         \
           goto yyerrlab;                                                \
@@ -1010,7 +1010,7 @@ do {                                                      
               \
 
 /* Given the stack whose top is *YYSSP, return 0 iff YYTOKEN can
    eventually (after perhaps some reductions) be shifted, return 1 if
-   not, or return YYNOMEM if memory is exhausted.  As preconditions and
+   not, or return YYENOMEM if memory is exhausted.  As preconditions and
    postconditions: *YYES_CAPACITY is the allocated size of the array to
    which *YYES points, and either *YYES = YYESA or *YYES points to an
    array allocated with YYSTACK_ALLOC.  yy_lac may overwrite the
@@ -1110,7 +1110,7 @@ yy_lac (yy_state_t *yyesa, yy_state_t **yyes,
                                       yyes, yyesa, &yyesp, yyes_prev))
               {
                 YYDPRINTF ((stderr, "\n"));
-                return YYNOMEM;
+                return YYENOMEM;
               }
             YY_IGNORE_USELESS_CAST_BEGIN
             *++yyesp = YY_CAST (yy_state_t, yystate);
@@ -1137,7 +1137,7 @@ typedef struct
 /* Put in YYARG at most YYARGN of the expected tokens given the
    current YYCTX, and return the number of tokens stored in YYARG.  If
    YYARG is null, return the number of expected tokens (guaranteed to
-   be less than YYNTOKENS).  Return YYNOMEM on memory exhaustion.
+   be less than YYNTOKENS).  Return YYENOMEM on memory exhaustion.
    Return 0 if there are more than YYARGN expected tokens, yet fill
    YYARG up to YYARGN. */]b4_push_if([[
 static int
@@ -1158,8 +1158,8 @@ yyexpected_tokens (const yypcontext_t *yyctx,
         switch (yy_lac (]b4_push_if([[yyps->yyesa, &yyps->yyes, 
&yyps->yyes_capacity, yyps->yyssp, yysym]],
                                     [[yyctx->yyesa, yyctx->yyes, 
yyctx->yyes_capacity, yyctx->yyssp, yysym]])[))
           {
-          case YYNOMEM:
-            return YYNOMEM;
+          case YYENOMEM:
+            return YYENOMEM;
           case 1:
             continue;
           default:
@@ -1364,8 +1364,8 @@ yy_syntax_error_arguments (const yypcontext_t *yyctx,
         yyarg[yycount] = yyctx->yytoken;
       ++yycount;
       yyn = yyexpected_tokens (yyctx, yyarg ? yyarg + 1 : yyarg, yyargn - 1);
-      if (yyn == YYNOMEM)
-        return YYNOMEM;]b4_lac_if([[
+      if (yyn == YYENOMEM)
+        return YYENOMEM;]b4_lac_if([[
       else if (yyn == 0)
         YYDPRINTF ((stderr, "No expected tokens.\n"));]])[
       else
@@ -1381,9 +1381,9 @@ yy_syntax_error_arguments (const yypcontext_t *yyctx,
 
    Return 0 if *YYMSG was successfully written.  Return -1 if *YYMSG is
    not large enough to hold the message.  In that case, also set
-   *YYMSG_ALLOC to the required number of bytes.  Return YYNOMEM if the
+   *YYMSG_ALLOC to the required number of bytes.  Return YYENOMEM if the
    required number of bytes is too large to store]b4_lac_if([[ or if
-   yy_lac returned YYNOMEM]])[.  */
+   yy_lac returned YYENOMEM]])[.  */
 static int
 yysyntax_error (YYPTRDIFF_T *yymsg_alloc, char **yymsg,
                 const yypcontext_t *yyctx)
@@ -1399,8 +1399,8 @@ yysyntax_error (YYPTRDIFF_T *yymsg_alloc, char **yymsg,
 
   /* Actual size of YYARG. */
   int yycount = yy_syntax_error_arguments (yyctx, yyarg, YYARGS_MAX);
-  if (yycount == YYNOMEM)
-    return YYNOMEM;
+  if (yycount == YYENOMEM)
+    return YYENOMEM;
 
   switch (yycount)
     {
@@ -1432,7 +1432,7 @@ yysyntax_error (YYPTRDIFF_T *yymsg_alloc, char **yymsg,
         if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)
           yysize = yysize1;
         else
-          return YYNOMEM;
+          return YYENOMEM;
       }
   }
 
@@ -1944,11 +1944,11 @@ yyerrlab:
               {
                 yymsg = yymsgbuf;
                 yymsg_alloc = sizeof yymsgbuf;
-                yysyntax_error_status = YYNOMEM;
+                yysyntax_error_status = YYENOMEM;
               }
           }
         yyerror (]b4_yyerror_args[yymsgp);
-        if (yysyntax_error_status == YYNOMEM)
+        if (yysyntax_error_status == YYENOMEM)
           goto yyexhaustedlab;
       }]])[
     }
diff --git a/src/parse-gram.c b/src/parse-gram.c
index 9121cc37..186d838e 100644
--- a/src/parse-gram.c
+++ b/src/parse-gram.c
@@ -895,7 +895,7 @@ static const yytype_int8 yyr2[] =
 };
 
 
-enum { YYNOMEM = -2 };
+enum { YYENOMEM = -2 };
 
 #define yyerrok         (yyerrstatus = 0)
 #define yyclearin       (yychar = YYEMPTY)
@@ -1349,7 +1349,7 @@ int yydebug;
    *YYTOP, and *YYCAPACITY to reflect the new capacity and memory
    location.  If *YYBOTTOM != YYBOTTOM_NO_FREE, then free the old stack
    using YYSTACK_FREE.  Return 0 if successful or if no reallocation is
-   required.  Return YYNOMEM if memory is exhausted.  */
+   required.  Return YYENOMEM if memory is exhausted.  */
 static int
 yy_lac_stack_realloc (YYPTRDIFF_T *yycapacity, YYPTRDIFF_T yyadd,
 #if GRAM_DEBUG
@@ -1374,7 +1374,7 @@ yy_lac_stack_realloc (YYPTRDIFF_T *yycapacity, 
YYPTRDIFF_T yyadd,
         {
           YYDPRINTF ((stderr, "%smax size exceeded%s", yydebug_prefix,
                       yydebug_suffix));
-          return YYNOMEM;
+          return YYENOMEM;
         }
       if (YYMAXDEPTH < yyalloc)
         yyalloc = YYMAXDEPTH;
@@ -1386,7 +1386,7 @@ yy_lac_stack_realloc (YYPTRDIFF_T *yycapacity, 
YYPTRDIFF_T yyadd,
         {
           YYDPRINTF ((stderr, "%srealloc failed%s", yydebug_prefix,
                       yydebug_suffix));
-          return YYNOMEM;
+          return YYENOMEM;
         }
       if (*yytop != yytop_empty)
         {
@@ -1437,7 +1437,7 @@ do {                                                      
              \
       yy_lac_established = 1;                                           \
       switch (yy_lac (yyesa, &yyes, &yyes_capacity, yyssp, yytoken))    \
         {                                                               \
-        case YYNOMEM:                                                   \
+        case YYENOMEM:                                                  \
           goto yyexhaustedlab;                                          \
         case 1:                                                         \
           goto yyerrlab;                                                \
@@ -1472,7 +1472,7 @@ do {                                                      
               \
 
 /* Given the stack whose top is *YYSSP, return 0 iff YYTOKEN can
    eventually (after perhaps some reductions) be shifted, return 1 if
-   not, or return YYNOMEM if memory is exhausted.  As preconditions and
+   not, or return YYENOMEM if memory is exhausted.  As preconditions and
    postconditions: *YYES_CAPACITY is the allocated size of the array to
    which *YYES points, and either *YYES = YYESA or *YYES points to an
    array allocated with YYSTACK_ALLOC.  yy_lac may overwrite the
@@ -1572,7 +1572,7 @@ yy_lac (yy_state_t *yyesa, yy_state_t **yyes,
                                       yyes, yyesa, &yyesp, yyes_prev))
               {
                 YYDPRINTF ((stderr, "\n"));
-                return YYNOMEM;
+                return YYENOMEM;
               }
             YY_IGNORE_USELESS_CAST_BEGIN
             *++yyesp = YY_CAST (yy_state_t, yystate);
@@ -1597,7 +1597,7 @@ typedef struct
 /* Put in YYARG at most YYARGN of the expected tokens given the
    current YYCTX, and return the number of tokens stored in YYARG.  If
    YYARG is null, return the number of expected tokens (guaranteed to
-   be less than YYNTOKENS).  Return YYNOMEM on memory exhaustion.
+   be less than YYNTOKENS).  Return YYENOMEM on memory exhaustion.
    Return 0 if there are more than YYARGN expected tokens, yet fill
    YYARG up to YYARGN. */
 static int
@@ -1614,8 +1614,8 @@ yyexpected_tokens (const yypcontext_t *yyctx,
       if (yysym != YYSYMBOL_YYERROR && yysym != YYSYMBOL_YYUNDEF)
         switch (yy_lac (yyctx->yyesa, yyctx->yyes, yyctx->yyes_capacity, 
yyctx->yyssp, yysym))
           {
-          case YYNOMEM:
-            return YYNOMEM;
+          case YYENOMEM:
+            return YYENOMEM;
           case 1:
             continue;
           default:
-- 
2.26.0




reply via email to

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