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:
32
ChangeLog
32
ChangeLog
@@ -1,3 +1,35 @@
|
|||||||
|
2007-01-09 Paolo Bonzini <bonzini@gnu.org>
|
||||||
|
and Joel E. Denny <jdenny@ces.clemson.edu>
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
2007-01-08 Joel E. Denny <jdenny@ces.clemson.edu>
|
2007-01-08 Joel E. Denny <jdenny@ces.clemson.edu>
|
||||||
|
|
||||||
Remove quotes from variables names in %define directives and from
|
Remove quotes from variables names in %define directives and from
|
||||||
|
|||||||
@@ -155,6 +155,8 @@ m4_define([b4_fatal_at],
|
|||||||
## ---------------- ##
|
## ---------------- ##
|
||||||
|
|
||||||
# m4_define_default([b4_lex_param], []) dnl breaks other skeletons
|
# m4_define_default([b4_lex_param], []) dnl breaks other skeletons
|
||||||
|
m4_define_default([b4_pre_prologue], [])
|
||||||
|
m4_define_default([b4_post_prologue], [])
|
||||||
m4_define_default([b4_epilogue], [])
|
m4_define_default([b4_epilogue], [])
|
||||||
m4_define_default([b4_parse_param], [])
|
m4_define_default([b4_parse_param], [])
|
||||||
|
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ m4_define([b4_user_args],
|
|||||||
# If defined, b4_parse_param arrives double quoted, but below we prefer
|
# If defined, b4_parse_param arrives double quoted, but below we prefer
|
||||||
# it to be single quoted.
|
# it to be single quoted.
|
||||||
m4_define([b4_parse_param],
|
m4_define([b4_parse_param],
|
||||||
b4_parse_param))
|
b4_parse_param)
|
||||||
|
|
||||||
|
|
||||||
# b4_parse_param_for(DECL, FORMAL, BODY)
|
# b4_parse_param_for(DECL, FORMAL, BODY)
|
||||||
|
|||||||
@@ -180,8 +180,9 @@ b4_token_enums(b4_tokens)
|
|||||||
[#ifndef YYSTYPE
|
[#ifndef YYSTYPE
|
||||||
]m4_ifdef([b4_stype],
|
]m4_ifdef([b4_stype],
|
||||||
[[typedef union ]b4_union_name[
|
[[typedef union ]b4_union_name[
|
||||||
|
{
|
||||||
]b4_user_stype[
|
]b4_user_stype[
|
||||||
YYSTYPE;
|
} YYSTYPE;
|
||||||
# define YYSTYPE_IS_TRIVIAL 1]],
|
# define YYSTYPE_IS_TRIVIAL 1]],
|
||||||
[m4_if(b4_tag_seen_flag, 0,
|
[m4_if(b4_tag_seen_flag, 0,
|
||||||
[[typedef int YYSTYPE;
|
[[typedef int YYSTYPE;
|
||||||
|
|||||||
@@ -280,8 +280,9 @@ namespace ]b4_namespace[
|
|||||||
#ifndef YYSTYPE
|
#ifndef YYSTYPE
|
||||||
]m4_ifdef([b4_stype],
|
]m4_ifdef([b4_stype],
|
||||||
[ union semantic_type
|
[ union semantic_type
|
||||||
|
{
|
||||||
b4_user_stype
|
b4_user_stype
|
||||||
;],
|
};],
|
||||||
[m4_if(b4_tag_seen_flag, 0,
|
[m4_if(b4_tag_seen_flag, 0,
|
||||||
[[ typedef int semantic_type;]],
|
[[ typedef int semantic_type;]],
|
||||||
[[ typedef YYSTYPE semantic_type;]])])[
|
[[ typedef YYSTYPE semantic_type;]])])[
|
||||||
|
|||||||
@@ -108,8 +108,9 @@ namespace ]b4_namespace[
|
|||||||
#ifndef YYSTYPE
|
#ifndef YYSTYPE
|
||||||
]m4_ifdef([b4_stype],
|
]m4_ifdef([b4_stype],
|
||||||
[ union semantic_type
|
[ union semantic_type
|
||||||
|
{
|
||||||
b4_user_stype
|
b4_user_stype
|
||||||
;],
|
};],
|
||||||
[m4_if(b4_tag_seen_flag, 0,
|
[m4_if(b4_tag_seen_flag, 0,
|
||||||
[[ typedef int semantic_type;]],
|
[[ typedef int semantic_type;]],
|
||||||
[[ typedef YYSTYPE semantic_type;]])])[
|
[[ typedef YYSTYPE semantic_type;]])])[
|
||||||
|
|||||||
@@ -205,8 +205,9 @@ b4_token_enums_defines(b4_tokens)[
|
|||||||
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
|
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
|
||||||
]m4_ifdef([b4_stype],
|
]m4_ifdef([b4_stype],
|
||||||
[[typedef union ]b4_union_name[
|
[[typedef union ]b4_union_name[
|
||||||
|
{
|
||||||
]b4_user_stype[
|
]b4_user_stype[
|
||||||
YYSTYPE;
|
} YYSTYPE;
|
||||||
# define YYSTYPE_IS_TRIVIAL 1]],
|
# define YYSTYPE_IS_TRIVIAL 1]],
|
||||||
[m4_if(b4_tag_seen_flag, 0,
|
[m4_if(b4_tag_seen_flag, 0,
|
||||||
[[typedef int YYSTYPE;
|
[[typedef int YYSTYPE;
|
||||||
@@ -1660,8 +1661,9 @@ b4_token_enums_defines(b4_tokens)
|
|||||||
[#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
|
[#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
|
||||||
]m4_ifdef([b4_stype],
|
]m4_ifdef([b4_stype],
|
||||||
[[typedef union ]b4_union_name[
|
[[typedef union ]b4_union_name[
|
||||||
|
{
|
||||||
]b4_user_stype[
|
]b4_user_stype[
|
||||||
YYSTYPE;
|
} YYSTYPE;
|
||||||
# define YYSTYPE_IS_TRIVIAL 1]],
|
# define YYSTYPE_IS_TRIVIAL 1]],
|
||||||
[m4_if(b4_tag_seen_flag, 0,
|
[m4_if(b4_tag_seen_flag, 0,
|
||||||
[[typedef int YYSTYPE;
|
[[typedef int YYSTYPE;
|
||||||
|
|||||||
@@ -192,8 +192,9 @@ b4_token_enums_defines(b4_tokens)[
|
|||||||
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
|
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
|
||||||
]m4_ifdef([b4_stype],
|
]m4_ifdef([b4_stype],
|
||||||
[[typedef union ]b4_union_name[
|
[[typedef union ]b4_union_name[
|
||||||
|
{
|
||||||
]b4_user_stype[
|
]b4_user_stype[
|
||||||
YYSTYPE;
|
} YYSTYPE;
|
||||||
# define YYSTYPE_IS_TRIVIAL 1]],
|
# define YYSTYPE_IS_TRIVIAL 1]],
|
||||||
[m4_if(b4_tag_seen_flag, 0,
|
[m4_if(b4_tag_seen_flag, 0,
|
||||||
[[typedef int YYSTYPE;
|
[[typedef int YYSTYPE;
|
||||||
@@ -1497,8 +1498,9 @@ b4_token_enums_defines(b4_tokens)
|
|||||||
[#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
|
[#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
|
||||||
]m4_ifdef([b4_stype],
|
]m4_ifdef([b4_stype],
|
||||||
[[typedef union ]b4_union_name[
|
[[typedef union ]b4_union_name[
|
||||||
|
{
|
||||||
]b4_user_stype[
|
]b4_user_stype[
|
||||||
YYSTYPE;
|
} YYSTYPE;
|
||||||
# define YYSTYPE_IS_TRIVIAL 1]],
|
# define YYSTYPE_IS_TRIVIAL 1]],
|
||||||
[m4_if(b4_tag_seen_flag, 0,
|
[m4_if(b4_tag_seen_flag, 0,
|
||||||
[[typedef int YYSTYPE;
|
[[typedef int YYSTYPE;
|
||||||
|
|||||||
@@ -35,9 +35,6 @@
|
|||||||
#include "getargs.h"
|
#include "getargs.h"
|
||||||
#include "gram.h"
|
#include "gram.h"
|
||||||
|
|
||||||
struct obstack pre_prologue_obstack;
|
|
||||||
struct obstack post_prologue_obstack;
|
|
||||||
|
|
||||||
/* Initializing some values below (such SPEC_NAME_PREFIX to `yy') is
|
/* Initializing some values below (such SPEC_NAME_PREFIX to `yy') is
|
||||||
tempting, but don't do that: for the time being our handling of the
|
tempting, but don't do that: for the time being our handling of the
|
||||||
%directive vs --option leaves precedence to the options by deciding
|
%directive vs --option leaves precedence to the options by deciding
|
||||||
|
|||||||
@@ -49,11 +49,6 @@ extern char *spec_defines_file;
|
|||||||
/* Directory prefix of output file names. */
|
/* Directory prefix of output file names. */
|
||||||
extern char *dir_prefix;
|
extern char *dir_prefix;
|
||||||
|
|
||||||
|
|
||||||
/* If semantic parser, output a .h file that defines YYSTYPE... */
|
|
||||||
extern struct obstack pre_prologue_obstack;
|
|
||||||
extern struct obstack post_prologue_obstack;
|
|
||||||
|
|
||||||
/* The file name as given on the command line.
|
/* The file name as given on the command line.
|
||||||
Not named "input_file" because Flex uses this name for an argument,
|
Not named "input_file" because Flex uses this name for an argument,
|
||||||
and therefore GCC warns about a name clash. */
|
and therefore GCC warns about a name clash. */
|
||||||
|
|||||||
@@ -191,18 +191,15 @@ muscle_code_grow (const char *key, const char *val, location loc)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*-------------------------------------------------------------------.
|
|
||||||
| MUSCLE is an M4 list of pairs. Create or extend it with the pair |
|
|
||||||
| (A1, A2). Note that because the muscle values are output *double* |
|
|
||||||
| quoted, one needs to strip the first level of quotes to reach the |
|
|
||||||
| list itself. |
|
|
||||||
`-------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
void muscle_pair_list_grow (const char *muscle,
|
void muscle_pair_list_grow (const char *muscle,
|
||||||
const char *a1, const char *a2)
|
const char *a1, const char *a2)
|
||||||
{
|
{
|
||||||
char *pair;
|
char *pair;
|
||||||
obstack_fgrow2 (&muscle_obstack, "[[[%s]], [[%s]]]", a1, a2);
|
obstack_sgrow (&muscle_obstack, "[[[");
|
||||||
|
MUSCLE_OBSTACK_SGROW (&muscle_obstack, a1);
|
||||||
|
obstack_sgrow (&muscle_obstack, "]], [[");
|
||||||
|
MUSCLE_OBSTACK_SGROW (&muscle_obstack, a2);
|
||||||
|
obstack_sgrow (&muscle_obstack, "]]]");
|
||||||
obstack_1grow (&muscle_obstack, 0);
|
obstack_1grow (&muscle_obstack, 0);
|
||||||
pair = obstack_finish (&muscle_obstack);
|
pair = obstack_finish (&muscle_obstack);
|
||||||
muscle_grow (muscle, pair, ",\n");
|
muscle_grow (muscle, pair, ",\n");
|
||||||
|
|||||||
@@ -104,10 +104,9 @@ void muscle_code_grow (const char *key, const char *value, location loc);
|
|||||||
|
|
||||||
|
|
||||||
/* MUSCLE is an M4 list of pairs. Create or extend it with the pair
|
/* MUSCLE is an M4 list of pairs. Create or extend it with the pair
|
||||||
(A1, A2). Note that because the muscle values are output *double*
|
(A1, A2) after escaping both values with digraphs. Note that because the
|
||||||
quoted, one needs to strip the first level of quotes to reach the
|
muscle values are output *double* quoted, one needs to strip the first level
|
||||||
list itself. */
|
of quotes to reach the list itself. */
|
||||||
|
|
||||||
void muscle_pair_list_grow (const char *muscle,
|
void muscle_pair_list_grow (const char *muscle,
|
||||||
const char *a1, const char *a2);
|
const char *a1, const char *a2);
|
||||||
|
|
||||||
|
|||||||
@@ -595,12 +595,6 @@ prepare (void)
|
|||||||
DEFINE (spec_verbose_file);
|
DEFINE (spec_verbose_file);
|
||||||
#undef DEFINE
|
#undef DEFINE
|
||||||
|
|
||||||
/* User Code. */
|
|
||||||
obstack_1grow (&pre_prologue_obstack, 0);
|
|
||||||
obstack_1grow (&post_prologue_obstack, 0);
|
|
||||||
muscle_insert ("pre_prologue", obstack_finish (&pre_prologue_obstack));
|
|
||||||
muscle_insert ("post_prologue", obstack_finish (&post_prologue_obstack));
|
|
||||||
|
|
||||||
/* Find the right skeleton file, and add muscles about the skeletons. */
|
/* Find the right skeleton file, and add muscles about the skeletons. */
|
||||||
if (skeleton)
|
if (skeleton)
|
||||||
MUSCLE_INSERT_C_STRING ("skeleton", skeleton);
|
MUSCLE_INSERT_C_STRING ("skeleton", skeleton);
|
||||||
@@ -639,6 +633,4 @@ output (void)
|
|||||||
output_skeleton ();
|
output_skeleton ();
|
||||||
|
|
||||||
obstack_free (&format_obstack, NULL);
|
obstack_free (&format_obstack, NULL);
|
||||||
obstack_free (&pre_prologue_obstack, NULL);
|
|
||||||
obstack_free (&post_prologue_obstack, NULL);
|
|
||||||
}
|
}
|
||||||
|
|||||||
633
src/parse-gram.c
633
src/parse-gram.c
File diff suppressed because it is too large
Load Diff
@@ -100,72 +100,14 @@
|
|||||||
PERCENT_UNION = 313
|
PERCENT_UNION = 313
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
/* Tokens. */
|
|
||||||
#define GRAM_EOF 0
|
|
||||||
#define STRING 258
|
|
||||||
#define INT 259
|
|
||||||
#define PERCENT_TOKEN 260
|
|
||||||
#define PERCENT_NTERM 261
|
|
||||||
#define PERCENT_TYPE 262
|
|
||||||
#define PERCENT_DESTRUCTOR 263
|
|
||||||
#define PERCENT_PRINTER 264
|
|
||||||
#define PERCENT_LEFT 265
|
|
||||||
#define PERCENT_RIGHT 266
|
|
||||||
#define PERCENT_NONASSOC 267
|
|
||||||
#define PERCENT_PREC 268
|
|
||||||
#define PERCENT_DPREC 269
|
|
||||||
#define PERCENT_MERGE 270
|
|
||||||
#define PERCENT_CODE 271
|
|
||||||
#define PERCENT_DEBUG 272
|
|
||||||
#define PERCENT_DEFAULT_PREC 273
|
|
||||||
#define PERCENT_DEFINE 274
|
|
||||||
#define PERCENT_DEFINES 275
|
|
||||||
#define PERCENT_ERROR_VERBOSE 276
|
|
||||||
#define PERCENT_EXPECT 277
|
|
||||||
#define PERCENT_EXPECT_RR 278
|
|
||||||
#define PERCENT_FILE_PREFIX 279
|
|
||||||
#define PERCENT_GLR_PARSER 280
|
|
||||||
#define PERCENT_INITIAL_ACTION 281
|
|
||||||
#define PERCENT_LANGUAGE 282
|
|
||||||
#define PERCENT_LEX_PARAM 283
|
|
||||||
#define PERCENT_LOCATIONS 284
|
|
||||||
#define PERCENT_NAME_PREFIX 285
|
|
||||||
#define PERCENT_NO_DEFAULT_PREC 286
|
|
||||||
#define PERCENT_NO_LINES 287
|
|
||||||
#define PERCENT_NONDETERMINISTIC_PARSER 288
|
|
||||||
#define PERCENT_OUTPUT 289
|
|
||||||
#define PERCENT_PARSE_PARAM 290
|
|
||||||
#define PERCENT_PURE_PARSER 291
|
|
||||||
#define PERCENT_PUSH_PARSER 292
|
|
||||||
#define PERCENT_PUSH_PULL_PARSER 293
|
|
||||||
#define PERCENT_REQUIRE 294
|
|
||||||
#define PERCENT_SKELETON 295
|
|
||||||
#define PERCENT_START 296
|
|
||||||
#define PERCENT_TOKEN_TABLE 297
|
|
||||||
#define PERCENT_VERBOSE 298
|
|
||||||
#define PERCENT_YACC 299
|
|
||||||
#define BRACED_CODE 300
|
|
||||||
#define CHAR 301
|
|
||||||
#define EPILOGUE 302
|
|
||||||
#define EQUAL 303
|
|
||||||
#define ID 304
|
|
||||||
#define ID_COLON 305
|
|
||||||
#define PERCENT_PERCENT 306
|
|
||||||
#define PIPE 307
|
|
||||||
#define PROLOGUE 308
|
|
||||||
#define SEMICOLON 309
|
|
||||||
#define TYPE 310
|
|
||||||
#define TYPE_TAG_ANY 311
|
|
||||||
#define TYPE_TAG_NONE 312
|
|
||||||
#define PERCENT_UNION 313
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
|
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
|
||||||
typedef union YYSTYPE
|
typedef union YYSTYPE
|
||||||
{
|
{
|
||||||
/* Line 1535 of yacc.c */
|
|
||||||
|
/* Line 1537 of yacc.c */
|
||||||
#line 97 "parse-gram.y"
|
#line 97 "parse-gram.y"
|
||||||
|
|
||||||
symbol *symbol;
|
symbol *symbol;
|
||||||
@@ -176,11 +118,12 @@ typedef union YYSTYPE
|
|||||||
assoc assoc;
|
assoc assoc;
|
||||||
uniqstr uniqstr;
|
uniqstr uniqstr;
|
||||||
unsigned char character;
|
unsigned char character;
|
||||||
}
|
|
||||||
|
|
||||||
/* Line 1535 of yacc.c */
|
|
||||||
#line 183 "parse-gram.h"
|
|
||||||
YYSTYPE;
|
/* Line 1537 of yacc.c */
|
||||||
|
#line 126 "parse-gram.h"
|
||||||
|
} YYSTYPE;
|
||||||
# define YYSTYPE_IS_TRIVIAL 1
|
# define YYSTYPE_IS_TRIVIAL 1
|
||||||
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
|
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
|
||||||
# define YYSTYPE_IS_DECLARED 1
|
# define YYSTYPE_IS_DECLARED 1
|
||||||
|
|||||||
@@ -228,7 +228,8 @@ prologue_declaration:
|
|||||||
code_props_plain_init (&plain_code, $1, @1);
|
code_props_plain_init (&plain_code, $1, @1);
|
||||||
code_props_translate_code (&plain_code);
|
code_props_translate_code (&plain_code);
|
||||||
gram_scanner_last_string_free ();
|
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 ();
|
code_scanner_last_string_free ();
|
||||||
}
|
}
|
||||||
| "%debug" { debug_flag = true; }
|
| "%debug" { debug_flag = true; }
|
||||||
@@ -350,28 +351,11 @@ union_name:
|
|||||||
;
|
;
|
||||||
|
|
||||||
grammar_declaration:
|
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;
|
union_seen = true;
|
||||||
muscle_code_grow ("stype", body, @3);
|
muscle_code_grow ("stype", $3, @3);
|
||||||
gram_scanner_last_string_free ();
|
code_scanner_last_string_free ();
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|||||||
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->class = token_sym;
|
||||||
undeftoken->number = ntokens++;
|
undeftoken->number = ntokens++;
|
||||||
|
|
||||||
/* Initialize the obstacks. */
|
|
||||||
obstack_init (&pre_prologue_obstack);
|
|
||||||
obstack_init (&post_prologue_obstack);
|
|
||||||
|
|
||||||
gram_in = xfopen (grammar_file, "r");
|
gram_in = xfopen (grammar_file, "r");
|
||||||
|
|
||||||
gram__flex_debug = trace_flag & trace_scan;
|
gram__flex_debug = trace_flag & trace_scan;
|
||||||
|
|||||||
@@ -44,7 +44,6 @@ char const *token_name (int type);
|
|||||||
|
|
||||||
/* From reader.c. */
|
/* From reader.c. */
|
||||||
void grammar_start_symbol_set (symbol *sym, location loc);
|
void grammar_start_symbol_set (symbol *sym, location loc);
|
||||||
void prologue_augment (const char *prologue, location loc, bool post);
|
|
||||||
void grammar_current_rule_begin (symbol *lhs, location loc);
|
void grammar_current_rule_begin (symbol *lhs, location loc);
|
||||||
void grammar_current_rule_end (location loc);
|
void grammar_current_rule_end (location loc);
|
||||||
void grammar_midrule_action (void);
|
void grammar_midrule_action (void);
|
||||||
|
|||||||
Reference in New Issue
Block a user