aboutsummaryrefslogtreecommitdiff
path: root/lib/checks/default.ml
diff options
context:
space:
mode:
authorChimrod <>2024-12-02 09:05:18 +0100
committerChimrod <>2024-12-02 09:05:18 +0100
commit53c02501935b3cb2db78e79deb4d38c997505a95 (patch)
tree88a75e012ee186ffb6c6e3e0c53ba80610ec3b0b /lib/checks/default.ml
parent9e7b9de243e488e15d2c7528ce64e569eba8add2 (diff)
Moved the checks in a dedicated library
Diffstat (limited to 'lib/checks/default.ml')
-rw-r--r--lib/checks/default.ml45
1 files changed, 45 insertions, 0 deletions
diff --git a/lib/checks/default.ml b/lib/checks/default.ml
new file mode 100644
index 0000000..a2b53f6
--- /dev/null
+++ b/lib/checks/default.ml
@@ -0,0 +1,45 @@
+(** Default implementation which does nothing.
+
+This module is expected to be used when you only need to implement an analyze
+over a limited part of the whole syntax. *)
+
+module S = Qsp_syntax.S
+module T = Qsp_syntax.T
+module Report = Qsp_syntax.Report
+
+module type T = sig
+ type t
+
+ val default : t
+end
+
+module Expression (T' : T) = struct
+ (**
+ Describe a variable, using the name in capitalized text, and an optionnal
+ index.
+
+ If missing, the index should be considered as [0].
+ *)
+
+ type t' = T'.t
+
+ let ident : (S.pos, T'.t) S.variable -> T'.t = fun _ -> T'.default
+
+ (*
+ Basic values, text, number…
+ *)
+
+ let integer : S.pos -> string -> T'.t = fun _ _ -> T'.default
+ let literal : S.pos -> T'.t T.literal list -> T'.t = fun _ _ -> T'.default
+
+ (** Call a function. The functions list is hardcoded in lib/lexer.mll *)
+ let function_ : S.pos -> T.function_ -> T'.t list -> T'.t =
+ fun _ _ _ -> T'.default
+
+ (** Unary operator like [-123] or [+'Text']*)
+ let uoperator : S.pos -> T.uoperator -> T'.t -> T'.t = fun _ _ _ -> T'.default
+
+ (** Binary operator, for a comparaison, or an operation *)
+ let boperator : S.pos -> T.boperator -> T'.t -> T'.t -> T'.t =
+ fun _ _ _ _ -> T'.default
+end