From 897668ee8d0702bf22f3659b639570d6ef0d1516 Mon Sep 17 00:00:00 2001 From: Marc Autret Date: Mon, 17 Dec 2001 20:28:51 +0000 Subject: [PATCH] * src/bison.simple: Don't hard code the skeleton line and filename. * src/output.c (output_parser): Rename 'line' as 'output_line'. New line counter 'skeleton_line' (skeleton-line muscle). --- ChangeLog | 13 ++++++------- src/bison.simple | 5 +++-- src/output.c | 19 +++++++++++++------ 3 files changed, 22 insertions(+), 15 deletions(-) diff --git a/ChangeLog b/ChangeLog index 79840f93..3d146563 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2001-12-17 Marc Autret + + * src/bison.simple: Don't hard code the skeleton line and filename. + * src/output.c (output_parser): Rename 'line' as 'output_line'. + New line counter 'skeleton_line' (skeleton-line muscle). + 2001-12-17 Paul Eggert * NEWS, doc/bison.texinfo, doc/bison.1, doc/bison.rnh: Document that @@ -14,7 +20,6 @@ * src/lalr.h (nlookaheads): Remove this orphan declaration. * src/lalr.c (initialize_lookaheads): Set nlookaheads for each state. - 2001-12-17 Akim Demaille @@ -22,19 +27,16 @@ * src/main.c (main): Don't open/close files, nor invoke lex_free, let... * src/reader.c (reader): Do it. - 2001-12-17 Akim Demaille * src/conflicts.c (print_reductions): Formatting changes. - 2001-12-17 Akim Demaille * src/conflicts.c (flush_shift): Also adjust lookaheadset. (flush_reduce): New. (resolve_sr_conflict): Adjust. - 2001-12-17 Akim Demaille @@ -44,18 +46,15 @@ * src/reader.h (muscle_obstack): Move to... * src/output.h: here, since it's defined in output.c. - 2001-12-17 Akim Demaille * src/output.c (action_row, save_column, default_goto) (sort_actions, matching_state, pack_vector): Better variable locality. - 2001-12-17 Akim Demaille * src/output.c: Various formatting changes. - 2001-12-17 Akim Demaille diff --git a/src/bison.simple b/src/bison.simple index de23187a..7625bde0 100644 --- a/src/bison.simple +++ b/src/bison.simple @@ -82,7 +82,7 @@ typedef struct yyltype /* Copy the user declarations. */ %%prologue -/* Line 85 of bison.simple. */ +/* Line %%skeleton-line of %%skeleton. */ #line %%line "%%parser-file-name" #include @@ -896,7 +896,8 @@ yyreduce: { %%actions } - /* Line 902 of bison.simple. */ + +/* Line %%skeleton-line of %%skeleton. */ #line %%line "%%parser-file-name" yyvsp -= yylen; diff --git a/src/output.c b/src/output.c index 125070ea..ca5eb63c 100644 --- a/src/output.c +++ b/src/output.c @@ -897,19 +897,24 @@ output_parser (const char *skel_filename, FILE *out) { int c; FILE *fskel; - size_t line; + size_t output_line; + size_t skeleton_line; fskel = xfopen (skel_filename, "r"); /* New output code. */ - line = 1; + output_line = 1; + skeleton_line = 1; c = getc (fskel); while (c != EOF) { if (c != '%') { if (c == '\n') - ++line; + { + ++output_line; + ++skeleton_line; + } putc (c, out); c = getc (fskel); } @@ -927,13 +932,15 @@ output_parser (const char *skel_filename, FILE *out) muscle_key = obstack_finish (&muscle_obstack); muscle_value = muscle_find (muscle_key); if (!strcmp (muscle_key, "actions")) - actions_output (out, &line); + actions_output (out, &output_line); else if (!strcmp (muscle_key, "line")) - fprintf (out, "%d", line); + fprintf (out, "%d", output_line); + else if (!strcmp (muscle_key, "skeleton-line")) + fprintf (out, "%d", skeleton_line); else if (muscle_value) { fputs (muscle_value, out); - line += get_lines_number (muscle_value); + output_line += get_lines_number (muscle_value); } else { -- 2.45.2