Debian Codegraph @

apps/tc/elpi/parser_addInstances.elpi

raw
1 /* license: GNU Lesser General Public License Version 2.1 or later */
2 /* ------------------------------------------------------------------------- */
3
4 namespace tc {
5 kind enum type.
6 type path string -> string -> enum.
7 type addInstPrio int -> string -> enum.
8 type tcOrInst list string -> enum.
9 type ignoreInstances, ignoreClasses string -> list string -> enum.
10
11 func parse list argument -> enum.
12 parse [int N, str Instance] (addInstPrio N Instance) :- !.
13 parse [str ClassName, str "path", str Path] (path ClassName Path) :- !.
14 parse [str ClassName, str "ignoreInstances" | InstNames] (ignoreInstances ClassName Res) :- !,
15 args->str-list InstNames Res.
16 parse [str ClassName, str "ignoreClasses" | ClassNames] (ignoreClasses ClassName Res) :- !,
17 args->str-list ClassNames Res.
18 parse ClassNames (tcOrInst Res) :- !, args->str-list ClassNames Res.
19
20 func run-command enum ->.
21 :if "debug"
22 run-command A :- coq.say A, fail.
23 run-command (ignoreClasses ClassName IgnoreClasses) :-
24 coq.locate ClassName ClassGR,
25 tc.add-tc-or-inst-gr IgnoreClasses [] [ClassGR].
26 run-command (tcOrInst InstNames) :-
27 std.map InstNames coq.locate InstGR,
28 tc.add-tc-or-inst-gr [] [] InstGR.
29 run-command (path ClassName Path):-
30 tc.add-path ClassName Path.
31 run-command (ignoreInstances ClassName InstNames):-
32 coq.locate ClassName ClassGR,
33 tc.add-tc-or-inst-gr [] InstNames [ClassGR].
34 run-command (addInstPrio Prio InstanceName) :-
35 coq.locate InstanceName InstGr,
36 tc.compile.instance-gr InstGr C,
37 S is int_to_string Prio,
38 tc.add-tc-db _ (before S) C.
39 }