- MACRO_INSERT_INT ("last", high);
- MACRO_INSERT_INT ("flag", MINSHORT);
- MACRO_INSERT_INT ("pure", pure_parser);
- MACRO_INSERT_INT ("nsym", nsyms);
- MACRO_INSERT_INT ("debug", debug_flag);
- MACRO_INSERT_INT ("final", final_state);
- MACRO_INSERT_INT ("maxtok", max_user_token_number);
- MACRO_INSERT_INT ("ntbase", ntokens);
- MACRO_INSERT_INT ("verbose", 0);
-
- MACRO_INSERT_STRING ("filename", infile);
-
- MACRO_INSERT_INT ("nnts", nvars);
- MACRO_INSERT_INT ("nrules", nrules);
- MACRO_INSERT_INT ("nstates", nstates);
- MACRO_INSERT_INT ("ntokens", ntokens);
-
- if (spec_name_prefix)
+ MUSCLE_INSERT_INT ("last", high);
+ MUSCLE_INSERT_INT ("flag", MINSHORT);
+ MUSCLE_INSERT_INT ("pure", pure_parser);
+ MUSCLE_INSERT_INT ("nsym", nsyms);
+ MUSCLE_INSERT_INT ("debug", debug_flag);
+ MUSCLE_INSERT_INT ("final", final_state);
+ MUSCLE_INSERT_INT ("maxtok", max_user_token_number);
+ MUSCLE_INSERT_INT ("error-verbose", error_verbose);
+ MUSCLE_INSERT_STRING ("prefix", spec_name_prefix ? spec_name_prefix : "yy");
+
+ MUSCLE_INSERT_INT ("nnts", nvars);
+ MUSCLE_INSERT_INT ("nrules", nrules);
+ MUSCLE_INSERT_INT ("nstates", nstates);
+ MUSCLE_INSERT_INT ("ntokens", ntokens);
+
+ MUSCLE_INSERT_INT ("locations-flag", locations_flag);
+}
+
+
+/*-------------------------.
+| Output the header file. |
+`-------------------------*/
+
+static void
+header_output (void)
+{
+ size_t dummy_line;
+ FILE *out = xfopen (spec_defines_file, "w");
+ char *macro_name = compute_header_macro ();
+
+ fprintf (out, "#ifndef %s\n", macro_name);
+ fprintf (out, "# define %s\n\n", macro_name);
+
+ token_definitions_output (out, &dummy_line);
+ fprintf (out, "\
+#ifndef YYSTYPE\n\
+typedef %s
+yystype;\n\
+# define YYSTYPE yystype\n\
+#endif\n",
+ muscle_find ("stype"));
+
+ if (!pure_parser)
+ fprintf (out, "\nextern YYSTYPE %slval;\n",
+ spec_name_prefix ? spec_name_prefix : "yy");
+
+ if (locations_flag)
+ {
+ fputs ("\n\n", out);
+ fprintf (out, "\
+#ifndef YYLTYPE\n\
+typedef struct yyltype\n\
+{\n\
+ int first_line;\n\
+ int first_column;\n\
+ int last_line;\n\
+ int last_column;\n\
+} yyltype;\n\
+# define YYLTYPE yyltype\n\
+#endif\n");
+ if (!pure_parser)
+ fprintf (out, "\nextern YYLTYPE %slloc;\n",
+ spec_name_prefix ? spec_name_prefix : "yy");
+ }
+
+ if (semantic_parser)