bison-patches
[Top][All Lists]
Advanced

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

[PATCH 3/4] regen


From: Akim Demaille
Subject: [PATCH 3/4] regen
Date: Wed, 3 Jul 2019 07:25:37 +0200

---
 src/parse-gram.c | 70 +++++++++++++++++++++++++++++++++---------------
 src/parse-gram.h | 10 ++++++-
 2 files changed, 57 insertions(+), 23 deletions(-)

diff --git a/src/parse-gram.c b/src/parse-gram.c
index fd1dec3c..1f10b026 100644
--- a/src/parse-gram.c
+++ b/src/parse-gram.c
@@ -1,4 +1,4 @@
-/* A Bison parser, made by GNU Bison 3.4.  */
+/* A Bison parser, made by GNU Bison 3.4.1.38-51f9.  */
 
 /* Bison implementation for Yacc-like parsers in C
 
@@ -48,7 +48,7 @@
 #define YYBISON 1
 
 /* Bison version.  */
-#define YYBISON_VERSION "3.4"
+#define YYBISON_VERSION "3.4.1.38-51f9"
 
 /* Skeleton name.  */
 #define YYSKELETON_NAME "yacc.c"
@@ -75,10 +75,15 @@
 #define yylex           gram_lex
 #define yyerror         gram_error
 #define yydebug         gram_debug
+#define yydebug_init    gram_debug_init
+#define yydebug_none    gram_debug_none
+#define yydebug_trace   gram_debug_trace
+#define yydebug_stats   gram_debug_stats
+#define yydebug_all     gram_debug_all
+#define yydebug_type    gram_debug_type
 #define yynerrs         gram_nerrs
 
 
-
 # ifndef YY_NULLPTR
 #  if defined __cplusplus
 #   if 201103L <= __cplusplus
@@ -476,19 +481,19 @@ static const yytype_uint8 yytranslate[] =
   /* YYRLINE[YYN] -- Source line where rule number YYN was defined.  */
 static const yytype_uint16 yyrline[] =
 {
-       0,   294,   294,   303,   304,   308,   309,   315,   319,   324,
-     325,   330,   331,   332,   333,   334,   339,   344,   345,   346,
-     347,   348,   349,   349,   350,   351,   352,   353,   354,   355,
-     356,   357,   361,   362,   371,   372,   376,   387,   391,   395,
-     403,   413,   414,   424,   425,   431,   444,   444,   449,   449,
-     454,   458,   468,   469,   470,   471,   475,   476,   481,   482,
-     486,   487,   491,   492,   493,   506,   515,   519,   523,   531,
-     532,   536,   549,   550,   562,   566,   570,   578,   580,   585,
-     592,   602,   606,   610,   618,   619,   627,   628,   634,   635,
-     636,   643,   643,   651,   652,   653,   658,   661,   663,   665,
-     667,   669,   671,   673,   675,   677,   682,   683,   692,   716,
-     717,   718,   719,   731,   733,   748,   753,   754,   759,   768,
-     769,   773,   774
+       0,   295,   295,   304,   305,   309,   310,   316,   320,   325,
+     326,   331,   332,   333,   334,   335,   340,   345,   346,   347,
+     348,   349,   350,   350,   351,   352,   353,   354,   355,   356,
+     357,   358,   362,   363,   372,   373,   377,   388,   392,   396,
+     404,   414,   415,   425,   426,   432,   445,   445,   450,   450,
+     455,   459,   469,   470,   471,   472,   476,   477,   482,   483,
+     487,   488,   492,   493,   494,   507,   516,   520,   524,   532,
+     533,   537,   550,   551,   563,   567,   571,   579,   581,   586,
+     593,   603,   607,   611,   619,   620,   628,   629,   635,   636,
+     637,   644,   644,   652,   653,   654,   659,   662,   664,   666,
+     668,   670,   672,   674,   676,   678,   683,   684,   693,   717,
+     718,   719,   720,   732,   734,   749,   754,   755,   760,   769,
+     770,   774,   775
 };
 #endif
 
@@ -806,7 +811,7 @@ static const yytype_uint8 yyr2[] =
 
 # define YYDPRINTF(Args)                        \
 do {                                            \
-  if (yydebug)                                  \
+  if (yydebug & yydebug_trace)                  \
     YYFPRINTF Args;                             \
 } while (0)
 
@@ -857,7 +862,7 @@ yy_location_print_ (FILE *yyo, YYLTYPE const * const yylocp)
 
 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)                    \
 do {                                                                      \
-  if (yydebug)                                                            \
+  if (yydebug & yydebug_trace)                                            \
     {                                                                     \
       YYFPRINTF (stderr, "%s ", Title);                                   \
       yy_symbol_print (stderr,                                            \
@@ -1110,7 +1115,7 @@ yy_stack_print (yytype_int16 *yybottom, yytype_int16 
*yytop)
 
 # define YY_STACK_PRINT(Bottom, Top)                            \
 do {                                                            \
-  if (yydebug)                                                  \
+  if (yydebug & yydebug_trace)                                  \
     yy_stack_print ((Bottom), (Top));                           \
 } while (0)
 
@@ -1141,7 +1146,7 @@ yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, 
YYLTYPE *yylsp, int yyrule
 
 # define YY_REDUCE_PRINT(Rule)          \
 do {                                    \
-  if (yydebug)                          \
+  if (yydebug & yydebug_trace)          \
     yy_reduce_print (yyssp, yyvsp, yylsp, Rule); \
 } while (0)
 
@@ -1292,7 +1297,7 @@ do {                                                      
       \
 do {                                                                     \
   if (yy_lac_established)                                                \
     {                                                                    \
-      if (yydebug)                                                       \
+      if (yydebug & yydebug_trace)                                       \
         YYFPRINTF (stderr, "LAC: initial context discarded due to "      \
                    Event "\n");                                          \
       yy_lac_established = 0;                                            \
@@ -1577,7 +1582,7 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
               }
         }
 # if GRAM_DEBUG
-      else if (yydebug)
+      else if (yydebug & yydebug_trace)
         YYFPRINTF (stderr, "No expected tokens.\n");
 # endif
     }
@@ -1779,6 +1784,15 @@ YYLTYPE yylloc = yyloc_default;
   YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
 #endif
 
+#if GRAM_DEBUG
+  typedef struct yy_stats_t {
+    int num_reductions;
+    int num_shifts;
+  } yy_stats_t;
+  static yy_stats_t yy_stats_init;
+  yy_stats_t yy_stats = yy_stats_init;
+#endif
+
 #define YYPOPSTACK(N)   (yyvsp -= (N), yyssp -= (N), yylsp -= (N))
 
   /* The number of symbols on the RHS of the reduced rule.
@@ -1960,6 +1974,9 @@ yybackup:
 
   /* Shift the lookahead token.  */
   YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
+#if GRAM_DEBUG
+  ++yy_stats.num_shifts;
+#endif
 
   /* Discard the shifted token.  */
   yychar = YYEMPTY;
@@ -2004,6 +2021,9 @@ yyreduce:
   YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen);
   yyerror_range[1] = yyloc;
   YY_REDUCE_PRINT (yyn);
+#if GRAM_DEBUG
+  ++yy_stats.num_reductions;
+#endif
   {
     int yychar_backup = yychar;
     switch (yyn)
@@ -2765,6 +2785,12 @@ yyreturn:
 #endif
   if (yyes != yyesa)
     YYSTACK_FREE (yyes);
+#if GRAM_DEBUG
+  if (yydebug & yydebug_stats)
+    YYFPRINTF (stderr,
+               "num_reductions: %d\nnum_shifts: %d\n",
+               yy_stats.num_reductions, yy_stats.num_shifts);
+#endif
 #if YYERROR_VERBOSE
   if (yymsg != yymsgbuf)
     YYSTACK_FREE (yymsg);
diff --git a/src/parse-gram.h b/src/parse-gram.h
index 1009592f..91d112eb 100644
--- a/src/parse-gram.h
+++ b/src/parse-gram.h
@@ -1,4 +1,4 @@
-/* A Bison parser, made by GNU Bison 3.4.  */
+/* A Bison parser, made by GNU Bison 3.4.1.38-51f9.  */
 
 /* Bison interface for Yacc-like parsers in C
 
@@ -49,6 +49,14 @@
 # endif /* ! defined YYDEBUG */
 #endif  /* ! defined GRAM_DEBUG */
 #if GRAM_DEBUG
+/* Values of gram_debug.  */
+enum gram_debug_type
+{
+  gram_debug_none = 0,
+  gram_debug_trace = 1 << 0,
+  gram_debug_stats = 1 << 1,
+  gram_debug_all = -1
+};
 extern int gram_debug;
 #endif
 /* "%code requires" blocks.  */
-- 
2.22.0




reply via email to

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