summaryrefslogtreecommitdiff
path: root/toke.c
diff options
context:
space:
mode:
authorYitzchak Scott-Thoennes <sthoenna@efn.org>2004-03-22 02:32:05 -0800
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2004-03-22 19:25:59 +0000
commitdecca21cb05bd8819a555574b7c51f4597013939 (patch)
tree5244a4d8e1c323fe4f769c8c5a2a6a9f3da2df9d /toke.c
parent3b8c0df9bfb9b3699a23e8633f5ede3b929d4620 (diff)
downloadperl-decca21cb05bd8819a555574b7c51f4597013939.tar.gz
Re: [PATCH] warn on !=~
Message-ID: <20040322183106.GA1284@efn.org> More warnings for this case. p4raw-id: //depot/perl@22553
Diffstat (limited to 'toke.c')
-rw-r--r--toke.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/toke.c b/toke.c
index 46aa3aa0ac..e27e32cc6e 100644
--- a/toke.c
+++ b/toke.c
@@ -3383,14 +3383,18 @@ Perl_yylex(pTHX)
s++;
tmp = *s++;
if (tmp == '=') {
- /* was this !=~ where !~ was meant? */
+ /* was this !=~ where !~ was meant?
+ * warn on m:!=~\s+([/?]|[msy]\W|tr\W): */
+
if (*s == '~' && ckWARN(WARN_SYNTAX)) {
char *t = s+1;
while (t < PL_bufend && isSPACE(*t))
++t;
- if (*t == '/' || (*t == 'm' && !isALNUM(t[1])) || *t == '?')
+ if (*t == '/' || *t == '?' ||
+ ((*t == 'm' || *t == 's' || *t == 'y') && !isALNUM(t[1])) ||
+ (*t == 't' && t[1] == 'r' && !isALNUM(t[2])))
Perl_warner(aTHX_ packWARN(WARN_SYNTAX),
"!=~ should be !~");
}