mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-13 22:33:03 +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:
@@ -228,7 +228,8 @@ prologue_declaration:
|
||||
code_props_plain_init (&plain_code, $1, @1);
|
||||
code_props_translate_code (&plain_code);
|
||||
gram_scanner_last_string_free ();
|
||||
prologue_augment (plain_code.code, @1, union_seen);
|
||||
muscle_code_grow (union_seen ? "post_prologue" : "pre_prologue",
|
||||
plain_code.code, @1);
|
||||
code_scanner_last_string_free ();
|
||||
}
|
||||
| "%debug" { debug_flag = true; }
|
||||
@@ -350,28 +351,11 @@ union_name:
|
||||
;
|
||||
|
||||
grammar_declaration:
|
||||
"%union" union_name "{...}"
|
||||
"%union" union_name braceless
|
||||
{
|
||||
char const *body = $3;
|
||||
|
||||
/* Concatenate the %union bodies. If this is the first %union, make sure
|
||||
the synchronization line appears after the opening '{' so as not to
|
||||
confuse Doxygen. Otherwise, turn the previous %union's trailing '}'
|
||||
into '\n', and omit the new %union's leading '{'. */
|
||||
if (!union_seen)
|
||||
{
|
||||
muscle_grow ("stype", "{", "");
|
||||
}
|
||||
else
|
||||
{
|
||||
char *code = muscle_find ("stype");
|
||||
code[strlen (code) - 1] = '\n';
|
||||
}
|
||||
body++;
|
||||
|
||||
union_seen = true;
|
||||
muscle_code_grow ("stype", body, @3);
|
||||
gram_scanner_last_string_free ();
|
||||
muscle_code_grow ("stype", $3, @3);
|
||||
code_scanner_last_string_free ();
|
||||
}
|
||||
;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user