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
open Ppxlib
module Field = struct
let unit =
Attribute.declare "scad.unit" Attribute.Context.label_declaration
Ast_pattern.(pstr nil)
()
let ignore =
Attribute.declare "scad.ignore" Attribute.Context.label_declaration
Ast_pattern.(pstr nil)
()
let map =
Attribute.declare "scad.map" Attribute.Context.label_declaration
Ast_pattern.(pstr nil)
()
let mapf =
Attribute.declare "scad.mapf" Attribute.Context.label_declaration
Ast_pattern.(pstr nil)
()
end
module Type = struct
let unit =
Attribute.declare "scad.unit" Attribute.Context.core_type
Ast_pattern.(pstr nil)
()
let map =
Attribute.declare "scad.map" Attribute.Context.core_type
Ast_pattern.(pstr nil)
()
let mapf =
Attribute.declare "scad.mapf" Attribute.Context.core_type
Ast_pattern.(pstr nil)
()
end
let get_unit = function
| `Type td -> Attribute.get Type.unit td
| `Field ld -> Attribute.get Field.unit ld
let get_ignore = function
| `Type _ -> None
| `Field ld -> Attribute.get Field.ignore ld
let get_map = function
| `Type td -> Attribute.get Type.map td
| `Field ld -> Attribute.get Field.map ld
let get_mapf = function
| `Type td -> Attribute.get Type.mapf td
| `Field ld -> Attribute.get Field.mapf ld