eyeprolog 1.1.8 → 1.1.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "1.1.8",
6
+ "version": "1.1.9",
7
7
  "description": "EyeProlog turns facts and rules into answers and proofs.",
8
8
  "type": "module",
9
9
  "main": "./index.js",
@@ -0,0 +1,10 @@
1
+ # Regression fixtures
2
+
3
+ `phrase_quad.pl` is an unmodified snapshot of Ulrich Neumerkel's ISO Prolog
4
+ `phrase/2-3` quad corpus:
5
+
6
+ <https://www.complang.tuwien.ac.at/ulrich/iso-prolog/phrase_quad.pl>
7
+
8
+ Retrieved on 2026-08-11. It is vendored so the regression suite exercises all
9
+ 58 quads without depending on network access or availability of the source
10
+ server.
@@ -0,0 +1,195 @@
1
+ c1 ?- call(1).
2
+ type_error(callable,1).
3
+
4
+ c2 ?- call((1,fail)).
5
+ type_error(callable,(1,fail)).
6
+
7
+ c3 ?- call((fail,1)).
8
+ type_error(callable,(fail,1)).
9
+
10
+ c4 ?- call((!;1)).
11
+ type_error(callable,(!;1)).
12
+
13
+ c5 ?- call((!;\+1)).
14
+ true.
15
+
16
+ c6 ?- call((!;call(1))).
17
+ true.
18
+
19
+ c7 ?- call((\+!;X=a)).
20
+ X=a.
21
+
22
+ f1 ?- functor(T,F,A).
23
+ instantiation_error.
24
+
25
+ f2 ?- functor(T,1,2).
26
+ type_error(atom,1).
27
+
28
+ f3 ?- functor([_],.,2).
29
+ true.
30
+
31
+ 1 ?- phrase(=,L).
32
+ L = []
33
+ | existence_error(non_terminal,(=)//0).
34
+
35
+ 2 ?- phrase(1,L).
36
+ type_error(callable,1).
37
+
38
+ 39 ?- phrase(K,L).
39
+ instantiation_error.
40
+
41
+ 40 ?- K = [], phrase(K,L).
42
+ K = [], L = [].
43
+
44
+ 24 ?- asserta((a-->b)).
45
+ permission_error(modify,static_procedure,(-->)/2).
46
+
47
+ 25 ?- clause((a-->b),B).
48
+ permission_error(access,private_procedure,(-->)/2).
49
+
50
+ 26 ?- (X-->Y).
51
+ existence_error(procedure,(-->)/2).
52
+
53
+ 3 ?- phrase(!,L).
54
+ L = [].
55
+
56
+ 4 ?- phrase([a],L).
57
+ L = [a].
58
+
59
+ 5 ?- phrase([a|b],L).
60
+ type_error(list,[a|b]).
61
+
62
+ 6 ?- phrase([a|L],K).
63
+ instantiation_error.
64
+
65
+ 38 ?- phrase([a|L],L).
66
+ instantiation_error.
67
+
68
+ 7 ?- phrase([a|L],[a,b]).
69
+ instantiation_error.
70
+
71
+ 8 ?- phrase([a|L],[]).
72
+ instantiation_error.
73
+
74
+ 9 ?- phrase(([a],[]),[a]).
75
+ true.
76
+
77
+ 10 ?- phrase(([a],{1}),[]).
78
+ type_error(callable,(...,...)).
79
+
80
+ 37 ?- phrase((!,[a],{1}),[]).
81
+ type_error(callable,(...,...)).
82
+
83
+ 11 ?- phrase(({!,fail};[]),L).
84
+ false.
85
+
86
+ 12 ?- phrase('|'([],[a]),[a]).
87
+ true.
88
+
89
+ 13 ?- phrase(({fail},1),L).
90
+ type_error(callable,1).
91
+
92
+ 14 ?- phrase(([a];[]),L).
93
+ L = [a] ; L = [].
94
+
95
+ 15 ?- phrase({fail,1},L).
96
+ type_error(callable,((fail,1),[]=_A))
97
+ | type_error(callable,((fail,1),...)).
98
+
99
+ 16 ?- phrase({throw(h)},[a]).
100
+ throw(h).
101
+
102
+ 17 ?- phrase(({L=[]},[a|L]),[a]).
103
+ instantiation_error.
104
+
105
+ 18 ?- phrase([a|L],K), L=[b].
106
+ instantiation_error.
107
+
108
+ 19 ?- phrase(([a|L],1),[]).
109
+ type_error(callable,1)
110
+ | instantiation_error.
111
+
112
+ 20 ?- phrase((1,[a|L]),[]).
113
+ type_error(callable,1)
114
+ | instantiation_error.
115
+
116
+ 21 ?- phrase((1,[a|b]),[]).
117
+ type_error(callable,1)
118
+ | type_error(list,[a|b]).
119
+
120
+ 46 ?- phrase((1,{2}),[]).
121
+ type_error(callable,1).
122
+
123
+ 47 ?- phrase(({2},1),[]).
124
+ type_error(callable,1).
125
+
126
+ 48 ?- phrase((1,(2,[_|_],3),4),[]).
127
+ type_error(callable,1)
128
+ | type_error(callable,2)
129
+ | instantiation_error
130
+ | type_error(callable,3)
131
+ | type_error(callable,4).
132
+
133
+
134
+ 22 ?- phrase('|'(([x]->[y]),[z]),L).
135
+ representation_error(dcg_body)
136
+ | L=[x,y].
137
+
138
+ 23 ?- phrase(;(([x]->[y]),[z]),L).
139
+ L=[x,y].
140
+
141
+ 45 ?- phrase(([a],phrase(2)),[]).
142
+ false.
143
+
144
+ 27 ?- phrase(\+[a],[]).
145
+ representation_error(dcg_body)
146
+ | true.
147
+
148
+ 28 ?- phrase(\+1,L).
149
+ representation_error(dcg_body)
150
+ | type_error(callable,1).
151
+
152
+ 29 ?- phrase(([a],\+1),[]).
153
+ representation_error(dcg_body)
154
+ | false.
155
+
156
+ 30 ?- phrase(([a],\+1;[]),[]).
157
+ representation_error(dcg_body)
158
+ | true.
159
+
160
+ 31 ?- phrase(phrase(phrase,[]),L).
161
+ existence_error(procedure,phrase/4)
162
+ | existence_error(non_terminal,phrase//2)
163
+ | L = [].
164
+
165
+ 32 ?- phrase(call([]),[]).
166
+ existence_error(procedure,[]/2)
167
+ | true.
168
+
169
+ 33 ?- L=[],phrase([a|L],[b]).
170
+ false.
171
+
172
+ 36 ?- L=[],phrase([a|L],[a]).
173
+ L=[].
174
+
175
+ 34 ?- phrase([a],[b]).
176
+ false.
177
+
178
+ 35 ?- phrase(!,[_]) ; L=1.
179
+ L=1.
180
+
181
+ 41 ?- phrase([], non_list).
182
+ false
183
+ | type_error(list,non_list).
184
+
185
+ 42 ?- phrase([], [a|non_list]).
186
+ false
187
+ | type_error(list,[a|non_list]).
188
+
189
+ 43 ?- phrase([], L,non_list).
190
+ L = non_list
191
+ | type_error(list,non_list).
192
+
193
+ 44 ?- phrase([], L,[a|non_list]).
194
+ L = [a|non_list]
195
+ | type_error(list,[a|non_list]).
@@ -309,6 +309,19 @@ c4 ?- call((!;1)).
309
309
  assertEqual(result.stdout, 'quads: 22 run, 22 passed, 0 failed.\n', 'quad report');
310
310
  },
311
311
  },
312
+ {
313
+ name: 'runQuads passes the complete vendored ISO phrase quad corpus',
314
+ run: () => {
315
+ const source = fs.readFileSync(path.join(testRoot, 'fixtures', 'phrase_quad.pl'), 'utf8');
316
+ const result = publicApi.runQuads(Program.parseSources([{
317
+ text: source,
318
+ filename: 'test/fixtures/phrase_quad.pl',
319
+ }]));
320
+ assertEqual(result.total, 58, 'quad total');
321
+ assertEqual(result.passed, 58, 'quad passed');
322
+ assertEqual(result.stdout, 'quads: 58 run, 58 passed, 0 failed.\n', 'quad report');
323
+ },
324
+ },
312
325
  {
313
326
  name: 'runQuads rejects malformed answer substitutions',
314
327
  run: () => {