]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
vala: Don't elide comments while parsing string literal
authorDaiki Ueno <ueno@gnu.org>
Mon, 2 Jun 2014 21:04:28 +0000 (06:04 +0900)
committerDaiki Ueno <ueno@gnu.org>
Mon, 2 Jun 2014 21:04:28 +0000 (06:04 +0900)
* x-vala.c (phase3_get): Use phase1_getc to read characters inside
a string literal.

gettext-tools/src/ChangeLog
gettext-tools/src/x-vala.c
gettext-tools/tests/ChangeLog
gettext-tools/tests/xgettext-vala-1

index b82ca6942eec36e29935a8bfd7fbcc015b7f2d4c..874da22985d4d95abe5d13db67555dd006b23cfb 100644 (file)
@@ -1,3 +1,9 @@
+2014-06-03  Daiki Ueno  <ueno@gnu.org>
+
+       vala: Don't elide comments while parsing string literal
+       * x-vala.c (phase3_get): Use phase1_getc to read characters inside
+       a string literal.
+
 2014-06-02  Daiki Ueno  <ueno@gnu.org>
 
        msgl-check: Treat missing header errors as warnings
index 0aed60ac6ea9884bbe2e5aa20a7121da009e3b45..1d88f47a7d111c18ad960391ec7f57fd07d6eb03 100644 (file)
@@ -690,21 +690,22 @@ phase3_get (token_ty *tp)
                 bufpos = 0;
                 for (;;)
                   {
-                    c = phase2_getc ();
+                    /* Use phase 1, because phase 2 elides comments.  */
+                    c = phase1_getc ();
                     if (c == EOF)
                       break;
 
                     if (c == '"')
                       {
-                        int c2 = phase2_getc ();
+                        int c2 = phase1_getc ();
                         if (c2 == '"')
                           {
-                            int c3 = phase2_getc ();
+                            int c3 = phase1_getc ();
                             if (c3 == '"')
                               break;
-                            phase2_ungetc (c3);
+                            phase1_ungetc (c3);
                           }
-                        phase2_ungetc (c2);
+                        phase1_ungetc (c2);
                       }
                     if (bufpos >= bufmax)
                       {
@@ -720,7 +721,7 @@ phase3_get (token_ty *tp)
                 bufpos = 0;
                 for (;;)
                   {
-                    c = phase2_getc ();
+                    c = phase1_getc ();
                     if (last_was_backslash)
                       {
                         last_was_backslash = false;
@@ -753,7 +754,7 @@ phase3_get (token_ty *tp)
 %s:%d: warning: unterminated string literal"),
                                logical_file_name, line_number - 1);
                         error_with_progname = true;
-                        phase2_ungetc ('\n');
+                        phase1_ungetc ('\n');
                         break;
                       case EOF: case '"':
                         break;
index 7c850443216d00f65c73631f5a9cef195f0247b7..c6b6d74e12cba28fb443d902445a54809f63a89d 100644 (file)
@@ -1,3 +1,7 @@
+2014-06-03  Daiki Ueno  <ueno@gnu.org>
+
+       * xgettext-vala-1: Test comment-like string inside a string literal.
+
 2014-06-02  Daiki Ueno  <ueno@gnu.org>
 
        * msgfmt-10: Update after error checking behaviro change.
index b40c7ff3bc4c3670dbca949ee0ce9c7db8cef1d2..b59670b4130a0fbba55bb26456d5647aedb6c277 100755 (executable)
@@ -22,6 +22,8 @@ int main (string[] args) {
     var s5 = _("Extract this \u2464th string");
 
     var s6 = /_("This is a regex literal and must not be extracted!")/i;
+
+    var s7 = _("Extract this //sixth string");
     return 0;
 }
 EOF
@@ -70,6 +72,9 @@ msgstr ""
 
 msgid "Extract this ⑤th string"
 msgstr ""
+
+msgid "Extract this //sixth string"
+msgstr ""
 EOF
 
 : ${DIFF=diff}
@@ -130,6 +135,9 @@ msgstr ""
 
 msgid "Extract this ⑤th string"
 msgstr ""
+
+msgid "Extract this //sixth string"
+msgstr ""
 EOF
 
 ${DIFF} xg-vala-1.all.ok xg-vala-1.pot