[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Main] FYI Repair %union.
From: |
Pascal Bart |
Subject: |
[Main] FYI Repair %union. |
Date: |
Sun, 23 Sep 2001 17:34:18 +0000 (GMT) |
Hello,
here is a patch, which repairs the %union specification. I wasn't
able to delete C code output from reader, the problem is that YYSTYPE can
be an union or an int.
Index: ChangeLog
===================================================================
RCS file: /cvsroot/bison/bison/ChangeLog,v
retrieving revision 1.220
diff -u -r1.220 ChangeLog
--- ChangeLog 2001/09/22 22:02:34 1.220
+++ ChangeLog 2001/09/23 15:28:20
@@ -1,5 +1,16 @@
2001-09-23 Pascal Bart <address@hidden>
+ * 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 <address@hidden>
+
* src/bison.simple: Add new `#line' directive.
2001-09-22 Pascal Bart <address@hidden>
Index: src/bison.simple
===================================================================
RCS file: /cvsroot/bison/bison/src/bison.simple,v
retrieving revision 1.66
diff -u -r1.66 bison.simple
--- src/bison.simple 2001/09/22 22:02:34 1.66
+++ src/bison.simple 2001/09/23 15:28:20
@@ -111,8 +111,9 @@
# define YYDEBUG %%debug
#endif
+#line %%input_line "%%filename"
#ifndef YYSTYPE
-# define YYSTYPE %%stype
+typedef %%stype YYSTYPE;
#endif
#ifndef YYLTYPE
Index: src/reader.c
===================================================================
RCS file: /cvsroot/bison/bison/src/reader.c,v
retrieving revision 1.88
diff -u -r1.88 reader.c
--- src/reader.c 2001/09/21 16:25:19 1.88
+++ src/reader.c 2001/09/23 15:28:21
@@ -735,9 +735,9 @@
/*--------------------------------------------------------------.
-| Copy the union declaration into ATTRS_OBSTACK (and fdefines), |
-| where it is made into the definition of YYSTYPE, the type of |
-| elements of the parser value stack. |
+| Copy the union declaration into the stype muscle |
+| (and fdefines), where it is made into the definition of |
+| YYSTYPE, the type of elements of the parser value stack. |
`--------------------------------------------------------------*/
static void
@@ -745,23 +745,18 @@
{
int c;
int count = 0;
+ struct obstack union_obstack;
if (typed)
complain (_("multiple %s declarations"), "%union");
typed = 1;
-
- if (!no_lines_flag)
- {
- obstack_fgrow2 (&attrs_obstack, muscle_find ("linef"),
- lineno, quotearg_style (c_quoting_style,
- muscle_find("filename")));
- }
- else
+ if (no_lines_flag)
obstack_1grow (&attrs_obstack, '\n');
- obstack_sgrow (&attrs_obstack, "typedef union");
+ obstack_init (&union_obstack);
+ obstack_sgrow (&union_obstack, "union");
if (defines_flag)
obstack_sgrow (&defines_obstack, "typedef union");
@@ -769,7 +764,7 @@
while (c != EOF)
{
- obstack_1grow (&attrs_obstack, c);
+ obstack_1grow (&union_obstack, c);
if (defines_flag)
obstack_1grow (&defines_obstack, c);
@@ -780,7 +775,7 @@
break;
case '/':
- copy_comment2 (finput, &defines_obstack, &attrs_obstack);
+ copy_comment2 (finput, &defines_obstack, &union_obstack);
break;
case '{':
@@ -793,19 +788,21 @@
count--;
if (count <= 0)
{
- obstack_sgrow (&attrs_obstack, " YYSTYPE;\n");
if (defines_flag)
obstack_sgrow (&defines_obstack, " YYSTYPE;\n");
/* JF don't choke on trailing semi */
c = skip_white_space ();
if (c != ';')
ungetc (c, finput);
+ obstack_1grow (&union_obstack, 0);
+ muscle_insert ("stype", obstack_finish (&union_obstack));
return;
}
}
c = getc (finput);
}
+
}
Pascal Bart (address@hidden)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Main] FYI Repair %union.,
Pascal Bart <=