summaryrefslogtreecommitdiffstats
path: root/perl_checker.src/parser_helper.ml
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2003-04-15 21:20:00 +0000
committerPascal Rigaux <pixel@mandriva.com>2003-04-15 21:20:00 +0000
commit293167fe02578bfc2d12e9b26ff0e5ca6e205dbe (patch)
treebabdbe387c903a9e9a179f61935d601746a5a4b0 /perl_checker.src/parser_helper.ml
parentb11cd56179401e20be410ebf6a0e86a12322bed7 (diff)
downloadperl-MDK-Common-293167fe02578bfc2d12e9b26ff0e5ca6e205dbe.tar
perl-MDK-Common-293167fe02578bfc2d12e9b26ff0e5ca6e205dbe.tar.gz
perl-MDK-Common-293167fe02578bfc2d12e9b26ff0e5ca6e205dbe.tar.bz2
perl-MDK-Common-293167fe02578bfc2d12e9b26ff0e5ca6e205dbe.tar.xz
perl-MDK-Common-293167fe02578bfc2d12e9b26ff0e5ca6e205dbe.zip
forbid "unless (...) { ... } else { ... }" and "unless (...) { ... } elsif (...) { ... }
Diffstat (limited to 'perl_checker.src/parser_helper.ml')
-rw-r--r--perl_checker.src/parser_helper.ml4
1 files changed, 4 insertions, 0 deletions
diff --git a/perl_checker.src/parser_helper.ml b/perl_checker.src/parser_helper.ml
index d4c5842..0092a9f 100644
--- a/perl_checker.src/parser_helper.ml
+++ b/perl_checker.src/parser_helper.ml
@@ -466,6 +466,10 @@ let check_block_ref esp_lines esp_BRACKET_END =
if esp_BRACKET_END.spaces <> Space_cr then
(if l <> [] && last l = Semi_colon then warn_verb (get_pos_end esp_lines) "spurious \";\" before closing block")
+let check_unless_else elsif else_ =
+ if elsif.any <> [] then warn elsif.pos "don't use \"elsif\" with \"unless\" (replace \"unless\" with \"if\")";
+ if else_.any <> [] then warn else_.pos "don't use \"else\" with \"unless\" (replace \"unless\" with \"if\")"
+
let check_my_our_paren { any = ((comma_closed, _), _) } =
if not comma_closed then die_rule "syntax error"