-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfunnelweb.ml
More file actions
66 lines (51 loc) · 1.5 KB
/
Copy pathfunnelweb.ml
File metadata and controls
66 lines (51 loc) · 1.5 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
# 209 "parsing.fw"
open Batteries
open PortiaParse
# 85 "parsing.fw"
let find_inclusions =
let re = Str.regexp
# 77 "parsing.fw"
"^@i +\\(.+\\) *$"
# 86 "parsing.fw"
in
fold_all_groups (fun l p -> match l with
| [Some (f, _, _)] -> f::p
| _ -> assert false) [] re
# 212 "parsing.fw"
# 145 "parsing.fw"
let find_definitions =
let re = Str.regexp
# 129 "parsing.fw"
"^@\\(\\$\\|O\\)@<\\([^@]+\\)@>\\(==\\|\\+=\\)@{\
\\(@-\n\\)?\\(\\([^@]\\|@[^}]\\)*\\)@}"
# 146 "parsing.fw"
in
fold_all_groups (fun l p ->
PortiaLog.debug "found def: %a\n"
(List.print (Option.print
(Tuple3.print String.print Int.print Int.print))) l ;
match l with
| [Some (c, _, _); Some (id, _, _); _; _; Some (_, start, stop); _] ->
(id, c = "O", start, stop) :: p
| _ -> assert false) [] re
# 213 "parsing.fw"
# 175 "parsing.fw"
let find_references =
let re = Str.regexp
# 166 "parsing.fw"
"\\(@<\\([^@]+\\)@>\\)"
# 176 "parsing.fw"
in
fold_all_groups (fun l p -> match l with
| [Some (_, start, stop); Some (id, _, _)] -> (id, start, stop)::p
| _ -> assert false) [] re
# 214 "parsing.fw"
# 195 "parsing.fw"
let postprocess str =
String.nreplace ~str ~sub:"@@" ~by:"@"
# 215 "parsing.fw"
let () =
PortiaConfig.find_definitions := find_definitions ;
PortiaConfig.find_references := find_references ;
PortiaConfig.find_inclusions := find_inclusions ;
PortiaConfig.postprocess := postprocess