summaryrefslogtreecommitdiffstats
path: root/perl_checker.src/lexer.mll
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2003-09-30 21:35:05 +0000
committerPascal Rigaux <pixel@mandriva.com>2003-09-30 21:35:05 +0000
commit498e275c45d0ec807648fc2ec5ce5229f7c3a861 (patch)
tree1a49cf9d69f1120c9b37cb3f217f7f8e21fa75d7 /perl_checker.src/lexer.mll
parent5c51e15ff3bb305fe9ed902874e73e54b5ced31c (diff)
downloadperl_checker-498e275c45d0ec807648fc2ec5ce5229f7c3a861.tar
perl_checker-498e275c45d0ec807648fc2ec5ce5229f7c3a861.tar.gz
perl_checker-498e275c45d0ec807648fc2ec5ce5229f7c3a861.tar.bz2
perl_checker-498e275c45d0ec807648fc2ec5ce5229f7c3a861.tar.xz
perl_checker-498e275c45d0ec807648fc2ec5ce5229f7c3a861.zip
disallow s/foo/die "bar \"zzz\"/e
Diffstat (limited to 'perl_checker.src/lexer.mll')
-rw-r--r--perl_checker.src/lexer.mll3
1 files changed, 3 insertions, 0 deletions
diff --git a/perl_checker.src/lexer.mll b/perl_checker.src/lexer.mll
index 71d6399..672ff5c 100644
--- a/perl_checker.src/lexer.mll
+++ b/perl_checker.src/lexer.mll
@@ -562,6 +562,9 @@ rule token = parse
let s2, (_, end_) = ins delimited_string lexbuf in
let opts, _ = raw_ins pattern_options lexbuf in
let pos = start, end_ in
+ if String.contains opts 'e' && sum (List.map (fun (s, _) -> count_chars_in_string s '"') s2) > 2 then
+ die lexbuf ("do not write so complicated things in the eval part of s///,\n" ^
+ "i generate wrong warnings for things like s/xxx/die \"yyy \\\"zzz\\\" \"/")
check_multi_line_delimited_string (Some opts) pos ;
PATTERN_SUBST(s1, s2, opts, pos)
}