summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2011-10-04 23:02:15 +0200
committerBruno Haible <bruno@clisp.org>2011-10-04 23:02:15 +0200
commit517b83e0169d9268c36b9e500bbcbb0f6b8b7295 (patch)
treed990573d325738c0ad4be9af78fc53099fe793ad
parent6a34b9ef2a6f13fd0a8767e9810ab4d7b1e1f782 (diff)
downloadgettext-517b83e0169d9268c36b9e500bbcbb0f6b8b7295.tar.gz
xgettext for Scheme: Understand guile 2.0 comment syntax, part 1.
-rw-r--r--gettext-tools/src/ChangeLog8
-rw-r--r--gettext-tools/src/x-scheme.c19
2 files changed, 15 insertions, 12 deletions
diff --git a/gettext-tools/src/ChangeLog b/gettext-tools/src/ChangeLog
index 842dada43..8392394b6 100644
--- a/gettext-tools/src/ChangeLog
+++ b/gettext-tools/src/ChangeLog
@@ -1,3 +1,11 @@
+2011-10-04 Bruno Haible <bruno@clisp.org>
+
+ xgettext for Scheme: Understand guile 2.0 comment syntax, part 1.
+ * x-scheme.c (read_object): Understand !# as a block comment terminator
+ even when not surrounded by newlines.
+ Reported by David Pirotte <david@altosw.be>
+ via Santiago Vila <sanvila@unex.es>.
+
2011-07-29 Bruno Haible <bruno@clisp.org>
Fix xgettext crash when extracting a message with plural that is
diff --git a/gettext-tools/src/x-scheme.c b/gettext-tools/src/x-scheme.c
index 168cb3706..3b7beeb2d 100644
--- a/gettext-tools/src/x-scheme.c
+++ b/gettext-tools/src/x-scheme.c
@@ -1,5 +1,5 @@
/* xgettext Scheme backend.
- Copyright (C) 2004-2009 Free Software Foundation, Inc.
+ Copyright (C) 2004-2009, 2011 Free Software Foundation, Inc.
This file was written by Bruno Haible <bruno@clisp.org>, 2004-2005.
@@ -40,7 +40,7 @@
/* The Scheme syntax is described in R5RS. It is implemented in
- guile-1.6.4/libguile/read.c.
+ guile-2.0.0/libguile/read.c.
Since we are interested only in strings and in forms similar to
(gettext msgid ...)
or (ngettext msgid msgid_plural ...)
@@ -60,7 +60,7 @@
- The syntax code assigned to each character, and how tokens are built
up from characters (single escape, multiple escape etc.).
- - Comment syntax: ';' and '#! ... \n!#\n'.
+ - Comment syntax: ';' and '#! ... !#'.
- String syntax: "..." with single escapes.
@@ -935,12 +935,10 @@ read_object (struct object *op, flag_context_ty outer_context)
}
case '!':
- /* Block comment '#! ... \n!#\n'. We don't extract it
+ /* Block comment '#! ... !#'. We don't extract it
because it's only used to introduce scripts on Unix. */
{
- int last1 = 0;
- int last2 = 0;
- int last3 = 0;
+ int last = 0;
for (;;)
{
@@ -948,12 +946,9 @@ read_object (struct object *op, flag_context_ty outer_context)
if (c == EOF)
/* EOF is not allowed here. But be tolerant. */
break;
- if (last3 == '\n' && last2 == '!' && last1 == '#'
- && c == '\n')
+ if (last == '!' && c == '#')
break;
- last3 = last2;
- last2 = last1;
- last1 = c;
+ last = c;
}
continue;
}