From ef312564ca84a2b49fc291434d8fb2f8501bb618 Mon Sep 17 00:00:00 2001 From: Sébastien Dailly Date: Tue, 15 Nov 2016 13:00:01 +0100 Subject: Initial commit --- scTypes.mli | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100755 scTypes.mli (limited to 'scTypes.mli') 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 + -- cgit v1.2.3