diff options
-rw-r--r-- | gettext-tools/src/ChangeLog | 6 | ||||
-rw-r--r-- | gettext-tools/src/x-vala.c | 15 | ||||
-rw-r--r-- | gettext-tools/tests/ChangeLog | 4 | ||||
-rwxr-xr-x | gettext-tools/tests/xgettext-vala-1 | 8 |
4 files changed, 26 insertions, 7 deletions
diff --git a/gettext-tools/src/ChangeLog b/gettext-tools/src/ChangeLog index b82ca69..874da22 100644 --- a/gettext-tools/src/ChangeLog +++ b/gettext-tools/src/ChangeLog @@ -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 diff --git a/gettext-tools/src/x-vala.c b/gettext-tools/src/x-vala.c index 0aed60a..1d88f47 100644 --- a/gettext-tools/src/x-vala.c +++ b/gettext-tools/src/x-vala.c @@ -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; diff --git a/gettext-tools/tests/ChangeLog b/gettext-tools/tests/ChangeLog index 7c85044..c6b6d74 100644 --- a/gettext-tools/tests/ChangeLog +++ b/gettext-tools/tests/ChangeLog @@ -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. diff --git a/gettext-tools/tests/xgettext-vala-1 b/gettext-tools/tests/xgettext-vala-1 index b40c7ff..b59670b 100755 --- a/gettext-tools/tests/xgettext-vala-1 +++ b/gettext-tools/tests/xgettext-vala-1 @@ -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 |