summaryrefslogtreecommitdiff
path: root/regcomp.c
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>1999-10-14 22:08:22 +0000
committerJarkko Hietaniemi <jhi@iki.fi>1999-10-14 22:08:22 +0000
commit1028017ab8b9674cf749da3584eec9f032360d33 (patch)
tree9d45adc219fe29d5568c6d303fbe82507de3629a /regcomp.c
parent73b437c8b23cd73848b265b0c5a0c71d47dc6532 (diff)
downloadperl-1028017ab8b9674cf749da3584eec9f032360d33.tar.gz
Warn inside character classes about unknown backslash escapes
(that are not caught earlier because of being completely unknown, such as \m), such as \z (because they make do sense inside regexen, but not inside character classes). p4raw-id: //depot/cfgperl@4380
Diffstat (limited to 'regcomp.c')
-rw-r--r--regcomp.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/regcomp.c b/regcomp.c
index 0dafdd0b9b..2a27b07743 100644
--- a/regcomp.c
+++ b/regcomp.c
@@ -2061,9 +2061,9 @@ tryagain:
default:
if (!SIZE_ONLY && ckWARN(WARN_UNSAFE) && isALPHA(*p))
Perl_warner(aTHX_ WARN_UNSAFE,
- "/%.127s/: Unrecognized escape \\%c passed through",
- PL_regprecomp,
- *p);
+ "/%.127s/: Unrecognized escape \\%c passed through",
+ PL_regprecomp,
+ *p);
goto normal_default;
}
break;
@@ -2364,6 +2364,13 @@ S_regclass(pTHX)
value = scan_oct(--PL_regcomp_parse, 3, &numlen);
PL_regcomp_parse += numlen;
break;
+ default:
+ if (!SIZE_ONLY && ckWARN(WARN_UNSAFE) && isALPHA(value))
+ Perl_warner(aTHX_ WARN_UNSAFE,
+ "/%.127s/: Unrecognized escape \\%c in character class passed through",
+ PL_regprecomp,
+ value);
+ break;
}
}
if (namedclass > OOB_NAMEDCLASS) {
@@ -2808,6 +2815,13 @@ S_regclassutf8(pTHX)
value = scan_oct(--PL_regcomp_parse, 3, &numlen);
PL_regcomp_parse += numlen;
break;
+ default:
+ if (!SIZE_ONLY && ckWARN(WARN_UNSAFE) && isALPHA(value))
+ Perl_warner(aTHX_ WARN_UNSAFE,
+ "/%.127s/: Unrecognized escape \\%c in character class passed through",
+ PL_regprecomp,
+ value);
+ break;
}
}
if (namedclass > OOB_NAMEDCLASS) {