diff options
author | Pascal Rigaux <pixel@mandriva.com> | 2004-11-16 16:06:12 +0000 |
---|---|---|
committer | Pascal Rigaux <pixel@mandriva.com> | 2004-11-16 16:06:12 +0000 |
commit | 72aa602b5e9ebc375e580f25261354e1386fd26a (patch) | |
tree | 0d27b33bef2ddee58e3ba7de34ccf329310bcb98 /perl_checker.src/parser.mly | |
parent | 9ae80ccaf06c68a90daf6f9f5bad8e621df98f75 (diff) | |
download | perl-MDK-Common-72aa602b5e9ebc375e580f25261354e1386fd26a.tar perl-MDK-Common-72aa602b5e9ebc375e580f25261354e1386fd26a.tar.gz perl-MDK-Common-72aa602b5e9ebc375e580f25261354e1386fd26a.tar.bz2 perl-MDK-Common-72aa602b5e9ebc375e580f25261354e1386fd26a.tar.xz perl-MDK-Common-72aa602b5e9ebc375e580f25261354e1386fd26a.zip |
turn an error into a warning (don't use for without "my"ing the iteration variable)
Diffstat (limited to 'perl_checker.src/parser.mly')
-rw-r--r-- | perl_checker.src/parser.mly | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/perl_checker.src/parser.mly b/perl_checker.src/parser.mly index 88dca94..e6cd294 100644 --- a/perl_checker.src/parser.mly +++ b/perl_checker.src/parser.mly @@ -133,8 +133,8 @@ loop: | WHILE PAREN expr PAREN_END BRACKET lines BRACKET_END cont {sp_p($1); sp_n($2); sp_0($3); sp_0_or_cr($4); sp_p($5); mcontext_check M_bool $3; check_block_sub $6 $7; to_Call_op M_none "while" [ prio_lo P_loose $3; Block $6.any ] $1 $8} | UNTIL PAREN expr PAREN_END BRACKET lines BRACKET_END cont {sp_p($1); sp_n($2); sp_0($3); sp_0_or_cr($4); sp_p($5); mcontext_check M_bool $3; check_block_sub $6 $7; to_Call_op M_none "until" [ prio_lo P_loose $3; Block $6.any ] $1 $8} | FOR PAREN expr_or_empty semi_colon expr_or_empty semi_colon expr_or_empty PAREN_END BRACKET lines BRACKET_END {sp_p($1); check_for($1); sp_n($2); sp_0($3); sp_p($5); sp_p($7); sp_0($8); sp_n($9); check_block_sub $10 $11; to_Call_op M_none "for" [ $3.any; $5.any; $7.any; Block $10.any ] $1 $11} -| FOR SCALAR_IDENT PAREN expr PAREN_END BRACKET lines BRACKET_END cont { die_rule "don't use for without \"my\"ing the iteration variable" } -| FOR PAREN expr PAREN_END BRACKET lines BRACKET_END cont {sp_p($1); sp_n($2); sp_0($3); sp_0_or_cr($4); sp_p($5); mcontext_check M_list $3; check_block_sub $6 $7; check_for_foreach $1 $3; to_Call_op M_none "foreach" [ prio_lo P_loose $3; Block $6.any ] $1 $8} +| FOR SCALAR_IDENT PAREN expr PAREN_END BRACKET lines BRACKET_END cont { warn_rule [Warn_normalized_expressions] "don't use for without \"my\"ing the iteration variable"; sp_p($1); sp_0($4); sp_0_or_cr($5); sp_p($6); mcontext_check M_list $4; check_block_sub $7 $8; to_Call_op M_none "foreach" [ prio_lo P_loose $4; Block $7.any ] $1 $9} +| FOR PAREN expr PAREN_END BRACKET lines BRACKET_END cont {sp_p($1); sp_n($2); sp_0($3); sp_0_or_cr($4); sp_p($5); mcontext_check M_list $3; check_block_sub $6 $7; check_for_foreach $1 $3; to_Call_op M_none "foreach" [ prio_lo P_loose $3; Block $6.any ] $1 $8} | for_my lines BRACKET_END cont {check_block_sub $2 $3; to_Call_op M_none "foreach my" ($1.any @ [ Block $2.any ]) $1 $4} for_my: |