+2001-12-15 Akim Demaille <akim@epita.fr>
+
+ * src/lex.c, src/lex.h (xgetc): No longer static.
+ * src/reader.c (parse_union_decl): Revamp.
+
2001-12-15 Akim Demaille <akim@epita.fr>
Still making progress in separating Bison into (i) input, (ii)
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
{
int c;
int count = 0;
+ bool done = FALSE;
struct obstack union_obstack;
const char *prologue = "\
#ifndef YYSTYPE\n\
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 != '/')
{
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));
}