aboutsummaryrefslogtreecommitdiff
path: root/lib/expression/t.ml
diff options
context:
space:
mode:
Diffstat (limited to 'lib/expression/t.ml')
-rw-r--r--lib/expression/t.ml21
1 files changed, 18 insertions, 3 deletions
diff --git a/lib/expression/t.ml b/lib/expression/t.ml
index 80cff4f..9ce21b8 100644
--- a/lib/expression/t.ml
+++ b/lib/expression/t.ml
@@ -38,12 +38,13 @@ and funct =
| Trim
| Upper
-let name_of_function = function
+let name_of_function : funct -> string = function
| Upper -> "UPPER"
| Trim -> "TRIM"
| Cmp -> "CMP"
-let function_of_name param f =
+let function_of_name : 'a t list -> string -> 'a t =
+ fun param f ->
match (String.lowercase_ascii f, param) with
| "nvl", _ -> Nvl param
| "join", Literal sep :: tl -> Join (sep, tl)
@@ -51,7 +52,21 @@ let function_of_name param f =
| "upper", _ -> Function' (Upper, param)
| "trim", _ -> Function' (Trim, param)
| "cmp", _ -> Function' (Cmp, param)
- | other, _ -> Function (other, param)
+ (* Branch function *)
+ | ("if" as fn), [ _; _; _ ] -> Function (fn, param)
+ (* Integer functions *)
+ | ("abs" as fn), _
+ | ("int" as fn), _
+ (* String functions *)
+ | ("concat" as fn), _
+ | ("match" as fn), _
+ | ("substring" as fn), _
+ (* Date functions *)
+ | ("date" as fn), _
+ | ("year" as fn), _ -> Function (fn, param)
+ | _ ->
+ (*Function (other, param)*)
+ raise (ImportErrors.UnknowFunction f)
let name_of_operator = function
| Equal -> "="