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: Mon, 30 Jan 2012 10:43:01 +0100

Hi Paul,

For the records, some of the context that was missing.

Le 30 janv. 2012 à 05:47, Paul Eggert a écrit :

> On 01/29/2012 10:05 AM, Akim Demaille wrote:
> 
>>> 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?
> 
> Sorry, I've lost context, but yes it'd be OK if Bison's quoting
> style depended on whether the LC_CTYPE locale was "C" or not.

Bruno says it's ok that LC_ALL=C is not obeyed at all on
Mac OS X for locale_quoting_style.  So I need a means to disable
this on the caller side, and I had suggested:

+void
+quote_init (void)
+{
+  if (getenv ("BISON_C_QUOTING_STYLE"))
+    set_custom_quoting (0, "'", "'");
+  else
+    set_quoting_style (0, locale_quoting_style);
+}



>>> -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?
> 
> Sure, if you want to be that fancy, you can use double-quotes
> if the token contains a single quote.  But what would happen
> if the token contains both single and double quotes?  Would
> we fall back on \ in that case, e.g.:
> 
>   missing '"\'"' at end of file
> 
> if the actual token is:
> 
>   "'"

Actually, again, I had not given enough context, sorry about
this.  The different kinds of "missing" guys is fixed, hard
wired.

src/scan-gram.l:    unexpected_eof (bracketed_id_start, "]");
src/scan-gram.l:  <<EOF>>  unexpected_eof (token_start, "*/"); BEGIN 
context_state;
src/scan-gram.l:  <<EOF>>         unexpected_eof (token_start, "*/"); BEGIN 
context_state;
src/scan-gram.l:      unexpected_newline (token_start, "\"");
src/scan-gram.l:    unexpected_eof (token_start, "\"");
src/scan-gram.l:      unexpected_newline (token_start, "'");
src/scan-gram.l:    unexpected_eof (token_start, "'");
src/scan-gram.l:    unexpected_eof (token_start, ">");
src/scan-gram.l:  \n            unexpected_newline (token_start, "'"); BEGIN 
context_state;
src/scan-gram.l:  <<EOF>>       unexpected_eof (token_start, "'"); BEGIN 
context_state;
src/scan-gram.l:  \n            unexpected_newline (token_start, "\""); BEGIN 
context_state;
src/scan-gram.l:  <<EOF>>       unexpected_eof (token_start, "\""); BEGIN 
context_state;
src/scan-gram.l:    unexpected_eof (code_start, "}");
src/scan-gram.l:    unexpected_eof (code_start, "%}");

So there is nothing really advanced here, I am truly suggesting
to treat the sole case of ' as "'" instead of ''' or '\''.

Here is a patch that does all this.  candidates/quotes is
updated.

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




reply via email to

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