mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-18 00:33:03 +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>
|
2001-12-15 Akim Demaille <akim@epita.fr>
|
||||||
|
|
||||||
Still making progress in separating Bison into (i) input, (ii)
|
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 |
|
| Do a getc, but give error message if EOF encountered |
|
||||||
`-----------------------------------------------------*/
|
`-----------------------------------------------------*/
|
||||||
|
|
||||||
static int
|
int
|
||||||
xgetc (FILE *f)
|
xgetc (FILE *f)
|
||||||
{
|
{
|
||||||
int c = getc (f);
|
int c = getc (f);
|
||||||
|
|||||||
@@ -66,6 +66,7 @@ void lex_free PARAMS ((void));
|
|||||||
int skip_white_space PARAMS ((void));
|
int skip_white_space PARAMS ((void));
|
||||||
void unlex PARAMS ((token_t));
|
void unlex PARAMS ((token_t));
|
||||||
void read_type_name PARAMS ((FILE *fin));
|
void read_type_name PARAMS ((FILE *fin));
|
||||||
|
int xgetc PARAMS ((FILE *fin));
|
||||||
|
|
||||||
/* Return one of the token-type codes. When an identifier is seen,
|
/* 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
|
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 c;
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
bool done = FALSE;
|
||||||
struct obstack union_obstack;
|
struct obstack union_obstack;
|
||||||
const char *prologue = "\
|
const char *prologue = "\
|
||||||
#ifndef YYSTYPE\n\
|
#ifndef YYSTYPE\n\
|
||||||
@@ -779,10 +780,10 @@ typedef union";
|
|||||||
if (defines_flag)
|
if (defines_flag)
|
||||||
obstack_sgrow (&defines_obstack, prologue);
|
obstack_sgrow (&defines_obstack, prologue);
|
||||||
|
|
||||||
c = getc (finput);
|
while (!done)
|
||||||
|
|
||||||
while (c != EOF)
|
|
||||||
{
|
{
|
||||||
|
c = xgetc (finput);
|
||||||
|
|
||||||
/* If C contains '/', it is output by copy_comment (). */
|
/* If C contains '/', it is output by copy_comment (). */
|
||||||
if (c != '/')
|
if (c != '/')
|
||||||
{
|
{
|
||||||
@@ -806,26 +807,24 @@ typedef union";
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case '}':
|
case '}':
|
||||||
|
/* FIXME: Errr. How could this happen???. --akim */
|
||||||
if (count == 0)
|
if (count == 0)
|
||||||
complain (_("unmatched %s"), "`}'");
|
complain (_("unmatched %s"), "`}'");
|
||||||
count--;
|
count--;
|
||||||
if (count <= 0)
|
if (!count)
|
||||||
{
|
done = TRUE;
|
||||||
if (defines_flag)
|
break;
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
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