[Top][All Lists]

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

Re: [PATCH 0/3] {master} convert the conflict messages to a more bison-l

From: Akim Demaille
Subject: Re: [PATCH 0/3] {master} convert the conflict messages to a more bison-like form
Date: Sun, 23 Sep 2012 21:03:28 +0200

Hi Paul!

Le 23 sept. 2012 à 17:55, Paul Eggert a écrit :

> Thanks, that reminded me of the problem.  Unfortunately the patch
> you proposed has the problem.  There are a couple of instances of
> code like this:
> +          complain (complaint,
> +                    ngettext ("%d reduce/reduce conflict, expected %d",
> +                              "%d reduce/reduce conflicts, expected %d",
> +                              total),
> +                    total, expected);
> But this isn't right, as there are two numbers 'total' and 'expected',
> and either or both can be singular or plural so there are four possibilities
> not two, and this can matter for the translation (even though it doesn't
> happen to matter for the English version).

Are there any evidence that there are languages in which there
would be no possible translation like that one?  I would venture
there is always a means to write it properly, even if that
means falling into some more mathematical wording

  unexpected number of shift/reduce conflicts: %d instead of %d
  shift/reduce conflict number mismatch: %d instead of %d

Besides, I am not a native English speaker, yet I don't subscribe
to the idea that messages should be altered in English in fear that
some language would not be able to support it.  I wholeheartedly
agree to pay attention to make translatable messages (and therefore
to avoid building sentences from bits), but that's not the case here:
you suggest to avoid the natural one-liner for a two-line error message.

> How about if we stick with the current style for numbers but use
> the patch's style for everything else?  That is, instead of
> the current style:
>    foo.y: conflicts: 1 shift/reduce, 2 reduce/reduce
> and the proposed style:
>    foo.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
>    foo.y: warning: 2 reduce/reduce conflicts [-Wconflicts-rr]
> we use this style:
>    foo.y: warning: conflicts: 1 shift/reduce, 2 reduce/reduce [-Wconflicts-sr]

There are actually two different warning categories here:
sr and rr.

> That'll be easier to generate, easier to translate,
> and easier to parse automatically.

But we still would have three different lines for mismatches on
expected and effective.

    bar.y: conflicts: 1 shift/reduce, 2 reduce/reduce
    bar.y: expected 0 shift/reduce conflicts
    bar.y: expected 0 reduce/reduce conflicts

My proposal, imho, is more readable, and more consistent
with the fact that there is one line per kind of conflict in both
cases (with or without %expect).

    bar.y: 1 shift/reduce conflict, expected 0
    bar.y: 2 reduce/reduce conflicts, expected 0

reply via email to

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