diff options
author | Pascal Rigaux <pixel@mandriva.com> | 2003-02-12 11:27:26 +0000 |
---|---|---|
committer | Pascal Rigaux <pixel@mandriva.com> | 2003-02-12 11:27:26 +0000 |
commit | fa0065c024f2dac346f4659ea6b880526c9e7716 (patch) | |
tree | 407bf1184b267d8fb99803e1eedcce79e75e7af9 /perl_checker.src | |
parent | 8bc79537287588304e04d266f38ce7bd2b15e2e6 (diff) | |
download | perl-MDK-Common-fa0065c024f2dac346f4659ea6b880526c9e7716.tar perl-MDK-Common-fa0065c024f2dac346f4659ea6b880526c9e7716.tar.gz perl-MDK-Common-fa0065c024f2dac346f4659ea6b880526c9e7716.tar.bz2 perl-MDK-Common-fa0065c024f2dac346f4659ea6b880526c9e7716.tar.xz perl-MDK-Common-fa0065c024f2dac346f4659ea6b880526c9e7716.zip |
warn when "ref" priority is badly handled by perl_checker
Diffstat (limited to 'perl_checker.src')
-rw-r--r-- | perl_checker.src/parser_helper.ml | 5 | ||||
-rw-r--r-- | perl_checker.src/parser_helper.mli | 3 |
2 files changed, 6 insertions, 2 deletions
diff --git a/perl_checker.src/parser_helper.ml b/perl_checker.src/parser_helper.ml index 680b571..622f55f 100644 --- a/perl_checker.src/parser_helper.ml +++ b/perl_checker.src/parser_helper.ml @@ -265,12 +265,15 @@ let check_parenthesized_first_argexpr word ((_, e), (_, (start, _)) as ex) = if word = "time" then die_rule "please use time() instead of time"; sp_p(ex) -let check_parenthesized_first_argexpr_with_Ident ident ((_, e), _ as ex) = +let check_parenthesized_first_argexpr_with_Ident ident ((prio, e), _ as ex) = + if prio = P_tok then (); (match ident with | Ident(Some _, _, _) -> (match e with | [e] when is_parenthesized e -> () | _ -> warn_rule "use parentheses around argument (otherwise it might cause syntax errors if the package is \"require\"d and not \"use\"d") + | Ident(None, word, _) when List.mem word ["ref"] -> + if prio <> P_tok then warn_rule "use parentheses around argument" | _ -> ()); check_parenthesized_first_argexpr (string_of_Ident ident) ex diff --git a/perl_checker.src/parser_helper.mli b/perl_checker.src/parser_helper.mli index 3b776ea..7fe749d 100644 --- a/perl_checker.src/parser_helper.mli +++ b/perl_checker.src/parser_helper.mli @@ -59,7 +59,8 @@ val check_parenthesized_first_argexpr : ('a * Types.fromparser list) * (Types.spaces * (int * 'b)) -> unit val check_parenthesized_first_argexpr_with_Ident : Types.fromparser -> - ('a * Types.fromparser list) * (Types.spaces * (int * 'b)) -> unit + (Types.priority * Types.fromparser list) * (Types.spaces * (int * 'a)) -> + unit val check_hash_subscript : ('a * Types.fromparser) * ('b * (int * int)) -> unit val check_arrow_needed : |