blob: 642ecd27ec83963252e3a9c7ae92b5f4a83b021b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
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
|