bug-bison
[Top][All Lists]
Advanced

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

Re: bison 2.0a token quoting change


From: Paul Eggert
Subject: Re: bison 2.0a token quoting change
Date: Fri, 22 Jul 2005 10:12:38 -0700
User-agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux)

Anthony Heading <address@hidden> writes:

> Only remaining question - this array is hidden behind
> #if YYDEBUG || YYERROR_VERBOSE
> neither of which seem necessarily linked to all the
> uses of the token string data.  Could it be
> #if YYDEBUG || YYERROR_VERBOSE || YYTNAME
> instead, just to provide a focussed way of exposing
> the symbol?

Thanks for noticing that bug.  I installed this patch.

2005-07-22  Paul Eggert  <address@hidden>

        Fix problem reported by Anthony Heading.
        * data/glr.c (YYTOKEN_TABLE): New macro.
        (yytname): Define if YYTOKEN_TABLE.
        * data/yacc.c (YYTOKEN_TABLE, yytname): Likewise.
        * data/lalr1.cc (YYTOKEN_TABLE, yytname_): Likewise.
        (YYERROR_VERBOSE): Define the same way the other skeletons do.
        * src/output.c (prepare_symbols): Output token_table_flag.

Index: data/glr.c
===================================================================
RCS file: /cvsroot/bison/bison/data/glr.c,v
retrieving revision 1.108
diff -p -u -r1.108 glr.c
--- data/glr.c  22 Jul 2005 04:56:14 -0000      1.108
+++ data/glr.c  22 Jul 2005 17:03:18 -0000
@@ -172,6 +172,11 @@ b4_pre_prologue[
 # define YYERROR_VERBOSE ]b4_error_verbose[
 #endif
 
+/* Enabling the token table.  */
+#ifndef YYTOKEN_TABLE
+# define YYTOKEN_TABLE ]b4_token_table[
+#endif
+
 #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
 ]m4_ifdef([b4_stype],
 [b4_syncline([b4_stype_line], [b4_filename])
@@ -331,7 +336,7 @@ static const ]b4_int_type_for([b4_rline]
 };
 #endif
 
-#if (YYDEBUG) || YYERROR_VERBOSE
+#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
    First, the terminals, then, starting at YYNTOKENS, nonterminals. */
 static const char *const yytname[] =
Index: data/lalr1.cc
===================================================================
RCS file: /cvsroot/bison/bison/data/lalr1.cc,v
retrieving revision 1.90
diff -p -u -r1.90 lalr1.cc
--- data/lalr1.cc       21 Jul 2005 20:53:03 -0000      1.90
+++ data/lalr1.cc       22 Jul 2005 17:03:18 -0000
@@ -149,11 +149,19 @@ b4_syncline(address@hidden@], address@hidden@])[
 # define YYDEBUG ]b4_debug[
 #endif
 
-/* Enabling verbose error message.  */
-#ifndef YYERROR_VERBOSE
+/* Enabling verbose error messages.  */
+#ifdef YYERROR_VERBOSE
+# undef YYERROR_VERBOSE
+# define YYERROR_VERBOSE 1
+#else
 # define YYERROR_VERBOSE ]b4_error_verbose[
 #endif
 
+/* Enabling the token table.  */
+#ifndef YYTOKEN_TABLE
+# define YYTOKEN_TABLE ]b4_token_table[
+#endif
+
 #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
 ]m4_ifdef([b4_stype],
 [b4_syncline([b4_stype_line], [b4_filename])
@@ -321,7 +329,7 @@ namespace yy
     /// For a rule, its RHS length.
     static const ]b4_int_type_for([b4_r2])[ yyr2_[];
 
-#if YYDEBUG || YYERROR_VERBOSE
+#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
     /// For a symbol, its name in clear.
     static const char* const yytname_[];
 #endif
@@ -1030,7 +1038,7 @@ yy::]b4_parser_class_name[::yyr2_[] =
   ]b4_r2[
 };
 
-#if YYDEBUG || YYERROR_VERBOSE
+#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
    First, the terminals, then, starting at \a yyntokens_, nonterminals. */
 const char*
Index: data/yacc.c
===================================================================
RCS file: /cvsroot/bison/bison/data/yacc.c,v
retrieving revision 1.99
diff -p -u -r1.99 yacc.c
--- data/yacc.c 21 Jul 2005 20:53:03 -0000      1.99
+++ data/yacc.c 22 Jul 2005 17:03:19 -0000
@@ -182,6 +182,11 @@ b4_location_if([#define yylloc b4_prefix
 # define YYERROR_VERBOSE ]b4_error_verbose[
 #endif
 
+/* Enabling the token table.  */
+#ifndef YYTOKEN_TABLE
+# define YYTOKEN_TABLE ]b4_token_table[
+#endif
+
 #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
 ]m4_ifdef([b4_stype],
 [b4_syncline([b4_stype_line], [b4_filename])
@@ -415,7 +420,7 @@ static const ]b4_int_type_for([b4_rline]
 };
 #endif
 
-#if YYDEBUG || YYERROR_VERBOSE
+#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
    First, the terminals, then, starting at YYNTOKENS, nonterminals. */
 static const char *const yytname[] =
Index: src/output.c
===================================================================
RCS file: /cvsroot/bison/bison/src/output.c,v
retrieving revision 1.233
diff -p -u -r1.233 output.c
--- src/output.c        21 Jul 2005 20:53:03 -0000      1.233
+++ src/output.c        22 Jul 2005 17:03:19 -0000
@@ -145,6 +145,7 @@ escaped_output (FILE *out, char const *s
 static void
 prepare_symbols (void)
 {
+  MUSCLE_INSERT_BOOL ("token_table", token_table_flag);
   MUSCLE_INSERT_INT ("tokens_number", ntokens);
   MUSCLE_INSERT_INT ("nterms_number", nvars);
   MUSCLE_INSERT_INT ("undef_token_number", undeftoken->number);




reply via email to

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