@tuprolog/2p-full 0.31.5-dev0c → 0.31.5-dev0f
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/2p-bdd.js +141 -141
- package/2p-core.js +2841 -2841
- package/2p-core.js.map +1 -1
- package/2p-io-lib.js +573 -573
- package/2p-oop-lib.js +815 -815
- package/2p-parser-core.js +136 -136
- package/2p-parser-theory.js +11 -11
- package/2p-repl.js +80 -80
- package/2p-solve-classic.js +936 -936
- package/2p-solve-plp.js +1 -1
- package/2p-solve-problog.js +1250 -1250
- package/2p-solve-streams.js +851 -851
- package/2p-solve.js +3409 -3409
- package/2p-theory.js +1258 -1258
- package/2p-unify.js +208 -208
- package/2p-utils.js +324 -324
- package/clikt-clikt-js-ir.js +1143 -1180
- package/clikt-clikt-js-ir.js.map +1 -1
- package/kotlin-kotlin-stdlib-js-ir.js +754 -741
- package/kotlin-kotlin-stdlib-js-ir.js.map +1 -1
- package/kt-math.js +2184 -2184
- package/kt-math.js.map +1 -1
- package/package.json +1 -1
package/2p-parser-theory.js
CHANGED
|
@@ -22,22 +22,22 @@
|
|
|
22
22
|
return Companion_getInstance_0().indexedOfSequence(unificator, this.parseClausesLazilyWithOperators(input, operators));
|
|
23
23
|
}
|
|
24
24
|
function parseTheoryWithOperatorsAndDefaultUnificator(input, operators) {
|
|
25
|
-
return this.parseTheoryWithOperators(input, operators, Companion_getInstance_1().
|
|
25
|
+
return this.parseTheoryWithOperators(input, operators, Companion_getInstance_1().e1l());
|
|
26
26
|
}
|
|
27
27
|
function parseTheory(input, unificator) {
|
|
28
|
-
return this.parseTheoryWithOperators(input, this.
|
|
28
|
+
return this.parseTheoryWithOperators(input, this.c3j(), unificator);
|
|
29
29
|
}
|
|
30
30
|
function parseTheoryWithDefaultUnificator(input) {
|
|
31
|
-
return this.parseTheory(input, Companion_getInstance_1().
|
|
31
|
+
return this.parseTheory(input, Companion_getInstance_1().e1l());
|
|
32
32
|
}
|
|
33
33
|
function parseClausesLazily(input) {
|
|
34
|
-
return this.parseClausesLazilyWithOperators(input, this.
|
|
34
|
+
return this.parseClausesLazilyWithOperators(input, this.c3j());
|
|
35
35
|
}
|
|
36
36
|
function parseClausesWithOperators(input, operators) {
|
|
37
37
|
return toList(this.parseClausesLazilyWithOperators(input, operators));
|
|
38
38
|
}
|
|
39
39
|
function parseClauses(input) {
|
|
40
|
-
return this.parseClausesWithOperators(input, this.
|
|
40
|
+
return this.parseClausesWithOperators(input, this.c3j());
|
|
41
41
|
}
|
|
42
42
|
setMetadataFor(ClausesParser, 'ClausesParser', interfaceMeta, undefined, undefined, undefined, undefined, []);
|
|
43
43
|
setMetadataFor(ClausesParserImpl, 'ClausesParserImpl', classMeta, undefined, [ClausesParser], undefined, undefined, []);
|
|
@@ -78,22 +78,22 @@
|
|
|
78
78
|
return toClause$default(it, null, 0, 0, 7, null);
|
|
79
79
|
}
|
|
80
80
|
function ClausesParserImpl(defaultOperatorSet) {
|
|
81
|
-
this.
|
|
81
|
+
this.c3k_1 = defaultOperatorSet;
|
|
82
82
|
}
|
|
83
|
-
ClausesParserImpl.prototype.
|
|
84
|
-
return this.
|
|
83
|
+
ClausesParserImpl.prototype.c3j = function () {
|
|
84
|
+
return this.c3k_1;
|
|
85
85
|
};
|
|
86
|
-
ClausesParserImpl.prototype.
|
|
86
|
+
ClausesParserImpl.prototype.d3k = function (input, operators) {
|
|
87
87
|
var tmp$ret$0;
|
|
88
88
|
// Inline function 'kotlin.sequences.asSequence' call
|
|
89
|
-
var tmp0_asSequence = PrologParserFactory_getInstance().
|
|
89
|
+
var tmp0_asSequence = PrologParserFactory_getInstance().k3j(input, operators);
|
|
90
90
|
tmp$ret$0 = tmp0_asSequence;
|
|
91
91
|
var tmp = tmp$ret$0;
|
|
92
92
|
var tmp_0 = map(tmp, ClausesParserImpl$parseClausesLazily$lambda);
|
|
93
93
|
return map(tmp_0, ClausesParserImpl$parseClausesLazily$lambda_0);
|
|
94
94
|
};
|
|
95
95
|
ClausesParserImpl.prototype.parseClausesLazilyWithOperators = function (input, operators) {
|
|
96
|
-
return this.
|
|
96
|
+
return this.d3k(input, operators);
|
|
97
97
|
};
|
|
98
98
|
//region block: post-declaration
|
|
99
99
|
ClausesParserImpl.prototype.parseTheoryWithOperators = parseTheoryWithOperators;
|
package/2p-repl.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function (_, kotlin_kotlin, kotlin_it_unibo_tuprolog_solve, kotlin_it_unibo_tuprolog_core,
|
|
1
|
+
(function (_, kotlin_kotlin, kotlin_it_unibo_tuprolog_solve, kotlin_it_unibo_tuprolog_core, kotlin_clikt_clikt, kotlin_it_unibo_tuprolog_theory, kotlin_it_unibo_tuprolog_parser_core, kotlin_it_unibo_tuprolog_io_lib, kotlin_it_unibo_tuprolog_oop_lib) {
|
|
2
2
|
'use strict';
|
|
3
3
|
//region block: imports
|
|
4
4
|
var emptyMap = kotlin_kotlin.$_$.t3;
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
var Yes = kotlin_it_unibo_tuprolog_solve.$_$.t4;
|
|
9
9
|
var Companion_getInstance = kotlin_it_unibo_tuprolog_solve.$_$.n2;
|
|
10
10
|
var format = kotlin_it_unibo_tuprolog_core.$_$.c3;
|
|
11
|
-
var ProgramResult =
|
|
11
|
+
var ProgramResult = kotlin_clikt_clikt.$_$.b;
|
|
12
12
|
var HaltException = kotlin_it_unibo_tuprolog_solve.$_$.t2;
|
|
13
13
|
var StringBuilder = kotlin_kotlin.$_$.v9;
|
|
14
14
|
var THROW_CCE = kotlin_kotlin.$_$.sb;
|
|
@@ -18,13 +18,13 @@
|
|
|
18
18
|
var Unit_getInstance = kotlin_kotlin.$_$.r2;
|
|
19
19
|
var _Char___init__impl__6a9atx = kotlin_kotlin.$_$.d2;
|
|
20
20
|
var endsWith$default = kotlin_kotlin.$_$.l;
|
|
21
|
-
var CliktCommand =
|
|
21
|
+
var CliktCommand = kotlin_clikt_clikt.$_$.a;
|
|
22
22
|
var charSequenceLength = kotlin_kotlin.$_$.l6;
|
|
23
23
|
var charSequenceGet = kotlin_kotlin.$_$.k6;
|
|
24
24
|
var toString_0 = kotlin_kotlin.$_$.h2;
|
|
25
25
|
var titlecase = kotlin_kotlin.$_$.qa;
|
|
26
26
|
var isLowerCase = kotlin_kotlin.$_$.ba;
|
|
27
|
-
var defaultCliktConsole =
|
|
27
|
+
var defaultCliktConsole = kotlin_clikt_clikt.$_$.d;
|
|
28
28
|
var classMeta = kotlin_kotlin.$_$.m6;
|
|
29
29
|
var setMetadataFor = kotlin_kotlin.$_$.j7;
|
|
30
30
|
var TuPrologException_init_$Init$ = kotlin_it_unibo_tuprolog_core.$_$.m;
|
|
@@ -38,11 +38,11 @@
|
|
|
38
38
|
var parseStructWithOperators = kotlin_it_unibo_tuprolog_parser_core.$_$.f;
|
|
39
39
|
var Companion_getInstance_2 = kotlin_it_unibo_tuprolog_core.$_$.f1;
|
|
40
40
|
var joinToString$default = kotlin_kotlin.$_$.e;
|
|
41
|
-
var option$default =
|
|
42
|
-
var multiple$default =
|
|
43
|
-
var int =
|
|
44
|
-
var default$default =
|
|
45
|
-
var flag$default =
|
|
41
|
+
var option$default = kotlin_clikt_clikt.$_$.j;
|
|
42
|
+
var multiple$default = kotlin_clikt_clikt.$_$.i;
|
|
43
|
+
var int = kotlin_clikt_clikt.$_$.e;
|
|
44
|
+
var default$default = kotlin_clikt_clikt.$_$.g;
|
|
45
|
+
var flag$default = kotlin_clikt_clikt.$_$.h;
|
|
46
46
|
var toLong = kotlin_kotlin.$_$.l7;
|
|
47
47
|
var Info_getInstance = kotlin_it_unibo_tuprolog_core.$_$.k1;
|
|
48
48
|
var Companion_getInstance_3 = kotlin_it_unibo_tuprolog_solve.$_$.n1;
|
|
@@ -56,8 +56,8 @@
|
|
|
56
56
|
var getPropertyCallableRef = kotlin_kotlin.$_$.r6;
|
|
57
57
|
var NotImplementedError = kotlin_kotlin.$_$.nb;
|
|
58
58
|
var parseStruct = kotlin_it_unibo_tuprolog_parser_core.$_$.e;
|
|
59
|
-
var argument$default =
|
|
60
|
-
var subcommands =
|
|
59
|
+
var argument$default = kotlin_clikt_clikt.$_$.f;
|
|
60
|
+
var subcommands = kotlin_clikt_clikt.$_$.c;
|
|
61
61
|
//endregion
|
|
62
62
|
//region block: pre-declaration
|
|
63
63
|
setMetadataFor(AbstractTuPrologCommand, 'AbstractTuPrologCommand', classMeta, CliktCommand, undefined, undefined, undefined, []);
|
|
@@ -106,16 +106,16 @@
|
|
|
106
106
|
}
|
|
107
107
|
function printYesSolution($this, sol, operatorSet) {
|
|
108
108
|
var tmp = format(sol, Companion_getInstance().withOperators(operatorSet));
|
|
109
|
-
$this.
|
|
109
|
+
$this.f3y(tmp, false, false, null, 14, null);
|
|
110
110
|
}
|
|
111
111
|
function printHaltSolution($this, sol, operatorSet) {
|
|
112
|
-
var ex = sol.
|
|
112
|
+
var ex = sol.z1v();
|
|
113
113
|
if (ex instanceof HaltException) {
|
|
114
|
-
$this.
|
|
114
|
+
$this.f3y('# goodbye.', false, false, null, 14, null);
|
|
115
115
|
throw new ProgramResult(ex.exitStatus);
|
|
116
116
|
} else {
|
|
117
117
|
var tmp = format(sol, Companion_getInstance().withOperators(operatorSet));
|
|
118
|
-
$this.
|
|
118
|
+
$this.f3y(tmp, false, false, null, 14, null);
|
|
119
119
|
}
|
|
120
120
|
}
|
|
121
121
|
function printEndOfSolutions($this) {
|
|
@@ -133,7 +133,7 @@
|
|
|
133
133
|
if (!!endsWith$default(tmp, tmp_0, false, 2, null)) {
|
|
134
134
|
break $l$loop;
|
|
135
135
|
}
|
|
136
|
-
var tmp0_elvis_lhs = $this.
|
|
136
|
+
var tmp0_elvis_lhs = $this.j3y('>', null, false, false, null, ' ', false, 94, null);
|
|
137
137
|
var tmp_1;
|
|
138
138
|
if (tmp0_elvis_lhs == null) {
|
|
139
139
|
throw NullInputException_init_$Create$('The standard input has been closed unexpectedly');
|
|
@@ -147,12 +147,12 @@
|
|
|
147
147
|
}
|
|
148
148
|
function printNoSolution($this, sol, operatorSet) {
|
|
149
149
|
var tmp = format(sol, Companion_getInstance().withOperators(operatorSet));
|
|
150
|
-
$this.
|
|
150
|
+
$this.f3y(tmp, false, false, null, 14, null);
|
|
151
151
|
}
|
|
152
152
|
function AbstractTuPrologCommand(help, epilog, name, invokeWithoutSubcommand, printHelpOnEmptyArgs, helpTags, autoCompleteEnvvar, allowMultipleSubcommands, treatUnknownOptionsAsArgs, hidden) {
|
|
153
153
|
CliktCommand.call(this, help, epilog, name, invokeWithoutSubcommand, printHelpOnEmptyArgs, helpTags, autoCompleteEnvvar, allowMultipleSubcommands, treatUnknownOptionsAsArgs, hidden);
|
|
154
154
|
}
|
|
155
|
-
AbstractTuPrologCommand.prototype.
|
|
155
|
+
AbstractTuPrologCommand.prototype.i4a = function (e) {
|
|
156
156
|
var tmp0_safe_receiver = e.message;
|
|
157
157
|
var tmp;
|
|
158
158
|
if (tmp0_safe_receiver == null) {
|
|
@@ -184,10 +184,10 @@
|
|
|
184
184
|
tmp = tmp$ret$4;
|
|
185
185
|
}
|
|
186
186
|
var tmp_2 = '# ' + tmp;
|
|
187
|
-
this.
|
|
187
|
+
this.f3y(tmp_2, false, true, null, 10, null);
|
|
188
188
|
};
|
|
189
|
-
AbstractTuPrologCommand.prototype.
|
|
190
|
-
var query = this.
|
|
189
|
+
AbstractTuPrologCommand.prototype.j4a = function () {
|
|
190
|
+
var query = this.j3y('?-', null, false, false, null, ' ', false, 94, null);
|
|
191
191
|
var tmp;
|
|
192
192
|
if (query == null) {
|
|
193
193
|
throw NullInputException_init_$Create$('The standard input has been close unexpectedly');
|
|
@@ -205,11 +205,11 @@
|
|
|
205
205
|
}
|
|
206
206
|
return tmp;
|
|
207
207
|
};
|
|
208
|
-
AbstractTuPrologCommand.prototype.
|
|
208
|
+
AbstractTuPrologCommand.prototype.k4a = function (solutions, operatorSet) {
|
|
209
209
|
var first = true;
|
|
210
210
|
$l$loop: while (solutions.m()) {
|
|
211
211
|
if (!first) {
|
|
212
|
-
var tmp0_safe_receiver = defaultCliktConsole().
|
|
212
|
+
var tmp0_safe_receiver = defaultCliktConsole().y45('', false);
|
|
213
213
|
var tmp;
|
|
214
214
|
if (tmp0_safe_receiver == null) {
|
|
215
215
|
tmp = null;
|
|
@@ -225,16 +225,16 @@
|
|
|
225
225
|
} else {
|
|
226
226
|
first = false;
|
|
227
227
|
}
|
|
228
|
-
printSolution(this, solutions.
|
|
228
|
+
printSolution(this, solutions.n(), operatorSet);
|
|
229
229
|
}
|
|
230
230
|
printEndOfSolutions(this);
|
|
231
231
|
};
|
|
232
|
-
AbstractTuPrologCommand.prototype.
|
|
232
|
+
AbstractTuPrologCommand.prototype.l4a = function (solutions, maxSolutions, operatorSet) {
|
|
233
233
|
var i = 0;
|
|
234
234
|
while (i < maxSolutions ? solutions.m() : false) {
|
|
235
235
|
var tmp0 = i;
|
|
236
236
|
i = tmp0 + 1 | 0;
|
|
237
|
-
printSolution(this, solutions.
|
|
237
|
+
printSolution(this, solutions.n(), operatorSet);
|
|
238
238
|
}
|
|
239
239
|
printEndOfSolutions(this);
|
|
240
240
|
};
|
|
@@ -257,7 +257,7 @@
|
|
|
257
257
|
}
|
|
258
258
|
function Companion() {
|
|
259
259
|
Companion_instance = this;
|
|
260
|
-
this.
|
|
260
|
+
this.m4a_1 = 1000;
|
|
261
261
|
}
|
|
262
262
|
var Companion_instance;
|
|
263
263
|
function Companion_getInstance_6() {
|
|
@@ -266,60 +266,60 @@
|
|
|
266
266
|
return Companion_instance;
|
|
267
267
|
}
|
|
268
268
|
function _get_files__hkfg7a($this) {
|
|
269
|
-
return $this.
|
|
269
|
+
return $this.f4b_1.h46($this, files$factory_0());
|
|
270
270
|
}
|
|
271
271
|
function _get_timeout__tg4wg($this) {
|
|
272
|
-
return $this.
|
|
272
|
+
return $this.g4b_1.h46($this, timeout$factory_0());
|
|
273
273
|
}
|
|
274
274
|
function _get_oop__e6e8e9($this) {
|
|
275
|
-
return $this.
|
|
275
|
+
return $this.h4b_1.h46($this, oop$factory_0());
|
|
276
276
|
}
|
|
277
277
|
function loadTheory($this) {
|
|
278
278
|
var theory = Companion_getInstance_0().emptyWithDefaultUnificator();
|
|
279
279
|
var tmp0_iterator = _get_files__hkfg7a($this).j();
|
|
280
280
|
while (tmp0_iterator.m()) {
|
|
281
|
-
var file = tmp0_iterator.
|
|
281
|
+
var file = tmp0_iterator.n();
|
|
282
282
|
if (isReadableFile(file)) {
|
|
283
283
|
try {
|
|
284
284
|
var t = loadTheoryFromFile(file);
|
|
285
|
-
var tmp = '# Successfully loaded ' + toString(t.
|
|
286
|
-
$this.
|
|
285
|
+
var tmp = '# Successfully loaded ' + toString(t.p()) + ' clauses from ' + file;
|
|
286
|
+
$this.f3y(tmp, false, false, null, 14, null);
|
|
287
287
|
theory = theory.plusTheory(t);
|
|
288
288
|
} catch ($p) {
|
|
289
289
|
if ($p instanceof ParseException) {
|
|
290
290
|
var tmp_0 = '\n |# Error while parsing theory file: ' + file + '\n |# Message: ' + $p.message + '\n |# Line : ' + $p.line + '\n |# Column : ' + $p.column + '\n |# Clause : ' + $p.clauseIndex + '\n ';
|
|
291
291
|
var tmp_1 = trimMargin$default(tmp_0, null, 1, null);
|
|
292
|
-
$this.
|
|
292
|
+
$this.f3y(tmp_1, false, true, null, 10, null);
|
|
293
293
|
} else {
|
|
294
294
|
throw $p;
|
|
295
295
|
}
|
|
296
296
|
}
|
|
297
297
|
}
|
|
298
298
|
}
|
|
299
|
-
$this.
|
|
299
|
+
$this.f3y('', false, false, null, 14, null);
|
|
300
300
|
return theory;
|
|
301
301
|
}
|
|
302
302
|
function readEvalPrintLoop($this, solver) {
|
|
303
303
|
try {
|
|
304
|
-
var query = $this.
|
|
304
|
+
var query = $this.j4a();
|
|
305
305
|
while (!(query == null)) {
|
|
306
306
|
try {
|
|
307
|
-
var goal = parseStructWithOperators(Companion_getInstance_1(), query, solver.
|
|
308
|
-
var solutions = solver.solveWithTimeout(goal, $this.
|
|
309
|
-
$this.
|
|
307
|
+
var goal = parseStructWithOperators(Companion_getInstance_1(), query, solver.e1v());
|
|
308
|
+
var solutions = solver.solveWithTimeout(goal, $this.i4b()).j();
|
|
309
|
+
$this.k4a(solutions, solver.e1v());
|
|
310
310
|
} catch ($p) {
|
|
311
311
|
if ($p instanceof ParseException) {
|
|
312
|
-
$this.
|
|
312
|
+
$this.i4a($p);
|
|
313
313
|
} else {
|
|
314
314
|
throw $p;
|
|
315
315
|
}
|
|
316
316
|
}
|
|
317
|
-
$this.
|
|
318
|
-
query = $this.
|
|
317
|
+
$this.f3y('', false, false, null, 14, null);
|
|
318
|
+
query = $this.j4a();
|
|
319
319
|
}
|
|
320
320
|
} catch ($p) {
|
|
321
321
|
if ($p instanceof NullInputException) {
|
|
322
|
-
$this.
|
|
322
|
+
$this.f3y('\n# goodbye.', false, false, null, 14, null);
|
|
323
323
|
throw new ProgramResult(0);
|
|
324
324
|
} else {
|
|
325
325
|
throw $p;
|
|
@@ -334,82 +334,82 @@
|
|
|
334
334
|
function TuPrologCmd$getSolver$lambda(this$0) {
|
|
335
335
|
return function (w) {
|
|
336
336
|
var tmp = '# ' + w.message;
|
|
337
|
-
this$0.
|
|
337
|
+
this$0.f3y(tmp, false, true, null, 10, null);
|
|
338
338
|
var sep = '\n at ';
|
|
339
|
-
var formatter = Companion_getInstance_2().prettyExpressionsPrettyVariables(w.j5().
|
|
340
|
-
var tmp_0 = w.
|
|
339
|
+
var formatter = Companion_getInstance_2().prettyExpressionsPrettyVariables(w.j5().e1v());
|
|
340
|
+
var tmp_0 = w.p1u();
|
|
341
341
|
var stacktrace = joinToString$default(tmp_0, sep, null, null, 0, null, TuPrologCmd$getSolver$lambda$lambda(formatter), 30, null);
|
|
342
342
|
var tmp_1 = '# at ' + stacktrace;
|
|
343
|
-
this$0.
|
|
343
|
+
this$0.f3y(tmp_1, false, true, null, 10, null);
|
|
344
344
|
return Unit_getInstance();
|
|
345
345
|
};
|
|
346
346
|
}
|
|
347
347
|
function TuPrologCmd$getSolver$lambda_0($this$flag) {
|
|
348
|
-
return $this$flag.
|
|
348
|
+
return $this$flag.r29_1;
|
|
349
349
|
}
|
|
350
350
|
function TuPrologCmd(additionalLibraries) {
|
|
351
351
|
Companion_getInstance_6();
|
|
352
352
|
AbstractTuPrologCommand_init_$Init$('Start a Prolog Read-Eval-Print loop', null, 'java -jar 2p-repl.jar', true, false, null, null, true, false, false, 882, null, this);
|
|
353
|
-
this.
|
|
353
|
+
this.e4b_1 = additionalLibraries;
|
|
354
354
|
var tmp = this;
|
|
355
355
|
var tmp_0 = option$default(this, ['-T', '--theory'], 'Path of theory file to be loaded', null, false, null, null, null, null, 252, null);
|
|
356
|
-
tmp.
|
|
356
|
+
tmp.f4b_1 = multiple$default(tmp_0, null, false, 3, null).q47(this, files$factory());
|
|
357
357
|
var tmp_1 = this;
|
|
358
358
|
Companion_getInstance_6();
|
|
359
359
|
var tmp_2 = 'Maximum amount of time for computing a solution (default: ' + 1000 + ' ms)';
|
|
360
360
|
var tmp_3 = int(option$default(this, ['-t', '--timeout'], tmp_2, null, false, null, null, null, null, 252, null));
|
|
361
361
|
Companion_getInstance_6();
|
|
362
|
-
tmp_1.
|
|
362
|
+
tmp_1.g4b_1 = default$default(tmp_3, 1000, null, 2, null).q47(this, timeout$factory());
|
|
363
363
|
var tmp_4 = this;
|
|
364
364
|
var tmp_5 = option$default(this, ['--oop'], 'Loads the OOP library', null, false, null, null, null, null, 252, null);
|
|
365
|
-
tmp_4.
|
|
365
|
+
tmp_4.h4b_1 = flag$default(tmp_5, [], false, null, 5, null).q47(this, oop$factory());
|
|
366
366
|
}
|
|
367
|
-
TuPrologCmd.prototype.
|
|
368
|
-
var solve = this.
|
|
369
|
-
var subcommand = this.
|
|
367
|
+
TuPrologCmd.prototype.e3z = function () {
|
|
368
|
+
var solve = this.j4b();
|
|
369
|
+
var subcommand = this.s2b().z3w_1;
|
|
370
370
|
if (subcommand == null) {
|
|
371
371
|
readEvalPrintLoop(this, solve);
|
|
372
372
|
}
|
|
373
373
|
};
|
|
374
|
-
TuPrologCmd.prototype.
|
|
374
|
+
TuPrologCmd.prototype.i4b = function () {
|
|
375
375
|
return toLong(_get_timeout__tg4wg(this));
|
|
376
376
|
};
|
|
377
|
-
TuPrologCmd.prototype.
|
|
377
|
+
TuPrologCmd.prototype.j4b = function () {
|
|
378
378
|
Info_getInstance();
|
|
379
|
-
var tmp = '# 2P-Kt version ' + '0.31.5-
|
|
380
|
-
this.
|
|
379
|
+
var tmp = '# 2P-Kt version ' + '0.31.5-dev0f+5a2ad7593';
|
|
380
|
+
this.f3y(tmp, false, false, null, 14, null);
|
|
381
381
|
var theory = loadTheory(this);
|
|
382
382
|
var tmp_0 = Companion_getInstance_3();
|
|
383
383
|
var outputChannel = tmp_0.of(TuPrologCmd$getSolver$lambda(this));
|
|
384
384
|
var tmp_1;
|
|
385
385
|
if (_get_oop__e6e8e9(this)) {
|
|
386
|
-
tmp_1 = Companion_getInstance_4().of(arrayConcat([[IOLib_getInstance(), OOPLib_getInstance()], this.
|
|
386
|
+
tmp_1 = Companion_getInstance_4().of(arrayConcat([[IOLib_getInstance(), OOPLib_getInstance()], this.e4b_1]));
|
|
387
387
|
} else {
|
|
388
|
-
tmp_1 = Companion_getInstance_4().of(arrayConcat([[IOLib_getInstance()], this.
|
|
388
|
+
tmp_1 = Companion_getInstance_4().of(arrayConcat([[IOLib_getInstance()], this.e4b_1]));
|
|
389
389
|
}
|
|
390
390
|
var libraries = tmp_1;
|
|
391
391
|
var tmp$ret$2;
|
|
392
392
|
// Inline function 'kotlin.also' call
|
|
393
|
-
var tmp_2 = Companion_getInstance_5().
|
|
393
|
+
var tmp_2 = Companion_getInstance_5().q1x().newBuilder().setRuntime(libraries).setStaticKb(theory);
|
|
394
394
|
var tmp_3 = TrackVariables_getInstance();
|
|
395
395
|
var tmp0_also = tmp_2.setNotableFlagByValue(tmp_3, TuPrologCmd$getSolver$lambda_0).setWarnings(outputChannel).build();
|
|
396
396
|
// Inline function 'kotlin.contracts.contract' call
|
|
397
397
|
// Inline function 'it.unibo.tuprolog.ui.repl.TuPrologCmd.getSolver.<anonymous>' call
|
|
398
398
|
var tmp$ret$0;
|
|
399
399
|
// Inline function 'kotlin.collections.iterator' call
|
|
400
|
-
var tmp0_iterator = tmp0_also.
|
|
400
|
+
var tmp0_iterator = tmp0_also.t1u();
|
|
401
401
|
tmp$ret$0 = tmp0_iterator.z().j();
|
|
402
402
|
var tmp0_iterator_0 = tmp$ret$0;
|
|
403
403
|
while (tmp0_iterator_0.m()) {
|
|
404
|
-
var tmp1_loop_parameter = tmp0_iterator_0.
|
|
404
|
+
var tmp1_loop_parameter = tmp0_iterator_0.n();
|
|
405
405
|
var tmp$ret$1;
|
|
406
406
|
// Inline function 'kotlin.collections.component2' call
|
|
407
407
|
tmp$ret$1 = tmp1_loop_parameter.b1();
|
|
408
408
|
var library = tmp$ret$1;
|
|
409
|
-
var tmp_4 = '# Successfully loaded library `' + library.
|
|
410
|
-
this.
|
|
409
|
+
var tmp_4 = '# Successfully loaded library `' + library.l2e() + '`';
|
|
410
|
+
this.f3y(tmp_4, false, false, null, 14, null);
|
|
411
411
|
}
|
|
412
|
-
this.
|
|
412
|
+
this.f3y('', false, false, null, 14, null);
|
|
413
413
|
tmp$ret$2 = tmp0_also;
|
|
414
414
|
return tmp$ret$2;
|
|
415
415
|
};
|
|
@@ -444,14 +444,14 @@
|
|
|
444
444
|
}, null);
|
|
445
445
|
}
|
|
446
446
|
function _get_query__c6g9vb($this) {
|
|
447
|
-
return $this.
|
|
447
|
+
return $this.b4c_1.h46($this, query$factory_0());
|
|
448
448
|
}
|
|
449
449
|
function _get_maxSolutions__ysux2t($this) {
|
|
450
|
-
return $this.
|
|
450
|
+
return $this.c4c_1.h46($this, maxSolutions$factory_0());
|
|
451
451
|
}
|
|
452
452
|
function _get_parentCommand__z09ff4($this) {
|
|
453
|
-
var tmp0_safe_receiver = $this.
|
|
454
|
-
var tmp = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.
|
|
453
|
+
var tmp0_safe_receiver = $this.s2b().j3w_1;
|
|
454
|
+
var tmp = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.k3w_1;
|
|
455
455
|
return tmp instanceof TuPrologCmd ? tmp : THROW_CCE();
|
|
456
456
|
}
|
|
457
457
|
function evalAndPrint($this, solver) {
|
|
@@ -461,16 +461,16 @@
|
|
|
461
461
|
tmp$ret$0 = charSequenceLength(tmp0_isNotEmpty) > 0;
|
|
462
462
|
if (tmp$ret$0) {
|
|
463
463
|
try {
|
|
464
|
-
var duration = _get_parentCommand__z09ff4($this).
|
|
464
|
+
var duration = _get_parentCommand__z09ff4($this).i4b();
|
|
465
465
|
var solutions = solver.solveWithTimeout(parseStruct(Companion_getInstance_1(), _get_query__c6g9vb($this)), duration).j();
|
|
466
466
|
if (_get_maxSolutions__ysux2t($this) === 0) {
|
|
467
|
-
$this.
|
|
467
|
+
$this.k4a(solutions, solver.e1v());
|
|
468
468
|
} else {
|
|
469
|
-
$this.
|
|
469
|
+
$this.l4a(solutions, _get_maxSolutions__ysux2t($this), solver.e1v());
|
|
470
470
|
}
|
|
471
471
|
} catch ($p) {
|
|
472
472
|
if ($p instanceof ParseException) {
|
|
473
|
-
$this.
|
|
473
|
+
$this.i4a($p);
|
|
474
474
|
} else {
|
|
475
475
|
throw $p;
|
|
476
476
|
}
|
|
@@ -483,13 +483,13 @@
|
|
|
483
483
|
function TuPrologSolveQuery() {
|
|
484
484
|
AbstractTuPrologCommand_init_$Init$('Compute a particular query and then terminate', null, 'solve', false, false, null, null, false, false, false, 1018, null, this);
|
|
485
485
|
var tmp = this;
|
|
486
|
-
tmp.
|
|
486
|
+
tmp.b4c_1 = argument$default(this, null, null, null, null, 15, null).i46(this, query$factory());
|
|
487
487
|
var tmp_0 = this;
|
|
488
488
|
var tmp_1 = int(option$default(this, ['-n', '--numberOfSolutions'], 'Number of solution to calculate', null, false, null, null, null, null, 252, null));
|
|
489
|
-
tmp_0.
|
|
489
|
+
tmp_0.c4c_1 = default$default(tmp_1, 0, null, 2, null).q47(this, maxSolutions$factory());
|
|
490
490
|
}
|
|
491
|
-
TuPrologSolveQuery.prototype.
|
|
492
|
-
var solver = _get_parentCommand__z09ff4(this).
|
|
491
|
+
TuPrologSolveQuery.prototype.e3z = function () {
|
|
492
|
+
var solver = _get_parentCommand__z09ff4(this).j4b();
|
|
493
493
|
evalAndPrint(this, solver);
|
|
494
494
|
};
|
|
495
495
|
function query$factory() {
|
|
@@ -521,7 +521,7 @@
|
|
|
521
521
|
throw new NotImplementedError('An operation is not implemented: Not yet implemented');
|
|
522
522
|
}
|
|
523
523
|
function main(args) {
|
|
524
|
-
subcommands(new TuPrologCmd([]), [new TuPrologSolveQuery()]).
|
|
524
|
+
subcommands(new TuPrologCmd([]), [new TuPrologSolveQuery()]).d3z(args);
|
|
525
525
|
}
|
|
526
526
|
//region block: exports
|
|
527
527
|
_.$_$ = _.$_$ || {};
|