X-Git-Url: https://git.saurik.com/bison.git/blobdiff_plain/d7913476c462b480f11e14b6829942f2691c6c01..f282676b7e6c9ae1b66233dbfc522bb685c3ece2:/src/output.c diff --git a/src/output.c b/src/output.c index f86d2243..a426ad8f 100644 --- a/src/output.c +++ b/src/output.c @@ -203,7 +203,7 @@ output_headers (void) if (semantic_parser) fprintf (fguard, GUARDSTR, attrsfile); - if (noparserflag) + if (no_parser_flag) return; fprintf (faction, (semantic_parser ? ACTSTR : ACTSTR_SIMPLE), attrsfile); @@ -238,7 +238,7 @@ output_trailers (void) fprintf (faction, "\n"); - if (noparserflag) + if (no_parser_flag) return; if (semantic_parser) @@ -300,8 +300,8 @@ output_gram (void) /* With the ordinary parser, yyprhs and yyrhs are needed only for yydebug. */ - /* With the noparser option, all tables are generated */ - if (!semantic_parser && !noparserflag) + /* With the no_parser option, all tables are generated */ + if (!semantic_parser && !no_parser_flag) fprintf (ftable, "\n#if YYDEBUG != 0\n"); output_short_table (ftable, "yyprhs", rrhs, @@ -332,7 +332,7 @@ output_gram (void) fprintf (ftable, "\n};\n"); - if (!semantic_parser && !noparserflag) + if (!semantic_parser && !no_parser_flag) fprintf (ftable, "\n#endif\n"); } @@ -361,7 +361,7 @@ output_rule_data (void) fputs ("#endif\n\n", ftable); - if (toknumflag || noparserflag) + if (token_table_flag || no_parser_flag) { fprintf (ftable, "#define YYNTOKENS %d\n", ntokens); fprintf (ftable, "#define YYNNTS %d\n", nvars); @@ -370,7 +370,7 @@ output_rule_data (void) fprintf (ftable, "#define YYMAXUTOK %d\n\n", max_user_token_number); } - if (!toknumflag && !noparserflag) + if (!token_table_flag && !no_parser_flag) fprintf (ftable, "\n#if YYDEBUG != 0 || defined (YYERROR_VERBOSE)\n\n"); /* Output the table of symbol names. */ @@ -436,11 +436,11 @@ output_rule_data (void) /* add a NULL entry to list of tokens */ fprintf (ftable, ", NULL\n};\n"); - if (!toknumflag && !noparserflag) + if (!token_table_flag && !no_parser_flag) fprintf (ftable, "#endif\n\n"); /* Output YYTOKNUM. */ - if (toknumflag) + if (token_table_flag) { output_short_table (ftable, "yytoknum", user_toknums, 0, 1, ntokens + 1); @@ -1166,6 +1166,7 @@ static void output_parser (void) { int c; + static int number_of_dollar_signs = 0; #ifdef DONTDEF FILE *fpars; #else @@ -1175,8 +1176,9 @@ output_parser (void) if (pure_parser) fprintf (ftable, "#define YYPURE 1\n\n"); -#ifdef DONTDEF /* JF no longer needed 'cuz open_extra_files changes the - currently open parser from bison.simple to bison.hairy */ +#ifdef DONTDEF + /* JF no longer needed 'cuz open_extra_files changes the currently + open parser from bison.simple to bison.hairy */ if (semantic_parser) fpars = fparser; else @@ -1193,7 +1195,7 @@ output_parser (void) /* See if the line starts with `#line. If so, set write_line to 0. */ - if (nolinesflag) + if (no_lines_flag) if (c == '#') { c = getc (fpars); @@ -1227,11 +1229,15 @@ output_parser (void) { if (c == '$') { + number_of_dollar_signs++; + assert (number_of_dollar_signs == 1); /* `$' in the parser file indicates where to put the actions. Copy them in at this point. */ rewind (faction); for (c = getc (faction); c != EOF; c = getc (faction)) putc (c, ftable); + /* Skip the end of the line containing `$'. */ + write_line = 0; } else putc (c, ftable); @@ -1240,6 +1246,7 @@ output_parser (void) break; putc (c, ftable); } + assert (number_of_dollar_signs == 1); } static void @@ -1247,7 +1254,7 @@ output_program (void) { int c; - if (!nolinesflag) + if (!no_lines_flag) fprintf (ftable, "#line %d \"%s\"\n", lineno, infile); c = getc (finput); @@ -1291,10 +1298,10 @@ output (void) putc (c, ftable); } reader_output_yylsp (ftable); - if (debugflag) + if (debug_flag) fputs ("\ #ifndef YYDEBUG\n\ -#define YYDEBUG 1\n\ +# define YYDEBUG 1\n\ #endif\n\ \n", ftable); @@ -1302,7 +1309,7 @@ output (void) if (semantic_parser) fprintf (ftable, "#include \"%s\"\n", attrsfile); - if (!noparserflag) + if (!no_parser_flag) fprintf (ftable, "#include \n\n"); /* Make "const" do nothing if not in ANSI C. */ @@ -1326,7 +1333,7 @@ output (void) output_stos (); output_rule_data (); output_actions (); - if (!noparserflag) + if (!no_parser_flag) output_parser (); output_program (); }