aboutsummaryrefslogtreecommitdiff
path: root/lib/expression/ast.ml
blob: ef083e9cce47062bffa0e025eb720f3f2be61bb7 (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
(** This module rebuilds an AST from an evaluation *)

type 'a repr = 'a T.t
type 'a obs = 'a T.t
type 'a path_repr = unit

let observe : 'a repr -> 'a obs = Fun.id
let empty : unit -> 'a repr = fun () -> T.Empty
let expr : 'a repr -> 'a repr = fun t -> T.Expr t
let literal : string -> 'a repr = fun s -> T.Literal s
let integer : string -> 'a repr = fun i -> T.Integer i
let path : 'a path_repr -> 'a -> 'a repr = fun _repr p -> T.Path p
let concat : 'a repr list -> 'a repr = fun ll -> T.Concat ll

let window : 'a repr T.window -> 'a repr list -> 'a repr list -> 'a repr =
 fun w groups order -> T.Window (w, groups, order)

let nvl : 'a repr list -> 'a repr = fun ll -> T.Nvl ll
let join : string -> 'a repr list -> 'a repr = fun s ll -> T.Join (s, ll)

let boperator : T.binary_operator -> 'a repr -> 'a repr -> 'a repr =
 fun op e1 e2 -> T.BOperator (op, e1, e2)

let gequality : T.binary_operator -> 'a repr -> 'a repr list -> 'a repr =
 fun op e1 ll -> T.GEquality (op, e1, ll)

let funct : string -> 'a repr list -> 'a repr =
 fun name args -> T.Function (name, args)

let function' : T.funct -> 'a repr list -> 'a repr =
 fun f args -> T.Function' (f, args)