bison-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] Introduce-alignment-mechanism-for-error-messages


From: Akim Demaille
Subject: Re: [PATCH] Introduce-alignment-mechanism-for-error-messages
Date: Thu, 17 Sep 2009 11:41:58 +0200


Le 17 sept. 2009 à 10:59, Alex Rozenman a écrit :

Akim,

But that's too complex for them (most are not programmer), and it might not even suffice to always produce nice translations. That's why I suggest that you de-factor and truly expose the two full format-strings: get rid of
msg[123], inline them in the format string.

So it is not advised to concat strings *before* translation, correct ?
(I just have misunderstand from your previous mail that there is a
problem with long complex sentences being translated together).

So I will need to repeat two long message strings twice - even they
are only slight different in English. This is the philosophy - correct
?

Yes, that's it.  That's also why you'll read this in the current code.

static void
conflict_report (FILE *out, int src_num, int rrc_num)
{
  if (src_num && rrc_num)
    fprintf (out, _("conflicts: %d shift/reduce, %d reduce/reduce\n"),
             src_num, rrc_num);
  else if (src_num)
    fprintf (out, _("conflicts: %d shift/reduce\n"), src_num);
  else if (rrc_num)
    fprintf (out, _("conflicts: %d reduce/reduce\n"), rrc_num);
}

This was installed by

commit be7280480c175bed203883f524c7dcd6cf37c13d
Author: Paul Eggert <address@hidden>
Date:   Sun Dec 29 01:58:49 2002 +0000

    (conflict_report):
    Renamed from conflict_report_yacc, removing the old
    'conflict_report'.  Translate the entire conflict report at once,
    so that we don't assume that "," has the same interpretation in
    all languages.
    (conflicts_output): Use Yacc-style conflict report for each state,
    instead of our more-complicated style.
    (conflicts_print): Use Yacc-style conflict report, except print
    the input file name when not emulating Yacc.

 static void
-conflict_report_yacc (int src_num, int rrc_num)
+conflict_report (FILE *out, int src_num, int rrc_num)
 {
-  /* If invoked with `--yacc', use the output format specified by
-     POSIX.  */
-  fprintf (stderr, _("conflicts: "));
-  if (src_num > 0)
-    fprintf (stderr, _(" %d shift/reduce"), src_num);
-  if (src_num > 0 && rrc_num > 0)
-    fprintf (stderr, ",");
-  if (rrc_num > 0)
-    fprintf (stderr, _(" %d reduce/reduce"), rrc_num);
-  putc ('\n', stderr);
+  if (src_num && rrc_num)
+    fprintf (out, _("conflicts: %d shift/reduce, %d reduce/reduce\n"),
+            src_num, rrc_num);
+  else if (src_num)
+    fprintf (out, _("conflicts: %d shift/reduce\n"), src_num);
+  else if (rrc_num)
+    fprintf (out, _("conflicts: %d reduce/reduce\n"), rrc_num);
 }





reply via email to

[Prev in Thread] Current Thread [Next in Thread]