bison-patches
[Top][All Lists]
Advanced

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

bison.simple, bison.c++ and regression.at patch for yyr1 type


From: Paul Hilfinger
Subject: bison.simple, bison.c++ and regression.at patch for yyr1 type
Date: Mon, 20 May 2002 16:06:36 -0700

The type given for yyr1's elements in bison.simple is guaranteed to 
contain only terminal symbols.  yyr1, however, consists of
non-terminals, and so needs a wider type in general.  The attached
patch (previously discussed, now committed) fixes this problem.

Paul Hilfinger

----------------------------------------------------------------------

2002-05-20  Paul Hilfinger  <address@hidden>

        * data/bison.simple (yyr1): Don't use yy_token_number_type as element
        type; it isn't always big enough, since it doesn't necessarily
        include non-terminals.
        (yytranslate): Expand definition of yy_token_number_type, so that 
        the latter can be removed.
        (yy_token_number_type): Remove, only one use.
        * data/bison.c++ (r1_): Parallel change to yyr1 in bison.simple---
        don't use TokenNumberType as element type.
        
        * tests/regression.at: Modify expected output to agree with change
        to yyr1 and yytranslate.
        
Index: data/bison.c++
===================================================================
RCS file: /cvsroot/bison/bison/data/bison.c++,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -p -r1.30 -r1.31
--- data/bison.c++      13 May 2002 00:27:26 -0000      1.30
+++ data/bison.c++      20 May 2002 22:56:53 -0000      1.31
@@ -260,7 +260,7 @@ namespace yy
     static const short defgoto_[[]];
     static const short table_[[]];
     static const short check_[[]];
-    static const TokenNumberType r1_[[]];
+    static const b4_uint_type(b4_r1_max) r1_[[]];
     static const b4_uint_type(b4_r2_max) r2_[[]];
 
 #if YYDEBUG || YYERROR_VERBOSE
@@ -687,7 +687,7 @@ yy::b4_name::check_[[]] =
 };
 
 /* YYR1[[YYN]] -- Symbol number of symbol that rule YYN derives.  */
-const yy::b4_name::TokenNumberType
+const b4_uint_type(b4_r1_max)
 yy::b4_name::r1_[[]] =
 {
   b4_r1
cvs server: data/bison.hairy no longer exists, no comparison available
Index: data/bison.simple
===================================================================
RCS file: /cvsroot/bison/bison/data/bison.simple,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -p -r1.25 -r1.26
--- data/bison.simple   13 May 2002 00:27:26 -0000      1.25
+++ data/bison.simple   20 May 2002 22:56:53 -0000      1.26
@@ -332,12 +332,11 @@ b4_token_defines(b4_tokens)
 #define YYUNDEFTOK  b4_undef_token_number
 #define YYMAXUTOK   b4_user_token_number_max
 
-typedef b4_uint_type(b4_translate_max) yy_token_number_type;
 #define YYTRANSLATE(X) \
   ((unsigned)(X) <= YYMAXUTOK ? yytranslate[[X]] : YYUNDEFTOK)
 
 /* YYTRANSLATE[[YYLEX]] -- Bison symbol number corresponding to YYLEX.  */
-static const yy_token_number_type yytranslate[[]] =
+static const b4_uint_type(b4_translate_max) yytranslate[[]] =
 {
   b4_translate
 };
@@ -379,7 +378,7 @@ static const short yytoknum[[]] =
 };
 
 /* YYR1[[YYN]] -- Symbol number of symbol that rule YYN derives.  */
-static const yy_token_number_type yyr1[[]] =
+static const b4_uint_type(b4_r1_max) yyr1[[]] =
 {
   b4_r1
 };
Index: tests/regression.at
===================================================================
RCS file: /cvsroot/bison/bison/tests/regression.at,v
retrieving revision 1.48
retrieving revision 1.49
diff -u -p -r1.48 -r1.49
--- tests/regression.at 13 May 2002 08:56:20 -0000      1.48
+++ tests/regression.at 20 May 2002 22:56:53 -0000      1.49
@@ -463,7 +463,7 @@ AT_CHECK([bison -v input.y -o input.c])
 # Check only the tables.  We don't use --no-parser, because it is
 # still to be implemented in the experimental branch of Bison.
 AT_CHECK([[sed -n 's/  *$//;/^static const.*\[\] =/,/^}/p' input.c]], 0,
-[[static const yy_token_number_type yytranslate[] =
+[[static const unsigned char yytranslate[] =
 {
        0,     2,     2,     2,     2,     2,     2,     2,     2,     2,
        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
@@ -515,7 +515,7 @@ static const short yytoknum[] =
 {
        0,   256,   257,   258,   259,   260,   261,    -1
 };
-static const yy_token_number_type yyr1[] =
+static const unsigned char yyr1[] =
 {
        0,     7,     8,     9,     9,    10,    11
 };



reply via email to

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