bug-gettext
[Top][All Lists]
Advanced

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

[bug-gettext] [PATCH 0/2] xgettext: Delay interpretation of escape seque


From: Daiki Ueno
Subject: [bug-gettext] [PATCH 0/2] xgettext: Delay interpretation of escape sequence
Date: Thu, 8 May 2014 18:30:14 +0900

Related to:
<https://lists.gnu.org/archive/html/bug-gettext/2013-02/msg00004.html>.

Some time ago, I moved the 'mixed_string_buffer' stuff from x-python.c
to xgettext.c and implemented C99-style Unicode escapes (\unnnn and
\Unnnnnnnn) using it, for C and Vala.  However, I realized that it
doesn't work well, because these escapes are interpreted and converted
to UTF-8 when we encounter a string literal (in 'phase7_get'), while
encoding conversion can also happen when we see a function call (in
'arglist_parser_done').  This could be a problem when the code mixes
the use of \u, \x, and bare bytes to represent multibyte strings.

So I plan to rewrite this more accurately.  The current idea is to
delay the interpretation/conversion until 'arglist_parser_done' is
called, like this:

1. add a variant of 'arglist_parser_remember', called
   'arglist_parser_remember_literal', which takes an uninterpreted string

2. register the scanner with a function to interpret escapes in a string

I feel this a bit overkill, but if there's no good alternative, I plan
to go with this.

Daiki Ueno (2):
  xgettext: Provide a way to interpret string literals lazily
  c: Interpret string literals lazily

 gettext-tools/src/x-awk.h         |   2 +-
 gettext-tools/src/x-c.c           | 515 ++++++++++++++++++++------------------
 gettext-tools/src/x-c.h           |  14 +-
 gettext-tools/src/x-csharp.h      |   2 +-
 gettext-tools/src/x-desktop.h     |   2 +-
 gettext-tools/src/x-elisp.h       |   2 +-
 gettext-tools/src/x-glade.h       |   2 +-
 gettext-tools/src/x-gsettings.h   |   2 +-
 gettext-tools/src/x-java.h        |   2 +-
 gettext-tools/src/x-javascript.h  |   2 +-
 gettext-tools/src/x-librep.h      |   2 +-
 gettext-tools/src/x-lisp.h        |   2 +-
 gettext-tools/src/x-lua.h         |   2 +-
 gettext-tools/src/x-perl.h        |   2 +-
 gettext-tools/src/x-php.h         |   2 +-
 gettext-tools/src/x-po.h          |   2 +-
 gettext-tools/src/x-properties.h  |   2 +-
 gettext-tools/src/x-python.h      |   2 +-
 gettext-tools/src/x-rst.h         |   2 +-
 gettext-tools/src/x-scheme.h      |   2 +-
 gettext-tools/src/x-sh.h          |   2 +-
 gettext-tools/src/x-smalltalk.h   |   2 +-
 gettext-tools/src/x-stringtable.h |   2 +-
 gettext-tools/src/x-tcl.h         |   2 +-
 gettext-tools/src/x-vala.h        |   2 +-
 gettext-tools/src/x-ycp.h         |   2 +-
 gettext-tools/src/xgettext.c      | 120 ++++++++-
 gettext-tools/src/xgettext.h      |  29 ++-
 28 files changed, 442 insertions(+), 284 deletions(-)

-- 
1.9.0




reply via email to

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