diff options
author | Pascal Rigaux <pixel@mandriva.com> | 2003-05-16 11:52:21 +0000 |
---|---|---|
committer | Pascal Rigaux <pixel@mandriva.com> | 2003-05-16 11:52:21 +0000 |
commit | 3b34f453abb3bc38dcd48fe7288773be7b2cee33 (patch) | |
tree | b03b9db8b029dc8b1dbc38cd690fcf84e48e2f29 | |
parent | 01b8c19bc5da6f55a2667f86939eb35961e6eabf (diff) | |
download | perl-MDK-Common-3b34f453abb3bc38dcd48fe7288773be7b2cee33.tar perl-MDK-Common-3b34f453abb3bc38dcd48fe7288773be7b2cee33.tar.gz perl-MDK-Common-3b34f453abb3bc38dcd48fe7288773be7b2cee33.tar.bz2 perl-MDK-Common-3b34f453abb3bc38dcd48fe7288773be7b2cee33.tar.xz perl-MDK-Common-3b34f453abb3bc38dcd48fe7288773be7b2cee33.zip |
correctly warn about the missing space in "my ($a,$b, $c);"
-rw-r--r-- | perl_checker.src/parser.mly | 14 | ||||
-rw-r--r-- | perl_checker.src/parser_helper.ml | 3 | ||||
-rw-r--r-- | perl_checker.src/parser_helper.mli | 4 |
3 files changed, 12 insertions, 9 deletions
diff --git a/perl_checker.src/parser.mly b/perl_checker.src/parser.mly index 2f12f75..0395859 100644 --- a/perl_checker.src/parser.mly +++ b/perl_checker.src/parser.mly @@ -405,9 +405,9 @@ parenthesized_start: my_our: /* Things that can be "my"'d */ | my_our_paren PAREN_END {sp_0($2); if snd $1.any <> [] && fstfst $1.any then die_rule "syntax error"; new_esp M_none (My_our(sndfst $1.any, snd $1.any, get_pos $1)) $1 $2} -| my_our_paren SCALAR_IDENT PAREN_END {(if snd $1.any = [] then sp_0 else sp_1)($2); check_my_our_paren $1; new_esp M_none (My_our(sndfst $1.any, snd $1.any @ [I_scalar, snd $2.any], pos_range $1 $3)) $1 $3} -| my_our_paren HASH_IDENT PAREN_END {(if snd $1.any = [] then sp_0 else sp_1)($2); check_my_our_paren $1; new_esp M_none (My_our(sndfst $1.any, snd $1.any @ [I_hash, snd $2.any], pos_range $1 $3)) $1 $3} -| my_our_paren ARRAY_IDENT PAREN_END {(if snd $1.any = [] then sp_0 else sp_1)($2); check_my_our_paren $1; new_esp M_none (My_our(sndfst $1.any, snd $1.any @ [I_array, snd $2.any], pos_range $1 $3)) $1 $3} +| my_our_paren SCALAR_IDENT PAREN_END {check_my_our_paren $1 $2; new_esp M_none (My_our(sndfst $1.any, snd $1.any @ [I_scalar, snd $2.any], pos_range $1 $3)) $1 $3} +| my_our_paren HASH_IDENT PAREN_END {check_my_our_paren $1 $2; new_esp M_none (My_our(sndfst $1.any, snd $1.any @ [I_hash, snd $2.any], pos_range $1 $3)) $1 $3} +| my_our_paren ARRAY_IDENT PAREN_END {check_my_our_paren $1 $2; new_esp M_none (My_our(sndfst $1.any, snd $1.any @ [I_array, snd $2.any], pos_range $1 $3)) $1 $3} | MY_OUR SCALAR_IDENT {new_esp (M_mixed [M_scalar; M_none]) (My_our($1.any, [I_scalar, snd $2.any], get_pos $2)) $1 $2} | MY_OUR HASH_IDENT {new_esp (M_mixed [M_hash ; M_none]) (My_our($1.any, [I_hash, snd $2.any], get_pos $2)) $1 $2} | MY_OUR ARRAY_IDENT {new_esp (M_mixed [M_array ; M_none]) (My_our($1.any, [I_array, snd $2.any], get_pos $2)) $1 $2} @@ -415,10 +415,10 @@ my_our: /* Things that can be "my"'d */ my_our_paren: | MY_OUR PAREN {sp_1($2); new_esp M_special ((true, $1.any), []) $1 $2} | my_our_paren comma {if fstfst $1.any then die_rule "syntax error"; new_esp M_none ((true, sndfst $1.any), snd $1.any) $1 $2} -| my_our_paren BAREWORD {check_my_our_paren $1; if $2.any <> "undef" then die_rule "scalar expected"; new_esp M_none ((false, sndfst $1.any), snd $1.any @ [I_raw, $2.any]) $1 $2} -| my_our_paren SCALAR_IDENT {check_my_our_paren $1; new_esp M_none ((false, sndfst $1.any), snd $1.any @ [I_scalar, snd $2.any]) $1 $2} -| my_our_paren HASH_IDENT {check_my_our_paren $1; new_esp M_none ((false, sndfst $1.any), snd $1.any @ [I_hash, snd $2.any]) $1 $2} -| my_our_paren ARRAY_IDENT {check_my_our_paren $1; new_esp M_none ((false, sndfst $1.any), snd $1.any @ [I_array, snd $2.any]) $1 $2} +| my_our_paren BAREWORD {check_my_our_paren $1 $2; if $2.any <> "undef" then die_rule "scalar expected"; new_esp M_none ((false, sndfst $1.any), snd $1.any @ [I_raw, $2.any]) $1 $2} +| my_our_paren SCALAR_IDENT {check_my_our_paren $1 $2; new_esp M_none ((false, sndfst $1.any), snd $1.any @ [I_scalar, snd $2.any]) $1 $2} +| my_our_paren HASH_IDENT {check_my_our_paren $1 $2; new_esp M_none ((false, sndfst $1.any), snd $1.any @ [I_hash, snd $2.any]) $1 $2} +| my_our_paren ARRAY_IDENT {check_my_our_paren $1 $2; new_esp M_none ((false, sndfst $1.any), snd $1.any @ [I_array, snd $2.any]) $1 $2} termdo: /* Things called with "do" */ | DO term %prec UNIOP { die_rule "\"do EXPR\" not allowed" } /* do $filename */ diff --git a/perl_checker.src/parser_helper.ml b/perl_checker.src/parser_helper.ml index 14f288f..0e37cf5 100644 --- a/perl_checker.src/parser_helper.ml +++ b/perl_checker.src/parser_helper.ml @@ -473,7 +473,8 @@ 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, _), _) } = +let check_my_our_paren { any = ((comma_closed, _), l) } after_esp = + (if l = [] then sp_0 else sp_1) after_esp ; if not comma_closed then die_rule "syntax error" let check_simple_pattern = function diff --git a/perl_checker.src/parser_helper.mli b/perl_checker.src/parser_helper.mli index 86cd2b2..69f559d 100644 --- a/perl_checker.src/parser_helper.mli +++ b/perl_checker.src/parser_helper.mli @@ -123,7 +123,9 @@ val check_block_ref : 'a Types.any_spaces_pos -> unit val check_unless_else : 'a list Types.any_spaces_pos -> 'b list Types.any_spaces_pos -> unit -val check_my_our_paren : ((bool * 'a) * 'b) Types.any_spaces_pos -> unit +val check_my_our_paren : + ((bool * 'a) * 'b list) Types.any_spaces_pos -> + 'c Types.any_spaces_pos -> unit val check_simple_pattern : Types.fromparser list -> unit val only_one : Types.fromparser list Types.any_spaces_pos -> Types.fromparser val only_one_array_ref : |