107 |
GENERATE_MUSCLE_INSERT_TABLE(muscle_insert_state_number_table, state_number_t) |
GENERATE_MUSCLE_INSERT_TABLE(muscle_insert_state_number_table, state_number_t) |
108 |
|
|
109 |
|
|
110 |
|
/*----------------------------------------------------------------------. |
111 |
|
| Print to OUT a representation of FILENAME escaped both for C and M4. | |
112 |
|
`----------------------------------------------------------------------*/ |
113 |
|
|
114 |
|
static void |
115 |
|
escaped_file_name_output (FILE *out, char const *filename) |
116 |
|
{ |
117 |
|
char const *p; |
118 |
|
fprintf (out, "[["); |
119 |
|
|
120 |
|
for (p = quotearg_style (c_quoting_style, filename); *p; p++) |
121 |
|
switch (*p) |
122 |
|
{ |
123 |
|
case '$': fputs ("$][", out); break; |
124 |
|
case '@': fputs ("@@", out); break; |
125 |
|
case '[': fputs ("@{", out); break; |
126 |
|
case ']': fputs ("@}", out); break; |
127 |
|
default: fputc (*p, out); break; |
128 |
|
} |
129 |
|
|
130 |
|
fprintf (out, "]]"); |
131 |
|
} |
132 |
|
|
133 |
|
|
134 |
/*------------------------------------------------------------------. |
/*------------------------------------------------------------------. |
135 |
| Prepare the muscles related to the symbols: translate, tname, and | |
| Prepare the muscles related to the symbols: translate, tname, and | |
136 |
| toknum. | |
| toknum. | |
170 |
j = 2; |
j = 2; |
171 |
} |
} |
172 |
|
|
173 |
for (; *cp; cp++) |
MUSCLE_OBSTACK_SGROW (&format_obstack, cp); |
|
switch (*cp) |
|
|
{ |
|
|
case '[': obstack_sgrow (&format_obstack, "@<:@"); break; |
|
|
case ']': obstack_sgrow (&format_obstack, "@:>@"); break; |
|
|
default: obstack_1grow (&format_obstack, *cp); break; |
|
|
} |
|
|
|
|
174 |
obstack_sgrow (&format_obstack, ", "); |
obstack_sgrow (&format_obstack, ", "); |
175 |
j += strsize; |
j += strsize; |
176 |
} |
} |
293 |
{ |
{ |
294 |
fprintf (out, " case %d:\n", r + 1); |
fprintf (out, " case %d:\n", r + 1); |
295 |
|
|
296 |
fprintf (out, "]b4_syncline([[%d]], [[%s]])[\n", |
fprintf (out, "]b4_syncline([[%d]], ", |
297 |
rules[r].action_location.first_line, |
rules[r].action_location.first_line); |
298 |
quotearg_style (escape_quoting_style, |
escaped_file_name_output (out, rules[r].action_location.file); |
299 |
rules[r].action_location.file)); |
fprintf (out, ")[\n"); |
300 |
fprintf (out, " %s\n break;\n\n", |
fprintf (out, " %s\n break;\n\n", |
301 |
rules[r].action); |
rules[r].action); |
302 |
} |
} |
395 |
/* Filename, lineno, |
/* Filename, lineno, |
396 |
Symbol-name, Symbol-number, |
Symbol-name, Symbol-number, |
397 |
destructor, typename. */ |
destructor, typename. */ |
398 |
fprintf (out, "%s[[[%s]], [[%d]], [[%s]], [[%d]], [[%s]], [[%s]]]", |
fprintf (out, "%s[", |
399 |
first ? "" : ",\n", |
first ? "" : ",\n"); |
400 |
quotearg_style (escape_quoting_style, |
escaped_file_name_output (out, symbol->destructor_location.file); |
401 |
symbol->destructor_location.file), |
fprintf (out, ", [[%d]], [[%s]], [[%d]], [[%s]], [[%s]]]", |
402 |
symbol->destructor_location.first_line, |
symbol->destructor_location.first_line, |
403 |
symbol->tag, |
symbol->tag, |
404 |
symbol->number, |
symbol->number, |
430 |
/* Filename, lineno, |
/* Filename, lineno, |
431 |
Symbol-name, Symbol-number, |
Symbol-name, Symbol-number, |
432 |
printer, typename. */ |
printer, typename. */ |
433 |
fprintf (out, "%s[[[%s]], [[%d]], [[%s]], [[%d]], [[%s]], [[%s]]]", |
fprintf (out, "%s[", |
434 |
first ? "" : ",\n", |
first ? "" : ",\n"); |
435 |
quotearg_style (escape_quoting_style, |
escaped_file_name_output (out, symbol->printer_location.file); |
436 |
symbol->printer_location.file), |
fprintf (out, ", [[%d]], [[%s]], [[%d]], [[%s]], [[%s]]]", |
437 |
symbol->printer_location.first_line, |
symbol->printer_location.first_line, |
438 |
symbol->tag, |
symbol->tag, |
439 |
symbol->number, |
symbol->number, |
594 |
/* FIXME: This is wrong: the muscles should decide whether they hold |
/* FIXME: This is wrong: the muscles should decide whether they hold |
595 |
a copy or not, but the situation is too obscure currently. */ |
a copy or not, but the situation is too obscure currently. */ |
596 |
MUSCLE_INSERT_STRING ("prefix", spec_name_prefix ? spec_name_prefix : "yy"); |
MUSCLE_INSERT_STRING ("prefix", spec_name_prefix ? spec_name_prefix : "yy"); |
|
MUSCLE_INSERT_STRING ("output_infix", output_infix ? output_infix : ""); |
|
|
MUSCLE_INSERT_STRING ("output_prefix", short_base_name); |
|
|
MUSCLE_INSERT_STRING ("output_parser_name", parser_file_name); |
|
|
MUSCLE_INSERT_STRING ("output_header_name", spec_defines_file); |
|
597 |
|
|
598 |
/* User Code. */ |
/* User Code. */ |
599 |
obstack_1grow (&pre_prologue_obstack, 0); |
obstack_1grow (&pre_prologue_obstack, 0); |
611 |
} |
} |
612 |
|
|
613 |
/* Parse the skeleton file and output the needed parsers. */ |
/* Parse the skeleton file and output the needed parsers. */ |
614 |
MUSCLE_INSERT_STRING ("skeleton", skeleton); |
MUSCLE_INSERT_C_STRING ("skeleton", skeleton); |
615 |
} |
} |
616 |
|
|
617 |
|
|