]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
xgettext for Scheme: Understand guile 2.0 comment syntax, part 1.
authorBruno Haible <bruno@clisp.org>
Tue, 4 Oct 2011 21:02:15 +0000 (23:02 +0200)
committerBruno Haible <bruno@clisp.org>
Tue, 4 Oct 2011 21:02:15 +0000 (23:02 +0200)
gettext-tools/src/ChangeLog
gettext-tools/src/x-scheme.c

index 842dada43a3572ec43fc6446ca0cb73b0718d7fc..8392394b6a26b637f7eeec6ac13f3fc497efafcc 100644 (file)
@@ -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
index 168cb370662f6021e30aee7fe9d6d416e3b896c8..3b7beeb2dafc7dfe6782a9ebcff31425f7293066 100644 (file)
@@ -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;
                 }