]> git.saurik.com Git - bison.git/blobdiff - data/glr.c
* data/glr.c: Switch to Bison 2.2 special-exception language in
[bison.git] / data / glr.c
index a810bcdc4e0f9e036f8df48236f453a98078f945..29ea3bc7b4ba8ce3e9a7eb0bea6933d704804e5e 100644 (file)
@@ -143,14 +143,27 @@ m4_define([b4_rhs_location],
 m4_changecom()
 m4_divert(0)dnl
 @output @output_parser_name@
-b4_copyright([Skeleton parser for GLR parsing with Bison],
+b4_copyright([Skeleton implementation for Bison GLR parsers in C],
   [2002, 2003, 2004, 2005, 2006])
 [
-/* This is the parser code for GLR (Generalized LR) parser.  */
+/* As a special exception, you may create a larger work that contains
+   part or all of the Bison parser skeleton and distribute that work
+   under terms of your choice, so long as that work isn't itself a
+   parser generator using the skeleton or a modified version thereof
+   as a parser skeleton.  Alternatively, if you modify or redistribute
+   the parser skeleton itself, you may (at your option) remove this
+   special exception, which will cause the skeleton and the resulting
+   Bison output files to be licensed under the GNU General Public
+   License without this special exception.
+
+   This special exception was added by the Free Software Foundation in
+   version 2.2 of Bison.  */
+
+/* C GLR parser skeleton written by Paul Hilfinger.  */
 
 ]b4_identification
 
-m4_if(b4_prefix[], [yy], [],
+m4_if(b4_prefix, [yy], [],
 [/* Substitute the variable and function names.  */
 #define yyparse b4_prefix[]parse
 #define yylex   b4_prefix[]lex
@@ -1803,43 +1816,43 @@ yyreportAmbiguity (yySemanticOption* yyx0,
   return yyabort;
 }
 
-/** Starting at and including state S, resolve the location for each of the
- *  previous N states that is unresolved.  The first semantic option of a state
+/** Starting at and including state S1, resolve the location for each of the
+ *  previous N1 states that is unresolved.  The first semantic option of a state
  *  is always chosen.  */
 static void
-yyresolveLocations (yyGLRState* yys, int yyn,
+yyresolveLocations (yyGLRState* yys1, int yyn1,
                    yyGLRStack *yystackp]b4_user_formals[)
 {
-  if (0 < yyn)
+  if (0 < yyn1)
     {
-      yyresolveLocations (yys->yypred, yyn-1, yystackp]b4_user_args[);
-      if (!yys->yyresolved)
+      yyresolveLocations (yys1->yypred, yyn1 - 1, yystackp]b4_user_args[);
+      if (!yys1->yyresolved)
        {
          yySemanticOption *yyoption;
-         yyGLRStackItem yyrhs[1 + YYMAXRHS];
+         yyGLRStackItem yyrhsloc[1 + YYMAXRHS];
          int yynrhs;
          int yychar_current;
          YYSTYPE yylval_current;
          YYLTYPE yylloc_current;
-         yyoption = yys->yysemantics.yyfirstVal;
+         yyoption = yys1->yysemantics.yyfirstVal;
          YYASSERT (yyoption != NULL);
          yynrhs = yyrhsLength (yyoption->yyrule);
          if (yynrhs > 0)
            {
              yyGLRState *yys;
-             int yyi;
+             int yyn;
              yyresolveLocations (yyoption->yystate, yynrhs,
                                  yystackp]b4_user_args[);
-             for (yys = yyoption->yystate, yyi = yynrhs;
-                  yyi >= 1;
-                  yys = yys->yypred, yyi -= 1)
-               yyrhs[yyi].yystate.yyloc = yys->yyloc;
+             for (yys = yyoption->yystate, yyn = yynrhs;
+                  yyn > 0;
+                  yys = yys->yypred, yyn -= 1)
+               yyrhsloc[yyn].yystate.yyloc = yys->yyloc;
            }
          else
            {
              yyGLRState *yyprevious = yyoption->yystate;
              YYASSERT (yyprevious->yyresolved);
-             yyrhs[0].yystate.yyloc = yyprevious->yyloc;
+             yyrhsloc[0].yystate.yyloc = yyprevious->yyloc;
            }
          yychar_current = yychar;
          yylval_current = yylval;
@@ -1847,7 +1860,7 @@ yyresolveLocations (yyGLRState* yys, int yyn,
          yychar = yyoption->yyrawchar;
          yylval = yyoption->yyval;
          yylloc = yyoption->yyloc;
-         YYLLOC_DEFAULT ((yys->yyloc), yyrhs, yynrhs);
+         YYLLOC_DEFAULT ((yys1->yyloc), yyrhsloc, yynrhs);
          yychar = yychar_current;
          yylval = yylval_current;
          yylloc = yylloc_current;
@@ -2597,10 +2610,21 @@ yypdumpstack (yyGLRStack* yystackp)
 b4_epilogue
 m4_if(b4_defines_flag, 0, [],
 [@output @output_header_name@
-b4_copyright([Skeleton parser for GLR parsing with Bison],
-            [2002, 2003, 2004, 2005, 2006])[
-
-/* C GLR parser skeleton written by Paul Hilfinger.  */
+b4_copyright([Skeleton interface for Bison GLR parsers in C],
+  [2002, 2003, 2004, 2005, 2006])
+[
+/* As a special exception, you may create a larger work that contains
+   part or all of the Bison parser skeleton and distribute that work
+   under terms of your choice, so long as that work isn't itself a
+   parser generator using the skeleton or a modified version thereof
+   as a parser skeleton.  Alternatively, if you modify or redistribute
+   the parser skeleton itself, you may (at your option) remove this
+   special exception, which will cause the skeleton and the resulting
+   Bison output files to be licensed under the GNU General Public
+   License without this special exception.
+
+   This special exception was added by the Free Software Foundation in
+   version 2.2 of Bison.  */
 ]
 
 b4_shared_declarations