]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
Fix the extraction of tagged comments.
authorBruno Haible <bruno@clisp.org>
Tue, 25 Nov 2003 11:07:27 +0000 (11:07 +0000)
committerBruno Haible <bruno@clisp.org>
Tue, 23 Jun 2009 10:11:21 +0000 (12:11 +0200)
12 files changed:
gettext-tools/src/ChangeLog
gettext-tools/src/x-awk.c
gettext-tools/src/x-c.c
gettext-tools/src/x-elisp.c
gettext-tools/src/x-java.c
gettext-tools/src/x-librep.c
gettext-tools/src/x-lisp.c
gettext-tools/src/x-sh.c
gettext-tools/src/x-tcl.c
gettext-tools/src/x-ycp.c
gettext-tools/tests/ChangeLog
gettext-tools/tests/Makefile.am

index 60ab037bf7f491baeb241d69cc82fa1672dd01d4..8f60594b4252430b7c5335d145fdb1e071dbd3a8 100644 (file)
@@ -1,3 +1,20 @@
+2003-11-22  Bruno Haible  <bruno@clisp.org>
+
+       * x-c.c (phase4_getc): Skip leading whitespace in C++ style comments
+       as well.
+       * x-sh.c (read_word): Skip leading whitespace in comments.
+       * x-lisp.c (read_object): Skip leading whitespace in single-line
+       comments as well.
+       * x-elisp.c (read_object): Skip leading whitespace in comments.
+       * x-librep.c (read_object): Skip leading whitespace in single-line
+       comments as well.
+       * x-java.c (phase4_getc): Skip leading whitespace in C++ style comments
+       as well.
+       * x-awk.c (phase2_getc): Skip leading whitespace in comments.
+       * x-ycp.c (phase2_getc): Skip leading whitespace in single-line
+       comments as well.
+       * x-tcl.c (read_command): Skip leading whitespace in comments.
+
 2003-11-24  Bruno Haible  <bruno@clisp.org>
 
        * format-lisp.c (check_params): Use ngettext for one of the messages.
index 933daedd0148e91d1de31b58e4eda911c0ca4bbc..a9023403659a6d60373489b2cb9028b86d925601 100644 (file)
@@ -187,12 +187,16 @@ phase2_getc ()
          c = phase1_getc ();
          if (c == '\n' || c == EOF)
            break;
-         if (buflen >= bufmax)
+         /* We skip all leading white space, but not EOLs.  */
+         if (!(buflen == 0 && (c == ' ' || c == '\t')))
            {
-             bufmax = 2 * bufmax + 10;
-             buffer = xrealloc (buffer, bufmax);
+             if (buflen >= bufmax)
+               {
+                 bufmax = 2 * bufmax + 10;
+                 buffer = xrealloc (buffer, bufmax);
+               }
+             buffer[buflen++] = c;
            }
-         buffer[buflen++] = c;
        }
       if (buflen >= bufmax)
        {
index cfff2d32d43ce87b5b09921179bb5d3c3f1a59b0..d38bc6aadca5f7ac79facb0299ce2c30dc486be3 100644 (file)
@@ -662,7 +662,9 @@ phase4_getc ()
          c = phase3_getc ();
          if (c == '\n' || c == EOF)
            break;
-         comment_add (c);
+         /* We skip all leading white space, but not EOLs.  */
+         if (!(buflen == 0 && (c == ' ' || c == '\t')))
+           comment_add (c);
        }
       comment_line_end (0);
       last_comment_line = newline_count;
index d1ecabc7b1d2bb212c385f6869a2910d21cbfc4a..03251636a26d68706f27fefdf71997448552a562 100644 (file)
@@ -864,7 +864,11 @@ read_object (struct object *op, bool first_in_list, bool new_backquote_flag,
                if (c != ';')
                  all_semicolons = false;
                if (!all_semicolons)
-                 comment_add (c);
+                 {
+                   /* We skip all leading white space, but not EOLs.  */
+                   if (!(buflen == 0 && (c == ' ' || c == '\t')))
+                     comment_add (c);
+                 }
              }
            comment_line_end (0);
            continue;
index eb38a8482f11643a8d6e1434bcd9a440b4e2ba0b..04a61c33b75eee58fcda61c8f147585a35946cb6 100644 (file)
@@ -766,7 +766,9 @@ phase4_getc ()
          c = phase3_getc ();
          if (RED (c) == '\n' || c == P2_EOF)
            break;
-         comment_add (c);
+         /* We skip all leading white space, but not EOLs.  */
+         if (!(comment_at_start () && (RED (c) == ' ' || RED (c) == '\t')))
+           comment_add (c);
        }
       phase3_ungetc (c); /* push back the newline, to decrement line_number */
       comment_line_end (0);
index 106b80867de38c3b3734a31e2abbdffc00ac4b8f..afa99fc3bb3918ac765c598ca3365f000e53b81a 100644 (file)
@@ -800,7 +800,11 @@ read_object (struct object *op, flag_context_ty outer_context)
                if (c != ';')
                  all_semicolons = false;
                if (!all_semicolons)
-                 comment_add (c);
+                 {
+                   /* We skip all leading white space, but not EOLs.  */
+                   if (!(buflen == 0 && (c == ' ' || c == '\t')))
+                     comment_add (c);
+                 }
              }
            comment_line_end (0);
            continue;
index 0c687ee9a4bc33117a5499535edd6b3d3c88888a..c3c8a556b269804d3837c1298371cfc9db35b6a0 100644 (file)
@@ -1174,7 +1174,11 @@ read_object (struct object *op, flag_context_ty outer_context)
                    if (c != ';')
                      all_semicolons = false;
                    if (!all_semicolons)
-                     comment_add (c);
+                     {
+                       /* We skip all leading white space, but not EOLs.  */
+                       if (!(buflen == 0 && (c == ' ' || c == '\t')))
+                         comment_add (c);
+                     }
                  }
                comment_line_end (0);
                continue;
index 2d8afa743ae805957ae0160cbb2d83853ba23511..de634065e4ca46f664158a436b4d5757b23a7f65 100644 (file)
@@ -714,7 +714,9 @@ read_word (struct word *wp, int looking_for, flag_context_ty context)
              c = phase1_getc ();
              if (c == EOF || c == '\n')
                break;
-             comment_add (c);
+             /* We skip all leading white space, but not EOLs.  */
+             if (!(buflen == 0 && (c == ' ' || c == '\t')))
+               comment_add (c);
            }
          comment_line_end ();
        }
index bfad460772f4187426e10319e2d59b67b3627a70..f35143a7671dc133b7562afa41bff2c1c03384aa 100644 (file)
@@ -830,7 +830,9 @@ read_command (int looking_for, flag_context_ty outer_context)
              c = phase2_getc ();
              if (c == EOF || c == CL_BRACE || c == '\n')
                break;
-             comment_add (c);
+             /* We skip all leading white space, but not EOLs.  */
+             if (!(buflen == 0 && (c == ' ' || c == '\t')))
+               comment_add (c);
            }
          comment_line_end ();
          continue;
index 80a8cfd8360ca592b121d2ab2f789f2524c2d879..e13ed185d3a5e3bc9ad1c98c081d381926cdaf0d 100644 (file)
@@ -159,12 +159,16 @@ phase2_getc ()
              c = phase1_getc ();
              if (c == '\n' || c == EOF)
                break;
-             if (buflen >= bufmax)
+             /* We skip all leading white space, but not EOLs.  */
+             if (!(buflen == 0 && (c == ' ' || c == '\t')))
                {
-                 bufmax = 2 * bufmax + 10;
-                 buffer = xrealloc (buffer, bufmax);
+                 if (buflen >= bufmax)
+                   {
+                     bufmax = 2 * bufmax + 10;
+                     buffer = xrealloc (buffer, bufmax);
+                   }
+                 buffer[buflen++] = c;
                }
-             buffer[buflen++] = c;
            }
          if (buflen >= bufmax)
            {
@@ -201,7 +205,7 @@ phase2_getc ()
              if (c == EOF)
                break;
              /* We skip all leading white space, but not EOLs.  */
-             if (buflen == 0 && isspace (c) && c != '\n')
+             if (buflen == 0 && (c == ' ' || c == '\t'))
                continue;
              if (buflen >= bufmax)
                {
@@ -260,12 +264,16 @@ phase2_getc ()
              c = phase1_getc ();
              if (c == '\n' || c == EOF)
                break;
-             if (buflen >= bufmax)
+             /* We skip all leading white space, but not EOLs.  */
+             if (!(buflen == 0 && (c == ' ' || c == '\t')))
                {
-                 bufmax = 2 * bufmax + 10;
-                 buffer = xrealloc (buffer, bufmax);
+                 if (buflen >= bufmax)
+                   {
+                     bufmax = 2 * bufmax + 10;
+                     buffer = xrealloc (buffer, bufmax);
+                   }
+                 buffer[buflen++] = c;
                }
-             buffer[buflen++] = c;
            }
          if (buflen >= bufmax)
            {
index a1963b9c7a8b558750912cdf303b171006098816..344239e1307abef5802873257e8838b42a1c512c 100644 (file)
@@ -1,3 +1,20 @@
+2003-11-22  Bruno Haible  <bruno@clisp.org>
+
+       * xgettext-c-9: New file.
+       * xgettext-sh-2: New file.
+       * xgettext-python-2: New file.
+       * xgettext-lisp-1: New file.
+       * xgettext-elisp-1: New file.
+       * xgettext-librep-1: New file.
+       * xgettext-smalltalk-1: New file.
+       * xgettext-java-5: New file.
+       * xgettext-awk-1: New file.
+       * xgettext-ycp-2: New file.
+       * xgettext-tcl-2: New file.
+       * xgettext-perl-5: New file.
+       * xgettext-php-1: New file.
+       * Makefile.am (TESTS): Add them.
+
 2003-11-15  Bruno Haible  <bruno@clisp.org>
 
        * Makefile.am (AM_CPPFLAGS): Renamed from INCLUDES.
index 54bc68b9bf6d11437edf8fbeeb7a6e7f591aabc6..ffbe12c9c178a2d45ab2dcb06f2b700040cddfb9 100644 (file)
@@ -57,19 +57,27 @@ TESTS = gettext-1 gettext-2 \
        msguniq-1 msguniq-2 msguniq-3 msguniq-4 \
        xgettext-1 xgettext-2 xgettext-3 xgettext-4 xgettext-5 xgettext-6 \
        xgettext-7 \
+       xgettext-awk-1 \
        xgettext-c-1 xgettext-c-2 xgettext-c-3 xgettext-c-4 xgettext-c-5 \
-       xgettext-c-6 xgettext-c-7 xgettext-c-8 \
+       xgettext-c-6 xgettext-c-7 xgettext-c-8 xgettext-c-9 \
+       xgettext-elisp-1 \
        xgettext-glade-1 xgettext-glade-2 xgettext-glade-3 \
        xgettext-java-1 xgettext-java-2 xgettext-java-3 xgettext-java-4 \
+       xgettext-java-5 \
+       xgettext-librep-1 \
+       xgettext-lisp-1 \
        xgettext-objc-1 \
        xgettext-perl-1 xgettext-perl-2 xgettext-perl-3 xgettext-perl-4 \
+       xgettext-perl-5 \
+       xgettext-php-1 \
        xgettext-po-1 \
        xgettext-properties-1 \
-       xgettext-python-1 \
-       xgettext-sh-1 \
+       xgettext-python-1 xgettext-python-2 \
+       xgettext-sh-1 xgettext-sh-2 \
+       xgettext-smalltalk-1 \
        xgettext-stringtable-1 \
-       xgettext-tcl-1 \
-       xgettext-ycp-1 \
+       xgettext-tcl-1 xgettext-tcl-2 \
+       xgettext-ycp-1 xgettext-ycp-2 \
        format-awk-1 format-awk-2 \
        format-c-1 format-c-2 format-c-3 format-c-4 \
        format-elisp-1 format-elisp-2 \