1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
type t =
{ start : Position.t
; end_ : Position.t option
}
let to_json { start; end_ } : Yojson.Basic.t =
`Assoc
(List.concat
[ [ "start", Position.to_json start ]
; (match end_ with
| None -> []
| Some end_pos -> [ "end", Position.to_json end_pos ])
])
;;