/
ast.ml
79 lines (64 loc) · 1.92 KB
/
ast.ml
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
open Source_pos
type typeRef =
| Tr_named of string spanning
| Tr_list of typeRef spanning
| Tr_non_null_named of string spanning
| Tr_non_null_list of typeRef spanning
type input_value =
| Iv_null
| Iv_int of int
| Iv_float of float
| Iv_string of string
| Iv_boolean of bool
| Iv_enum of string
| Iv_variable of string
| Iv_list of input_value spanning list
| Iv_object of (string spanning * input_value spanning) list
type variable_definition = {
vd_type: typeRef spanning;
vd_default_value: input_value spanning option
}
type variable_definitions = (string spanning * variable_definition) list
type arguments = (string spanning * input_value spanning) list
type directive = {
d_name: string spanning;
d_arguments: arguments spanning option;
}
type fragment_spread = {
fs_name: string spanning;
fs_directives: directive spanning list
}
type field = {
fd_alias: string spanning option;
fd_name: string spanning;
fd_arguments: arguments spanning option;
fd_directives: directive spanning list;
fd_selection_set: selection list spanning option;
}
and inlineFragment = {
if_type_condition: string spanning option;
if_directives: directive spanning list;
if_selection_set: selection list spanning;
}
and selection =
| Field of field spanning
| FragmentSpread of fragment_spread spanning
| InlineFragment of inlineFragment spanning
type operationType = Query | Mutation
type operation = {
o_type: operationType;
o_name: string spanning option;
o_variable_definitions: variable_definitions spanning option;
o_directives: directive spanning list;
o_selection_set: selection list spanning;
}
type fragment = {
fg_name: string spanning;
fg_type_condition: string spanning;
fg_directives: directive spanning list;
fg_selection_set: selection list spanning;
}
type definition =
| Operation of operation spanning
| Fragment of fragment spanning
type document = definition list