[Top][All Lists]

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

Re: [bug-gettext] [PATCH 4/4] xg-js: fix end-of string miss bug due to b

From: Daiki Ueno
Subject: Re: [bug-gettext] [PATCH 4/4] xg-js: fix end-of string miss bug due to backslashes
Date: Thu, 25 Apr 2013 18:35:26 +0900
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)

Andreas Stricker <address@hidden> writes:

> --- a/gettext-tools/src/x-javascript.c
> +++ b/gettext-tools/src/x-javascript.c
> @@ -1009,7 +1009,7 @@ phase7_getuc (int quote_char, unsigned int 
> *backslash_counter)
>            case '\n':
>              continue;
>            case '\\':
> -            ++*backslash_counter;
> +            *backslash_counter = 0;

Thanks for looking into this.  However, I doubt that backslash_counter
is even needed for JavaScript parser.  The original code in the Python
parser has a check like this:

  if (c == quote_char && (interpret_ansic || (*backslash_counter & 1) == 0))

In JavaScript parser, interpret_ansic is always true, and the latter
condition won't be checked (i.e. this seems to be a regression
introduced by my rewrite :)

By the way, ECMA 262 says:

   * The CV of DoubleStringCharacter :: \ EscapeSequence is the CV of the

   * The CV of CharacterEscapeSequence :: NonEscapeCharacter is the CV of
     the NonEscapeCharacter.

where CV stands for "character value".  That means, "\xxx" should be
treated as "xxx", while the current implementation treats it as "\\xxx".

Daiki Ueno

reply via email to

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