diff options
-rw-r--r-- | pod/perldiag.pod | 18 | ||||
-rw-r--r-- | regcomp.c | 10 | ||||
-rw-r--r-- | t/pragma/warn/regcomp | 47 |
3 files changed, 38 insertions, 37 deletions
diff --git a/pod/perldiag.pod b/pod/perldiag.pod index a10f9dfb42..baa088c7be 100644 --- a/pod/perldiag.pod +++ b/pod/perldiag.pod @@ -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 @@ -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); } } } diff --git a/t/pragma/warn/regcomp b/t/pragma/warn/regcomp index 5d0c291ea0..ef87b7fbb4 100644 --- a/t/pragma/warn/regcomp +++ b/t/pragma/warn/regcomp @@ -11,10 +11,6 @@ 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] $_ = ""; |