]> git.saurik.com Git - bison.git/blobdiff - data/glr.c
Regen.
[bison.git] / data / glr.c
index 9998612b23467a9c23362d14a62cef8ebd4afc0b..3e49a5f23a87bc49f557207f6b2035a25583847c 100644 (file)
@@ -1,7 +1,7 @@
                                                                     -*- C -*-
 
 # GLR skeleton for Bison
-# Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software
+# Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software
 # Foundation, Inc.
 
 # This program is free software: you can redistribute it and/or modify
@@ -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.  */
 
@@ -232,7 +232,7 @@ b4_defines_if([[#include "@basename(]b4_spec_defines_file[@)"]],
 # undef YYERROR_VERBOSE
 # define YYERROR_VERBOSE 1
 #else
-# define YYERROR_VERBOSE ]b4_error_verbose_flag[
+# define YYERROR_VERBOSE ]b4_error_verbose_if([1], [0])[
 #endif
 
 /* Enabling the token table.  */
@@ -500,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
 
@@ -511,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.  */
@@ -1363,8 +1366,7 @@ do {                                      \
 `----------------------------------------------------------*/
 
 /*ARGSUSED*/ static inline void
-yy_reduce_print (yyGLRStack* yystackp, size_t yyk, yyRuleNum yyrule,
-                YYSTYPE* yyvalp, YYLTYPE* yylocp]b4_user_formals[)
+yy_reduce_print (yyGLRStack* yystackp, size_t yyk, yyRuleNum yyrule]b4_user_formals[)
 {
   int yynrhs = yyrhsLength (yyrule);
   yybool yynormal __attribute__ ((__unused__)) =
@@ -1372,8 +1374,6 @@ yy_reduce_print (yyGLRStack* yystackp, size_t yyk, yyRuleNum yyrule,
   yyGLRStackItem* yyvsp = (yyGLRStackItem*) yystackp->yytops.yystates[yyk];
   int yylow = 1;
   int yyi;
-  YYUSE (yyvalp);
-  YYUSE (yylocp);
 ]b4_parse_param_use[]dnl
 [  YYFPRINTF (stderr, "Reducing stack %lu by rule %d (line %lu):\n",
             (unsigned long int) yyk, yyrule - 1,
@@ -1414,7 +1414,7 @@ yyglrReduce (yyGLRStack* yystackp, size_t yyk, yyRuleNum yyrule,
       YYSTYPE yysval;
       YYLTYPE yyloc;
 
-      YY_REDUCE_PRINT ((yystackp, yyk, yyrule, &yysval, &yyloc]b4_user_args[));
+      YY_REDUCE_PRINT ((yystackp, yyk, yyrule]b4_user_args[));
       YYCHK (yydoAction (yystackp, yyk, yyrule, &yysval,
                         &yyloc]b4_user_args[));
       YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyrule], &yysval, &yyloc);
@@ -2043,18 +2043,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.  */
@@ -2063,10 +2055,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)
@@ -2075,19 +2070,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;
 
@@ -2098,17 +2103,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);
@@ -2567,9 +2572,7 @@ yypdumpstack (yyGLRStack* yystackp)
   YYFPRINTF (stderr, "\n");
 }
 #endif
-]
-
-b4_epilogue
+]b4_epilogue[]dnl
 dnl
 dnl glr.cc produces its own header.
 dnl
@@ -2577,7 +2580,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
 
@@ -2587,5 +2590,5 @@ b4_pure_if([],
 b4_locations_if([b4_pure_if([],
 [extern YYLTYPE ]b4_prefix[lloc;])
 ])
-])])
+])])[]dnl
 m4_divert_pop(0)