Restore --no-lines.
authorAkim Demaille <akim@epita.fr>
Wed, 6 Nov 2002 14:11:47 +0000 (14:11 +0000)
committerAkim Demaille <akim@epita.fr>
Wed, 6 Nov 2002 14:11:47 +0000 (14:11 +0000)
Reported by Jim Kent.
* data/c.m4 (b4_syncline): New.
* data/glr.c, data/yacc.c, data/lalr1.cc: Use it.
* src/reader.c (prologue_augment, epilogue_set): Use b4_syncline.
* src/output.c (user_actions_output): Likewise.
(prepare): Define 'b4_synclines_flag'.

ChangeLog
NEWS
THANKS
TODO
data/c.m4
data/glr.c
data/lalr1.cc
data/yacc.c
src/muscle_tab.c
src/output.c
src/reader.c

index 204e896..71395e9 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,16 @@
 2002-11-06  Akim Demaille  <akim@epita.fr>
 
+       Restore --no-lines.
+       Reported by Jim Kent.
+
+       * data/c.m4 (b4_syncline): New.
+       * data/glr.c, data/yacc.c, data/lalr1.cc: Use it.
+       * src/reader.c (prologue_augment, epilogue_set): Use b4_syncline.
+       * src/output.c (user_actions_output): Likewise.
+       (prepare): Define 'b4_synclines_flag'.
+
+2002-11-06  Akim Demaille  <akim@epita.fr>
+
        * src/main.c (main): Free `infile'.
        * src/scan-gram.l (handle_syncline): New.
        Recognize `#line'.
diff --git a/NEWS b/NEWS
index b0ec9fd..08bc957 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -6,6 +6,8 @@ Changes in version 1.75b:
 * Bison now parses C99 lexical constructs like digraphs, UCNs, and
   backslash-newline within C escape sequences, as POSIX now requires.
 
+* --no-line works properly.
+
 Changes in version 1.75a, 2002-10-24:
 
 * Bison can no longer be built by a K&R C compiler; it requires C89 or
diff --git a/THANKS b/THANKS
index 2c59995..3b731d1 100644 (file)
--- a/THANKS
+++ b/THANKS
@@ -25,6 +25,7 @@ H. Merijn Brand           h.m.brand@hccnet.nl
 Hans Aberg                haberg@matematik.su.se
 Jan Nieuwenhuizen         janneke@gnu.org
 Jesse Thilo               jthilo@gnu.org
+Jim Kent                  jkent@arch.sel.sony.com
 Jim Meyering              jim@meyering.net
 Juan Manuel Guerrero      ST001906@HRZ1.HRZ.TU-Darmstadt.De
 Kees Zeelenberg           kzlg@users.sourceforge.net
diff --git a/TODO b/TODO
index 0e3b95d..7b4b7fd 100644 (file)
--- a/TODO
+++ b/TODO
@@ -155,21 +155,11 @@ Paul notes:
 Show reductions.       []
 
 * Broken options ?
-** %no-lines           [ok]
 ** %no-parser          []
-** %pure-parser                []
 ** %token-table                []
-** Options which could use parse_dquoted_param ().
-Maybe transferred in lex.c.
-*** %skeleton          [ok]
-*** %output            []
-*** %file-prefix       []
-*** %name-prefix       []
-
 ** Skeleton strategy.  []
 Must we keep %no-parser?
             %token-table?
-*** New skeletons.     []
 
 * src/print_graph.c
 Find the best graph parameters.        []
index 2617162..aafe2c7 100644 (file)
--- a/data/c.m4
+++ b/data/c.m4
@@ -300,3 +300,15 @@ m4_define([b4_c_args],
 
 m4_define([b4_c_arg],
 [$2])
+
+
+## ----------- ##
+## Synclines.  ##
+## ----------- ##
+
+
+# b4_syncline(LINE, FILE)
+# -----------------------
+m4_define([b4_syncline],
+[m4_if(b4_synclines_flag, 1,
+       [[#]line $1 "$2"])])
index 6a18bcb..daea8b9 100644 (file)
@@ -195,10 +195,10 @@ b4_pre_prologue[
 
 #ifndef YYSTYPE
 ]m4_ifdef([b4_stype],
-[#line b4_stype_line "b4_filename"
+[b4_syncline([b4_stype_line], [b4_filename])
 typedef union b4_stype yystype;
 /* Line __line__ of __file__.  */
-#line __oline__ "__ofile__"],
+b4_syncline([__oline__], [__ofile__])],
 [typedef int yystype;])[
 # define YYSTYPE yystype
 # define YYSTYPE_IS_TRIVIAL 1
@@ -228,7 +228,7 @@ static YYLTYPE yyloc_default;
 ]b4_post_prologue[
 
 ]/* Line __line__ of __file__.  */
-#line __oline__ "__ofile__"
+b4_syncline([__oline__], [__ofile__])
 [
 #if ! defined (__cplusplus)
    typedef char bool;
@@ -656,7 +656,7 @@ yyuserAction (yyRuleNum yyn, int yyrhslen, yyGLRStackItem* yyvsp,
 # undef yyclearin
 # undef YYRECOVERING
 /* Line __line__ of __file__.  */
-#line __oline__ "__ofile__"
+b4_syncline([__oline__], [__ofile__])
 }
 \f
 
@@ -1906,10 +1906,10 @@ b4_token_defines(b4_tokens)
 
 #ifndef YYSTYPE
 m4_ifdef([b4_stype],
-[#line b4_stype_line "b4_filename"
+[b4_syncline([b4_stype_line], [b4_filename])
 typedef union b4_stype yystype;
 /* Line __line__ of __file__.  */
-#line __oline__ "__ofile__"],
+b4_syncline([__oline__], [__ofile__])],
 [typedef int yystype;])
 # define YYSTYPE yystype
 #endif
index 8f3ebad..9ab9a2c 100644 (file)
@@ -129,7 +129,7 @@ b4_token_defines(b4_tokens)
 b4_pre_prologue
 
 /* Line __line__ of __file__.  */
-#line __oline__ "__ofile__"
+b4_syncline([__oline__], [__ofile__])
 
 /* Enabling traces.  */
 #ifndef YYDEBUG
@@ -143,10 +143,10 @@ b4_pre_prologue
 
 #ifndef YYSTYPE
 m4_ifdef([b4_stype],
-[#line b4_stype_line "b4_filename"
+[b4_syncline([b4_stype_line], [b4_filename])
 typedef union b4_stype yystype;
 /* Line __line__ of __file__.  */
-#line __oline__ "__ofile__"],
+b4_syncline([__oline__], [__ofile__])],
 [typedef int yystype;])
 # define YYSTYPE yystype
 #endif
@@ -155,7 +155,7 @@ typedef union b4_stype yystype;
 b4_post_prologue
 
 /* Line __line__ of __file__.  */
-#line __oline__  "__ofile__"
+b4_syncline([__oline__], [__ofile__])
 #ifndef YYLLOC_DEFAULT
 # define YYLLOC_DEFAULT(Current, Rhs, N) \
    Current.last_line = Rhs[[N]].last_line; \
@@ -463,7 +463,7 @@ yy::b4_parser_class_name::parse ()
     }
 
 /* Line __line__ of __file__.  */
-#line __oline__ "__ofile__"
+b4_syncline([__oline__], [__ofile__])
 
   state_stack_.pop (len_);
   semantic_stack_.pop (len_);
index cd93373..c6045e2 100644 (file)
@@ -165,9 +165,9 @@ m4_define([b4_symbol_actions],
 [m4_pushdef([b4_dollar_dollar], [yyvalue.$6])dnl
 m4_pushdef([b4_at_dollar], [yylocation])dnl
       case $4: /* $3 */
-#line $2 "$1"
+b4_syncline([$2], [$1])
         $5;
-#line __oline__ "__ofile__"
+b4_syncline([__oline__], [__ofile__])
         break;
 m4_popdef([b4_at_dollar])dnl
 m4_popdef([b4_dollar_dollar])dnl
@@ -229,10 +229,10 @@ b4_pre_prologue
 
 #ifndef YYSTYPE
 m4_ifdef([b4_stype],
-[#line b4_stype_line "b4_filename"
+[b4_syncline([b4_stype_line], [b4_filename])
 typedef union b4_stype yystype;
 /* Line __line__ of __file__.  */
-#line __oline__ "__ofile__"],
+b4_syncline([__oline__], [__ofile__])],
 [typedef int yystype;])
 # define YYSTYPE yystype
 # define YYSTYPE_IS_TRIVIAL 1
@@ -254,7 +254,7 @@ typedef struct yyltype
 b4_post_prologue
 
 /* Line __line__ of __file__.  */
-#line __oline__ "__ofile__"
+b4_syncline([__oline__], [__ofile__])
 
 #if ! defined (yyoverflow) || YYERROR_VERBOSE
 
@@ -1053,7 +1053,7 @@ yyreduce:
     }
 
 /* Line __line__ of __file__.  */
-#line __oline__ "__ofile__"
+b4_syncline([__oline__], [__ofile__])
 \f
 [  yyvsp -= yylen;
   yyssp -= yylen;
@@ -1290,10 +1290,10 @@ b4_token_defines(b4_tokens)
 
 #ifndef YYSTYPE
 m4_ifdef([b4_stype],
-[#line b4_stype_line "b4_filename"
+[b4_syncline([b4_stype_line], [b4_filename])
 typedef union b4_stype yystype;
 /* Line __line__ of __file__.  */
-#line __oline__ "__ofile__"],
+b4_syncline([__oline__], [__ofile__])],
 [typedef int yystype;])
 # define YYSTYPE yystype
 #endif
index b86c09b..d5f39f4 100644 (file)
@@ -65,12 +65,6 @@ muscle_init (void)
   /* Version and input file.  */
   MUSCLE_INSERT_STRING ("version", VERSION);
   MUSCLE_INSERT_STRING ("filename", infile);
-
-  /* FIXME: there should probably be no default here, only in the
-     skeletons.  */
-
-  /* Default #line formatting.  */
-  MUSCLE_INSERT_STRING ("linef", "#line %d %s\n");
 }
 
 
index d13e51f..f115bd2 100644 (file)
@@ -276,11 +276,10 @@ user_actions_output (FILE *out)
       {
        fprintf (out, "  case %d:\n", r + 1);
 
-       if (!no_lines_flag)
-         fprintf (out, muscle_find ("linef"),
-                  rules[r].action_location.first_line,
-                  quotearg_style (c_quoting_style,
-                                  rules[r].action_location.file));
+       fprintf (out, "]b4_syncline([[%d]], [[%s]])[\n",
+                rules[r].action_location.first_line,
+                quotearg_style (escape_quoting_style,
+                                rules[r].action_location.file));
        fprintf (out, "    %s\n    break;\n\n",
                 rules[r].action);
       }
@@ -566,11 +565,12 @@ static void
 prepare (void)
 {
   /* Flags. */
-  MUSCLE_INSERT_INT ("locations_flag", locations_flag);
+  MUSCLE_INSERT_INT ("debug", debug_flag);
   MUSCLE_INSERT_INT ("defines_flag", defines_flag);
   MUSCLE_INSERT_INT ("error_verbose", error_verbose);
+  MUSCLE_INSERT_INT ("locations_flag", locations_flag);
   MUSCLE_INSERT_INT ("pure", pure_parser);
-  MUSCLE_INSERT_INT ("debug", debug_flag);
+  MUSCLE_INSERT_INT ("synclines_flag", !no_lines_flag);
 
   /* FIXME: This is wrong: the muscles should decide whether they hold
      a copy or not, but the situation is too obscure currently.  */
index 1c145c1..e85b042 100644 (file)
@@ -69,13 +69,9 @@ prologue_augment (const char *prologue, location_t location)
   struct obstack *oout =
     !typed ? &pre_prologue_obstack : &post_prologue_obstack;
 
-  if (!no_lines_flag)
-    {
-      obstack_fgrow2 (oout, muscle_find ("linef"),
-                     location.first_line,
-                     quotearg_style (c_quoting_style,
-                                     location.file));
-    }
+  obstack_fgrow2 (oout, "]b4_syncline([[%d]], [[%s]])[\n",
+          location.first_line,
+          quotearg_style (escape_quoting_style, location.file));
   obstack_sgrow (oout, prologue);
 }
 
@@ -89,13 +85,9 @@ prologue_augment (const char *prologue, location_t location)
 void
 epilogue_set (const char *epilogue, location_t location)
 {
-  if (!no_lines_flag)
-    {
-      obstack_fgrow2 (&muscle_obstack, muscle_find ("linef"),
-                     location.first_line,
-                     quotearg_style (c_quoting_style,
-                                     location.file));
-    }
+  obstack_fgrow2 (&muscle_obstack, "]b4_syncline([[%d]], [[%s]])[\n",
+                 location.first_line,
+                 quotearg_style (escape_quoting_style, location.file));
   obstack_sgrow (&muscle_obstack, epilogue);
   obstack_1grow (&muscle_obstack, 0);
   muscle_insert ("epilogue", obstack_finish (&muscle_obstack));