-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtdf.ml
More file actions
29 lines (24 loc) · 682 Bytes
/
tdf.ml
File metadata and controls
29 lines (24 loc) · 682 Bytes
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
let caseless = [`CASELESS]
let depend_re = Pcre.regexp ~flags:caseless "depend\\d+\\s*=\\s*(.+)\\s*;"
let name_re = Pcre.regexp ~flags:caseless "name\\s*=\\s*(.+)\\s*;"
let version_re = Pcre.regexp ~flags:caseless "version\\s*=\\s*(.+)\\s*;"
let deps data =
try
let matches = Pcre.extract_all ~rex:depend_re data in
let f inner = inner.(1) in
Array.map f matches
with
| Not_found -> [||]
let name data =
try
let strings = Pcre.extract ~rex:name_re data in
strings.(1)
with
| Not_found -> ""
let version data =
try
let strings = Pcre.extract ~rex:version_re data in
strings.(1)
with
| Not_found -> ""
let modinfo data = name data, version data, deps data