summaryrefslogtreecommitdiffstats
path: root/perl_checker.src/parser_helper.ml
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2003-12-15 15:35:23 +0000
committerPascal Rigaux <pixel@mandriva.com>2003-12-15 15:35:23 +0000
commitd585bff07cf831f557cb5bca530fe9a539ad72b5 (patch)
treea408d590fe93b4d6299ead13a4d9ab37770eaef9 /perl_checker.src/parser_helper.ml
parent4dbce6d83dbfd9ebefed80f9b735ad2a3359172c (diff)
downloadperl_checker-d585bff07cf831f557cb5bca530fe9a539ad72b5.tar
perl_checker-d585bff07cf831f557cb5bca530fe9a539ad72b5.tar.gz
perl_checker-d585bff07cf831f557cb5bca530fe9a539ad72b5.tar.bz2
perl_checker-d585bff07cf831f557cb5bca530fe9a539ad72b5.tar.xz
perl_checker-d585bff07cf831f557cb5bca530fe9a539ad72b5.zip
allow to specify the return context of functions instead of always saying M_unknown
Diffstat (limited to 'perl_checker.src/parser_helper.ml')
-rw-r--r--perl_checker.src/parser_helper.ml19
1 files changed, 10 insertions, 9 deletions
diff --git a/perl_checker.src/parser_helper.ml b/perl_checker.src/parser_helper.ml
index a07ad38..48bb7f7 100644
--- a/perl_checker.src/parser_helper.ml
+++ b/perl_checker.src/parser_helper.ml
@@ -742,7 +742,7 @@ msgstr \"\"
) pot_strings ;
close_out fd
-let call_raw is_a_func (e, para) =
+let call_raw force_non_builtin_func (e, para) =
match e with
| Deref(I_func, Ident(None, f, _)) ->
let para' = match f with
@@ -776,7 +776,7 @@ let call_raw is_a_func (e, para) =
| [ Ident(None, s, pos) ] -> Some [ Raw_string(s, pos) ]
| _ -> None)
- | "last" | "next" | "redo" when not is_a_func ->
+ | "last" | "next" | "redo" when not force_non_builtin_func ->
(match para with
| [ Ident(None, s, pos) ] -> Some [ Raw_string(s, pos) ]
| _ -> die_rule (sprintf "%s must be used with a raw string" f))
@@ -823,18 +823,13 @@ let call_raw is_a_func (e, para) =
let call(e, para) = call_raw false (e, para)
-let call_func esp_func esp_para = call_raw true (esp_func.any, esp_para.any.expr)
-
let check_return esp_func esp_para =
match esp_func.any with
| Ident(None, "return", _) ->
prio_lo_check P_call_no_paren esp_para.any.priority esp_para.pos (List esp_para.any.expr)
| _ -> ()
-let call_no_paren esp_func esp_para = check_return esp_func esp_para; new_pesp M_unknown P_call_no_paren (call(Deref(I_func, esp_func.any), esp_para.any.expr)) esp_func esp_para
-let call_with_paren esp_func esp_para = check_return esp_func esp_para; new_pesp M_unknown P_tok (call(Deref(I_func, esp_func.any), esp_para.any.expr)) esp_func esp_para
-
-let call_and_context(e, para) priority esp_start esp_end =
+let call_and_context(e, para) force_non_builtin_func priority esp_start esp_end =
let context =
match e with
| Deref(I_func, Ident(None, f, _)) ->
@@ -847,7 +842,13 @@ let call_and_context(e, para) priority esp_start esp_end =
| _ -> M_unknown)
| _ -> M_unknown
in
- new_pesp context priority (call(e, para)) esp_start esp_end
+ new_pesp context priority (call_raw force_non_builtin_func (e, para)) esp_start esp_end
+
+let call_no_paren esp_func esp_para = check_return esp_func esp_para; call_and_context(Deref(I_func, esp_func.any), esp_para.any.expr) false P_call_no_paren esp_func esp_para
+let call_with_paren esp_func esp_para = check_return esp_func esp_para; call_and_context (Deref(I_func, esp_func.any), esp_para.any.expr) false P_tok esp_func esp_para
+
+let call_func esp_func esp_para =
+ call_and_context(esp_func.any, esp_para.any.expr) true P_tok esp_func esp_para
let call_one_scalar_para { any = e ; pos = pos } para esp_start esp_end =
let para =