From: Bruno Haible Date: Tue, 4 Oct 2011 21:02:15 +0000 (+0200) Subject: xgettext for Scheme: Understand guile 2.0 comment syntax, part 1. X-Git-Tag: v0.18.2~55 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=517b83e0169d9268c36b9e500bbcbb0f6b8b7295;p=thirdparty%2Fgettext.git xgettext for Scheme: Understand guile 2.0 comment syntax, part 1. --- 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 + + 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 + via Santiago Vila . + 2011-07-29 Bruno Haible 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 , 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; }