* src/muscle_tab.h (MUSCLE_INSERT_INT, MUSCLE_INSERT_STRING)

(MUSCLE_INSERT_PREFIX): ...to there.
* src/output.c (MUSCLE_INSERT_INT, MUSCLE_INSERT_STRING)
(MUSCLE_INSERT_PREFIX): Move from here...
* src/bison.hairy: Add a section directive.  Put braces around muscle
names.  This parser skeleton is still broken, but Bison should not
choke on a bad muscle 'syntax'.
* src/bison.simple: Add a section directive.  Put braces around muscle
names.
* src/files.h (strsuffix, stringappend): Add declarations.
(tab_extension): Add declaration.
(short_base_name): Add declaration.
* src/files.c (strsuffix, stringappend): No longer static.  These
functions are used in the skeleton parser.
(tab_extension): New.
(compute_base_names): Use the computations done in this function
to guess if the generated parsers should have '.tab' in their
names.
(short_base_name): No longer static.
* src/output.c (output_skeleton): New.
(output): Disable call to output_master_parser, and give a try to
a new skeleton handling system.
(guards_output, actions_output): No longer static.
(token_definitions_output, get_lines_number): No longer static.
* configure.in: Use AM_PROG_LEX and AC_PROG_YACC.
* src/Makefile.am (bison_SOURCES): Add scan-skel.l and
parse-skel.y.
* src/parse-skel.y: New file.
* src/scan-skel.l: New file.
This commit is contained in:
Robert Anisko
2001-12-30 15:01:06 +00:00
parent 3cd5bcdd19
commit 9b3add5beb
11 changed files with 411 additions and 80 deletions

View File

@@ -125,7 +125,7 @@ static struct obstack format_obstack;
int error_verbose = 0;
/* Returns the number of lines of S. */
static size_t
size_t
get_lines_number (const char *s)
{
size_t lines = 0;
@@ -503,7 +503,7 @@ token_actions (void)
| Output the actions to OOUT. |
`-----------------------------*/
static void
void
actions_output (FILE *out, size_t *line)
{
int rule;
@@ -539,7 +539,7 @@ actions_output (FILE *out, size_t *line)
| Output the guards to OOUT. |
`----------------------------*/
static void
void
guards_output (FILE *out, size_t *line)
{
int rule;
@@ -571,7 +571,7 @@ guards_output (FILE *out, size_t *line)
| Output the tokens definition to OOUT. |
`---------------------------------------*/
static void
void
token_definitions_output (FILE *out, size_t *line)
{
int i;
@@ -1042,6 +1042,11 @@ static void
output_master_parser (void)
{
FILE *parser = xfopen (parser_file_name, "w");
/* FIXME: Remove the two following lines. */
printf ("Test: %s\n", infile);
printf ("Test: %s\n", parser_file_name);
if (!skeleton)
{
if (semantic_parser)
@@ -1056,29 +1061,24 @@ output_master_parser (void)
xfclose (parser);
}
/* Call the skeleton parser. */
/* FIXME. */
static
void
output_skeleton ()
{
/* Find the right skeleton file. */
if (!skeleton)
{
if (semantic_parser)
skeleton = skeleton_find ("BISON_HAIRY", BISON_HAIRY);
else
skeleton = skeleton_find ("BISON_SIMPLE", BISON_SIMPLE);
}
#define MUSCLE_INSERT_INT(Key, Value) \
{ \
obstack_fgrow1 (&muscle_obstack, "%d", Value); \
obstack_1grow (&muscle_obstack, 0); \
muscle_insert (Key, obstack_finish (&muscle_obstack)); \
}
#define MUSCLE_INSERT_STRING(Key, Value) \
{ \
obstack_sgrow (&muscle_obstack, Value); \
obstack_1grow (&muscle_obstack, 0); \
muscle_insert (Key, obstack_finish (&muscle_obstack)); \
}
#define MUSCLE_INSERT_PREFIX(Key, Value) \
{ \
obstack_fgrow2 (&muscle_obstack, "%s%s", \
spec_name_prefix ? spec_name_prefix : "yy", Value); \
obstack_1grow (&muscle_obstack, 0); \
muscle_insert (Key, obstack_finish (&muscle_obstack)); \
/* Parse the skeleton file and output the needed parsers. */
muscle_insert ("skeleton", skeleton);
process_skeleton (infile, skeleton);
}
static void
@@ -1102,7 +1102,6 @@ prepare (void)
MUSCLE_INSERT_INT ("locations-flag", locations_flag);
}
/*-------------------------.
| Output the header file. |
`-------------------------*/
@@ -1188,8 +1187,13 @@ output (void)
obstack_1grow (&attrs_obstack, 0);
muscle_insert ("prologue", obstack_finish (&attrs_obstack));
/* Process the selected skeleton file. */
output_skeleton ();
/* Output the parser. */
#if 0
output_master_parser ();
#endif
/* Output the header if needed. */
if (defines_flag)
header_output ();