diff options
author | Pascal Rigaux <pixel@mandriva.com> | 2003-04-30 09:30:59 +0000 |
---|---|---|
committer | Pascal Rigaux <pixel@mandriva.com> | 2003-04-30 09:30:59 +0000 |
commit | 3d726d18053a2ea9cf435d661fc6fd0a36daab99 (patch) | |
tree | 64406beefbf9d941a955d72f33dcb1f5d8ef15cf /perl_checker.src/parser.mly | |
parent | 16d1e7e21e4169abd573a3b6e53afb4a203a81f2 (diff) | |
download | perl_checker-3d726d18053a2ea9cf435d661fc6fd0a36daab99.tar perl_checker-3d726d18053a2ea9cf435d661fc6fd0a36daab99.tar.gz perl_checker-3d726d18053a2ea9cf435d661fc6fd0a36daab99.tar.bz2 perl_checker-3d726d18053a2ea9cf435d661fc6fd0a36daab99.tar.xz perl_checker-3d726d18053a2ea9cf435d661fc6fd0a36daab99.zip |
allow "*foo = sub {}" with no prototype
Diffstat (limited to 'perl_checker.src/parser.mly')
-rw-r--r-- | perl_checker.src/parser.mly | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/perl_checker.src/parser.mly b/perl_checker.src/parser.mly index 2a45414..2f12f75 100644 --- a/perl_checker.src/parser.mly +++ b/perl_checker.src/parser.mly @@ -157,13 +157,13 @@ decl: | FORMAT BAREWORD ASSIGN {new_esp M_none Too_complex $1 $3} | FORMAT ASSIGN {new_esp M_none Too_complex $1 $2} | func_decl semi_colon {if snd $1.any = None then die_rule "there is no need to pre-declare in Perl!" else (warn_rule "please don't use prototype pre-declaration" ; new_esp M_special Too_complex $1 $2) } -| func_decl BRACKET BRACKET_END {sp_n($2); sp_0_or_cr($3); let name, proto = $1.any in new_esp M_none (sub_declaration (name, proto) []) $1 $3} -| func_decl BRACKET lines BRACKET_END {sp_n($2); check_block_sub $3 $4; new_esp M_none (sub_declaration $1.any $3.any) $1 $4} -| func_decl BRACKET BRACKET expr BRACKET_END BRACKET_END {sp_n($2); sp_p($3); sp_p($4); sp_p($5); sp_p($6); new_esp M_none (sub_declaration $1.any [Ref(I_hash, prio_lo P_loose $4)]) $1 $6} -| func_decl BRACKET BRACKET expr BRACKET_END semi_colon BRACKET_END {sp_n($2); sp_p($3); sp_p($4); sp_p($5); sp_p($7); new_esp M_none (sub_declaration $1.any [Ref(I_hash, prio_lo P_loose $4); Semi_colon]) $1 $7} +| func_decl BRACKET BRACKET_END {sp_n($2); sp_0_or_cr($3); let name, proto = $1.any in new_esp M_none (sub_declaration (name, proto) [] Real_sub_declaration) $1 $3} +| func_decl BRACKET lines BRACKET_END {sp_n($2); check_block_sub $3 $4; new_esp M_none (sub_declaration $1.any $3.any Real_sub_declaration) $1 $4} +| func_decl BRACKET BRACKET expr BRACKET_END BRACKET_END {sp_n($2); sp_p($3); sp_p($4); sp_p($5); sp_p($6); new_esp M_none (sub_declaration $1.any [Ref(I_hash, prio_lo P_loose $4)] Real_sub_declaration) $1 $6} +| func_decl BRACKET BRACKET expr BRACKET_END semi_colon BRACKET_END {sp_n($2); sp_p($3); sp_p($4); sp_p($5); sp_p($7); new_esp M_none (sub_declaration $1.any [Ref(I_hash, prio_lo P_loose $4); Semi_colon] Real_sub_declaration) $1 $7} | PACKAGE word semi_colon {sp_0_or_cr($1); sp_1($2); new_esp M_none (Package $2.any) $1 $3} -| BEGIN BRACKET lines BRACKET_END {sp_0_or_cr($1); sp_1($2); check_block_sub $3 $4; new_esp M_none (Sub_declaration(Ident(None, "BEGIN", get_pos $1), None, Block $3.any)) $1 $4} -| END BRACKET lines BRACKET_END {sp_0_or_cr($1); sp_1($2); check_block_sub $3 $4; new_esp M_none (Sub_declaration(Ident(None, "END", get_pos $1), None, Block $3.any)) $1 $4} +| BEGIN BRACKET lines BRACKET_END {sp_0_or_cr($1); sp_1($2); check_block_sub $3 $4; new_esp M_none (Sub_declaration(Ident(None, "BEGIN", get_pos $1), None, Block $3.any, Glob_assign)) $1 $4} +| END BRACKET lines BRACKET_END {sp_0_or_cr($1); sp_1($2); check_block_sub $3 $4; new_esp M_none (Sub_declaration(Ident(None, "END", get_pos $1), None, Block $3.any, Glob_assign)) $1 $4} | use {$1} use: |