mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-20 09:43:03 +00:00
* 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.
This commit is contained in:
22
ChangeLog
22
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>
|
2005-02-28 Paul Eggert <eggert@cs.ucla.edu>
|
||||||
|
|
||||||
* doc/bison.texinfo (Semantic Tokens): Fix scoping problem in
|
* doc/bison.texinfo (Semantic Tokens): Fix scoping problem in
|
||||||
@@ -13160,7 +13180,7 @@
|
|||||||
-----
|
-----
|
||||||
|
|
||||||
Copyright (C) 1987, 1988, 1991, 1992, 1993, 1994, 1995, 1996, 1997,
|
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.
|
This file is part of Bison, the GNU Compiler Compiler.
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
/* Muscle table manager for Bison.
|
/* 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.
|
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)
|
muscle_code_grow (const char *key, const char *val, location loc)
|
||||||
{
|
{
|
||||||
char *extension = NULL;
|
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,
|
MUSCLE_OBSTACK_SGROW (&muscle_obstack,
|
||||||
quotearg_style (c_quoting_style, loc.start.file));
|
quotearg_style (c_quoting_style, loc.start.file));
|
||||||
obstack_sgrow (&muscle_obstack, "]])[\n");
|
obstack_sgrow (&muscle_obstack, "]])[\n");
|
||||||
|
|||||||
38
src/output.c
38
src/output.c
@@ -1,6 +1,6 @@
|
|||||||
/* Output the generated parsing program for Bison.
|
/* 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.
|
Free Software Foundation, Inc.
|
||||||
|
|
||||||
This file is part of Bison, the GNU Compiler Compiler.
|
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)
|
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
|
static void
|
||||||
escaped_file_name_output (FILE *out, char const *filename)
|
escaped_output (FILE *out, char const *string)
|
||||||
{
|
{
|
||||||
char const *p;
|
char const *p;
|
||||||
fprintf (out, "[[");
|
fprintf (out, "[[");
|
||||||
|
|
||||||
for (p = quotearg_style (c_quoting_style, filename); *p; p++)
|
for (p = quotearg_style (c_quoting_style, string); *p; p++)
|
||||||
switch (*p)
|
switch (*p)
|
||||||
{
|
{
|
||||||
case '$': fputs ("$][", out); break;
|
case '$': fputs ("$][", out); break;
|
||||||
@@ -300,9 +300,9 @@ user_actions_output (FILE *out)
|
|||||||
{
|
{
|
||||||
fprintf (out, " case %d:\n", r + 1);
|
fprintf (out, " case %d:\n", r + 1);
|
||||||
|
|
||||||
fprintf (out, "]b4_syncline([[%d]], ",
|
fprintf (out, "]b4_syncline(%d, ",
|
||||||
rules[r].action_location.start.line);
|
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, ")[\n");
|
||||||
fprintf (out, " %s\n break;\n\n",
|
fprintf (out, " %s\n break;\n\n",
|
||||||
rules[r].action);
|
rules[r].action);
|
||||||
@@ -375,7 +375,7 @@ token_definitions_output (FILE *out)
|
|||||||
if (strchr (sym->tag, '.') || strchr (sym->tag, '$'))
|
if (strchr (sym->tag, '.') || strchr (sym->tag, '$'))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
fprintf (out, "%s[[[%s]], [%d]]",
|
fprintf (out, "%s[[[%s]], %d]",
|
||||||
sep, sym->tag, number);
|
sep, sym->tag, number);
|
||||||
sep = ",\n";
|
sep = ",\n";
|
||||||
}
|
}
|
||||||
@@ -404,12 +404,10 @@ symbol_destructors_output (FILE *out)
|
|||||||
destructor, optional typename. */
|
destructor, optional typename. */
|
||||||
fprintf (out, "%s[", sep);
|
fprintf (out, "%s[", sep);
|
||||||
sep = ",\n";
|
sep = ",\n";
|
||||||
escaped_file_name_output (out, sym->destructor_location.start.file);
|
escaped_output (out, sym->destructor_location.start.file);
|
||||||
fprintf (out, ", [[%d]], [[%s]], [[%d]], [[%s]]",
|
fprintf (out, ", %d, ", sym->destructor_location.start.line);
|
||||||
sym->destructor_location.start.line,
|
escaped_output (out, sym->tag);
|
||||||
sym->tag,
|
fprintf (out, ", %d, [[%s]]", sym->number, sym->destructor);
|
||||||
sym->number,
|
|
||||||
sym->destructor);
|
|
||||||
if (sym->type_name)
|
if (sym->type_name)
|
||||||
fprintf (out, ", [[%s]]", sym->type_name);
|
fprintf (out, ", [[%s]]", sym->type_name);
|
||||||
fputc (']', out);
|
fputc (']', out);
|
||||||
@@ -439,12 +437,10 @@ symbol_printers_output (FILE *out)
|
|||||||
printer, optional typename. */
|
printer, optional typename. */
|
||||||
fprintf (out, "%s[", sep);
|
fprintf (out, "%s[", sep);
|
||||||
sep = ",\n";
|
sep = ",\n";
|
||||||
escaped_file_name_output (out, sym->printer_location.start.file);
|
escaped_output (out, sym->printer_location.start.file);
|
||||||
fprintf (out, ", [[%d]], [[%s]], [[%d]], [[%s]]",
|
fprintf (out, ", %d, ", sym->printer_location.start.line);
|
||||||
sym->printer_location.start.line,
|
escaped_output (out, sym->tag);
|
||||||
sym->tag,
|
fprintf (out, ", %d, [[%s]]", sym->number, sym->printer);
|
||||||
sym->number,
|
|
||||||
sym->printer);
|
|
||||||
if (sym->type_name)
|
if (sym->type_name)
|
||||||
fprintf (out, ", [[%s]]", sym->type_name);
|
fprintf (out, ", [[%s]]", sym->type_name);
|
||||||
fputc (']', out);
|
fputc (']', out);
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/* Input parser for Bison
|
/* Input parser for Bison
|
||||||
|
|
||||||
Copyright (C) 1984, 1986, 1989, 1992, 1998, 2000, 2001, 2002, 2003
|
Copyright (C) 1984, 1986, 1989, 1992, 1998, 2000, 2001, 2002, 2003,
|
||||||
Free Software Foundation, Inc.
|
2005 Free Software Foundation, Inc.
|
||||||
|
|
||||||
This file is part of Bison, the GNU Compiler Compiler.
|
This file is part of Bison, the GNU Compiler Compiler.
|
||||||
|
|
||||||
@@ -74,7 +74,7 @@ prologue_augment (const char *prologue, location loc)
|
|||||||
struct obstack *oout =
|
struct obstack *oout =
|
||||||
!typed ? &pre_prologue_obstack : &post_prologue_obstack;
|
!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,
|
MUSCLE_OBSTACK_SGROW (oout,
|
||||||
quotearg_style (c_quoting_style, loc.start.file));
|
quotearg_style (c_quoting_style, loc.start.file));
|
||||||
obstack_sgrow (oout, "]])[\n");
|
obstack_sgrow (oout, "]])[\n");
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/* Bison Grammar Scanner -*- C -*-
|
/* 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.
|
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);
|
unsigned long int c = strtoul (yytext + 1, 0, 8);
|
||||||
if (UCHAR_MAX < c)
|
if (UCHAR_MAX < c)
|
||||||
complain_at (*loc, _("invalid escape sequence: %s"), quote (yytext));
|
complain_at (*loc, _("invalid escape sequence: %s"), quote (yytext));
|
||||||
else if (! c)
|
else if (! c)
|
||||||
complain_at (*loc, _("invalid null character: %s"), quote (yytext));
|
complain_at (*loc, _("invalid null character: %s"), quote (yytext));
|
||||||
else
|
else
|
||||||
obstack_1grow (&obstack_for_string, c);
|
obstack_1grow (&obstack_for_string, c);
|
||||||
@@ -805,7 +805,7 @@ handle_action_dollar (char *text, location loc)
|
|||||||
if (!type_name)
|
if (!type_name)
|
||||||
type_name = "";
|
type_name = "";
|
||||||
obstack_fgrow3 (&obstack_for_string,
|
obstack_fgrow3 (&obstack_for_string,
|
||||||
"]b4_rhs_value([%d], [%d], [%s])[",
|
"]b4_rhs_value(%d, %d, [%s])[",
|
||||||
rule_length, n, type_name);
|
rule_length, n, type_name);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -874,7 +874,7 @@ handle_action_at (char *text, location loc)
|
|||||||
if (INT_MIN <= num && num <= rule_length && ! get_errno ())
|
if (INT_MIN <= num && num <= rule_length && ! get_errno ())
|
||||||
{
|
{
|
||||||
int n = num;
|
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);
|
rule_length, n);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
Reference in New Issue
Block a user