[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
parse_union_decl
From: |
Akim Demaille |
Subject: |
parse_union_decl |
Date: |
15 Dec 2001 16:08:14 +0100 |
User-agent: |
Gnus/5.0808 (Gnus v5.8.8) XEmacs/21.4 (Civil Service) |
Index: ChangeLog
from Akim Demaille <address@hidden>
* src/lex.c, src/lex.h (xgetc): No longer static.
* src/reader.c (parse_union_decl): Revamp.
Index: src/lex.c
===================================================================
RCS file: /cvsroot/bison/bison/src/lex.c,v
retrieving revision 1.49
diff -u -u -r1.49 lex.c
--- src/lex.c 14 Dec 2001 16:03:28 -0000 1.49
+++ src/lex.c 15 Dec 2001 15:12:47 -0000
@@ -130,7 +130,7 @@
| Do a getc, but give error message if EOF encountered |
`-----------------------------------------------------*/
-static int
+int
xgetc (FILE *f)
{
int c = getc (f);
Index: src/lex.h
===================================================================
RCS file: /cvsroot/bison/bison/src/lex.h,v
retrieving revision 1.24
diff -u -u -r1.24 lex.h
--- src/lex.h 14 Dec 2001 16:03:28 -0000 1.24
+++ src/lex.h 15 Dec 2001 15:12:47 -0000
@@ -66,6 +66,7 @@
int skip_white_space PARAMS ((void));
void unlex PARAMS ((token_t));
void read_type_name PARAMS ((FILE *fin));
+int xgetc PARAMS ((FILE *fin));
/* Return one of the token-type codes. When an identifier is seen,
the code IDENTIFIER is returned and the name is looked up in the
Index: src/reader.c
===================================================================
RCS file: /cvsroot/bison/bison/src/reader.c,v
retrieving revision 1.119
diff -u -u -r1.119 reader.c
--- src/reader.c 15 Dec 2001 14:14:30 -0000 1.119
+++ src/reader.c 15 Dec 2001 15:12:47 -0000
@@ -753,6 +753,7 @@
{
int c;
int count = 0;
+ bool done = FALSE;
struct obstack union_obstack;
const char *prologue = "\
#ifndef YYSTYPE\n\
@@ -779,10 +780,10 @@
if (defines_flag)
obstack_sgrow (&defines_obstack, prologue);
- c = getc (finput);
-
- while (c != EOF)
+ while (!done)
{
+ c = xgetc (finput);
+
/* If C contains '/', it is output by copy_comment (). */
if (c != '/')
{
@@ -806,26 +807,24 @@
break;
case '}':
+ /* FIXME: Errr. How could this happen???. --akim */
if (count == 0)
complain (_("unmatched %s"), "`}'");
count--;
- if (count <= 0)
- {
- if (defines_flag)
- obstack_sgrow (&defines_obstack, epilogue);
- /* 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;
- }
+ if (!count)
+ done = TRUE;
+ break;
}
-
- c = getc (finput);
}
+ if (defines_flag)
+ obstack_sgrow (&defines_obstack, epilogue);
+ /* 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));
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- parse_union_decl,
Akim Demaille <=