bug-bison
[Top][All Lists]
Advanced

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

Re: [PATCH 10/11] quote consistently and make tests pass with new quotin


From: Akim Demaille
Subject: Re: [PATCH 10/11] quote consistently and make tests pass with new quoting from gnulib
Date: Sun, 29 Jan 2012 19:05:09 +0100

Hi Paul,

Le 28 janv. 2012 à 22:50, Paul Eggert a écrit :

>>>  if (getenv ("BISON_C_QUOTING_STYLE"))
>>>    bison_quoting_style = shell_quoting_style;
> 
> Wouldn't it be better if we didn't have yet another
> environment variable to worry about?

Would you prefer LC_CTYPE as C or POSIX?

>> - Is there a consensus among gnulibers on single quotes vs.
>>  double quotes in error messages?
> 
> Bruno's suggestion, which I think is a good one, is to use
> single quotes when quoting code and other text that should
> not be translated, and to use double quotes when quoting
> natural-language text that should be translated.  Usually
> this means single quotes, but not always.

This is good to know, thanks!

> 
>>> -    error (EXIT_FAILURE, get_errno (), _("cannot open file '%s'"), name);
>>> +    error (EXIT_FAILURE, get_errno (), _("cannot open file %s"), quote 
>>> (name));
> 
> For that _particular_ diagnostic I'd prefer
> 
>   _("%s: cannot open"), quotearg_colon (name)
> 
> That way, the message is shorter and less quotier and easier to translate
> (the translators don't have to worry about quote marks at all, yay!)

Agreed :)  I'll try to write something about this in HACKING.
Or maybe the GCS should be clarified on this regard (disclaimer:
I have not checked them recently, will do so, and see if there
are improvements to suggest).

> and the most important thing (the file name) comes first.  This is the
> old Unix tradition, and in this particular case the traditional way
> seems better.

I agree.  Actually, I had already "normalized" some other
messages like this.

Here is my current proposal.  There are some changes in the test
suite, but I think there are improvements.  I am much closer to
the error messages as Joel as design them a couple of years ago.

I have left some failures in the test suite because I can't really
make up my mind.  First, in UTF-8, the messages look perfect:

> address@hidden ~/src/bison/_build/debug $ ./tests/bison 
> tests/testsuite.dir/018/input.y
> tests/testsuite.dir/018/input.y:1.10-2.0: missing ‘"’ at end of line
> tests/testsuite.dir/018/input.y:4.10-5.0: missing ‘'’ at end of line
> tests/testsuite.dir/018/input.y:14.11-15.0: missing ‘'’ at end of line
> tests/testsuite.dir/018/input.y:16.11-17.0: missing ‘"’ at end of line
> tests/testsuite.dir/018/input.y:19.13-20.0: missing ‘}’ at end of file
> tests/testsuite.dir/018/input.y:20.1: syntax error, unexpected end of file
> 
> 
> address@hidden ~/src/bison/_build/debug $ ./tests/bison 
> tests/testsuite.dir/030/empty.y
> tests/testsuite.dir/030/empty.y:2.8-9: warning: empty character literal
> tests/testsuite.dir/030/empty.y:3.8-4.0: warning: empty character literal
> tests/testsuite.dir/030/empty.y:3.8-4.0: missing ‘'’ at end of line
> tests/testsuite.dir/030/empty.y:4.8: warning: empty character literal
> tests/testsuite.dir/030/empty.y:4.8: missing ‘'’ at end of file

and now, the failures when nice quotes are disabled:

> 18. input.at:717: testing Unclosed constructs ...
> @@ -1,6 +1,6 @@
>  input.y:1.10-2.0: missing '"' at end of line
> -input.y:4.10-5.0: missing ''' at end of line
> -input.y:14.11-15.0: missing ''' at end of line
> +input.y:4.10-5.0: missing '\'' at end of line
> +input.y:14.11-15.0: missing '\'' at end of line
>  input.y:16.11-17.0: missing '"' at end of line
>  input.y:19.13-20.0: missing '}' at end of file
>  input.y:20.1: syntax error, unexpected end of file
> 
> 30. input.at:1197: testing Bad character literals ...
> @@ -1,6 +1,6 @@
>  empty.y:2.8-9: warning: empty character literal
>  empty.y:3.8-4.0: warning: empty character literal
> -empty.y:3.8-4.0: missing ''' at end of line
> +empty.y:3.8-4.0: missing '\'' at end of line
>  empty.y:4.8: warning: empty character literal
> -empty.y:4.8: missing ''' at end of file
> +empty.y:4.8: missing '\'' at end of file

I am not sure this is a real improvement.  In this case, I think
I would prefer issuing "'" (those three characters).  WDYT?

I updated the candidates/quotes branch.

Attachment: 0001-use-a-more-consistent-quoting-style.patch
Description: Binary data


reply via email to

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