mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-09 12:23:04 +00:00
Simplify union and prologue handling, and escape union and lex/parse
params with digraphs.
* data/bison.m4 (b4_pre_prologue, b4_post_prologue): Set their default
values to the empty string since these are no longer guaranteed
initialized by the front-end.
* data/glr.c, data/glr.cc, data/lalr1.cc, data/push.c, data/yacc.c: Add
braces around b4_user_stype since this is no longer done by the
front-end.
* src/files.c, src/files.h (pre_prologue_obstack,
post_prologue_obstack): Remove.
* src/muscle_tab.c (muscle_pair_list_grow): Don't duplicate header
comments here. Use MUSCLE_OBSTACK_SGROW so that values are escaped
with digraphs. This fixes lex params and parse params.
* src/muscle_tab.h (muscle_pair_list_grow): Update comments.
* src/output.c (prepare): Remove muscle insertion of the prologues.
(output): Remove freeing of pre_prologue_obstack and
post_prologue_obstack.
* src/parse-gram.y (prologue_declaration): Use muscle_code_grow rather
than prologue_augment for prologue parsing so you don't need prologue
obstacks.
(grammar_declaration): Use `braceless' instead of "{...}" so that
braces are already stripped and code is escaped with digraphs.
* src/reader.c (prologue_augment): Remove.
(reader): Remove initialization of pre_prologue_obstack and
post_prologue_obstack.
* src/reader.h (prologue_augment): Remove.
* data/c.m4: Remove stray parenthesis.
This commit is contained in:
25
src/reader.c
25
src/reader.c
@@ -69,27 +69,6 @@ grammar_start_symbol_set (symbol *sym, location loc)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------.
|
||||
| There are two prologues: one before the first %union and one after. |
|
||||
| Augment the one specified by POST. |
|
||||
`---------------------------------------------------------------------*/
|
||||
|
||||
void
|
||||
prologue_augment (const char *prologue, location loc, bool post)
|
||||
{
|
||||
struct obstack *oout =
|
||||
!post ? &pre_prologue_obstack : &post_prologue_obstack;
|
||||
|
||||
obstack_fgrow1 (oout, "]b4_syncline(%d, [[", loc.start.line);
|
||||
/* FIXME: Protection of M4 characters missing here. See
|
||||
output.c:escaped_output. */
|
||||
MUSCLE_OBSTACK_SGROW (oout,
|
||||
quotearg_style (c_quoting_style, loc.start.file));
|
||||
obstack_sgrow (oout, "]])[\n");
|
||||
obstack_sgrow (oout, prologue);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------.
|
||||
@@ -585,10 +564,6 @@ reader (void)
|
||||
undeftoken->class = token_sym;
|
||||
undeftoken->number = ntokens++;
|
||||
|
||||
/* Initialize the obstacks. */
|
||||
obstack_init (&pre_prologue_obstack);
|
||||
obstack_init (&post_prologue_obstack);
|
||||
|
||||
gram_in = xfopen (grammar_file, "r");
|
||||
|
||||
gram__flex_debug = trace_flag & trace_scan;
|
||||
|
||||
Reference in New Issue
Block a user