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
open Prelude
open Base
type node =
| Text of string
| Group of delim * t
| Math of math_mode * t
| Ident of Trie.path * string list
| Xml_tag of string * (string * t) list * t
| Transclude of string
| Embed_tex of t
| Let of Trie.path * Trie.path list * t
| Open of Trie.path
| Block of t * t
| Scope of t
| Put of Trie.path * t
| Default of Trie.path * t
| Get of Trie.path
| If_tex of t * t
| Prim of Prim.t * t
| Object of {self : Trie.path option; methods : (string * t) list}
| Patch of {obj : t; self : Trie.path option; methods: (string * t) list}
| Call of t * string
| Query of t Query.t
| Import of visibility * addr
| Def of Trie.path * Trie.path list * t
| Alloc of Trie.path
| Title of t
| Taxon of string
| Meta of string * t
| Author of string
| Tag of string
| TeX_package of string
| Date of string
| Namespace of Trie.path * t
[@@deriving show]
and t = node Range.located list
[@@deriving show]
type tree =
{source_path : string option;
addr : addr;
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)