@tuprolog/2p-full 1.0.3 → 1.1.0
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 +204 -201
- package/2p-bdd.js.map +1 -1
- package/2p-core.js +3668 -4128
- package/2p-core.js.map +1 -1
- package/2p-datalog.js +3 -3
- package/2p-datalog.js.map +1 -1
- package/2p-dsl-core.js +3 -3
- package/2p-dsl-core.js.map +1 -1
- package/2p-dsl-solve.js +3 -3
- package/2p-dsl-solve.js.map +1 -1
- package/2p-dsl-theory.js +3 -3
- package/2p-dsl-theory.js.map +1 -1
- package/2p-dsl-unify.js +3 -3
- package/2p-dsl-unify.js.map +1 -1
- package/2p-full.js +9 -19
- package/2p-full.js.map +1 -1
- package/2p-io-lib.js +6 -3321
- package/2p-io-lib.js.map +1 -1
- package/2p-oop-lib.js +6 -3435
- package/2p-oop-lib.js.map +1 -1
- package/2p-parser-core.js +6 -1266
- package/2p-parser-core.js.map +1 -1
- package/2p-parser-js.js +6 -30
- package/2p-parser-js.js.map +1 -1
- package/2p-parser-theory.js +6 -126
- package/2p-parser-theory.js.map +1 -1
- package/2p-repl.js +6 -499
- package/2p-repl.js.map +1 -1
- package/2p-serialize-core.js +3 -3
- package/2p-serialize-core.js.map +1 -1
- package/2p-serialize-theory.js +3 -3
- package/2p-serialize-theory.js.map +1 -1
- package/2p-solve-classic.js +1216 -1203
- package/2p-solve-classic.js.map +1 -1
- package/2p-solve-concurrent.js +3 -3
- package/2p-solve-concurrent.js.map +1 -1
- package/2p-solve-plp.js +8 -8
- package/2p-solve-plp.js.map +1 -1
- package/2p-solve-problog.js +2095 -2140
- package/2p-solve-problog.js.map +1 -1
- package/2p-solve-streams.js +1244 -1333
- package/2p-solve-streams.js.map +1 -1
- package/2p-solve.js +5185 -6393
- package/2p-solve.js.map +1 -1
- package/2p-test-dsl.js +3 -3
- package/2p-test-dsl.js.map +1 -1
- package/2p-theory.js +2091 -1992
- package/2p-theory.js.map +1 -1
- package/2p-unify.js +315 -300
- package/2p-unify.js.map +1 -1
- package/2p-utils.js +625 -635
- package/2p-utils.js.map +1 -1
- package/clikt-clikt-mordant.js +15 -0
- package/clikt-clikt-mordant.js.map +1 -0
- package/clikt-clikt.js +15 -0
- package/clikt-clikt.js.map +1 -0
- package/colormath-root-colormath.js +15 -0
- package/colormath-root-colormath.js.map +1 -0
- package/kotlin-kotlin-stdlib.js +6829 -8585
- package/kotlin-kotlin-stdlib.js.map +1 -1
- package/kotlin-kotlin-test.js +15 -0
- package/kotlin-kotlin-test.js.map +1 -0
- package/kotlin_org_jetbrains_kotlin_kotlin_dom_api_compat.js +3 -3
- package/kotlin_org_jetbrains_kotlin_kotlin_dom_api_compat.js.map +1 -1
- package/kotlinx-atomicfu.js +15 -0
- package/kotlinx-atomicfu.js.map +1 -0
- package/kotlinx-coroutines-core.js +15 -0
- package/kotlinx-coroutines-core.js.map +1 -0
- package/kt-math.js +3143 -3508
- package/kt-math.js.map +1 -1
- package/mordant-mordant-omnibus.js +15 -0
- package/mordant-mordant-omnibus.js.map +1 -0
- package/mordant-mordant.js +19 -0
- package/mordant-mordant.js.map +1 -0
- package/package.json +2 -3
- package/88b0986a7186d029-atomicfu-js-ir.js +0 -15
- package/88b0986a7186d029-atomicfu-js-ir.js.map +0 -1
- package/clikt-clikt-js-ir.js +0 -6006
- package/clikt-clikt-js-ir.js.map +0 -1
- package/kotlin-kotlin-test-kotlin-test-js-ir.js +0 -15
- package/kotlin-kotlin-test-kotlin-test-js-ir.js.map +0 -1
- package/kotlin-kotlinx-atomicfu-runtime-js-ir.js +0 -15
- package/kotlin-kotlinx-atomicfu-runtime-js-ir.js.map +0 -1
- package/kotlinx.coroutines-kotlinx-coroutines-core-js-ir.js +0 -15
- package/kotlinx.coroutines-kotlinx-coroutines-core-js-ir.js.map +0 -1
package/2p-repl.js
CHANGED
|
@@ -1,506 +1,13 @@
|
|
|
1
|
-
(function (
|
|
1
|
+
(function (factory) {
|
|
2
2
|
if (typeof define === 'function' && define.amd)
|
|
3
|
-
define(['exports'
|
|
3
|
+
define(['exports'], factory);
|
|
4
4
|
else if (typeof exports === 'object')
|
|
5
|
-
factory(module.exports
|
|
6
|
-
else
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}
|
|
10
|
-
if (typeof this['2p-solve'] === 'undefined') {
|
|
11
|
-
throw new Error("Error loading module '2p-repl'. Its dependency '2p-solve' was not found. Please, check whether '2p-solve' is loaded prior to '2p-repl'.");
|
|
12
|
-
}
|
|
13
|
-
if (typeof this['2p-core'] === 'undefined') {
|
|
14
|
-
throw new Error("Error loading module '2p-repl'. Its dependency '2p-core' was not found. Please, check whether '2p-core' is loaded prior to '2p-repl'.");
|
|
15
|
-
}
|
|
16
|
-
if (typeof this['clikt-clikt-js-ir'] === 'undefined') {
|
|
17
|
-
throw new Error("Error loading module '2p-repl'. Its dependency 'clikt-clikt-js-ir' was not found. Please, check whether 'clikt-clikt-js-ir' is loaded prior to '2p-repl'.");
|
|
18
|
-
}
|
|
19
|
-
if (typeof this['2p-theory'] === 'undefined') {
|
|
20
|
-
throw new Error("Error loading module '2p-repl'. Its dependency '2p-theory' was not found. Please, check whether '2p-theory' is loaded prior to '2p-repl'.");
|
|
21
|
-
}
|
|
22
|
-
if (typeof this['2p-parser-core'] === 'undefined') {
|
|
23
|
-
throw new Error("Error loading module '2p-repl'. Its dependency '2p-parser-core' was not found. Please, check whether '2p-parser-core' is loaded prior to '2p-repl'.");
|
|
24
|
-
}
|
|
25
|
-
if (typeof this['2p-io-lib'] === 'undefined') {
|
|
26
|
-
throw new Error("Error loading module '2p-repl'. Its dependency '2p-io-lib' was not found. Please, check whether '2p-io-lib' is loaded prior to '2p-repl'.");
|
|
27
|
-
}
|
|
28
|
-
if (typeof this['2p-oop-lib'] === 'undefined') {
|
|
29
|
-
throw new Error("Error loading module '2p-repl'. Its dependency '2p-oop-lib' was not found. Please, check whether '2p-oop-lib' is loaded prior to '2p-repl'.");
|
|
30
|
-
}
|
|
31
|
-
root['2p-repl'] = factory(typeof this['2p-repl'] === 'undefined' ? {} : this['2p-repl'], this['kotlin-kotlin-stdlib'], this['2p-solve'], this['2p-core'], this['clikt-clikt-js-ir'], this['2p-theory'], this['2p-parser-core'], this['2p-io-lib'], this['2p-oop-lib']);
|
|
32
|
-
}
|
|
33
|
-
}(this, 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) {
|
|
5
|
+
factory(module.exports);
|
|
6
|
+
else
|
|
7
|
+
globalThis['2p-repl'] = factory(typeof globalThis['2p-repl'] === 'undefined' ? {} : globalThis['2p-repl']);
|
|
8
|
+
}(function (_) {
|
|
34
9
|
'use strict';
|
|
35
|
-
//region block: imports
|
|
36
|
-
var Unit_instance = kotlin_kotlin.$_$.y1;
|
|
37
|
-
var Halt = kotlin_it_unibo_tuprolog_solve.$_$.l4;
|
|
38
|
-
var isInterface = kotlin_kotlin.$_$.j6;
|
|
39
|
-
var No = kotlin_it_unibo_tuprolog_solve.$_$.m4;
|
|
40
|
-
var Yes = kotlin_it_unibo_tuprolog_solve.$_$.n4;
|
|
41
|
-
var Companion_instance = kotlin_it_unibo_tuprolog_solve.$_$.l2;
|
|
42
|
-
var format = kotlin_it_unibo_tuprolog_core.$_$.c3;
|
|
43
|
-
var ProgramResult = kotlin_clikt_clikt.$_$.b;
|
|
44
|
-
var HaltException = kotlin_it_unibo_tuprolog_solve.$_$.r2;
|
|
45
|
-
var StringBuilder = kotlin_kotlin.$_$.j9;
|
|
46
|
-
var THROW_CCE = kotlin_kotlin.$_$.vb;
|
|
47
|
-
var isCharSequence = kotlin_kotlin.$_$.h6;
|
|
48
|
-
var trim = kotlin_kotlin.$_$.fb;
|
|
49
|
-
var toString = kotlin_kotlin.$_$.z6;
|
|
50
|
-
var _Char___init__impl__6a9atx = kotlin_kotlin.$_$.k1;
|
|
51
|
-
var endsWith = kotlin_kotlin.$_$.p9;
|
|
52
|
-
var VOID = kotlin_kotlin.$_$.d;
|
|
53
|
-
var CliktCommand = kotlin_clikt_clikt.$_$.a;
|
|
54
|
-
var emptyMap = kotlin_kotlin.$_$.a3;
|
|
55
|
-
var charSequenceLength = kotlin_kotlin.$_$.u5;
|
|
56
|
-
var charSequenceGet = kotlin_kotlin.$_$.t5;
|
|
57
|
-
var toString_0 = kotlin_kotlin.$_$.o1;
|
|
58
|
-
var titlecase = kotlin_kotlin.$_$.sa;
|
|
59
|
-
var isLowerCase = kotlin_kotlin.$_$.u9;
|
|
60
|
-
var protoOf = kotlin_kotlin.$_$.u6;
|
|
61
|
-
var defaultCliktConsole = kotlin_clikt_clikt.$_$.d;
|
|
62
|
-
var classMeta = kotlin_kotlin.$_$.v5;
|
|
63
|
-
var setMetadataFor = kotlin_kotlin.$_$.v6;
|
|
64
|
-
var TuPrologException_init_$Init$ = kotlin_it_unibo_tuprolog_core.$_$.m;
|
|
65
|
-
var objectCreate = kotlin_kotlin.$_$.s6;
|
|
66
|
-
var captureStack = kotlin_kotlin.$_$.q5;
|
|
67
|
-
var TuPrologException = kotlin_it_unibo_tuprolog_core.$_$.l1;
|
|
68
|
-
var objectMeta = kotlin_kotlin.$_$.t6;
|
|
69
|
-
var Companion_instance_0 = kotlin_it_unibo_tuprolog_theory.$_$.b;
|
|
70
|
-
var trimMargin = kotlin_kotlin.$_$.db;
|
|
71
|
-
var ParseException = kotlin_it_unibo_tuprolog_parser_core.$_$.b;
|
|
72
|
-
var Companion_getInstance = kotlin_it_unibo_tuprolog_core.$_$.d1;
|
|
73
|
-
var parseStructWithOperators = kotlin_it_unibo_tuprolog_parser_core.$_$.e;
|
|
74
|
-
var Companion_instance_1 = kotlin_it_unibo_tuprolog_core.$_$.f1;
|
|
75
|
-
var joinToString = kotlin_kotlin.$_$.i3;
|
|
76
|
-
var option = kotlin_clikt_clikt.$_$.i;
|
|
77
|
-
var multiple = kotlin_clikt_clikt.$_$.h;
|
|
78
|
-
var int = kotlin_clikt_clikt.$_$.j;
|
|
79
|
-
var default_0 = kotlin_clikt_clikt.$_$.f;
|
|
80
|
-
var flag = kotlin_clikt_clikt.$_$.g;
|
|
81
|
-
var toLong = kotlin_kotlin.$_$.x6;
|
|
82
|
-
var Info_getInstance = kotlin_it_unibo_tuprolog_core.$_$.k1;
|
|
83
|
-
var Companion_instance_2 = kotlin_it_unibo_tuprolog_solve.$_$.l1;
|
|
84
|
-
var Companion_instance_3 = kotlin_it_unibo_tuprolog_solve.$_$.d2;
|
|
85
|
-
var IOLib_getInstance = kotlin_it_unibo_tuprolog_io_lib.$_$.a;
|
|
86
|
-
var arrayConcat = kotlin_kotlin.$_$.a;
|
|
87
|
-
var OOPLib_getInstance = kotlin_it_unibo_tuprolog_oop_lib.$_$.a;
|
|
88
|
-
var Companion_getInstance_0 = kotlin_it_unibo_tuprolog_solve.$_$.n2;
|
|
89
|
-
var TrackVariables_getInstance = kotlin_it_unibo_tuprolog_solve.$_$.a2;
|
|
90
|
-
var KProperty1 = kotlin_kotlin.$_$.q7;
|
|
91
|
-
var getPropertyCallableRef = kotlin_kotlin.$_$.c6;
|
|
92
|
-
var NotImplementedError = kotlin_kotlin.$_$.qb;
|
|
93
|
-
var parseStruct = kotlin_it_unibo_tuprolog_parser_core.$_$.d;
|
|
94
|
-
var argument = kotlin_clikt_clikt.$_$.e;
|
|
95
|
-
var subcommands = kotlin_clikt_clikt.$_$.c;
|
|
96
|
-
//endregion
|
|
97
10
|
//region block: pre-declaration
|
|
98
|
-
setMetadataFor(AbstractTuPrologCommand, 'AbstractTuPrologCommand', classMeta, CliktCommand);
|
|
99
|
-
setMetadataFor(NullInputException, 'NullInputException', classMeta, TuPrologException);
|
|
100
|
-
setMetadataFor(Companion, 'Companion', objectMeta);
|
|
101
|
-
setMetadataFor(TuPrologCmd, 'TuPrologCmd', classMeta, AbstractTuPrologCommand);
|
|
102
|
-
setMetadataFor(TuPrologSolveQuery, 'TuPrologSolveQuery', classMeta, AbstractTuPrologCommand, VOID, TuPrologSolveQuery);
|
|
103
|
-
//endregion
|
|
104
|
-
function printSolution($this, sol, operatorSet) {
|
|
105
|
-
if (isInterface(sol, Yes)) {
|
|
106
|
-
printYesSolution($this, sol, operatorSet);
|
|
107
|
-
} else {
|
|
108
|
-
if (isInterface(sol, No)) {
|
|
109
|
-
printNoSolution($this, sol, operatorSet);
|
|
110
|
-
} else {
|
|
111
|
-
if (isInterface(sol, Halt)) {
|
|
112
|
-
printHaltSolution($this, sol, operatorSet);
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
function printYesSolution($this, sol, operatorSet) {
|
|
118
|
-
$this.u3x(format(sol, Companion_instance.withOperators(operatorSet)));
|
|
119
|
-
}
|
|
120
|
-
function printHaltSolution($this, sol, operatorSet) {
|
|
121
|
-
var ex = sol.f1w();
|
|
122
|
-
if (ex instanceof HaltException) {
|
|
123
|
-
$this.u3x('# goodbye.');
|
|
124
|
-
throw new ProgramResult(ex.exitStatus);
|
|
125
|
-
} else {
|
|
126
|
-
$this.u3x(format(sol, Companion_instance.withOperators(operatorSet)));
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
function printEndOfSolutions($this) {
|
|
130
|
-
}
|
|
131
|
-
function readQueryMultiline($this, query) {
|
|
132
|
-
var longQuery = new StringBuilder(query);
|
|
133
|
-
var lastRead = query;
|
|
134
|
-
$l$loop: while (true) {
|
|
135
|
-
// Inline function 'kotlin.text.trim' call
|
|
136
|
-
var this_0 = lastRead;
|
|
137
|
-
var tmp$ret$0 = toString(trim(isCharSequence(this_0) ? this_0 : THROW_CCE()));
|
|
138
|
-
if (!!endsWith(tmp$ret$0, _Char___init__impl__6a9atx(46))) {
|
|
139
|
-
break $l$loop;
|
|
140
|
-
}
|
|
141
|
-
var tmp0_elvis_lhs = $this.y3x('>', VOID, VOID, VOID, VOID, ' ');
|
|
142
|
-
var tmp;
|
|
143
|
-
if (tmp0_elvis_lhs == null) {
|
|
144
|
-
throw NullInputException_init_$Create$('The standard input has been closed unexpectedly');
|
|
145
|
-
} else {
|
|
146
|
-
tmp = tmp0_elvis_lhs;
|
|
147
|
-
}
|
|
148
|
-
lastRead = tmp;
|
|
149
|
-
longQuery.v5(lastRead);
|
|
150
|
-
}
|
|
151
|
-
return longQuery.toString();
|
|
152
|
-
}
|
|
153
|
-
function printNoSolution($this, sol, operatorSet) {
|
|
154
|
-
$this.u3x(format(sol, Companion_instance.withOperators(operatorSet)));
|
|
155
|
-
}
|
|
156
|
-
function AbstractTuPrologCommand(help, epilog, name, invokeWithoutSubcommand, printHelpOnEmptyArgs, helpTags, autoCompleteEnvvar, allowMultipleSubcommands, treatUnknownOptionsAsArgs, hidden) {
|
|
157
|
-
help = help === VOID ? '' : help;
|
|
158
|
-
epilog = epilog === VOID ? '' : epilog;
|
|
159
|
-
name = name === VOID ? null : name;
|
|
160
|
-
invokeWithoutSubcommand = invokeWithoutSubcommand === VOID ? false : invokeWithoutSubcommand;
|
|
161
|
-
printHelpOnEmptyArgs = printHelpOnEmptyArgs === VOID ? false : printHelpOnEmptyArgs;
|
|
162
|
-
helpTags = helpTags === VOID ? emptyMap() : helpTags;
|
|
163
|
-
autoCompleteEnvvar = autoCompleteEnvvar === VOID ? '' : autoCompleteEnvvar;
|
|
164
|
-
allowMultipleSubcommands = allowMultipleSubcommands === VOID ? false : allowMultipleSubcommands;
|
|
165
|
-
treatUnknownOptionsAsArgs = treatUnknownOptionsAsArgs === VOID ? false : treatUnknownOptionsAsArgs;
|
|
166
|
-
hidden = hidden === VOID ? false : hidden;
|
|
167
|
-
CliktCommand.call(this, help, epilog, name, invokeWithoutSubcommand, printHelpOnEmptyArgs, helpTags, autoCompleteEnvvar, allowMultipleSubcommands, treatUnknownOptionsAsArgs, hidden);
|
|
168
|
-
}
|
|
169
|
-
protoOf(AbstractTuPrologCommand).x49 = function (e) {
|
|
170
|
-
var tmp0_safe_receiver = e.message;
|
|
171
|
-
var tmp;
|
|
172
|
-
if (tmp0_safe_receiver == null) {
|
|
173
|
-
tmp = null;
|
|
174
|
-
} else {
|
|
175
|
-
// Inline function 'kotlin.text.replaceFirstChar' call
|
|
176
|
-
var tmp_0;
|
|
177
|
-
// Inline function 'kotlin.text.isNotEmpty' call
|
|
178
|
-
if (charSequenceLength(tmp0_safe_receiver) > 0) {
|
|
179
|
-
// Inline function 'it.unibo.tuprolog.ui.repl.AbstractTuPrologCommand.printParseException.<anonymous>' call
|
|
180
|
-
var it = charSequenceGet(tmp0_safe_receiver, 0);
|
|
181
|
-
var tmp$ret$1 = isLowerCase(it) ? titlecase(it) : toString_0(it);
|
|
182
|
-
var tmp_1 = toString(tmp$ret$1);
|
|
183
|
-
// Inline function 'kotlin.text.substring' call
|
|
184
|
-
// Inline function 'kotlin.js.asDynamic' call
|
|
185
|
-
tmp_0 = tmp_1 + tmp0_safe_receiver.substring(1);
|
|
186
|
-
} else {
|
|
187
|
-
tmp_0 = tmp0_safe_receiver;
|
|
188
|
-
}
|
|
189
|
-
tmp = tmp_0;
|
|
190
|
-
}
|
|
191
|
-
this.u3x('# ' + tmp, VOID, true);
|
|
192
|
-
};
|
|
193
|
-
protoOf(AbstractTuPrologCommand).y49 = function () {
|
|
194
|
-
var query = this.y3x('?-', VOID, VOID, VOID, VOID, ' ');
|
|
195
|
-
var tmp;
|
|
196
|
-
if (query == null) {
|
|
197
|
-
throw NullInputException_init_$Create$('The standard input has been close unexpectedly');
|
|
198
|
-
} else {
|
|
199
|
-
// Inline function 'kotlin.text.trim' call
|
|
200
|
-
var tmp$ret$0 = toString(trim(isCharSequence(query) ? query : THROW_CCE()));
|
|
201
|
-
if (endsWith(tmp$ret$0, _Char___init__impl__6a9atx(46))) {
|
|
202
|
-
tmp = query;
|
|
203
|
-
} else {
|
|
204
|
-
tmp = readQueryMultiline(this, query);
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
return tmp;
|
|
208
|
-
};
|
|
209
|
-
protoOf(AbstractTuPrologCommand).z49 = function (solutions, operatorSet) {
|
|
210
|
-
var first = true;
|
|
211
|
-
$l$loop: while (solutions.s()) {
|
|
212
|
-
if (!first) {
|
|
213
|
-
var tmp0_safe_receiver = defaultCliktConsole().n45('', false);
|
|
214
|
-
var tmp;
|
|
215
|
-
if (tmp0_safe_receiver == null) {
|
|
216
|
-
tmp = null;
|
|
217
|
-
} else {
|
|
218
|
-
// Inline function 'kotlin.text.trim' call
|
|
219
|
-
tmp = toString(trim(isCharSequence(tmp0_safe_receiver) ? tmp0_safe_receiver : THROW_CCE()));
|
|
220
|
-
}
|
|
221
|
-
var cmd = tmp;
|
|
222
|
-
if (!(cmd === ';'))
|
|
223
|
-
break $l$loop;
|
|
224
|
-
} else {
|
|
225
|
-
first = false;
|
|
226
|
-
}
|
|
227
|
-
printSolution(this, solutions.u(), operatorSet);
|
|
228
|
-
}
|
|
229
|
-
printEndOfSolutions(this);
|
|
230
|
-
};
|
|
231
|
-
protoOf(AbstractTuPrologCommand).a4a = function (solutions, maxSolutions, operatorSet) {
|
|
232
|
-
var i = 0;
|
|
233
|
-
while (i < maxSolutions ? solutions.s() : false) {
|
|
234
|
-
i = i + 1 | 0;
|
|
235
|
-
printSolution(this, solutions.u(), operatorSet);
|
|
236
|
-
}
|
|
237
|
-
printEndOfSolutions(this);
|
|
238
|
-
};
|
|
239
|
-
function NullInputException_init_$Init$(message, cause, $this) {
|
|
240
|
-
TuPrologException_init_$Init$(message, cause, $this);
|
|
241
|
-
NullInputException.call($this);
|
|
242
|
-
return $this;
|
|
243
|
-
}
|
|
244
|
-
function NullInputException_init_$Init$_0(message, $this) {
|
|
245
|
-
NullInputException_init_$Init$(message, null, $this);
|
|
246
|
-
return $this;
|
|
247
|
-
}
|
|
248
|
-
function NullInputException_init_$Create$(message) {
|
|
249
|
-
var tmp = NullInputException_init_$Init$_0(message, objectCreate(protoOf(NullInputException)));
|
|
250
|
-
captureStack(tmp, NullInputException_init_$Create$);
|
|
251
|
-
return tmp;
|
|
252
|
-
}
|
|
253
|
-
function NullInputException() {
|
|
254
|
-
captureStack(this, NullInputException);
|
|
255
|
-
}
|
|
256
|
-
function Companion() {
|
|
257
|
-
this.b4a_1 = 1000;
|
|
258
|
-
}
|
|
259
|
-
var Companion_instance_4;
|
|
260
|
-
function Companion_getInstance_1() {
|
|
261
|
-
return Companion_instance_4;
|
|
262
|
-
}
|
|
263
|
-
function _get_files__hkfg7a($this) {
|
|
264
|
-
return $this.u4a_1.w45($this, files$factory_0());
|
|
265
|
-
}
|
|
266
|
-
function _get_timeout__tg4wg($this) {
|
|
267
|
-
return $this.v4a_1.w45($this, timeout$factory_0());
|
|
268
|
-
}
|
|
269
|
-
function _get_oop__e6e8e9($this) {
|
|
270
|
-
return $this.w4a_1.w45($this, oop$factory_0());
|
|
271
|
-
}
|
|
272
|
-
function loadTheory($this) {
|
|
273
|
-
var theory = Companion_instance_0.emptyWithDefaultUnificator();
|
|
274
|
-
var tmp0_iterator = _get_files__hkfg7a($this).r();
|
|
275
|
-
while (tmp0_iterator.s()) {
|
|
276
|
-
var file = tmp0_iterator.u();
|
|
277
|
-
if (isReadableFile(file)) {
|
|
278
|
-
try {
|
|
279
|
-
var t = loadTheoryFromFile(file);
|
|
280
|
-
$this.u3x('# Successfully loaded ' + t.l().toString() + ' clauses from ' + file);
|
|
281
|
-
theory = theory.plusTheory(t);
|
|
282
|
-
} catch ($p) {
|
|
283
|
-
if ($p instanceof ParseException) {
|
|
284
|
-
var e = $p;
|
|
285
|
-
$this.u3x(trimMargin('\n |# Error while parsing theory file: ' + file + '\n |# Message: ' + e.message + '\n |# Line : ' + e.line + '\n |# Column : ' + e.column + '\n |# Clause : ' + e.clauseIndex + '\n '), VOID, true);
|
|
286
|
-
} else {
|
|
287
|
-
throw $p;
|
|
288
|
-
}
|
|
289
|
-
}
|
|
290
|
-
}
|
|
291
|
-
}
|
|
292
|
-
$this.u3x('');
|
|
293
|
-
return theory;
|
|
294
|
-
}
|
|
295
|
-
function readEvalPrintLoop($this, solver) {
|
|
296
|
-
try {
|
|
297
|
-
var query = $this.y49();
|
|
298
|
-
while (!(query == null)) {
|
|
299
|
-
try {
|
|
300
|
-
var goal = parseStructWithOperators(Companion_getInstance(), query, solver.l1v());
|
|
301
|
-
var solutions = solver.solveWithTimeout(goal, $this.x4a()).r();
|
|
302
|
-
$this.z49(solutions, solver.l1v());
|
|
303
|
-
} catch ($p) {
|
|
304
|
-
if ($p instanceof ParseException) {
|
|
305
|
-
var e = $p;
|
|
306
|
-
$this.x49(e);
|
|
307
|
-
} else {
|
|
308
|
-
throw $p;
|
|
309
|
-
}
|
|
310
|
-
}
|
|
311
|
-
$this.u3x('');
|
|
312
|
-
query = $this.y49();
|
|
313
|
-
}
|
|
314
|
-
} catch ($p) {
|
|
315
|
-
if ($p instanceof NullInputException) {
|
|
316
|
-
var _ = $p;
|
|
317
|
-
$this.u3x('\n# goodbye.');
|
|
318
|
-
throw new ProgramResult(0);
|
|
319
|
-
} else {
|
|
320
|
-
throw $p;
|
|
321
|
-
}
|
|
322
|
-
}
|
|
323
|
-
}
|
|
324
|
-
function TuPrologCmd$getSolver$lambda$lambda($formatter) {
|
|
325
|
-
return function (it) {
|
|
326
|
-
return format(it, $formatter);
|
|
327
|
-
};
|
|
328
|
-
}
|
|
329
|
-
function TuPrologCmd$getSolver$lambda(this$0) {
|
|
330
|
-
return function (w) {
|
|
331
|
-
this$0.u3x('# ' + w.message, VOID, true);
|
|
332
|
-
var sep = '\n at ';
|
|
333
|
-
var formatter = Companion_instance_1.prettyExpressionsPrettyVariables(w.uc().l1v());
|
|
334
|
-
var tmp = w.z1u();
|
|
335
|
-
var stacktrace = joinToString(tmp, sep, VOID, VOID, VOID, VOID, TuPrologCmd$getSolver$lambda$lambda(formatter));
|
|
336
|
-
this$0.u3x('# at ' + stacktrace, VOID, true);
|
|
337
|
-
return Unit_instance;
|
|
338
|
-
};
|
|
339
|
-
}
|
|
340
|
-
function TuPrologCmd$getSolver$lambda_0($this$flag) {
|
|
341
|
-
return $this$flag.h29_1;
|
|
342
|
-
}
|
|
343
|
-
function TuPrologCmd(additionalLibraries) {
|
|
344
|
-
AbstractTuPrologCommand.call(this, 'Start a Prolog Read-Eval-Print loop', VOID, 'java -jar 2p-repl.jar', true, VOID, VOID, VOID, true);
|
|
345
|
-
this.t4a_1 = additionalLibraries;
|
|
346
|
-
this.u4a_1 = multiple(option(this, ['-T', '--theory'], 'Path of theory file to be loaded')).f47(this, files$factory());
|
|
347
|
-
this.v4a_1 = default_0(int(option(this, ['-t', '--timeout'], 'Maximum amount of time for computing a solution (default: 1000 ms)')), 1000).f47(this, timeout$factory());
|
|
348
|
-
this.w4a_1 = flag(option(this, ['--oop'], 'Loads the OOP library'), [], false).f47(this, oop$factory());
|
|
349
|
-
}
|
|
350
|
-
protoOf(TuPrologCmd).t3y = function () {
|
|
351
|
-
var solve = this.y4a();
|
|
352
|
-
var subcommand = this.i2b().o3w_1;
|
|
353
|
-
if (subcommand == null) {
|
|
354
|
-
readEvalPrintLoop(this, solve);
|
|
355
|
-
}
|
|
356
|
-
};
|
|
357
|
-
protoOf(TuPrologCmd).x4a = function () {
|
|
358
|
-
return toLong(_get_timeout__tg4wg(this));
|
|
359
|
-
};
|
|
360
|
-
protoOf(TuPrologCmd).y4a = function () {
|
|
361
|
-
Info_getInstance();
|
|
362
|
-
this.u3x('# 2P-Kt version ' + '1.0.3');
|
|
363
|
-
var theory = loadTheory(this);
|
|
364
|
-
var tmp = Companion_instance_2;
|
|
365
|
-
var outputChannel = tmp.of(TuPrologCmd$getSolver$lambda(this));
|
|
366
|
-
var tmp_0;
|
|
367
|
-
if (_get_oop__e6e8e9(this)) {
|
|
368
|
-
tmp_0 = Companion_instance_3.of(arrayConcat([[IOLib_getInstance(), OOPLib_getInstance()], this.t4a_1]));
|
|
369
|
-
} else {
|
|
370
|
-
tmp_0 = Companion_instance_3.of(arrayConcat([[IOLib_getInstance()], this.t4a_1]));
|
|
371
|
-
}
|
|
372
|
-
var libraries = tmp_0;
|
|
373
|
-
// Inline function 'kotlin.also' call
|
|
374
|
-
var tmp_1 = Companion_getInstance_0().u1x().newBuilder().setRuntime(libraries).setStaticKb(theory);
|
|
375
|
-
var tmp_2 = TrackVariables_getInstance();
|
|
376
|
-
var this_0 = tmp_1.setNotableFlagByValue(tmp_2, TuPrologCmd$getSolver$lambda_0).setWarnings(outputChannel).build();
|
|
377
|
-
// Inline function 'kotlin.contracts.contract' call
|
|
378
|
-
// Inline function 'it.unibo.tuprolog.ui.repl.TuPrologCmd.getSolver.<anonymous>' call
|
|
379
|
-
// Inline function 'kotlin.collections.iterator' call
|
|
380
|
-
var tmp0_iterator = this_0.c1v().p2().r();
|
|
381
|
-
while (tmp0_iterator.s()) {
|
|
382
|
-
// Inline function 'kotlin.collections.component2' call
|
|
383
|
-
var library = tmp0_iterator.u().r2();
|
|
384
|
-
this.u3x('# Successfully loaded library `' + library.j2e() + '`');
|
|
385
|
-
}
|
|
386
|
-
this.u3x('');
|
|
387
|
-
return this_0;
|
|
388
|
-
};
|
|
389
|
-
function files$factory() {
|
|
390
|
-
return getPropertyCallableRef('files', 1, KProperty1, function (receiver) {
|
|
391
|
-
return _get_files__hkfg7a(receiver);
|
|
392
|
-
}, null);
|
|
393
|
-
}
|
|
394
|
-
function timeout$factory() {
|
|
395
|
-
return getPropertyCallableRef('timeout', 1, KProperty1, function (receiver) {
|
|
396
|
-
return _get_timeout__tg4wg(receiver);
|
|
397
|
-
}, null);
|
|
398
|
-
}
|
|
399
|
-
function oop$factory() {
|
|
400
|
-
return getPropertyCallableRef('oop', 1, KProperty1, function (receiver) {
|
|
401
|
-
return _get_oop__e6e8e9(receiver);
|
|
402
|
-
}, null);
|
|
403
|
-
}
|
|
404
|
-
function files$factory_0() {
|
|
405
|
-
return getPropertyCallableRef('files', 1, KProperty1, function (receiver) {
|
|
406
|
-
return _get_files__hkfg7a(receiver);
|
|
407
|
-
}, null);
|
|
408
|
-
}
|
|
409
|
-
function timeout$factory_0() {
|
|
410
|
-
return getPropertyCallableRef('timeout', 1, KProperty1, function (receiver) {
|
|
411
|
-
return _get_timeout__tg4wg(receiver);
|
|
412
|
-
}, null);
|
|
413
|
-
}
|
|
414
|
-
function oop$factory_0() {
|
|
415
|
-
return getPropertyCallableRef('oop', 1, KProperty1, function (receiver) {
|
|
416
|
-
return _get_oop__e6e8e9(receiver);
|
|
417
|
-
}, null);
|
|
418
|
-
}
|
|
419
|
-
function _get_query__c6g9vb($this) {
|
|
420
|
-
return $this.q4b_1.w45($this, query$factory_0());
|
|
421
|
-
}
|
|
422
|
-
function _get_maxSolutions__ysux2t($this) {
|
|
423
|
-
return $this.r4b_1.w45($this, maxSolutions$factory_0());
|
|
424
|
-
}
|
|
425
|
-
function _get_parentCommand__z09ff4($this) {
|
|
426
|
-
var tmp0_safe_receiver = $this.i2b().y3v_1;
|
|
427
|
-
var tmp = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.z3v_1;
|
|
428
|
-
return tmp instanceof TuPrologCmd ? tmp : THROW_CCE();
|
|
429
|
-
}
|
|
430
|
-
function evalAndPrint($this, solver) {
|
|
431
|
-
// Inline function 'kotlin.text.isNotEmpty' call
|
|
432
|
-
var this_0 = _get_query__c6g9vb($this);
|
|
433
|
-
if (charSequenceLength(this_0) > 0) {
|
|
434
|
-
try {
|
|
435
|
-
var duration = _get_parentCommand__z09ff4($this).x4a();
|
|
436
|
-
var solutions = solver.solveWithTimeout(parseStruct(Companion_getInstance(), _get_query__c6g9vb($this)), duration).r();
|
|
437
|
-
if (_get_maxSolutions__ysux2t($this) === 0) {
|
|
438
|
-
$this.z49(solutions, solver.l1v());
|
|
439
|
-
} else {
|
|
440
|
-
$this.a4a(solutions, _get_maxSolutions__ysux2t($this), solver.l1v());
|
|
441
|
-
}
|
|
442
|
-
} catch ($p) {
|
|
443
|
-
if ($p instanceof ParseException) {
|
|
444
|
-
var e = $p;
|
|
445
|
-
$this.x49(e);
|
|
446
|
-
} else {
|
|
447
|
-
throw $p;
|
|
448
|
-
}
|
|
449
|
-
}
|
|
450
|
-
} else {
|
|
451
|
-
// Inline function 'kotlin.TODO' call
|
|
452
|
-
var reason = 'throw adequate exception';
|
|
453
|
-
throw new NotImplementedError('An operation is not implemented: ' + reason);
|
|
454
|
-
}
|
|
455
|
-
}
|
|
456
|
-
function TuPrologSolveQuery() {
|
|
457
|
-
AbstractTuPrologCommand.call(this, 'Compute a particular query and then terminate', VOID, 'solve');
|
|
458
|
-
this.q4b_1 = argument(this).x45(this, query$factory());
|
|
459
|
-
this.r4b_1 = default_0(int(option(this, ['-n', '--numberOfSolutions'], 'Number of solution to calculate')), 0).f47(this, maxSolutions$factory());
|
|
460
|
-
}
|
|
461
|
-
protoOf(TuPrologSolveQuery).t3y = function () {
|
|
462
|
-
var solver = _get_parentCommand__z09ff4(this).y4a();
|
|
463
|
-
evalAndPrint(this, solver);
|
|
464
|
-
};
|
|
465
|
-
function query$factory() {
|
|
466
|
-
return getPropertyCallableRef('query', 1, KProperty1, function (receiver) {
|
|
467
|
-
return _get_query__c6g9vb(receiver);
|
|
468
|
-
}, null);
|
|
469
|
-
}
|
|
470
|
-
function maxSolutions$factory() {
|
|
471
|
-
return getPropertyCallableRef('maxSolutions', 1, KProperty1, function (receiver) {
|
|
472
|
-
return _get_maxSolutions__ysux2t(receiver);
|
|
473
|
-
}, null);
|
|
474
|
-
}
|
|
475
|
-
function query$factory_0() {
|
|
476
|
-
return getPropertyCallableRef('query', 1, KProperty1, function (receiver) {
|
|
477
|
-
return _get_query__c6g9vb(receiver);
|
|
478
|
-
}, null);
|
|
479
|
-
}
|
|
480
|
-
function maxSolutions$factory_0() {
|
|
481
|
-
return getPropertyCallableRef('maxSolutions', 1, KProperty1, function (receiver) {
|
|
482
|
-
return _get_maxSolutions__ysux2t(receiver);
|
|
483
|
-
}, null);
|
|
484
|
-
}
|
|
485
|
-
function isReadableFile(path) {
|
|
486
|
-
// Inline function 'kotlin.TODO' call
|
|
487
|
-
var reason = 'Not yet implemented';
|
|
488
|
-
throw new NotImplementedError('An operation is not implemented: ' + reason);
|
|
489
|
-
}
|
|
490
|
-
function loadTheoryFromFile(path) {
|
|
491
|
-
// Inline function 'kotlin.TODO' call
|
|
492
|
-
var reason = 'Not yet implemented';
|
|
493
|
-
throw new NotImplementedError('An operation is not implemented: ' + reason);
|
|
494
|
-
}
|
|
495
|
-
function main(args) {
|
|
496
|
-
subcommands(new TuPrologCmd([]), [new TuPrologSolveQuery()]).s3y(args);
|
|
497
|
-
}
|
|
498
|
-
//region block: init
|
|
499
|
-
Companion_instance_4 = new Companion();
|
|
500
|
-
//endregion
|
|
501
|
-
//region block: exports
|
|
502
|
-
_.$_$ = _.$_$ || {};
|
|
503
|
-
_.$_$.a = main;
|
|
504
11
|
//endregion
|
|
505
12
|
return _;
|
|
506
13
|
}));
|
package/2p-repl.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"ignoreList":[],"x_google_ignoreList":[],"names":[],"mappings":";;;;;;;;;;;;;"}
|
package/2p-serialize-core.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
(function (
|
|
1
|
+
(function (factory) {
|
|
2
2
|
if (typeof define === 'function' && define.amd)
|
|
3
3
|
define(['exports'], factory);
|
|
4
4
|
else if (typeof exports === 'object')
|
|
5
5
|
factory(module.exports);
|
|
6
6
|
else
|
|
7
|
-
|
|
8
|
-
}(
|
|
7
|
+
globalThis['2p-serialize-core'] = factory(typeof globalThis['2p-serialize-core'] === 'undefined' ? {} : globalThis['2p-serialize-core']);
|
|
8
|
+
}(function (_) {
|
|
9
9
|
'use strict';
|
|
10
10
|
//region block: pre-declaration
|
|
11
11
|
//endregion
|
package/2p-serialize-core.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"ignoreList":[],"x_google_ignoreList":[],"names":[],"mappings":";;;;;;;;;;;;;"}
|
package/2p-serialize-theory.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
(function (
|
|
1
|
+
(function (factory) {
|
|
2
2
|
if (typeof define === 'function' && define.amd)
|
|
3
3
|
define(['exports'], factory);
|
|
4
4
|
else if (typeof exports === 'object')
|
|
5
5
|
factory(module.exports);
|
|
6
6
|
else
|
|
7
|
-
|
|
8
|
-
}(
|
|
7
|
+
globalThis['2p-serialize-theory'] = factory(typeof globalThis['2p-serialize-theory'] === 'undefined' ? {} : globalThis['2p-serialize-theory']);
|
|
8
|
+
}(function (_) {
|
|
9
9
|
'use strict';
|
|
10
10
|
//region block: pre-declaration
|
|
11
11
|
//endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"ignoreList":[],"x_google_ignoreList":[],"names":[],"mappings":";;;;;;;;;;;;;"}
|