summaryrefslogtreecommitdiffstats
path: root/gettext-tools
diff options
context:
space:
mode:
authorDaiki Ueno <ueno@gnu.org>2014-06-03 06:04:28 +0900
committerDaiki Ueno <ueno@gnu.org>2014-06-03 06:04:28 +0900
commit0d5a75817ada8f531e019715eb9fa2862aefefea (patch)
tree9d4858b678bff2140545d65f27a9fcdc1d903c9a /gettext-tools
parent317449061ac9b2ed2a24fa51de1bc75278ae8497 (diff)
downloadexternal_gettext-0d5a75817ada8f531e019715eb9fa2862aefefea.zip
external_gettext-0d5a75817ada8f531e019715eb9fa2862aefefea.tar.gz
external_gettext-0d5a75817ada8f531e019715eb9fa2862aefefea.tar.bz2
vala: Don't elide comments while parsing string literal
* x-vala.c (phase3_get): Use phase1_getc to read characters inside a string literal.
Diffstat (limited to 'gettext-tools')
-rw-r--r--gettext-tools/src/ChangeLog6
-rw-r--r--gettext-tools/src/x-vala.c15
-rw-r--r--gettext-tools/tests/ChangeLog4
-rwxr-xr-xgettext-tools/tests/xgettext-vala-18
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