]> git.eshelyaron.com Git - emacs.git/commitdiff
(skip_chars): Only recognize [:class:] when it has the
authorKim F. Storm <storm@cua.dk>
Tue, 15 Jun 2004 09:42:31 +0000 (09:42 +0000)
committerKim F. Storm <storm@cua.dk>
Tue, 15 Jun 2004 09:42:31 +0000 (09:42 +0000)
proper format and class is a lower-case word.

src/syntax.c

index 62612620f03fd5bde55a71185e0dcc8bee5a1737..302250c39a46c00ad3f00a253cec6d24cab90c51 100644 (file)
@@ -1455,7 +1455,7 @@ skip_chars (forwardp, syntaxp, string, lim, handle_iso_classes)
            {
              const unsigned char *class_beg = str + i_byte + 1;
              const unsigned char *class_end = class_beg;
-             const unsigned char *class_limit = str + size_byte;
+             const unsigned char *class_limit = str + size_byte - 2;
              /* Leave room for the null.        */
              unsigned char class_name[CHAR_CLASS_MAX_LENGTH + 1];
              re_wctype_t cc;
@@ -1463,17 +1463,13 @@ skip_chars (forwardp, syntaxp, string, lim, handle_iso_classes)
              if (class_limit - class_beg > CHAR_CLASS_MAX_LENGTH)
                class_limit = class_beg + CHAR_CLASS_MAX_LENGTH;
 
-             while (class_end != class_limit
-                    && ! (*class_end >= 0200
-                          || *class_end <= 040
-                          || (*class_end == ':'
-                              && class_end[1] == ']')))
+             while (class_end < class_limit
+                    && *class_end >= 'a' && *class_end <= 'z')
                class_end++;
 
-             if (class_end == class_limit
-                 || *class_end >= 0200
-                 || *class_end <= 040)
-               error ("Invalid ISO C character class");
+             if (class_end == class_beg
+                 || *class_end != ':' || class_end[1] != ']')
+               goto not_a_class_name;
 
              bcopy (class_beg, class_name, class_end - class_beg);
              class_name[class_end - class_beg] = 0;
@@ -1488,6 +1484,7 @@ skip_chars (forwardp, syntaxp, string, lim, handle_iso_classes)
              continue;
            }
 
+       not_a_class_name:
          if (c == '\\')
            {
              if (i_byte == size_byte)