bug-bison
[Top][All Lists]
Advanced

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

Re: i18n for yacc backend messages


From: Jan Nieuwenhuizen
Subject: Re: i18n for yacc backend messages
Date: Sat, 16 Apr 2005 10:00:27 +0200
User-agent: Gnus/5.1003 (Gnus v5.10.3) Emacs/21.3.50 (gnu/linux)

Paul Eggert writes:

> Thanks, but your patch was incomplete, as it didn't contain any fixes
> to lib/quotearg.c.

Ah, that file is not under version control.  Found it, see below.

For

    %token BOOK "\book"   /* backslash character + "ook" */
    %token BOOK "\\paper"

this produces

    static const char *const yytname[] =
    {
      "$end", ... "\"\book\"", ... "\"\\paper\"",

We may even want to drop the double quotes in some cases.

> I installed this patch instead.  It doesn't require any changes to
> quotearg (a shared module) so it's better in that respect.

Hmm, this doesn't fix the escaping problem, sorry.

Jan

Index: ChangeLog
===================================================================
RCS file: /cvsroot/bison/bison/ChangeLog,v
retrieving revision 1.1221
diff -p -u -r1.1221 ChangeLog
--- ChangeLog   16 Apr 2005 06:32:51 -0000      1.1221
+++ ChangeLog   16 Apr 2005 07:54:20 -0000
@@ -1,3 +1,11 @@
+2005-04-14  Jan Nieuwenhuizen  <address@hidden>
+
+       * gnulib/quotearg.c (quoting_style_args): Add
+       literal_double_quoting_style.
+
+       * src/output.c (prepare_symbols): Use it.  Fixes special C
+       character sequences and extraneous backslashes.
+       
 2005-04-15  Paul Eggert  <address@hidden>
 
        * src/parse-gram.y: Include quotearg.h.
Index: src/output.c
===================================================================
RCS file: /cvsroot/bison/bison/src/output.c,v
retrieving revision 1.230
diff -p -u -r1.230 output.c
--- src/output.c        7 Mar 2005 06:41:39 -0000       1.230
+++ src/output.c        16 Apr 2005 07:54:20 -0000
@@ -162,7 +162,8 @@ prepare_symbols (void)
     int j = 2;
     for (i = 0; i < nsyms; i++)
       {
-       const char *cp = quotearg_style (c_quoting_style, symbols[i]->tag);
+       const char *cp = quotearg_style (literal_double_quoting_style,
+                                        symbols[i]->tag);
        /* Width of the next token, including the two quotes, the
           comma and the space.  */
        int width = strlen (cp) + 2;
Index: gnulib/lib/quotearg.c
===================================================================
RCS file: /cvsroot/gnulib/gnulib/lib/quotearg.c,v
retrieving revision 1.43
diff -p -u -r1.43 quotearg.c
--- gnulib/lib/quotearg.c       11 Nov 2004 05:58:47 -0000      1.43
+++ gnulib/lib/quotearg.c       16 Apr 2005 07:54:23 -0000
@@ -97,6 +97,7 @@ char const *const quoting_style_args[] =
   "escape",
   "locale",
   "clocale",
+  "literal-double",
   0
 };
 
@@ -109,7 +110,8 @@ enum quoting_style const quoting_style_v
   c_quoting_style,
   escape_quoting_style,
   locale_quoting_style,
-  clocale_quoting_style
+  clocale_quoting_style,
+  literal_double_quoting_style,
 };
 
 /* The default quoting options.  */
@@ -215,6 +217,13 @@ quotearg_buffer_restyled (char *buffer, 
       quote_string_len = 1;
       break;
 
+    case literal_double_quoting_style:
+      STORE ('"');
+      backslash_escapes = false;
+      quote_string = "\"";
+      quote_string_len = 1;
+      break;
+
     case escape_quoting_style:
       backslash_escapes = true;
       break;
@@ -262,7 +271,7 @@ quotearg_buffer_restyled (char *buffer, 
       unsigned char c;
       unsigned char esc;
 
-      if (backslash_escapes
+      if ((backslash_escapes || quoting_style == literal_double_quoting_style)
          && quote_string_len
          && i + quote_string_len <= argsize
          && memcmp (arg + i, quote_string, quote_string_len) == 0)
Index: gnulib/lib/quotearg.h
===================================================================
RCS file: /cvsroot/gnulib/gnulib/lib/quotearg.h,v
retrieving revision 1.11
diff -p -u -r1.11 quotearg.h
--- gnulib/lib/quotearg.h       7 Aug 2004 00:09:39 -0000       1.11
+++ gnulib/lib/quotearg.h       16 Apr 2005 07:54:23 -0000
@@ -51,7 +51,10 @@ enum quoting_style
 
     /* Like c_quoting_style except use quotation marks appropriate for
        the locale (ls --quoting-style=clocale).  */
-    clocale_quoting_style
+    clocale_quoting_style,
+    
+    /* Like literal_quoting_style, except always use double quotes.  */
+    literal_double_quoting_style,
   };
 
 /* For now, --quoting-style=literal is the default, but this may change.  */

-- 
Jan Nieuwenhuizen <address@hidden> | GNU LilyPond - The music typesetter
http://www.xs4all.nl/~jantien       | http://www.lilypond.org




reply via email to

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