mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-20 09:43:03 +00:00
* src/reader.c (parse_union_decl): Add new obstack union_obstack. Which
will contain `%union' declaration. (parse_union_decl): Delete #line directive output. (parse_union_decl): Substitute /attrs_obstack/union_obstack for all informations about %union. (parse_union_decl): Copy the union_obstack in the muscle stype. * src/bison.simple: Add new #line directive. Add typdef %%stype YYSTYPE.
This commit is contained in:
11
ChangeLog
11
ChangeLog
@@ -1,3 +1,14 @@
|
|||||||
|
2001-09-23 Pascal Bart <pascal.bart@epita.fr>
|
||||||
|
|
||||||
|
* src/reader.c (parse_union_decl): Add new obstack union_obstack. Which
|
||||||
|
will contain `%union' declaration.
|
||||||
|
(parse_union_decl): Delete #line directive output.
|
||||||
|
(parse_union_decl): Substitute /attrs_obstack/union_obstack for all
|
||||||
|
informations about %union.
|
||||||
|
(parse_union_decl): Copy the union_obstack in the muscle stype.
|
||||||
|
* src/bison.simple: Add new #line directive.
|
||||||
|
Add typdef %%stype YYSTYPE.
|
||||||
|
|
||||||
2001-09-23 Pascal Bart <pascal.bart@epita.fr>
|
2001-09-23 Pascal Bart <pascal.bart@epita.fr>
|
||||||
|
|
||||||
* src/bison.simple: Add new `#line' directive.
|
* src/bison.simple: Add new `#line' directive.
|
||||||
|
|||||||
@@ -111,8 +111,9 @@
|
|||||||
# define YYDEBUG %%debug
|
# define YYDEBUG %%debug
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#line %%input_line "%%filename"
|
||||||
#ifndef YYSTYPE
|
#ifndef YYSTYPE
|
||||||
# define YYSTYPE %%stype
|
typedef %%stype YYSTYPE;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef YYLTYPE
|
#ifndef YYLTYPE
|
||||||
|
|||||||
27
src/reader.c
27
src/reader.c
@@ -735,9 +735,9 @@ token_buffer);
|
|||||||
|
|
||||||
|
|
||||||
/*--------------------------------------------------------------.
|
/*--------------------------------------------------------------.
|
||||||
| Copy the union declaration into ATTRS_OBSTACK (and fdefines), |
|
| Copy the union declaration into the stype muscle |
|
||||||
| where it is made into the definition of YYSTYPE, the type of |
|
| (and fdefines), where it is made into the definition of |
|
||||||
| elements of the parser value stack. |
|
| YYSTYPE, the type of elements of the parser value stack. |
|
||||||
`--------------------------------------------------------------*/
|
`--------------------------------------------------------------*/
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -745,23 +745,18 @@ parse_union_decl (void)
|
|||||||
{
|
{
|
||||||
int c;
|
int c;
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
struct obstack union_obstack;
|
||||||
|
|
||||||
if (typed)
|
if (typed)
|
||||||
complain (_("multiple %s declarations"), "%union");
|
complain (_("multiple %s declarations"), "%union");
|
||||||
|
|
||||||
typed = 1;
|
typed = 1;
|
||||||
|
|
||||||
|
if (no_lines_flag)
|
||||||
if (!no_lines_flag)
|
|
||||||
{
|
|
||||||
obstack_fgrow2 (&attrs_obstack, muscle_find ("linef"),
|
|
||||||
lineno, quotearg_style (c_quoting_style,
|
|
||||||
muscle_find("filename")));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
obstack_1grow (&attrs_obstack, '\n');
|
obstack_1grow (&attrs_obstack, '\n');
|
||||||
|
|
||||||
obstack_sgrow (&attrs_obstack, "typedef union");
|
obstack_init (&union_obstack);
|
||||||
|
obstack_sgrow (&union_obstack, "union");
|
||||||
if (defines_flag)
|
if (defines_flag)
|
||||||
obstack_sgrow (&defines_obstack, "typedef union");
|
obstack_sgrow (&defines_obstack, "typedef union");
|
||||||
|
|
||||||
@@ -769,7 +764,7 @@ parse_union_decl (void)
|
|||||||
|
|
||||||
while (c != EOF)
|
while (c != EOF)
|
||||||
{
|
{
|
||||||
obstack_1grow (&attrs_obstack, c);
|
obstack_1grow (&union_obstack, c);
|
||||||
if (defines_flag)
|
if (defines_flag)
|
||||||
obstack_1grow (&defines_obstack, c);
|
obstack_1grow (&defines_obstack, c);
|
||||||
|
|
||||||
@@ -780,7 +775,7 @@ parse_union_decl (void)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case '/':
|
case '/':
|
||||||
copy_comment2 (finput, &defines_obstack, &attrs_obstack);
|
copy_comment2 (finput, &defines_obstack, &union_obstack);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case '{':
|
case '{':
|
||||||
@@ -793,19 +788,21 @@ parse_union_decl (void)
|
|||||||
count--;
|
count--;
|
||||||
if (count <= 0)
|
if (count <= 0)
|
||||||
{
|
{
|
||||||
obstack_sgrow (&attrs_obstack, " YYSTYPE;\n");
|
|
||||||
if (defines_flag)
|
if (defines_flag)
|
||||||
obstack_sgrow (&defines_obstack, " YYSTYPE;\n");
|
obstack_sgrow (&defines_obstack, " YYSTYPE;\n");
|
||||||
/* JF don't choke on trailing semi */
|
/* JF don't choke on trailing semi */
|
||||||
c = skip_white_space ();
|
c = skip_white_space ();
|
||||||
if (c != ';')
|
if (c != ';')
|
||||||
ungetc (c, finput);
|
ungetc (c, finput);
|
||||||
|
obstack_1grow (&union_obstack, 0);
|
||||||
|
muscle_insert ("stype", obstack_finish (&union_obstack));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
c = getc (finput);
|
c = getc (finput);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user