aboutsummaryrefslogtreecommitdiff
path: root/scTypes.mli
diff options
context:
space:
mode:
Diffstat (limited to 'scTypes.mli')
-rwxr-xr-xscTypes.mli58
1 files changed, 58 insertions, 0 deletions
diff --git a/scTypes.mli b/scTypes.mli
new file mode 100755
index 0000000..642ecd2
--- /dev/null
+++ b/scTypes.mli
@@ -0,0 +1,58 @@
+(** All the types used in the spreadsheet. *)
+
+exception Error
+
+type cell = (int * int) * (bool * bool)
+
+type ident = UTF8.t
+
+type types =
+ | Num : Num.num * (UTF8.t option) -> types (** A number *)
+ | Str : UTF8.t -> types (** A string *)
+ | Date : Num.num -> types (** A date in julian day *)
+
+ | Undefined : types (** The content is not defined *)
+ | Bool : bool -> types (** A boolean *)
+ | List : types list -> types (** List with heterogenous datas *)
+
+type refs =
+ | Cell of cell (** A cell *)
+ | Range of cell * cell (** An area of cells *)
+
+type expression =
+ | Value of types (** A direct value *)
+ | Ref of refs (** A reference to another cell *)
+ | Call of ident * expression list (** A call to a function *)
+ | Expression of expression (** An expression *)
+
+(** Result from a computation *)
+type result =
+ | Result of types
+ | Error of exn
+
+module Type : sig
+
+ val (=) : types -> types -> bool
+
+ val show: UTF8.Buffer.buffer -> types -> unit
+
+end
+
+module Refs : sig
+
+ val collect: refs -> (int * int) list
+
+ val shift: (int * int) -> refs -> refs
+
+end
+
+val show_expr: UTF8.Buffer.buffer -> expression -> unit
+
+module Result : sig
+
+ val (=) : result -> result -> bool
+
+ val show: result -> UTF8.t
+
+end
+