* src/output.c (escaped_output): Renamed from
authorPaul Eggert <eggert@cs.ucla.edu>
Mon, 7 Mar 2005 06:41:39 +0000 (06:41 +0000)
committerPaul Eggert <eggert@cs.ucla.edu>
Mon, 7 Mar 2005 06:41:39 +0000 (06:41 +0000)
escaped_file_name_output, since we now use it for symbol tags as
well.  All uses changed.
(symbol_destructors_output, symbol_printers_output):
Escape symbol tags too.
Problem reported by Matyas Forstner in
<http://lists.gnu.org/archive/html/bug-bison/2005-03/msg00009.html>.

* src/muscle_tab.c (muscle_code_grow): Don't quote numbers; it's
not needed.
* src/output.c (user_actions_output, token_definitions_output,
symbol_destructors_output, symbol_printers_output): Likewise.
* src/reader.c (prologue_augment): Likewise.
* src/scan-gram.l (handle_action_dollar, handle_action_at): Likewise.

ChangeLog
src/muscle_tab.c
src/output.c
src/reader.c
src/scan-gram.l

index fa5787c..e894e20 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,23 @@
+2005-03-06  Paul Eggert  <eggert@cs.ucla.edu>
+
+       * src/output.c (escaped_output): Renamed from
+       escaped_file_name_output, since we now use it for symbol tags as
+       well.  All uses changed.
+       (symbol_destructors_output, symbol_printers_output):
+       Escape symbol tags too.
+       Problem reported by Matyas Forstner in
+       <http://lists.gnu.org/archive/html/bug-bison/2005-03/msg00009.html>.
+
+       * src/muscle_tab.c (muscle_code_grow): Don't quote numbers; it's
+       not needed.
+       * src/output.c (user_actions_output, token_definitions_output,
+       symbol_destructors_output, symbol_printers_output): Likewise.
+       * src/reader.c (prologue_augment): Likewise.
+       * src/scan-gram.l (handle_action_dollar, handle_action_at): Likewise.
+
+       * src/vcg.c (output_edge): Don't quote linestyle arg.
+       Problem reported by twlevo@xs4all.nl.
+
 2005-02-28  Paul Eggert  <eggert@cs.ucla.edu>
 
        * doc/bison.texinfo (Semantic Tokens): Fix scoping problem in
 -----
 
 Copyright (C) 1987, 1988, 1991, 1992, 1993, 1994, 1995, 1996, 1997,
-1998, 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
 
 This file is part of Bison, the GNU Compiler Compiler.
 
index c1f675b..93d44cc 100644 (file)
@@ -1,6 +1,7 @@
 /* Muscle table manager for Bison.
 
-   Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+   Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software
+   Foundation, Inc.
 
    This file is part of Bison, the GNU Compiler Compiler.
 
@@ -163,7 +164,7 @@ void
 muscle_code_grow (const char *key, const char *val, location loc)
 {
   char *extension = NULL;
-  obstack_fgrow1 (&muscle_obstack, "]b4_syncline([[%d]], [[", loc.start.line);
+  obstack_fgrow1 (&muscle_obstack, "]b4_syncline(%d, [[", loc.start.line);
   MUSCLE_OBSTACK_SGROW (&muscle_obstack,
                        quotearg_style (c_quoting_style, loc.start.file));
   obstack_sgrow (&muscle_obstack, "]])[\n");
index 55a3d47..2278784 100644 (file)
@@ -1,6 +1,6 @@
 /* Output the generated parsing program for Bison.
 
-   Copyright (C) 1984, 1986, 1989, 1992, 2000, 2001, 2002, 2003, 2004
+   Copyright (C) 1984, 1986, 1989, 1992, 2000, 2001, 2002, 2003, 2004, 2005
    Free Software Foundation, Inc.
 
    This file is part of Bison, the GNU Compiler Compiler.
@@ -113,17 +113,17 @@ GENERATE_MUSCLE_INSERT_TABLE(muscle_insert_item_number_table, item_number)
 GENERATE_MUSCLE_INSERT_TABLE(muscle_insert_state_number_table, state_number)
 
 
-/*----------------------------------------------------------------------.
-| Print to OUT a representation of FILENAME escaped both for C and M4.  |
-`----------------------------------------------------------------------*/
+/*--------------------------------------------------------------------.
+| Print to OUT a representation of STRING escaped both for C and M4.  |
+`--------------------------------------------------------------------*/
 
 static void
-escaped_file_name_output (FILE *out, char const *filename)
+escaped_output (FILE *out, char const *string)
 {
   char const *p;
   fprintf (out, "[[");
 
-  for (p = quotearg_style (c_quoting_style, filename); *p; p++)
+  for (p = quotearg_style (c_quoting_style, string); *p; p++)
     switch (*p)
       {
       case '$': fputs ("$][", out); break;
@@ -300,9 +300,9 @@ user_actions_output (FILE *out)
       {
        fprintf (out, "  case %d:\n", r + 1);
 
-       fprintf (out, "]b4_syncline([[%d]], ",
+       fprintf (out, "]b4_syncline(%d, ",
                 rules[r].action_location.start.line);
-       escaped_file_name_output (out, rules[r].action_location.start.file);
+       escaped_output (out, rules[r].action_location.start.file);
        fprintf (out, ")[\n");
        fprintf (out, "    %s\n    break;\n\n",
                 rules[r].action);
@@ -375,7 +375,7 @@ token_definitions_output (FILE *out)
       if (strchr (sym->tag, '.') || strchr (sym->tag, '$'))
        continue;
 
-      fprintf (out, "%s[[[%s]], [%d]]",
+      fprintf (out, "%s[[[%s]], %d]",
               sep, sym->tag, number);
       sep = ",\n";
     }
@@ -404,12 +404,10 @@ symbol_destructors_output (FILE *out)
           destructor, optional typename.  */
        fprintf (out, "%s[", sep);
        sep = ",\n";
-       escaped_file_name_output (out, sym->destructor_location.start.file);
-       fprintf (out, ", [[%d]], [[%s]], [[%d]], [[%s]]",
-                sym->destructor_location.start.line,
-                sym->tag,
-                sym->number,
-                sym->destructor);
+       escaped_output (out, sym->destructor_location.start.file);
+       fprintf (out, ", %d, ", sym->destructor_location.start.line);
+       escaped_output (out, sym->tag);
+       fprintf (out, ", %d, [[%s]]", sym->number, sym->destructor);
        if (sym->type_name)
          fprintf (out, ", [[%s]]", sym->type_name);
        fputc (']', out);
@@ -439,12 +437,10 @@ symbol_printers_output (FILE *out)
           printer, optional typename.  */
        fprintf (out, "%s[", sep);
        sep = ",\n";
-       escaped_file_name_output (out, sym->printer_location.start.file);
-       fprintf (out, ", [[%d]], [[%s]], [[%d]], [[%s]]",
-                sym->printer_location.start.line,
-                sym->tag,
-                sym->number,
-                sym->printer);
+       escaped_output (out, sym->printer_location.start.file);
+       fprintf (out, ", %d, ", sym->printer_location.start.line);
+       escaped_output (out, sym->tag);
+       fprintf (out, ", %d, [[%s]]", sym->number, sym->printer);
        if (sym->type_name)
          fprintf (out, ", [[%s]]", sym->type_name);
        fputc (']', out);
index e7016b2..b6200c9 100644 (file)
@@ -1,7 +1,7 @@
 /* Input parser for Bison
 
-   Copyright (C) 1984, 1986, 1989, 1992, 1998, 2000, 2001, 2002, 2003
-   Free Software Foundation, Inc.
+   Copyright (C) 1984, 1986, 1989, 1992, 1998, 2000, 2001, 2002, 2003,
+   2005 Free Software Foundation, Inc.
 
    This file is part of Bison, the GNU Compiler Compiler.
 
@@ -74,7 +74,7 @@ prologue_augment (const char *prologue, location loc)
   struct obstack *oout =
     !typed ? &pre_prologue_obstack : &post_prologue_obstack;
 
-  obstack_fgrow1 (oout, "]b4_syncline([[%d]], [[", loc.start.line);
+  obstack_fgrow1 (oout, "]b4_syncline(%d, [[", loc.start.line);
   MUSCLE_OBSTACK_SGROW (oout,
                        quotearg_style (c_quoting_style, loc.start.file));
   obstack_sgrow (oout, "]])[\n");
index 7541bf9..adf9761 100644 (file)
@@ -1,6 +1,6 @@
 /* Bison Grammar Scanner                             -*- C -*-
 
-   Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
+   Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
 
    This file is part of Bison, the GNU Compiler Compiler.
 
@@ -413,7 +413,7 @@ splice       (\\[ \f\t\v]*\n)*
     unsigned long int c = strtoul (yytext + 1, 0, 8);
     if (UCHAR_MAX < c)
       complain_at (*loc, _("invalid escape sequence: %s"), quote (yytext));
-    else if (! c) 
+    else if (! c)
       complain_at (*loc, _("invalid null character: %s"), quote (yytext));
     else
       obstack_1grow (&obstack_for_string, c);
@@ -805,7 +805,7 @@ handle_action_dollar (char *text, location loc)
          if (!type_name)
            type_name = "";
          obstack_fgrow3 (&obstack_for_string,
-                         "]b4_rhs_value([%d], [%d], [%s])[",
+                         "]b4_rhs_value(%d, %d, [%s])[",
                          rule_length, n, type_name);
        }
       else
@@ -874,7 +874,7 @@ handle_action_at (char *text, location loc)
       if (INT_MIN <= num && num <= rule_length && ! get_errno ())
        {
          int n = num;
-         obstack_fgrow2 (&obstack_for_string, "]b4_rhs_location([%d], [%d])[",
+         obstack_fgrow2 (&obstack_for_string, "]b4_rhs_location(%d, %d)[",
                          rule_length, n);
        }
       else