]> git.saurik.com Git - bison.git/blobdiff - data/glr.c
Do not let the scan-skel token buffer grow unboundedly in the usual case.
[bison.git] / data / glr.c
index c10bb2d2bd73eba8fad42ef62b38455d840c8db3..2c3a7356bd8686150c099516a148fbf72bc687f6 100644 (file)
@@ -1,8 +1,7 @@
 m4_divert(-1)                                                       -*- C -*-
-m4_include([c.m4])
 
 # GLR skeleton for Bison
-# Copyright (C) 2002 Free Software Foundation, Inc.
+# Copyright (C) 2002, 2003 Free Software Foundation, Inc.
 
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -139,7 +138,7 @@ m4_define([b4_rhs_location],
 m4_changecom()
 m4_divert(0)dnl
 @output @output_parser_name@
-b4_copyright([Skeleton parser for GLR parsing with Bison], [2002])
+b4_copyright([Skeleton parser for GLR parsing with Bison], [2002, 2003])
 [
 /* This is the parser code for GLR (Generalized LR) parser. */
 
@@ -217,11 +216,13 @@ static YYLTYPE yyloc_default;
 ]/* Line __line__ of glr.c.  */
 b4_syncline([@oline@], [@ofile@])
 [
-#if ! defined (__cplusplus)
-   typedef char bool;
-#  define yytrue 1
-#  define yyfalse 0
+#ifdef __cplusplus
+   typedef bool yybool;
+#else
+   typedef unsigned char yybool;
 #endif
+#define yytrue 1
+#define yyfalse 0
 
 /*-----------------.
 | GCC extensions.  |
@@ -537,8 +538,8 @@ typedef struct yyGLRStack yyGLRStack;
 typedef struct yyGLRStateSet yyGLRStateSet;
 
 struct yyGLRState {
-  bool yyisState;
-  bool yyresolved;
+  yybool yyisState;
+  yybool yyresolved;
   yyStateNum yylrState;
   yyGLRState* yypred;
   size_t yyposn;
@@ -555,7 +556,7 @@ struct yyGLRStateSet {
 };
 
 struct yySemanticOption {
-  bool yyisState;
+  yybool yyisState;
   yyRuleNum yyrule;
   yyGLRState* yystate;
   yySemanticOption* yynext;
@@ -714,7 +715,7 @@ yylhsNonterm (yyRuleNum yyrule)
 
 /** True iff LR state STATE has only a default reduction (regardless
  *  of token). */
-static inline bool
+static inline yybool
 yyisDefaultedState (yyStateNum yystate)
 {
   return yyis_pact_ninf (yypact[yystate]);
@@ -773,13 +774,13 @@ yyLRgotoState (yyStateNum yystate, yySymbol yylhs)
     return yydefgoto[yylhs - YYNTOKENS];
 }
 
-static inline bool
+static inline yybool
 yyisShiftAction (int yyaction)
 {
   return 0 < yyaction;
 }
 
-static inline bool
+static inline yybool
 yyisErrorAction (int yyaction)
 {
   return yyaction == 0;
@@ -865,7 +866,7 @@ yyexpandGLRStack (yyGLRStack* yystack]b4_pure_formals[)
        yyn -= 1, yyp0 += 1, yyp1 += 1)
     {
       *yyp1 = *yyp0;
-      if (*(bool*) yyp0)
+      if (*(yybool *) yyp0)
        {
          yyGLRState* yys0 = &yyp0->yystate;
          yyGLRState* yys1 = &yyp1->yystate;
@@ -1124,7 +1125,7 @@ yy_reduce_print (size_t yyk, yyRuleNum yyrule)
  */
 static inline YYRESULTTAG
 yyglrReduce (yyGLRStack* yystack, size_t yyk, yyRuleNum yyrule,
-             bool yyforceEval]b4_pure_formals[)
+             yybool yyforceEval]b4_pure_formals[)
 {
   size_t yyposn = yystack->yytops.yystates[yyk]->yyposn;
 
@@ -1210,7 +1211,7 @@ yysplitStack (yyGLRStack* yystack, int yyk)
 /** True iff Y0 and Y1 represent identical options at the top level.
  *  That is, they represent the same rule applied to RHS symbols
  *  that produce the same terminal symbols. */
-static bool
+static yybool
 yyidenticalOptions (yySemanticOption* yyy0, yySemanticOption* yyy1)
 {
   if (yyy0->yyrule == yyy1->yyrule)
@@ -1919,7 +1920,7 @@ yypdumpstack (yyGLRStack* yystack)
   for (yyp = yystack->yyitems; yyp < yystack->yynextFree; yyp += 1)
     {
       fprintf (stderr, "%3lu. ", (unsigned long) (yyp - yystack->yyitems));
-      if (*(bool*) yyp)
+      if (*(yybool *) yyp)
        {
          fprintf (stderr, "Res: %d, LR State: %d, posn: %lu, pred: %ld",
                   yyp->yystate.yyresolved, yyp->yystate.yylrState,
@@ -1949,7 +1950,7 @@ yypdumpstack (yyGLRStack* yystack)
 b4_epilogue
 m4_if(b4_defines_flag, 0, [],
 [@output @output_header_name@
-b4_copyright([Skeleton parser for GLR parsing with Bison], [2002])
+b4_copyright([Skeleton parser for GLR parsing with Bison], [2002, 2003])
 
 b4_token_defines(b4_tokens)