1 /* Output the generated parsing program for Bison.
3 Copyright (C) 1984, 1986, 1989, 1992, 2000-2015, 2018-2020 Free
4 Software Foundation, Inc.
6 This file is part of Bison, the GNU Compiler Compiler.
8 This program is free software: you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation, either version 3 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program. If not, see <http://www.gnu.org/licenses/>. */
24 #include <filename.h> /* IS_PATH_WITH_DIR */
25 #include <get-errno.h>
27 #include <path-join.h>
29 #include <spawn-pipe.h>
31 #include <wait-process.h>
37 #include "muscle-tab.h"
41 #include "scan-code.h" /* max_left_semantic_context */
42 #include "scan-skel.h"
45 #include "strversion.h"
47 static struct obstack format_obstack
;
50 /*-------------------------------------------------------------------.
51 | Create a function NAME which associates to the muscle NAME the |
52 | result of formatting the FIRST and then TABLE_DATA[BEGIN..END[ (of |
53 | TYPE), and to the muscle NAME_max, the max value of the |
56 | For the typical case of outputting a complete table from 0, pass |
57 | TABLE[0] as FIRST, and 1 as BEGIN. For instance |
58 | muscle_insert_base_table ("pact", base, base[0], 1, nstates); |
59 `-------------------------------------------------------------------*/
62 #define GENERATE_MUSCLE_INSERT_TABLE(Name, Type) \
65 Name (char const *name, Type *table_data, Type first, \
72 obstack_printf (&format_obstack, "%6d", first); \
73 for (int i = begin; i < end; ++i) \
75 obstack_1grow (&format_obstack, ','); \
78 obstack_sgrow (&format_obstack, "\n "); \
83 obstack_printf (&format_obstack, "%6d", table_data[i]); \
84 if (table_data[i] < min) \
85 min = table_data[i]; \
86 if (max < table_data[i]) \
87 max = table_data[i]; \
89 muscle_insert (name, obstack_finish0 (&format_obstack)); \
93 /* Build 'NAME_min' and 'NAME_max' in the obstack. */ \
94 obstack_printf (&format_obstack, "%s_min", name); \
95 MUSCLE_INSERT_LONG_INT (obstack_finish0 (&format_obstack), lmin); \
96 obstack_printf (&format_obstack, "%s_max", name); \
97 MUSCLE_INSERT_LONG_INT (obstack_finish0 (&format_obstack), lmax); \
100 GENERATE_MUSCLE_INSERT_TABLE (muscle_insert_int_table
, int)
101 GENERATE_MUSCLE_INSERT_TABLE (muscle_insert_base_table
, base_number
)
102 GENERATE_MUSCLE_INSERT_TABLE (muscle_insert_rule_number_table
, rule_number
)
103 GENERATE_MUSCLE_INSERT_TABLE (muscle_insert_symbol_number_table
, symbol_number
)
104 GENERATE_MUSCLE_INSERT_TABLE (muscle_insert_item_number_table
, item_number
)
105 GENERATE_MUSCLE_INSERT_TABLE (muscle_insert_state_number_table
, state_number
)
107 /*----------------------------------------------------------------.
108 | Print to OUT a representation of CP quoted and escaped for M4. |
109 `----------------------------------------------------------------*/
112 output_escaped (FILE *out
, const char *cp
)
117 case '$': fputs ("$][", out
); break;
118 case '@': fputs ("@@", out
); break;
119 case '[': fputs ("@{", out
); break;
120 case ']': fputs ("@}", out
); break;
121 default: fputc (*cp
, out
); break;
126 output_quoted (FILE *out
, char const *cp
)
129 output_escaped (out
, cp
);
133 /*----------------------------------------------------------------.
134 | Print to OUT a representation of STRING quoted and escaped both |
136 `----------------------------------------------------------------*/
139 string_output (FILE *out
, char const *string
)
141 output_quoted (out
, quotearg_style (c_quoting_style
, string
));
145 /* Store in BUFFER a copy of SRC where trigraphs are escaped, return
146 the size of the result (including the final NUL). If called with
147 BUFFERSIZE = 0, returns the needed size for BUFFER. */
149 escape_trigraphs (char *buffer
, ptrdiff_t buffersize
, const char *src
)
154 if (res < buffersize) \
160 for (ptrdiff_t i
= 0, len
= strlen (src
); i
< len
; ++i
)
163 && src
[i
] == '?' && src
[i
+1] == '?')
168 case '(': case ')': case '-': case '/':
169 case '<': case '=': case '>':
185 /* Same as xstrdup, except that trigraphs are escaped. */
187 xescape_trigraphs (const char *src
)
189 ptrdiff_t bufsize
= escape_trigraphs (NULL
, 0, src
);
190 char *buf
= xcharalloc (bufsize
);
191 escape_trigraphs (buf
, bufsize
, src
);
195 /* The tag to show in the generated parsers. Use "end of file" rather
196 than "$end". But keep "$end" in the reports, it's shorter and more
197 consistent. Support i18n if the user already uses it. */
199 symbol_tag (const symbol
*sym
)
201 const bool eof_is_user_defined
202 = !eoftoken
->alias
|| STRNEQ (eoftoken
->alias
->tag
, "$end");
204 if (!eof_is_user_defined
&& sym
->content
== eoftoken
->content
)
205 return "\"end of file\"";
206 else if (sym
->content
== undeftoken
->content
)
207 return "\"invalid token\"";
212 /* Generate the b4_<MUSCLE_NAME> (e.g., b4_tname) table with the
213 symbol names (aka tags). */
216 prepare_symbol_names (char const *muscle_name
)
218 // Whether to add a pair of quotes around the name.
219 const bool quote
= STREQ (muscle_name
, "tname");
220 bool has_translations
= false;
222 /* We assume that the table will be output starting at column 2. */
224 struct quoting_options
*qo
= clone_quoting_options (0);
225 set_quoting_style (qo
, c_quoting_style
);
226 set_quoting_flags (qo
, QA_SPLIT_TRIGRAPHS
);
227 for (int i
= 0; i
< nsyms
; i
++)
229 const char *tag
= symbol_tag (symbols
[i
]);
230 bool translatable
= !quote
&& symbols
[i
]->translatable
;
232 has_translations
= true;
235 = tag
[0] == '"' && !quote
236 ? xescape_trigraphs (tag
)
237 : quotearg_alloc (tag
, -1, qo
);
238 /* Width of the next token, including the two quotes, the
239 comma and the space. */
241 = mbswidth (cp
, 0) + 2
242 + (translatable
? strlen ("N_()") : 0);
244 if (col
+ width
> 75)
246 obstack_sgrow (&format_obstack
, "\n ");
251 obstack_1grow (&format_obstack
, ' ');
253 obstack_sgrow (&format_obstack
, "]b4_symbol_translate""([");
254 obstack_escape (&format_obstack
, cp
);
256 obstack_sgrow (&format_obstack
, "])[");
258 obstack_1grow (&format_obstack
, ',');
262 obstack_sgrow (&format_obstack
, " ]b4_null[");
264 /* Finish table and store. */
265 muscle_insert (muscle_name
, obstack_finish0 (&format_obstack
));
267 /* Announce whether translation support is needed. */
268 MUSCLE_INSERT_BOOL ("has_translations_flag", has_translations
);
272 /*------------------------------------------------------------------.
273 | Prepare the muscles related to the symbols: translate, tname, and |
275 `------------------------------------------------------------------*/
278 prepare_symbols (void)
280 MUSCLE_INSERT_INT ("tokens_number", ntokens
);
281 MUSCLE_INSERT_INT ("nterms_number", nnterms
);
282 MUSCLE_INSERT_INT ("symbols_number", nsyms
);
283 MUSCLE_INSERT_INT ("code_max", max_code
);
285 muscle_insert_symbol_number_table ("translate",
287 token_translations
[0],
290 /* tname -- token names. */
291 prepare_symbol_names ("tname");
292 prepare_symbol_names ("symbol_names");
294 /* translatable -- whether a token is translatable. */
296 bool translatable
= false;
297 for (int i
= 0; i
< ntokens
; ++i
)
298 if (symbols
[i
]->translatable
)
305 int *values
= xnmalloc (nsyms
, sizeof *values
);
306 for (int i
= 0; i
< ntokens
; ++i
)
307 values
[i
] = symbols
[i
]->translatable
;
308 muscle_insert_int_table ("translatable", values
,
309 values
[0], 1, ntokens
);
314 /* Output YYTOKNUM. */
316 int *values
= xnmalloc (ntokens
, sizeof *values
);
317 for (int i
= 0; i
< ntokens
; ++i
)
318 values
[i
] = symbols
[i
]->content
->code
;
319 muscle_insert_int_table ("toknum", values
,
320 values
[0], 1, ntokens
);
326 /*-------------------------------------------------------------.
327 | Prepare the muscles related to the rules: rhs, prhs, r1, r2, |
328 | rline, dprec, merger, immediate. |
329 `-------------------------------------------------------------*/
334 int *prhs
= xnmalloc (nrules
, sizeof *prhs
);
335 item_number
*rhs
= xnmalloc (nritems
, sizeof *rhs
);
336 int *rline
= xnmalloc (nrules
, sizeof *rline
);
337 symbol_number
*r1
= xnmalloc (nrules
, sizeof *r1
);
338 int *r2
= xnmalloc (nrules
, sizeof *r2
);
339 int *dprec
= xnmalloc (nrules
, sizeof *dprec
);
340 int *merger
= xnmalloc (nrules
, sizeof *merger
);
341 int *immediate
= xnmalloc (nrules
, sizeof *immediate
);
345 for (rule_number r
= 0; r
< nrules
; ++r
)
347 /* Index of rule R in RHS. */
349 /* RHS of the rule R. */
350 for (item_number
*rhsp
= rules
[r
].rhs
; 0 <= *rhsp
; ++rhsp
)
352 /* Separator in RHS. */
355 /* Line where rule was defined. */
356 rline
[r
] = rules
[r
].location
.start
.line
;
357 /* LHS of the rule R. */
358 r1
[r
] = rules
[r
].lhs
->number
;
359 /* Length of rule R's RHS. */
360 r2
[r
] = rule_rhs_length (&rules
[r
]);
361 /* Dynamic precedence (GLR). */
362 dprec
[r
] = rules
[r
].dprec
;
363 /* Merger-function index (GLR). */
364 merger
[r
] = rules
[r
].merger
;
365 /* Immediate reduction flags (GLR). */
366 immediate
[r
] = rules
[r
].is_predicate
;
370 muscle_insert_item_number_table ("rhs", rhs
, ritem
[0], 1, nritems
);
371 muscle_insert_int_table ("prhs", prhs
, 0, 0, nrules
);
372 muscle_insert_int_table ("rline", rline
, 0, 0, nrules
);
373 muscle_insert_symbol_number_table ("r1", r1
, 0, 0, nrules
);
374 muscle_insert_int_table ("r2", r2
, 0, 0, nrules
);
375 muscle_insert_int_table ("dprec", dprec
, 0, 0, nrules
);
376 muscle_insert_int_table ("merger", merger
, 0, 0, nrules
);
377 muscle_insert_int_table ("immediate", immediate
, 0, 0, nrules
);
379 MUSCLE_INSERT_INT ("rules_number", nrules
);
380 MUSCLE_INSERT_INT ("max_left_semantic_context", max_left_semantic_context
);
392 /*--------------------------------------------.
393 | Prepare the muscles related to the states. |
394 `--------------------------------------------*/
397 prepare_states (void)
399 symbol_number
*values
= xnmalloc (nstates
, sizeof *values
);
400 for (state_number i
= 0; i
< nstates
; ++i
)
401 values
[i
] = states
[i
]->accessing_symbol
;
402 muscle_insert_symbol_number_table ("stos", values
,
406 MUSCLE_INSERT_INT ("last", high
);
407 MUSCLE_INSERT_INT ("final_state_number", final_state
->number
);
408 MUSCLE_INSERT_INT ("states_number", nstates
);
412 /*-------------------------------------------------------.
413 | Compare two symbols by type-name, and then by number. |
414 `-------------------------------------------------------*/
417 symbol_type_name_cmp (const symbol
**lhs
, const symbol
**rhs
)
419 int res
= uniqstr_cmp ((*lhs
)->content
->type_name
, (*rhs
)->content
->type_name
);
421 res
= (*lhs
)->content
->number
- (*rhs
)->content
->number
;
426 /*----------------------------------------------------------------.
427 | Return a (malloc'ed) table of the symbols sorted by type-name. |
428 `----------------------------------------------------------------*/
431 symbols_by_type_name (void)
433 typedef int (*qcmp_type
) (const void *, const void *);
434 symbol
**res
= xmemdup (symbols
, nsyms
* sizeof *res
);
435 qsort (res
, nsyms
, sizeof *res
, (qcmp_type
) &symbol_type_name_cmp
);
440 /*------------------------------------------------------------------.
441 | Define b4_type_names, which is a list of (lists of the numbers of |
442 | symbols with same type-name). |
443 `------------------------------------------------------------------*/
446 type_names_output (FILE *out
)
448 symbol
**syms
= symbols_by_type_name ();
449 fputs ("m4_define([b4_type_names],\n[", out
);
450 for (int i
= 0; i
< nsyms
; /* nothing */)
452 /* The index of the first symbol of the current type-name. */
454 fputs (i
? ",\n[" : "[", out
);
456 && syms
[i
]->content
->type_name
== syms
[i0
]->content
->type_name
; ++i
)
457 fprintf (out
, "%s%d", i
!= i0
? ", " : "", syms
[i
]->content
->number
);
460 fputs ("])\n\n", out
);
465 /*-------------------------------------.
466 | The list of all the symbol numbers. |
467 `-------------------------------------*/
470 symbol_numbers_output (FILE *out
)
472 fputs ("m4_define([b4_symbol_numbers],\n[", out
);
473 for (int i
= 0; i
< nsyms
; ++i
)
474 fprintf (out
, "%s[%d]", i
? ", " : "", i
);
475 fputs ("])\n\n", out
);
479 /*-------------------------------------------.
480 | Output the user reduction actions to OUT. |
481 `-------------------------------------------*/
484 rule_output (const rule
*r
, FILE *out
)
486 output_escaped (out
, r
->lhs
->symbol
->tag
);
489 for (item_number
*rhsp
= r
->rhs
; 0 <= *rhsp
; ++rhsp
)
492 output_escaped (out
, symbols
[*rhsp
]->tag
);
495 fputs (" %empty", out
);
499 user_actions_output (FILE *out
)
501 fputs ("m4_define([b4_actions], \n[", out
);
502 for (rule_number r
= 0; r
< nrules
; ++r
)
505 /* The useless "" is there to pacify syntax-check. */
506 fprintf (out
, "%s""(%d, [",
507 rules
[r
].is_predicate
? "b4_predicate_case" : "b4_case",
511 fprintf (out
, "b4_syncline(%d, ",
512 rules
[r
].action_loc
.start
.line
);
513 string_output (out
, rules
[r
].action_loc
.start
.file
);
514 fprintf (out
, ")dnl\n");
516 fprintf (out
, "[%*s%s]],\n[[",
517 rules
[r
].action_loc
.start
.column
- 1, "",
519 rule_output (&rules
[r
], out
);
520 fprintf (out
, "]])\n\n");
522 fputs ("])\n\n", out
);
525 /*------------------------------------.
526 | Output the merge functions to OUT. |
527 `------------------------------------*/
530 merger_output (FILE *out
)
532 fputs ("m4_define([b4_mergers], \n[[", out
);
535 for (n
= 1, p
= merge_functions
; p
!= NULL
; n
+= 1, p
= p
->next
)
537 if (p
->type
[0] == '\0')
538 fprintf (out
, " case %d: *yy0 = %s (*yy0, *yy1); break;\n",
541 fprintf (out
, " case %d: yy0->%s = %s (*yy0, *yy1); break;\n",
542 n
, p
->type
, p
->name
);
544 fputs ("]])\n\n", out
);
548 /*---------------------------------------------.
549 | Prepare the muscles for symbol definitions. |
550 `---------------------------------------------*/
553 prepare_symbol_definitions (void)
555 /* Map "orig NUM" to new numbers. See data/README. */
556 for (symbol_number i
= ntokens
; i
< nsyms
+ nuseless_nonterminals
; ++i
)
558 obstack_printf (&format_obstack
, "symbol""(orig %d, number)", i
);
559 const char *key
= obstack_finish0 (&format_obstack
);
560 MUSCLE_INSERT_INT (key
, nterm_map
? nterm_map
[i
- ntokens
] : i
);
563 for (int i
= 0; i
< nsyms
; ++i
)
565 symbol
*sym
= symbols
[i
];
568 #define SET_KEY(Entry) \
569 obstack_printf (&format_obstack, "symbol""(%d, %s)", \
571 key = obstack_finish0 (&format_obstack);
573 #define SET_KEY2(Entry, Suffix) \
574 obstack_printf (&format_obstack, "symbol""(%d, %s_%s)", \
576 key = obstack_finish0 (&format_obstack);
578 /* Whether the symbol has an identifier. */
579 const char *id
= symbol_id_get (sym
);
581 MUSCLE_INSERT_INT (key
, !!id
);
583 /* Its identifier. */
585 MUSCLE_INSERT_STRING (key
, id
? id
: "");
587 /* Its tag. Typically for documentation purpose. */
589 MUSCLE_INSERT_STRING (key
, symbol_tag (sym
));
592 MUSCLE_INSERT_INT (key
, sym
->content
->code
);
594 SET_KEY ("is_token");
595 MUSCLE_INSERT_INT (key
, i
< ntokens
);
598 MUSCLE_INSERT_INT (key
, sym
->content
->number
);
600 SET_KEY ("has_type");
601 MUSCLE_INSERT_INT (key
, !!sym
->content
->type_name
);
604 MUSCLE_INSERT_STRING (key
, sym
->content
->type_name
605 ? sym
->content
->type_name
: "");
607 for (int j
= 0; j
< CODE_PROPS_SIZE
; ++j
)
609 /* "printer", not "%printer". */
610 char const *pname
= code_props_type_string (j
) + 1;
611 code_props
const *p
= symbol_code_props_get (sym
, j
);
612 SET_KEY2 ("has", pname
);
613 MUSCLE_INSERT_INT (key
, !!p
->code
);
617 SET_KEY2 (pname
, "file");
618 MUSCLE_INSERT_C_STRING (key
, p
->location
.start
.file
);
620 SET_KEY2 (pname
, "line");
621 MUSCLE_INSERT_INT (key
, p
->location
.start
.line
);
623 SET_KEY2 (pname
, "loc");
624 muscle_location_grow (key
, p
->location
);
627 obstack_printf (&muscle_obstack
,
628 "%*s%s", p
->location
.start
.column
- 1, "", p
->code
);
629 muscle_insert (key
, obstack_finish0 (&muscle_obstack
));
639 prepare_actions (void)
641 /* Figure out the actions for the specified state. */
642 muscle_insert_rule_number_table ("defact", yydefact
,
643 yydefact
[0], 1, nstates
);
645 /* Figure out what to do after reducing with each rule, depending on
646 the saved state from before the beginning of parsing the data
647 that matched this rule. */
648 muscle_insert_state_number_table ("defgoto", yydefgoto
,
649 yydefgoto
[0], 1, nsyms
- ntokens
);
653 muscle_insert_base_table ("pact", base
,
654 base
[0], 1, nstates
);
655 MUSCLE_INSERT_INT ("pact_ninf", base_ninf
);
658 muscle_insert_base_table ("pgoto", base
,
659 base
[nstates
], nstates
+ 1, nvectors
);
661 muscle_insert_base_table ("table", table
,
662 table
[0], 1, high
+ 1);
663 MUSCLE_INSERT_INT ("table_ninf", table_ninf
);
665 muscle_insert_base_table ("check", check
,
666 check
[0], 1, high
+ 1);
668 /* GLR parsing slightly modifies YYTABLE and YYCHECK (and thus
669 YYPACT) so that in states with unresolved conflicts, the default
670 reduction is not used in the conflicted entries, so that there is
671 a place to put a conflict pointer.
673 This means that YYCONFLP and YYCONFL are nonsense for a non-GLR
674 parser, so we could avoid accidents by not writing them out in
675 that case. Nevertheless, it seems even better to be able to use
676 the GLR skeletons even without the non-deterministic tables. */
677 muscle_insert_int_table ("conflict_list_heads", conflict_table
,
678 conflict_table
[0], 1, high
+ 1);
679 muscle_insert_int_table ("conflicting_rules", conflict_list
,
680 0, 1, conflict_list_cnt
);
684 /*--------------------------------------------.
685 | Output the definitions of all the muscles. |
686 `--------------------------------------------*/
689 muscles_output (FILE *out
)
691 fputs ("m4_init()\n", out
);
693 symbol_numbers_output (out
);
694 type_names_output (out
);
695 user_actions_output (out
);
697 muscles_m4_output (out
);
700 /*---------------------------.
701 | Call the skeleton parser. |
702 `---------------------------*/
705 output_skeleton (void)
707 /* Compute the names of the package data dir and skeleton files. */
708 char const *m4
= m4path ();
709 char const *datadir
= pkgdatadir ();
710 char *skeldir
= xpath_join (datadir
, "skeletons");
711 char *m4sugar
= xpath_join (datadir
, "m4sugar/m4sugar.m4");
712 char *m4bison
= xpath_join (skeldir
, "bison.m4");
713 char *traceon
= xpath_join (skeldir
, "traceon.m4");
714 char *skel
= (IS_PATH_WITH_DIR (skeleton
)
716 : xpath_join (skeldir
, skeleton
));
718 /* Test whether m4sugar.m4 is readable, to check for proper
719 installation. A faulty installation can cause deadlock, so a
720 cheap sanity check is worthwhile. */
721 xfclose (xfopen (m4sugar
, "r"));
723 /* Create an m4 subprocess connected to us via two pipes. */
728 char const *argv
[11];
732 /* When POSIXLY_CORRECT is set, GNU M4 1.6 and later disable GNU
733 extensions, which Bison's skeletons depend on. With older M4,
734 it has no effect. M4 1.4.12 added a -g/--gnu command-line
735 option to make it explicit that a program wants GNU M4
736 extensions even when POSIXLY_CORRECT is set.
738 See the thread starting at
739 <http://lists.gnu.org/archive/html/bug-bison/2008-07/msg00000.html>
742 argv
[i
++] = M4_GNU_OPTION
;
746 /* Some future version of GNU M4 (most likely 1.6) may treat the
747 -dV in a position-dependent manner. See the thread starting at
748 <http://lists.gnu.org/archive/html/bug-bison/2008-07/msg00000.html>
750 if (trace_flag
& trace_m4_early
)
755 if (trace_flag
& trace_m4
)
759 aver (i
<= ARRAY_CARDINALITY (argv
));
761 if (trace_flag
& trace_tools
)
763 fputs ("running:", stderr
);
764 for (int j
= 0; argv
[j
]; ++j
)
765 fprintf (stderr
, " %s", argv
[j
]);
766 fputc ('\n', stderr
);
769 /* The ugly cast is because gnulib gets the const-ness wrong. */
770 pid
= create_pipe_bidi ("m4", m4
, (char **)(void*)argv
, false, true,
780 if (trace_flag
& trace_muscles
)
781 muscles_output (stderr
);
783 FILE *out
= xfdopen (filter_fd
[1], "w");
784 muscles_output (out
);
788 /* Read and process m4's output. */
789 timevar_push (tv_m4
);
791 FILE *in
= xfdopen (filter_fd
[0], "r");
793 /* scan_skel should have read all of M4's output. Otherwise, when we
794 close the pipe, we risk letting M4 report a broken-pipe to the
799 wait_subprocess (pid
, "m4", false, false, true, true, NULL
);
806 /* BISON_USE_PUSH_FOR_PULL is for the test suite and should not be
807 documented for the user. */
808 char const *cp
= getenv ("BISON_USE_PUSH_FOR_PULL");
809 bool use_push_for_pull_flag
= cp
&& *cp
&& strtol (cp
, 0, 10);
812 MUSCLE_INSERT_STRING ("version_string", VERSION
);
813 MUSCLE_INSERT_INT ("version", strversion_to_int (VERSION
));
814 MUSCLE_INSERT_INT ("required_version", required_version
);
817 MUSCLE_INSERT_BOOL ("defines_flag", defines_flag
);
818 MUSCLE_INSERT_BOOL ("glr_flag", glr_parser
);
819 MUSCLE_INSERT_BOOL ("nondeterministic_flag", nondeterministic_parser
);
820 MUSCLE_INSERT_BOOL ("synclines_flag", !no_lines_flag
);
821 MUSCLE_INSERT_BOOL ("tag_seen_flag", tag_seen
);
822 MUSCLE_INSERT_BOOL ("token_table_flag", token_table_flag
);
823 MUSCLE_INSERT_BOOL ("use_push_for_pull_flag", use_push_for_pull_flag
);
824 MUSCLE_INSERT_BOOL ("yacc_flag", !location_empty (yacc_loc
));
827 if (spec_name_prefix
)
828 MUSCLE_INSERT_STRING ("prefix", spec_name_prefix
);
830 MUSCLE_INSERT_STRING ("file_name_all_but_ext", all_but_ext
);
832 #define DEFINE(Name) MUSCLE_INSERT_STRING (#Name, Name ? Name : "")
834 DEFINE (mapped_dir_prefix
);
835 DEFINE (parser_file_name
);
836 DEFINE (spec_header_file
);
837 DEFINE (spec_mapped_header_file
);
838 DEFINE (spec_file_prefix
);
839 DEFINE (spec_graph_file
);
840 DEFINE (spec_name_prefix
);
841 DEFINE (spec_outfile
);
842 DEFINE (spec_verbose_file
);
845 /* Find the right skeleton file, and add muscles about the skeletons. */
847 MUSCLE_INSERT_C_STRING ("skeleton", skeleton
);
849 skeleton
= language
->skeleton
;
851 /* About the skeletons. */
853 /* b4_skeletonsdir is used inside m4_include in the skeletons, so digraphs
854 would never be expanded. Hopefully no one has M4-special characters in
855 his Bison installation path. */
856 char *skeldir
= xpath_join (pkgdatadir (), "skeletons");
857 MUSCLE_INSERT_STRING_RAW ("skeletonsdir", skeldir
);
863 /*----------------------------------------------------------.
864 | Output the parsing tables and the parser code to ftable. |
865 `----------------------------------------------------------*/
870 obstack_init (&format_obstack
);
876 prepare_symbol_definitions ();
880 /* Process the selected skeleton file. */
883 /* If late errors were generated, destroy the generated source
885 if (complaint_status
)
886 unlink_generated_sources ();
888 obstack_free (&format_obstack
, NULL
);