summaryrefslogtreecommitdiffstats
path: root/perl_checker.src
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2003-02-12 11:27:26 +0000
committerPascal Rigaux <pixel@mandriva.com>2003-02-12 11:27:26 +0000
commitf4603c474d329c04f596dae4fe33f020a1e50a23 (patch)
treeae76400e08a6fc9db0debbeaaa363cec7519a64b /perl_checker.src
parent59478369faed0a81220d374470f448596ede5bc3 (diff)
downloadperl_checker-f4603c474d329c04f596dae4fe33f020a1e50a23.tar
perl_checker-f4603c474d329c04f596dae4fe33f020a1e50a23.tar.gz
perl_checker-f4603c474d329c04f596dae4fe33f020a1e50a23.tar.bz2
perl_checker-f4603c474d329c04f596dae4fe33f020a1e50a23.tar.xz
perl_checker-f4603c474d329c04f596dae4fe33f020a1e50a23.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.ml5
-rw-r--r--perl_checker.src/parser_helper.mli3
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 :