]> git.saurik.com Git - bison.git/blobdiff - data/glr.c
Copyright years.
[bison.git] / data / glr.c
index aee1aeda98390ad9650a469d8c7daa9f2aa8815f..9cabf622190afa56612b56cfe59371222fd0943c 100644 (file)
@@ -158,7 +158,7 @@ m4_changecom()
 m4_divert_push(0)dnl
 @output(b4_parser_file_name@)@
 b4_copyright([Skeleton implementation for Bison GLR parsers in C],
-  [2002, 2003, 2004, 2005, 2006])
+             [2002, 2003, 2004, 2005, 2006, 2007, 2008])
 [
 /* C GLR parser skeleton written by Paul Hilfinger.  */
 
@@ -383,17 +383,10 @@ static const char *const yytname[] =
 };
 #endif
 
-/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
-static const ]b4_int_type_for([b4_r1])[ yyr1[] =
-{
-  ]b4_r1[
-};
+#define YYPACT_NINF ]b4_pact_ninf[
+#define YYTABLE_NINF ]b4_table_ninf[
 
-/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN.  */
-static const ]b4_int_type_for([b4_r2])[ yyr2[] =
-{
-  ]b4_r2[
-};
+]b4_parser_tables_define[
 
 /* YYDPREC[RULE-NUM] -- Dynamic precedence of rule #RULE-NUM (0 if none).  */
 static const ]b4_int_type_for([b4_dprec])[ yydprec[] =
@@ -407,44 +400,6 @@ static const ]b4_int_type_for([b4_merger])[ yymerger[] =
   ]b4_merger[
 };
 
-/* YYDEFACT[S] -- default rule to reduce with in state S when YYTABLE
-   doesn't specify something else to do.  Zero means the default is an
-   error.  */
-static const ]b4_int_type_for([b4_defact])[ yydefact[] =
-{
-  ]b4_defact[
-};
-
-/* YYPDEFGOTO[NTERM-NUM].  */
-static const ]b4_int_type_for([b4_defgoto])[ yydefgoto[] =
-{
-  ]b4_defgoto[
-};
-
-/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
-   STATE-NUM.  */
-#define YYPACT_NINF ]b4_pact_ninf[
-static const ]b4_int_type_for([b4_pact])[ yypact[] =
-{
-  ]b4_pact[
-};
-
-/* YYPGOTO[NTERM-NUM].  */
-static const ]b4_int_type_for([b4_pgoto])[ yypgoto[] =
-{
-  ]b4_pgoto[
-};
-
-/* YYTABLE[YYPACT[STATE-NUM]].  What to do in state STATE-NUM.  If
-   positive, shift that token.  If negative, reduce the rule which
-   number is the opposite.  If zero, do what YYDEFACT says.
-   If YYTABLE_NINF, syntax error.  */
-#define YYTABLE_NINF ]b4_table_ninf[
-static const ]b4_int_type_for([b4_table])[ yytable[] =
-{
-  ]b4_table[
-};
-
 /* YYCONFLP[YYPACT[STATE-NUM]] -- Pointer into YYCONFL of start of
    list of conflicting reductions corresponding to action entry for
    state STATE-NUM in yytable.  0 means no conflicts.  The list in
@@ -463,19 +418,6 @@ dnl We probably ought to introduce a type for confl.
 {
   ]b4_conflicting_rules[
 };
-
-static const ]b4_int_type_for([b4_check])[ yycheck[] =
-{
-  ]b4_check[
-};
-
-/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
-   symbol of state STATE-NUM.  */
-static const ]b4_int_type_for([b4_stos])[ yystos[] =
-{
-  ]b4_stos[
-};
-
 \f
 /* Prevent warning if -Wmissing-prototypes.  */
 ]b4_c_ansi_function_decl([yyparse], [int], b4_parse_param)[
@@ -558,9 +500,12 @@ static const int YYEMPTY = -2;
 
 typedef enum { yyok, yyaccept, yyabort, yyerr } YYRESULTTAG;
 
-#define YYCHK(YYE)                                                          \
-   do { YYRESULTTAG yyflag = YYE; if (yyflag != yyok) return yyflag; }      \
-   while (YYID (0))
+#define YYCHK(YYE)                              \
+  do {                                          \
+    YYRESULTTAG yyflag = YYE;                   \
+    if (yyflag != yyok)                         \
+      return yyflag;                            \
+  } while (YYID (0))
 
 #if YYDEBUG
 
@@ -569,23 +514,23 @@ typedef enum { yyok, yyaccept, yyabort, yyerr } YYRESULTTAG;
 # endif
 
 # define YYDPRINTF(Args)                       \
-do {                                           \
-  if (yydebug)                                 \
-    YYFPRINTF Args;                            \
-} while (YYID (0))
+  do {                                         \
+    if (yydebug)                                \
+      YYFPRINTF Args;                          \
+  } while (YYID (0))
 
 ]b4_yy_symbol_print_generate([b4_c_ansi_function_def])[
 
-# define YY_SYMBOL_PRINT(Title, Type, Value, Location)                     \
-do {                                                                       \
-  if (yydebug)                                                             \
-    {                                                                      \
-      YYFPRINTF (stderr, "%s ", Title);                                            \
-      yy_symbol_print (stderr, Type,                                       \
-                      Value]b4_locations_if([, Location])[]b4_user_args[);  \
-      YYFPRINTF (stderr, "\n");                                                    \
-    }                                                                      \
-} while (YYID (0))
+# define YY_SYMBOL_PRINT(Title, Type, Value, Location)                  \
+  do {                                                                  \
+    if (yydebug)                                                        \
+      {                                                                 \
+        YYFPRINTF (stderr, "%s ", Title);                               \
+        yy_symbol_print (stderr, Type,                                  \
+                         Value]b4_locations_if([, Location])[]b4_user_args[); \
+        YYFPRINTF (stderr, "\n");                                       \
+      }                                                                 \
+  } while (YYID (0))
 
 /* Nonzero means print parse trace.  It is left uninitialized so that
    multiple parsers can coexist.  */
@@ -2101,18 +2046,10 @@ yyreportSyntaxError (yyGLRStack* yystackp]b4_user_formals[)
          yybool yysize_overflow = yyfalse;
          char* yymsg = NULL;
          enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
+          /* Internationalized format string. */
+          const char *yyformat = 0;
+          /* Arguments of yyformat. */
          char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
-         int yyx;
-         char *yyfmt;
-         char const *yyf;
-         static char const yyunexpected[] = "syntax error, unexpected %s";
-         static char const yyexpecting[] = ", expecting %s";
-         static char const yyor[] = " or %s";
-         char yyformat[sizeof yyunexpected
-                       + sizeof yyexpecting - 1
-                       + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
-                          * (sizeof yyor - 1))];
-         char const *yyprefix = yyexpecting;
 
          /* Start YYX at -YYN if negative to avoid negative indexes in
             YYCHECK.  */
@@ -2121,10 +2058,13 @@ yyreportSyntaxError (yyGLRStack* yystackp]b4_user_formals[)
          /* Stay within bounds of both yycheck and yytname.  */
          int yychecklim = YYLAST - yyn + 1;
          int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
-         int yycount = 1;
 
-         yyarg[0] = yytokenName (yytoken);
-         yyfmt = yystpcpy (yyformat, yyunexpected);
+          /* Number of reported tokens (one for the "unexpected", one per
+             "expected"). */
+          int yycount = 0;
+          int yyx;
+
+         yyarg[yycount++] = yytokenName (yytoken);
 
          for (yyx = yyxbegin; yyx < yyxend; ++yyx)
            if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
@@ -2133,19 +2073,29 @@ yyreportSyntaxError (yyGLRStack* yystackp]b4_user_formals[)
                  {
                    yycount = 1;
                    yysize = yysize0;
-                   yyformat[sizeof yyunexpected - 1] = '\0';
                    break;
                  }
                yyarg[yycount++] = yytokenName (yyx);
                yysize1 = yysize + yytnamerr (NULL, yytokenName (yyx));
                yysize_overflow |= yysize1 < yysize;
                yysize = yysize1;
-               yyfmt = yystpcpy (yyfmt, yyprefix);
-               yyprefix = yyor;
              }
 
-         yyf = YY_(yyformat);
-         yysize1 = yysize + strlen (yyf);
+          switch (yycount)
+            {
+#define YYCASE_(N, S)                           \
+              case N:                           \
+                yyformat = S;                   \
+              break
+              YYCASE_(1, YY_("syntax error, unexpected %s"));
+              YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
+              YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
+              YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
+              YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
+#undef YYCASE_
+            }
+
+         yysize1 = yysize + strlen (yyformat);
          yysize_overflow |= yysize1 < yysize;
          yysize = yysize1;
 
@@ -2156,17 +2106,17 @@ yyreportSyntaxError (yyGLRStack* yystackp]b4_user_formals[)
            {
              char *yyp = yymsg;
              int yyi = 0;
-             while ((*yyp = *yyf))
+             while ((*yyp = *yyformat))
                {
-                 if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
+                 if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
                    {
                      yyp += yytnamerr (yyp, yyarg[yyi++]);
-                     yyf += 2;
+                     yyformat += 2;
                    }
                  else
                    {
                      yyp++;
-                     yyf++;
+                     yyformat++;
                    }
                }
              yyerror (]b4_lyyerror_args[yymsg);
@@ -2625,9 +2575,7 @@ yypdumpstack (yyGLRStack* yystackp)
   YYFPRINTF (stderr, "\n");
 }
 #endif
-]
-
-b4_epilogue
+]b4_epilogue[]dnl
 dnl
 dnl glr.cc produces its own header.
 dnl
@@ -2635,7 +2583,7 @@ m4_if(b4_skeleton, ["glr.c"],
 [b4_defines_if(
 [@output(b4_spec_defines_file@)@
 b4_copyright([Skeleton interface for Bison GLR parsers in C],
-  [2002, 2003, 2004, 2005, 2006])
+             [2002, 2003, 2004, 2005, 2006, 2007, 2008])
 
 b4_shared_declarations
 
@@ -2645,5 +2593,5 @@ b4_pure_if([],
 b4_locations_if([b4_pure_if([],
 [extern YYLTYPE ]b4_prefix[lloc;])
 ])
-])])
+])])[]dnl
 m4_divert_pop(0)