Make the unimplemented POSIX regex features [[.cc.]] and [[=c=]]
authorJeffrey Friedl <jfriedl@regex.info>
Sun, 16 Jul 2000 17:55:29 +0000 (10:55 -0700)
committerJarkko Hietaniemi <jhi@iki.fi>
Wed, 26 Jul 2000 04:31:01 +0000 (04:31 +0000)
to be fatal errors (instead of by default ignoring them, and
ignoring with a bug: even though -w gave an error, the opening [
was left in)  Reported in:

Subject: [ID 20000716.024] [=cc=] / [:blank:]
Message-Id: <200007170055.RAA23528@fummy.dsl.yahoo.com>

p4raw-id: //depot/perl@6439

pod/perldiag.pod
regcomp.c
t/pragma/warn/regcomp

index a10f9df..baa088c 100644 (file)
@@ -1031,23 +1031,23 @@ Perhaps you need to copy the value to a temporary, and repeat that.
 I<inside> character classes, the [] are part of the construct, for
 example: /[012[:alpha:]345]/.  Note that [= =] and [. .] are not
 currently implemented; they are simply placeholders for future
-extensions.
+extensions and will cause fatal errors.
 
 =item Character class syntax [. .] is reserved for future extensions
 
-(W regexp) Within regular expression character classes ([]) the syntax
+(F regexp) Within regular expression character classes ([]) the syntax
 beginning with "[." and ending with ".]" is reserved for future
-extensions.  If you need to represent those character sequences inside a
-regular expression character class, just quote the square brackets with
-the backslash: "\[." and ".\]".
+extensions.  If you need to represent those character sequences inside
+a regular expression character class, just quote the square brackets
+with the backslash: "\[." and ".\]".
 
 =item Character class syntax [= =] is reserved for future extensions
 
-(W regexp) Within regular expression character classes ([]) the syntax
+(F) Within regular expression character classes ([]) the syntax
 beginning with "[=" and ending with "=]" is reserved for future
-extensions.  If you need to represent those character sequences inside a
-regular expression character class, just quote the square brackets with
-the backslash: "\[=" and "=\]".
+extensions.  If you need to represent those character sequences inside
+a regular expression character class, just quote the square brackets
+with the backslash: "\[=" and "=\]".
 
 =item Character class [:%s:] unknown
 
index bbdfdc3..a15eb23 100644 (file)
--- a/regcomp.c
+++ b/regcomp.c
@@ -2842,10 +2842,10 @@ S_regpposixcc(pTHX_ I32 value)
                        Perl_croak(aTHX_
                                   "Character class [:%.*s:] unknown",
                                   t - s - 1, s + 1);
-               } else if (ckWARN(WARN_REGEXP) && !SIZE_ONLY)
+               } else if (!SIZE_ONLY)
                    /* [[=foo=]] and [[.foo.]] are still future. */
-                   Perl_warner(aTHX_ WARN_REGEXP,
-                               "Character class syntax [%c %c] is reserved for future extensions", c, c);
+                   Perl_croak(aTHX_
+                              "Character class syntax [%c %c] is reserved for future extensions", c, c);
            } else {
                /* Maternal grandfather:
                 * "[:" ending in ":" but not in ":]" */
@@ -2873,8 +2873,8 @@ S_checkposixcc(pTHX)
            Perl_warner(aTHX_ WARN_REGEXP,
                        "Character class syntax [%c %c] belongs inside character classes", c, c);
            if (c == '=' || c == '.')
-               Perl_warner(aTHX_ WARN_REGEXP,
-                           "Character class syntax [%c %c] is reserved for future extensions", c, c);
+               Perl_croak(aTHX_
+                          "Character class syntax [%c %c] is reserved for future extensions", c, c);
        }
     }
 }
index 5d0c291..ef87b7f 100644 (file)
 
   Character class [:%.*s:] unknown     [S_regpposixcc]
 
-  Character class syntax [. .] is reserved for future extensions [S_regpposixcc]
-
-  Character class syntax [= =] is reserved for future extensions [S_checkposixcc]
-
   Character class syntax [%c %c] belongs inside character classes [S_checkposixcc] 
   
   /%.127s/: false [] range \"%*.*s\" in regexp [S_regclass]
@@ -58,32 +54,37 @@ BEGIN { $ENV{PERL_DESTRUCT_LEVEL} = 0 unless $ENV{PERL_DESTRUCT_LEVEL} > 3 }
 use warnings 'regexp' ;
 $_ = "" ;
 /[:alpha:]/;
-/[.bar.]/;
-/[=zog=]/;
-/[[:alpha:]]/;
-/[[.foo.]]/;
-/[[=bar=]]/;
 /[:zog:]/;
 /[[:zog:]]/;
 no warnings 'regexp' ;
 /[:alpha:]/;
-/[.foo.]/;
-/[=bar=]/;
-/[[:alpha:]]/;
-/[[.foo.]]/;
-/[[=bar=]]/;
-/[[:zog:]]/;
 /[:zog:]/;
+/[[:zog:]]/;
 EXPECT
 Character class syntax [: :] belongs inside character classes at - line 5.
-Character class syntax [. .] belongs inside character classes at - line 6.
-Character class syntax [. .] is reserved for future extensions at - line 6.
-Character class syntax [= =] belongs inside character classes at - line 7.
-Character class syntax [= =] is reserved for future extensions at - line 7.
-Character class syntax [. .] is reserved for future extensions at - line 9.
-Character class syntax [= =] is reserved for future extensions at - line 10.
-Character class syntax [: :] belongs inside character classes at - line 11.
-Character class [:zog:] unknown at - line 12.
+Character class syntax [: :] belongs inside character classes at - line 6.
+Character class [:zog:] unknown at - line 7.
+########
+# regcomp.c [S_checkposixcc]
+BEGIN { $ENV{PERL_DESTRUCT_LEVEL} = 0 unless $ENV{PERL_DESTRUCT_LEVEL} > 3 }
+use warnings 'regexp' ;
+$_ = "" ;
+/[.zog.]/;
+no warnings 'regexp' ;
+/[.zog.]/;
+EXPECT
+Character class syntax [. .] belongs inside character classes at - line 5.
+Character class syntax [. .] is reserved for future extensions at - line 5.
+########
+# regcomp.c [S_checkposixcc]
+BEGIN { $ENV{PERL_DESTRUCT_LEVEL} = 0 unless $ENV{PERL_DESTRUCT_LEVEL} > 3 }
+use warnings 'regexp' ;
+$_ = "" ;
+/[[.zog.]]/;
+no warnings 'regexp' ;
+/[[.zog.]]/;
+EXPECT
+Character class syntax [. .] is reserved for future extensions at - line 5.
 ########
 # regcomp.c [S_regclass]
 $_ = "";