Debian Codegraph @

tests/inputs/AnsProlog.lp

raw
1 % ASP logic program for cloc tests.
2 % Demonstrates the use of different types of comments in .lp files.
3 %
4 % There should be:
5 % 18 lines of comments
6 % 12 lines of whitespace (one inside a multi-line comment)
7 % 19 lines of code
8 %
9 % There are 49 total lines.
10 %
11
12 % This is a single line comment
13 baz(X) :- bar(X). % This counts as a line of code
14
15 % This is a slightly more indented single line comment
16 foo(X) :- baz(X). % This counts as a line of code as well.
17
18 bar(a).
19
20 % Here are some choice rules and cardinality rules.
21 1 { bar(b); bar(c); bar(d) } 3.
22 1 { garply(X) : foo(X) } 2.
23
24 allow(a).
25 allow(b).
26 allow(c).
27
28 % conditional rule
29 conditional(X) :-
30 garply(X);
31 foo(X) : allow(X).
32
33 weight(1) :- conditional(a).
34 weight(2) :- conditional(b).
35 weight(3) :- conditional(c).
36 weight(4) :- conditional(d).
37
38
39 %* This is a multi-line comment with one whitespace line in it
40 quux(X) :- foo(X). % This shouldn't be counted as it is in a multi-line comment.
41 this is a line inside a comment
42
43 *%
44
45 #minimize {
46 X@0: weight(X)
47 }.
48
49 #show garply/1.