-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathtest.atd
More file actions
146 lines (114 loc) · 3.25 KB
/
Copy pathtest.atd
File metadata and controls
146 lines (114 loc) · 3.25 KB
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
<doc text="This is just a test.">
type def <ocaml_biniou module="Test_lib.Biniou">
<ocaml_json module="Test_lib.Json"> = abstract
<doc text="
}}}abc{{def}}ghi
{{{
j * j
k * k
l*l
}}}{{{mno}}}
{{pqr}}{stu}vwx
yz
{{} [ ] {v }}
{{{
} [x] v} {v [ @ \
}}}
">
type r = {
a : int <ocaml validator="fun _ -> print_endline \"field a\"; true">;
b <ocaml mutable> : bool;
c : p;
}
type p =
[ A | B of r | C ]
<ocaml validator="function `A -> false | _ -> true">
type p'' = int p'
type 'a p' = [ A | Bb of 'a p' | Ccccc of 'a ] <ocaml repr="classic">
type hello = [ Hello of string | World ] <ocaml repr="poly">
type tup = (int * test)
type test_variant =
[ Case1 | Case2 of int | Case3 of string | Case4 of test_variant list ]
type mixed_record = {
?field0 : int option;
?field1 : float option;
field2 : string option;
field3 : int <ocaml repr="int64"> <biniou repr="int64">;
field4 : float list <ocaml repr="array">;
?field5 : bool option;
?field6 : string option;
field7 : test_variant;
field8 : string list <ocaml repr="array">;
field9 : (
int <biniou repr="uvint">
* int <biniou repr="int8">
* int <ocaml repr="char"> <biniou repr="int8">
* int <biniou repr="int16">
* int <ocaml repr="int32"> <biniou repr="int32">
* int <ocaml repr="int64"> <biniou repr="int64">
);
field10 : bool;
~field11 : bool;
field12 : unit list;
field13 : string option list;
}
type mixed =
(mixed_record list <ocaml repr="array"> <biniou repr="table">
* mixed_record list <ocaml repr="array">) list
type test = {
?x0 : int option;
?x1 : float option;
x2 : mixed;
x3 : mixed_record list;
x4 : int <ocaml repr="int64"> <biniou repr="int64">;
}
type base = {
b0 : int;
b1 : bool;
}
type extended = {
b0 <ocaml name="b0x"> : int;
b1 <ocaml name="b1x"> : bool <ocaml validator="not">;
b2 <ocaml name="b2x"> : string;
?b3 <ocaml name="b3x"> : string option;
b4 <ocaml name="b4x"> : string option;
~b5 <ocaml name="b5x" default="0.5"> : float;
} <ocaml validator="fun x -> print_endline \"validating record\"; x.b0x >= 0">
type val1 = { val1_x : int <ocaml validator="fun _ -> false"> }
type val2 = {
val2_x : val1;
?val2_y : val1 option;
}
type base_tuple = (int * float) <ocaml validator="fun (i, f) -> float i < f">
type extended_tuple =
(int
* float
* <ocaml default="true"> : bool
* <ocaml default="None"> : int option
* string
* <ocaml default="[]"> : string list)
type option_validation = int <ocaml validator="fun _ -> false"> option
type ('x, 'y) poly = {
fst : 'x list;
snd : ('x, 'y) poly option;
}
(*
type field_hash_clash = {
workshop1 : bool;
examples3 : bool;
}
type variant_hash_clash = [ X_workshop1 | X_examples3 ]
*)
type int_assoc_list =
(string * int) list <json repr="object">
type int_assoc_array =
(string * int) list <ocaml repr="array"> <json repr="object">
type 'a abs1 = 'a list
type 'a abs2 = 'a list
type 'a abs3 = 'a list
type intopt = int option
type int8 = int <biniou repr="int8">
type char = int <ocaml repr="char"> <biniou repr="int8">
type int32 = int <ocaml repr="int32"> <biniou repr="int32">
type int64 = int <ocaml repr="int64"> <biniou repr="int64">
type 'a array = 'a list <ocaml repr="array">