125 |
int error_verbose = 0; |
int error_verbose = 0; |
126 |
|
|
127 |
/* Returns the number of lines of S. */ |
/* Returns the number of lines of S. */ |
128 |
static size_t |
size_t |
129 |
get_lines_number (const char *s) |
get_lines_number (const char *s) |
130 |
{ |
{ |
131 |
size_t lines = 0; |
size_t lines = 0; |
503 |
| Output the actions to OOUT. | |
| Output the actions to OOUT. | |
504 |
`-----------------------------*/ |
`-----------------------------*/ |
505 |
|
|
506 |
static void |
void |
507 |
actions_output (FILE *out, size_t *line) |
actions_output (FILE *out, size_t *line) |
508 |
{ |
{ |
509 |
int rule; |
int rule; |
539 |
| Output the guards to OOUT. | |
| Output the guards to OOUT. | |
540 |
`----------------------------*/ |
`----------------------------*/ |
541 |
|
|
542 |
static void |
void |
543 |
guards_output (FILE *out, size_t *line) |
guards_output (FILE *out, size_t *line) |
544 |
{ |
{ |
545 |
int rule; |
int rule; |
571 |
| Output the tokens definition to OOUT. | |
| Output the tokens definition to OOUT. | |
572 |
`---------------------------------------*/ |
`---------------------------------------*/ |
573 |
|
|
574 |
static void |
void |
575 |
token_definitions_output (FILE *out, size_t *line) |
token_definitions_output (FILE *out, size_t *line) |
576 |
{ |
{ |
577 |
int i; |
int i; |
1042 |
output_master_parser (void) |
output_master_parser (void) |
1043 |
{ |
{ |
1044 |
FILE *parser = xfopen (parser_file_name, "w"); |
FILE *parser = xfopen (parser_file_name, "w"); |
1045 |
|
|
1046 |
|
/* FIXME: Remove the two following lines. */ |
1047 |
|
printf ("Test: %s\n", infile); |
1048 |
|
printf ("Test: %s\n", parser_file_name); |
1049 |
|
|
1050 |
if (!skeleton) |
if (!skeleton) |
1051 |
{ |
{ |
1052 |
if (semantic_parser) |
if (semantic_parser) |
1061 |
xfclose (parser); |
xfclose (parser); |
1062 |
} |
} |
1063 |
|
|
1064 |
|
/* Call the skeleton parser. */ |
1065 |
|
|
1066 |
/* FIXME. */ |
static |
1067 |
|
void |
1068 |
|
output_skeleton () |
1069 |
|
{ |
1070 |
|
/* Find the right skeleton file. */ |
1071 |
|
if (!skeleton) |
1072 |
|
{ |
1073 |
|
if (semantic_parser) |
1074 |
|
skeleton = skeleton_find ("BISON_HAIRY", BISON_HAIRY); |
1075 |
|
else |
1076 |
|
skeleton = skeleton_find ("BISON_SIMPLE", BISON_SIMPLE); |
1077 |
|
} |
1078 |
|
|
1079 |
#define MUSCLE_INSERT_INT(Key, Value) \ |
/* Parse the skeleton file and output the needed parsers. */ |
1080 |
{ \ |
muscle_insert ("skeleton", skeleton); |
1081 |
obstack_fgrow1 (&muscle_obstack, "%d", Value); \ |
process_skeleton (infile, skeleton); |
|
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)); \ |
|
1082 |
} |
} |
1083 |
|
|
1084 |
static void |
static void |
1102 |
MUSCLE_INSERT_INT ("locations-flag", locations_flag); |
MUSCLE_INSERT_INT ("locations-flag", locations_flag); |
1103 |
} |
} |
1104 |
|
|
|
|
|
1105 |
/*-------------------------. |
/*-------------------------. |
1106 |
| Output the header file. | |
| Output the header file. | |
1107 |
`-------------------------*/ |
`-------------------------*/ |
1187 |
obstack_1grow (&attrs_obstack, 0); |
obstack_1grow (&attrs_obstack, 0); |
1188 |
muscle_insert ("prologue", obstack_finish (&attrs_obstack)); |
muscle_insert ("prologue", obstack_finish (&attrs_obstack)); |
1189 |
|
|
1190 |
|
/* Process the selected skeleton file. */ |
1191 |
|
output_skeleton (); |
1192 |
|
|
1193 |
/* Output the parser. */ |
/* Output the parser. */ |
1194 |
|
#if 0 |
1195 |
output_master_parser (); |
output_master_parser (); |
1196 |
|
#endif |
1197 |
/* Output the header if needed. */ |
/* Output the header if needed. */ |
1198 |
if (defines_flag) |
if (defines_flag) |
1199 |
header_output (); |
header_output (); |