bug-bison
[Top][All Lists]
Advanced

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

Re: Untranslatable composition of sentence


From: Joel E. Denny
Subject: Re: Untranslatable composition of sentence
Date: Wed, 16 Jul 2008 03:02:22 -0400 (EDT)

On Tue, 10 Jun 2008, Joel E. Denny wrote:

> On Tue, 10 Jun 2008, Wojciech Polak wrote:
> 
> > On Tue, 2008-06-03 at 12:01 -0400, Goeran Uddeborg wrote:
> > 
> > > There is a problem in the messages if bison 2.3b.
> > > 
> > > The function reduce_print() in src/reduce.c composes a sentence of
> > > several parts.  In general it is not possible to translate such
> > > compositions to other languages.  In this case the translation of
> > > "useless" to Swedish would have different singular and plural forms.
> > 
> > Same in Polish. It's untranslatable, so can we change it to a complete
> > sentence?
> 
> Thanks to both of you for the report.  Sorry for the slow response.  I 
> haven't had a chance to look at this yet, but I haven't forgotten.  I'll 
> try to get to it soon.

Well, it wasn't soon, but I finally got to it.  I pushed the following.

Please let us know if there are any other troubles.  Thanks again!

>From bcf07cb7070fab57727b274486dc7a331ff8ac2d Mon Sep 17 00:00:00 2001
From: Joel E. Denny <address@hidden>
Date: Wed, 16 Jul 2008 02:56:36 -0400
Subject: [PATCH] Fix untranslatable composition of sentences.

Reported by Goran Uddeborg at
<http://lists.gnu.org/archive/html/bug-bison/2008-06/msg00000.html>.
* THANKS (Goran Uddeborg): Add.
* src/reduce.c (reduce_print): Report the number of nonterminals and
rules useless in the grammar in separate sentences.
* tests/reduce.at (Useless Rules): Update output.
(Reduced Automaton): Likewise.
(Underivable Rules): Likewise.
(Empty Language): Likewise.
---
 ChangeLog       |   13 +++++++++++++
 THANKS          |    1 +
 src/reduce.c    |   34 ++++++++++++++++------------------
 tests/reduce.at |   12 ++++++++----
 4 files changed, 38 insertions(+), 22 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 8ac70e0..9d5692c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2008-07-16  Joel E. Denny  <address@hidden>
+
+       Fix untranslatable composition of sentences.  Reported by Goran
+       Uddeborg at
+       <http://lists.gnu.org/archive/html/bug-bison/2008-06/msg00000.html>.
+       * THANKS (Goran Uddeborg): Add.
+       * src/reduce.c (reduce_print): Report the number of nonterminals and
+       rules useless in the grammar in separate sentences.
+       * tests/reduce.at (Useless Rules): Update output.
+       (Reduced Automaton): Likewise.
+       (Underivable Rules): Likewise.
+       (Empty Language): Likewise.
+
 2008-07-15  Joel E. Denny  <address@hidden>
 
        Fix some .gitignore and .cvsignore problems.
diff --git a/THANKS b/THANKS
index a54bf04..3842f6c 100644
--- a/THANKS
+++ b/THANKS
@@ -33,6 +33,7 @@ Fabrice Bauzac            address@hidden
 Florian Krohm             address@hidden
 Frank Heckenbach          address@hidden
 Frans Englich             address@hidden
+Goran Uddeborg            address@hidden
 Guido Trentalancia        address@hidden
 H. Merijn Brand           address@hidden
 Hans Aberg                address@hidden
diff --git a/src/reduce.c b/src/reduce.c
index 1306374..1f8fc34 100644
--- a/src/reduce.c
+++ b/src/reduce.c
@@ -382,26 +382,24 @@ reduce_output (FILE *out)
 static void
 reduce_print (void)
 {
-  fprintf (stderr, "%s: %s: ", grammar_file, _("warning"));
-
   if (nuseless_nonterminals > 0)
-    fprintf (stderr, ngettext ("%d nonterminal",
-                              "%d nonterminals",
-                              nuseless_nonterminals),
-            nuseless_nonterminals);
-
-  if (nuseless_nonterminals > 0 && nuseless_productions > 0)
-    fprintf (stderr, _(" and "));
-
+    {
+      fprintf (stderr, "%s: %s: ", grammar_file, _("warning"));
+      fprintf (stderr, ngettext ("%d nonterminal useless in grammar",
+                                 "%d nonterminals useless in grammar",
+                                 nuseless_nonterminals),
+               nuseless_nonterminals);
+      fprintf (stderr, "\n");
+    }
   if (nuseless_productions > 0)
-    fprintf (stderr, ngettext ("%d rule",
-                              "%d rules",
-                              nuseless_productions),
-            nuseless_productions);
-
-  if (nuseless_nonterminals > 0 || nuseless_productions > 0)
-    fprintf (stderr, _(" useless in grammar"));
-  fprintf (stderr, "\n");
+    {
+      fprintf (stderr, "%s: %s: ", grammar_file, _("warning"));
+      fprintf (stderr, ngettext ("%d rule useless in grammar",
+                                 "%d rules useless in grammar",
+                                 nuseless_productions),
+               nuseless_productions);
+      fprintf (stderr, "\n");
+    }
 }
 
 void
diff --git a/tests/reduce.at b/tests/reduce.at
index c7ca326..55220c8 100644
--- a/tests/reduce.at
+++ b/tests/reduce.at
@@ -142,7 +142,8 @@ useless9: '9';
 ]])
 
 AT_BISON_CHECK([[input.y]], 0, [],
-[[input.y: warning: 9 nonterminals and 9 rules useless in grammar
+[[input.y: warning: 9 nonterminals useless in grammar
+input.y: warning: 9 rules useless in grammar
 input.y:6.1-8: warning: nonterminal useless in grammar: useless1
 input.y:7.1-8: warning: nonterminal useless in grammar: useless2
 input.y:8.1-8: warning: nonterminal useless in grammar: useless3
@@ -237,7 +238,8 @@ non_productive: non_productive useless_token
 ]])
 
 AT_BISON_CHECK([[not-reduced.y]], 0, [],
-[[not-reduced.y: warning: 2 nonterminals and 3 rules useless in grammar
+[[not-reduced.y: warning: 2 nonterminals useless in grammar
+not-reduced.y: warning: 3 rules useless in grammar
 not-reduced.y:14.1-13: warning: nonterminal useless in grammar: not_reachable
 not-reduced.y:11.6-19: warning: nonterminal useless in grammar: non_productive
 not-reduced.y:11.6-57: warning: rule useless in grammar: exp: non_productive
@@ -311,7 +313,8 @@ indirection: underivable;
 ]])
 
 AT_BISON_CHECK([[input.y]], 0, [],
-[[input.y: warning: 2 nonterminals and 3 rules useless in grammar
+[[input.y: warning: 2 nonterminals useless in grammar
+input.y: warning: 3 rules useless in grammar
 input.y:5.15-25: warning: nonterminal useless in grammar: underivable
 input.y:6.14-24: warning: nonterminal useless in grammar: indirection
 input.y:5.15-25: warning: rule useless in grammar: exp: underivable
@@ -346,7 +349,8 @@ exp: exp;
 ]])
 
 AT_BISON_CHECK([[input.y]], 1, [],
-[[input.y: warning: 2 nonterminals and 2 rules useless in grammar
+[[input.y: warning: 2 nonterminals useless in grammar
+input.y: warning: 2 rules useless in grammar
 input.y:3.1-3: fatal error: start symbol exp does not derive any sentence
 ]])
 
-- 
1.5.4.3





reply via email to

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