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
open Forester_prelude
open Base
type node =
| Text of string
| Verbatim of string
| Group of delim * t
| Math of math_mode * t
| Ident of Trie.path * string list
| Xml_tag of (string option * string) * ((string option * string) * t) list * t
| Subtree of string option * t
| Let of Trie.path * Trie.path binding list * t
| Open of Trie.path
| Scope of t
| Put of Trie.path * t
| Default of Trie.path * t
| Get of Trie.path
| Fun of Trie.path binding list * t
| Object of _object
| Patch of patch
| Call of t * string
| Import of visibility * string
| Def of Trie.path * Trie.path binding list * t
| Decl_xmlns of string * string
| Alloc of Trie.path
| Namespace of Trie.path * t
[@@deriving show]
and _object = {self : Trie.path option; methods : (string * t) list}
[@@deriving show]
and patch = {obj : t; self : Trie.path option; methods: (string * t) list}
[@@deriving show]
and t = node Range.located list
[@@deriving show]
type tree =
{source_path : string option;
addr : string option;
code : t}
[@@deriving show]
let import_private x = Import (Private, x)
let import_public x = Import (Public, x)
let inline_math e = Math (Inline, e)
let display_math e = Math (Display, e)
let parens e = Group (Parens, e)
let squares e = Group (Squares, e)
let braces e = Group (Braces, e)