mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-09 12:23:04 +00:00
* src/lex.c, src/lex.h (xgetc): No longer static.
* src/reader.c (parse_union_decl): Revamp.
This commit is contained in:
@@ -1,3 +1,8 @@
|
||||
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)
|
||||
|
||||
@@ -130,7 +130,7 @@ skip_white_space (void)
|
||||
| Do a getc, but give error message if EOF encountered |
|
||||
`-----------------------------------------------------*/
|
||||
|
||||
static int
|
||||
int
|
||||
xgetc (FILE *f)
|
||||
{
|
||||
int c = getc (f);
|
||||
|
||||
@@ -66,6 +66,7 @@ void lex_free PARAMS ((void));
|
||||
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
|
||||
|
||||
33
src/reader.c
33
src/reader.c
@@ -753,6 +753,7 @@ parse_union_decl (void)
|
||||
{
|
||||
int c;
|
||||
int count = 0;
|
||||
bool done = FALSE;
|
||||
struct obstack union_obstack;
|
||||
const char *prologue = "\
|
||||
#ifndef YYSTYPE\n\
|
||||
@@ -779,10 +780,10 @@ typedef union";
|
||||
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 @@ typedef union";
|
||||
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));
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user