X-Git-Url: https://git.saurik.com/bison.git/blobdiff_plain/327afc7c849accd5fd7f97bd061f6480c6961ed8..a36b333cc208e43106b3c556b6bb9205b0a831a2:/src/output.c?ds=inline diff --git a/src/output.c b/src/output.c index 6a02bb33..1a7769df 100644 --- a/src/output.c +++ b/src/output.c @@ -36,6 +36,7 @@ #include "muscle_tab.h" #include "output.h" #include "reader.h" +#include "scan-code.h" /* max_left_semantic_context */ #include "scan-skel.h" #include "symtab.h" #include "tables.h" @@ -175,9 +176,7 @@ prepare_symbols (void) obstack_1grow (&format_obstack, ','); j += width; } - /* Add a NULL entry to list of tokens (well, 0, as NULL might not be - defined). */ - obstack_sgrow (&format_obstack, " 0"); + obstack_sgrow (&format_obstack, " ]b4_null["); /* Finish table and store. */ obstack_1grow (&format_obstack, 0); @@ -289,20 +288,16 @@ user_actions_output (FILE *out) { rule_number r; - fputs ("m4_define([b4_actions], \n[[", out); + fputs ("m4_define([b4_actions], \n[", out); for (r = 0; r < nrules; ++r) if (rules[r].action) { - fprintf (out, " case %d:\n", r + 1); - - fprintf (out, "]b4_syncline(%d, ", + fprintf (out, "b4_case(%d, [b4_syncline(%d, ", r + 1, rules[r].action_location.start.line); escaped_output (out, rules[r].action_location.start.file); - fprintf (out, ")[\n"); - fprintf (out, " %s\n break;\n\n", - rules[r].action); + fprintf (out, ")\n[ %s]])\n\n", rules[r].action); } - fputs ("]])\n\n", out); + fputs ("])\n\n", out); } /*--------------------------------------. @@ -389,7 +384,7 @@ symbol_destructors_output (FILE *out) fputs ("m4_define([b4_symbol_destructors], \n[", out); for (i = 0; i < nsyms; ++i) - if (symbols[i]->destructor) + if (symbol_destructor_get (symbols[i])) { symbol *sym = symbols[i]; @@ -398,10 +393,12 @@ symbol_destructors_output (FILE *out) destructor, optional typename. */ fprintf (out, "%s[", sep); sep = ",\n"; - escaped_output (out, sym->destructor_location.start.file); - fprintf (out, ", %d, ", sym->destructor_location.start.line); + escaped_output (out, symbol_destructor_location_get (sym).start.file); + fprintf (out, ", %d, ", + symbol_destructor_location_get (sym).start.line); escaped_output (out, sym->tag); - fprintf (out, ", %d, [[%s]]", sym->number, sym->destructor); + fprintf (out, ", %d, [[%s]]", sym->number, + symbol_destructor_get (sym)); if (sym->type_name) fprintf (out, ", [[%s]]", sym->type_name); fputc (']', out); @@ -422,7 +419,7 @@ symbol_printers_output (FILE *out) fputs ("m4_define([b4_symbol_printers], \n[", out); for (i = 0; i < nsyms; ++i) - if (symbols[i]->printer) + if (symbol_printer_get (symbols[i])) { symbol *sym = symbols[i]; @@ -431,10 +428,10 @@ symbol_printers_output (FILE *out) printer, optional typename. */ fprintf (out, "%s[", sep); sep = ",\n"; - escaped_output (out, sym->printer_location.start.file); - fprintf (out, ", %d, ", sym->printer_location.start.line); + escaped_output (out, symbol_printer_location_get (sym).start.file); + fprintf (out, ", %d, ", symbol_printer_location_get (sym).start.line); escaped_output (out, sym->tag); - fprintf (out, ", %d, [[%s]]", sym->number, sym->printer); + fprintf (out, ", %d, [[%s]]", sym->number, symbol_printer_get (sym)); if (sym->type_name) fprintf (out, ", [[%s]]", sym->type_name); fputc (']', out); @@ -447,7 +444,7 @@ static void prepare_actions (void) { /* Figure out the actions for the specified state, indexed by - look-ahead token type. */ + lookahead token type. */ muscle_insert_rule_number_table ("defact", yydefact, yydefact[0], 1, nstates); @@ -589,6 +586,8 @@ prepare (void) MUSCLE_INSERT_BOOL ("locations_flag", locations_flag); MUSCLE_INSERT_BOOL ("pure_flag", pure_parser); MUSCLE_INSERT_BOOL ("synclines_flag", !no_lines_flag); + MUSCLE_INSERT_BOOL ("tag_seen_flag", tag_seen); + MUSCLE_INSERT_BOOL ("yacc_flag", yacc_flag); /* File names. */ MUSCLE_INSERT_STRING ("prefix", spec_name_prefix ? spec_name_prefix : "yy");