@tuprolog/2p-full 3.0.7 → 4.0.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-repl.js CHANGED
@@ -1,27 +1,30 @@
1
1
  (function (factory) {
2
2
  if (typeof define === 'function' && define.amd)
3
- define(['exports', './kotlin-kotlin-stdlib.js', './2p-solve.js', './2p-core.js', './clikt-clikt.js', './clikt-clikt-mordant.js', './mordant-mordant.js', './2p-theory.js', './2p-parser-core.js', './2p-io-lib.js', './2p-oop-lib.js'], factory);
3
+ define(['exports', './2p-solve.js', './kotlin-kotlin-stdlib.js', './clikt-clikt.js', './2p-core.js', './clikt-clikt-mordant.js', './mordant-mordant.js', './2p-utils.js', './2p-theory.js', './2p-parser-core.js', './2p-io-lib.js', './2p-oop-lib.js'], factory);
4
4
  else if (typeof exports === 'object')
5
- factory(module.exports, require('./kotlin-kotlin-stdlib.js'), require('./2p-solve.js'), require('./2p-core.js'), require('./clikt-clikt.js'), require('./clikt-clikt-mordant.js'), require('./mordant-mordant.js'), require('./2p-theory.js'), require('./2p-parser-core.js'), require('./2p-io-lib.js'), require('./2p-oop-lib.js'));
5
+ factory(module.exports, require('./2p-solve.js'), require('./kotlin-kotlin-stdlib.js'), require('./clikt-clikt.js'), require('./2p-core.js'), require('./clikt-clikt-mordant.js'), require('./mordant-mordant.js'), require('./2p-utils.js'), require('./2p-theory.js'), require('./2p-parser-core.js'), require('./2p-io-lib.js'), require('./2p-oop-lib.js'));
6
6
  else {
7
- if (typeof globalThis['kotlin-kotlin-stdlib'] === 'undefined') {
8
- throw new Error("Error loading module '2p-repl'. Its dependency 'kotlin-kotlin-stdlib' was not found. Please, check whether 'kotlin-kotlin-stdlib' is loaded prior to '2p-repl'.");
9
- }
10
7
  if (typeof globalThis['2p-solve'] === 'undefined') {
11
8
  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
9
  }
13
- if (typeof globalThis['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'.");
10
+ if (typeof globalThis['kotlin-kotlin-stdlib'] === 'undefined') {
11
+ throw new Error("Error loading module '2p-repl'. Its dependency 'kotlin-kotlin-stdlib' was not found. Please, check whether 'kotlin-kotlin-stdlib' is loaded prior to '2p-repl'.");
15
12
  }
16
13
  if (typeof globalThis['clikt-clikt'] === 'undefined') {
17
14
  throw new Error("Error loading module '2p-repl'. Its dependency 'clikt-clikt' was not found. Please, check whether 'clikt-clikt' is loaded prior to '2p-repl'.");
18
15
  }
16
+ if (typeof globalThis['2p-core'] === 'undefined') {
17
+ 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'.");
18
+ }
19
19
  if (typeof globalThis['clikt-clikt-mordant'] === 'undefined') {
20
20
  throw new Error("Error loading module '2p-repl'. Its dependency 'clikt-clikt-mordant' was not found. Please, check whether 'clikt-clikt-mordant' is loaded prior to '2p-repl'.");
21
21
  }
22
22
  if (typeof globalThis['mordant-mordant'] === 'undefined') {
23
23
  throw new Error("Error loading module '2p-repl'. Its dependency 'mordant-mordant' was not found. Please, check whether 'mordant-mordant' is loaded prior to '2p-repl'.");
24
24
  }
25
+ if (typeof globalThis['2p-utils'] === 'undefined') {
26
+ throw new Error("Error loading module '2p-repl'. Its dependency '2p-utils' was not found. Please, check whether '2p-utils' is loaded prior to '2p-repl'.");
27
+ }
25
28
  if (typeof globalThis['2p-theory'] === 'undefined') {
26
29
  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'.");
27
30
  }
@@ -34,76 +37,88 @@
34
37
  if (typeof globalThis['2p-oop-lib'] === 'undefined') {
35
38
  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'.");
36
39
  }
37
- globalThis['2p-repl'] = factory(typeof globalThis['2p-repl'] === 'undefined' ? {} : globalThis['2p-repl'], globalThis['kotlin-kotlin-stdlib'], globalThis['2p-solve'], globalThis['2p-core'], globalThis['clikt-clikt'], globalThis['clikt-clikt-mordant'], globalThis['mordant-mordant'], globalThis['2p-theory'], globalThis['2p-parser-core'], globalThis['2p-io-lib'], globalThis['2p-oop-lib']);
40
+ globalThis['2p-repl'] = factory(typeof globalThis['2p-repl'] === 'undefined' ? {} : globalThis['2p-repl'], globalThis['2p-solve'], globalThis['kotlin-kotlin-stdlib'], globalThis['clikt-clikt'], globalThis['2p-core'], globalThis['clikt-clikt-mordant'], globalThis['mordant-mordant'], globalThis['2p-utils'], globalThis['2p-theory'], globalThis['2p-parser-core'], globalThis['2p-io-lib'], globalThis['2p-oop-lib']);
38
41
  }
39
- }(function (_, kotlin_kotlin, kotlin_it_unibo_tuprolog_solve, kotlin_it_unibo_tuprolog_core, kotlin_clikt_clikt, kotlin_clikt_clikt_mordant, kotlin_mordant_mordant, kotlin_it_unibo_tuprolog_theory, kotlin_it_unibo_tuprolog_parser_core, kotlin_it_unibo_tuprolog_io_lib, kotlin_it_unibo_tuprolog_oop_lib) {
42
+ }(function (_, kotlin_it_unibo_tuprolog_solve, kotlin_kotlin, kotlin_clikt_clikt, kotlin_it_unibo_tuprolog_core, kotlin_clikt_clikt_mordant, kotlin_mordant_mordant, kotlin_it_unibo_tuprolog_utils, kotlin_it_unibo_tuprolog_theory, kotlin_it_unibo_tuprolog_parser_core, kotlin_it_unibo_tuprolog_io_lib, kotlin_it_unibo_tuprolog_oop_lib) {
40
43
  'use strict';
41
44
  //region block: imports
42
- var noWhenBranchMatchedException = kotlin_kotlin.$_$.se;
43
- var Unit_instance = kotlin_kotlin.$_$.r;
44
- var Halt = kotlin_it_unibo_tuprolog_solve.$_$.m4;
45
- var isInterface = kotlin_kotlin.$_$.m8;
46
- var No = kotlin_it_unibo_tuprolog_solve.$_$.n4;
47
- var Yes = kotlin_it_unibo_tuprolog_solve.$_$.o4;
48
- var Companion_instance = kotlin_it_unibo_tuprolog_solve.$_$.t1;
49
- var format = kotlin_it_unibo_tuprolog_core.$_$.b3;
45
+ var Halt = kotlin_it_unibo_tuprolog_solve.$_$.i5;
46
+ var isInterface = kotlin_kotlin.$_$.t9;
50
47
  var ProgramResult = kotlin_clikt_clikt.$_$.c;
51
- var HaltException = kotlin_it_unibo_tuprolog_solve.$_$.r2;
52
- var StringBuilder = kotlin_kotlin.$_$.qb;
53
- var THROW_CCE = kotlin_kotlin.$_$.he;
54
- var isCharSequence = kotlin_kotlin.$_$.k8;
55
- var trim = kotlin_kotlin.$_$.rd;
56
- var toString = kotlin_kotlin.$_$.x8;
57
- var _Char___init__impl__6a9atx = kotlin_kotlin.$_$.c;
58
- var endsWith = kotlin_kotlin.$_$.bc;
48
+ var HaltException = kotlin_it_unibo_tuprolog_solve.$_$.e3;
49
+ var minus = kotlin_kotlin.$_$.s5;
50
+ var Companion_instance = kotlin_it_unibo_tuprolog_solve.$_$.d2;
51
+ var format = kotlin_it_unibo_tuprolog_core.$_$.d3;
52
+ var charCodeAt = kotlin_kotlin.$_$.v8;
53
+ var isLetter = kotlin_kotlin.$_$.kd;
54
+ var substring = kotlin_kotlin.$_$.ie;
55
+ var get_time = kotlin_it_unibo_tuprolog_solve.$_$.m4;
56
+ var Duration = kotlin_kotlin.$_$.ze;
57
+ var formatTime = kotlin_it_unibo_tuprolog_solve.$_$.l4;
59
58
  var get_terminal = kotlin_clikt_clikt_mordant.$_$.b;
59
+ var TextStyles_bold_getInstance = kotlin_mordant_mordant.$_$.f;
60
+ var drop = kotlin_kotlin.$_$.bd;
61
+ var StringBuilder = kotlin_kotlin.$_$.rc;
62
+ var THROW_CCE = kotlin_kotlin.$_$.sf;
63
+ var isCharSequence = kotlin_kotlin.$_$.r9;
64
+ var trim = kotlin_kotlin.$_$.ye;
65
+ var toString = kotlin_kotlin.$_$.ea;
66
+ var _Char___init__impl__6a9atx = kotlin_kotlin.$_$.q;
67
+ var endsWith = kotlin_kotlin.$_$.cd;
60
68
  var VOID = kotlin_kotlin.$_$.b;
61
69
  var prompt = kotlin_mordant_mordant.$_$.c;
70
+ var Unit_instance = kotlin_kotlin.$_$.m1;
62
71
  var CliktCommand = kotlin_clikt_clikt_mordant.$_$.a;
63
- var emptyMap = kotlin_kotlin.$_$.m3;
64
- var protoOf = kotlin_kotlin.$_$.u8;
65
- var charSequenceLength = kotlin_kotlin.$_$.q7;
66
- var charCodeAt = kotlin_kotlin.$_$.o7;
67
- var toString_0 = kotlin_kotlin.$_$.h;
68
- var titlecase = kotlin_kotlin.$_$.gd;
69
- var isLowerCase = kotlin_kotlin.$_$.hc;
70
- var substring = kotlin_kotlin.$_$.dd;
71
- var initMetadataForClass = kotlin_kotlin.$_$.d8;
72
- var TuPrologException_init_$Init$ = kotlin_it_unibo_tuprolog_core.$_$.i1;
73
- var objectCreate = kotlin_kotlin.$_$.t8;
74
- var captureStack = kotlin_kotlin.$_$.l7;
75
- var TuPrologException = kotlin_it_unibo_tuprolog_core.$_$.l1;
76
- var initMetadataForCompanion = kotlin_kotlin.$_$.e8;
77
- var KProperty1 = kotlin_kotlin.$_$.v9;
78
- var getPropertyCallableRef = kotlin_kotlin.$_$.a8;
72
+ var emptyMap = kotlin_kotlin.$_$.m4;
73
+ var protoOf = kotlin_kotlin.$_$.ba;
74
+ var System_instance = kotlin_kotlin.$_$.h1;
75
+ var formatLocalTimestamp = kotlin_it_unibo_tuprolog_utils.$_$.d;
76
+ var trimEnd = kotlin_kotlin.$_$.te;
77
+ var removeSuffix = kotlin_kotlin.$_$.vd;
78
+ var charSequenceLength = kotlin_kotlin.$_$.x8;
79
+ var toString_0 = kotlin_kotlin.$_$.v;
80
+ var titlecase = kotlin_kotlin.$_$.ke;
81
+ var isLowerCase = kotlin_kotlin.$_$.ld;
82
+ var substring_0 = kotlin_kotlin.$_$.he;
83
+ var initMetadataForClass = kotlin_kotlin.$_$.k9;
84
+ var TuPrologException_init_$Init$ = kotlin_it_unibo_tuprolog_core.$_$.j1;
85
+ var objectCreate = kotlin_kotlin.$_$.aa;
86
+ var captureStack = kotlin_kotlin.$_$.s8;
87
+ var TuPrologException = kotlin_it_unibo_tuprolog_core.$_$.m1;
88
+ var initMetadataForCompanion = kotlin_kotlin.$_$.l9;
89
+ var KProperty1 = kotlin_kotlin.$_$.eb;
90
+ var getPropertyCallableRef = kotlin_kotlin.$_$.h9;
79
91
  var Companion_instance_0 = kotlin_it_unibo_tuprolog_theory.$_$.b;
80
- var trimMargin = kotlin_kotlin.$_$.pd;
92
+ var trimMargin = kotlin_kotlin.$_$.ve;
81
93
  var ParseException = kotlin_it_unibo_tuprolog_parser_core.$_$.a;
82
- var Companion_getInstance = kotlin_it_unibo_tuprolog_core.$_$.x;
94
+ var Companion_getInstance = kotlin_it_unibo_tuprolog_core.$_$.y;
83
95
  var parseStructWithOperators = kotlin_it_unibo_tuprolog_parser_core.$_$.d;
84
- var GroundQueriesHaveBooleanSolution_getInstance = kotlin_it_unibo_tuprolog_solve.$_$.h1;
85
- var equals = kotlin_kotlin.$_$.v7;
86
- var constructCallableReference = kotlin_kotlin.$_$.t7;
87
- var Companion_instance_1 = kotlin_it_unibo_tuprolog_core.$_$.z;
88
- var joinToString = kotlin_kotlin.$_$.v3;
96
+ var timed = kotlin_it_unibo_tuprolog_solve.$_$.n4;
97
+ var GroundQueriesHaveBooleanSolution_getInstance = kotlin_it_unibo_tuprolog_solve.$_$.o1;
98
+ var equals = kotlin_kotlin.$_$.c9;
99
+ var constructCallableReference = kotlin_kotlin.$_$.a9;
100
+ var Companion_instance_1 = kotlin_it_unibo_tuprolog_core.$_$.a1;
101
+ var joinToString = kotlin_kotlin.$_$.x4;
89
102
  var option = kotlin_clikt_clikt.$_$.m;
90
103
  var multiple = kotlin_clikt_clikt.$_$.l;
91
104
  var int = kotlin_clikt_clikt.$_$.n;
92
105
  var default_0 = kotlin_clikt_clikt.$_$.j;
93
106
  var flag = kotlin_clikt_clikt.$_$.k;
94
- var fromInt = kotlin_kotlin.$_$.y6;
95
- var Companion_instance_2 = kotlin_it_unibo_tuprolog_solve.$_$.u;
96
- var Companion_instance_3 = kotlin_it_unibo_tuprolog_solve.$_$.m1;
107
+ var Companion_getInstance_0 = kotlin_kotlin.$_$.i1;
108
+ var fromInt = kotlin_kotlin.$_$.f8;
109
+ var DurationUnit_MILLISECONDS_getInstance = kotlin_kotlin.$_$.b1;
110
+ var toDuration = kotlin_kotlin.$_$.af;
111
+ var Companion_instance_2 = kotlin_it_unibo_tuprolog_solve.$_$.b1;
112
+ var Companion_instance_3 = kotlin_it_unibo_tuprolog_solve.$_$.v1;
97
113
  var IOLib_getInstance = kotlin_it_unibo_tuprolog_io_lib.$_$.a;
98
114
  var arrayConcat = kotlin_kotlin.$_$.a;
99
115
  var OOPLib_getInstance = kotlin_it_unibo_tuprolog_oop_lib.$_$.a;
100
- var Companion_getInstance_0 = kotlin_it_unibo_tuprolog_solve.$_$.v1;
101
- var TrackVariables_getInstance = kotlin_it_unibo_tuprolog_solve.$_$.j1;
116
+ var Companion_getInstance_1 = kotlin_it_unibo_tuprolog_solve.$_$.f2;
102
117
  var parseStruct = kotlin_it_unibo_tuprolog_parser_core.$_$.c;
103
- var isBlank = kotlin_kotlin.$_$.fc;
118
+ var isBlank = kotlin_kotlin.$_$.id;
104
119
  var argument = kotlin_clikt_clikt.$_$.h;
105
120
  var validate = kotlin_clikt_clikt.$_$.i;
106
- var NotImplementedError = kotlin_kotlin.$_$.ce;
121
+ var NotImplementedError = kotlin_kotlin.$_$.nf;
107
122
  var subcommands = kotlin_clikt_clikt.$_$.f;
108
123
  var main = kotlin_clikt_clikt.$_$.d;
109
124
  //endregion
@@ -114,34 +129,51 @@
114
129
  initMetadataForClass(TuPrologCmd, 'TuPrologCmd', VOID, AbstractTuPrologCommand);
115
130
  initMetadataForClass(TuPrologSolveQuery, 'TuPrologSolveQuery', TuPrologSolveQuery, AbstractTuPrologCommand);
116
131
  //endregion
117
- function printSolution($this, sol, operatorSet, groundQueriesHaveBooleanSolution) {
118
- if (isInterface(sol, Yes)) {
119
- printYesSolution($this, sol, operatorSet, groundQueriesHaveBooleanSolution);
120
- } else {
121
- if (isInterface(sol, No)) {
122
- printNoSolution($this, sol, operatorSet);
123
- } else {
124
- if (isInterface(sol, Halt)) {
125
- printHaltSolution($this, sol, operatorSet);
126
- } else {
127
- noWhenBranchMatchedException();
132
+ function printSolution($this, sol, number, operatorSet, groundQueriesHaveBooleanSolution) {
133
+ var tmp0_safe_receiver = isInterface(sol, Halt) ? sol : null;
134
+ var exception = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.m25();
135
+ if (exception instanceof HaltException) {
136
+ $this.z3x('# goodbye.');
137
+ throw new ProgramResult(exception.exitStatus);
138
+ }
139
+ var plain = format(sol.resetTags(minus(sol.gz(), 'it.unibo.tuprolog.solve.timing.time')), Companion_instance.x25(operatorSet, groundQueriesHaveBooleanSolution));
140
+ var tmp$ret$0;
141
+ $l$block: {
142
+ // Inline function 'kotlin.text.takeWhile' call
143
+ var inductionVariable = 0;
144
+ var last = plain.length;
145
+ if (inductionVariable < last)
146
+ do {
147
+ var index = inductionVariable;
148
+ inductionVariable = inductionVariable + 1 | 0;
149
+ var it = charCodeAt(plain, index);
150
+ if (!isLetter(it)) {
151
+ tmp$ret$0 = substring(plain, 0, index);
152
+ break $l$block;
153
+ }
128
154
  }
129
- }
155
+ while (inductionVariable < last);
156
+ tmp$ret$0 = plain;
130
157
  }
131
- }
132
- function printYesSolution($this, sol, operatorSet, groundQueriesHaveBooleanSolution) {
133
- $this.q3u(format(sol, Companion_instance.x1z(operatorSet, groundQueriesHaveBooleanSolution)));
134
- }
135
- function printHaltSolution($this, sol, operatorSet) {
136
- var ex = sol.m1z();
137
- if (ex instanceof HaltException) {
138
- $this.q3u('# goodbye.');
139
- throw new ProgramResult(ex.exitStatus);
158
+ var keyword = tmp$ret$0;
159
+ var tmp1_safe_receiver = get_time(sol);
160
+ var tmp;
161
+ var tmp_0 = tmp1_safe_receiver;
162
+ if ((tmp_0 == null ? null : new Duration(tmp_0)) == null) {
163
+ tmp = null;
140
164
  } else {
141
- $this.q3u(format(sol, Companion_instance.withOperators(operatorSet)));
165
+ var tmp_1 = tmp1_safe_receiver;
166
+ // Inline function 'kotlin.let' call
167
+ var it_0 = (tmp_1 == null ? null : new Duration(tmp_1)).ld_1;
168
+ tmp = '[' + formatTime(it_0) + '] ';
142
169
  }
170
+ // Inline function 'kotlin.text.orEmpty' call
171
+ var tmp0_elvis_lhs = tmp;
172
+ var prefix = '' + number + '. ' + (tmp0_elvis_lhs == null ? '' : tmp0_elvis_lhs);
173
+ get_terminal($this).f5u(prefix + TextStyles_bold_getInstance().p5e(keyword) + drop(plain, keyword.length));
143
174
  }
144
- function printEndOfSolutions($this) {
175
+ function printEndOfSolutions($this, solutions) {
176
+ $this.z3x('% resolution time: ' + formatTime(solutions.r3e().active));
145
177
  }
146
178
  function readQueryMultiline($this, query) {
147
179
  var longQuery = new StringBuilder(query);
@@ -161,13 +193,10 @@
161
193
  tmp = tmp0_elvis_lhs;
162
194
  }
163
195
  lastRead = tmp;
164
- longQuery.u7(lastRead);
196
+ longQuery.s7(lastRead);
165
197
  }
166
198
  return longQuery.toString();
167
199
  }
168
- function printNoSolution($this, sol, operatorSet) {
169
- $this.q3u(format(sol, Companion_instance.withOperators(operatorSet)));
170
- }
171
200
  function AbstractTuPrologCommand(help, epilog, name, invokeWithoutSubcommand, printHelpOnEmptyArgs, helpTags, autoCompleteEnvvar, allowMultipleSubcommands, treatUnknownOptionsAsArgs, hiddenFromHelp) {
172
201
  help = help === VOID ? '' : help;
173
202
  epilog = epilog === VOID ? '' : epilog;
@@ -180,44 +209,51 @@
180
209
  treatUnknownOptionsAsArgs = treatUnknownOptionsAsArgs === VOID ? false : treatUnknownOptionsAsArgs;
181
210
  hiddenFromHelp = hiddenFromHelp === VOID ? false : hiddenFromHelp;
182
211
  CliktCommand.call(this, name);
183
- this.l5t_1 = help;
184
- this.m5t_1 = epilog;
185
- this.n5t_1 = invokeWithoutSubcommand;
186
- this.o5t_1 = printHelpOnEmptyArgs;
187
- this.p5t_1 = helpTags;
188
- this.q5t_1 = autoCompleteEnvvar;
189
- this.r5t_1 = allowMultipleSubcommands;
190
- this.s5t_1 = treatUnknownOptionsAsArgs;
191
- this.t5t_1 = hiddenFromHelp;
192
- }
193
- protoOf(AbstractTuPrologCommand).p3t = function () {
194
- return this.n5t_1;
212
+ this.u5w_1 = help;
213
+ this.v5w_1 = epilog;
214
+ this.w5w_1 = invokeWithoutSubcommand;
215
+ this.x5w_1 = printHelpOnEmptyArgs;
216
+ this.y5w_1 = helpTags;
217
+ this.z5w_1 = autoCompleteEnvvar;
218
+ this.a5x_1 = allowMultipleSubcommands;
219
+ this.b5x_1 = treatUnknownOptionsAsArgs;
220
+ this.c5x_1 = hiddenFromHelp;
221
+ }
222
+ protoOf(AbstractTuPrologCommand).y3w = function () {
223
+ return this.w5w_1;
195
224
  };
196
- protoOf(AbstractTuPrologCommand).q3t = function () {
197
- return this.o5t_1;
225
+ protoOf(AbstractTuPrologCommand).z3w = function () {
226
+ return this.x5w_1;
198
227
  };
199
- protoOf(AbstractTuPrologCommand).r3t = function () {
200
- return this.p5t_1;
228
+ protoOf(AbstractTuPrologCommand).a3x = function () {
229
+ return this.y5w_1;
201
230
  };
202
- protoOf(AbstractTuPrologCommand).s3t = function () {
203
- return this.q5t_1;
231
+ protoOf(AbstractTuPrologCommand).b3x = function () {
232
+ return this.z5w_1;
204
233
  };
205
- protoOf(AbstractTuPrologCommand).t3t = function () {
206
- return this.r5t_1;
234
+ protoOf(AbstractTuPrologCommand).c3x = function () {
235
+ return this.a5x_1;
207
236
  };
208
- protoOf(AbstractTuPrologCommand).u3t = function () {
209
- return this.s5t_1;
237
+ protoOf(AbstractTuPrologCommand).d3x = function () {
238
+ return this.b5x_1;
210
239
  };
211
- protoOf(AbstractTuPrologCommand).v3t = function () {
212
- return this.t5t_1;
240
+ protoOf(AbstractTuPrologCommand).e3x = function () {
241
+ return this.c5x_1;
213
242
  };
214
- protoOf(AbstractTuPrologCommand).i3t = function (context) {
215
- return this.l5t_1;
243
+ protoOf(AbstractTuPrologCommand).r3w = function (context) {
244
+ return this.u5w_1;
216
245
  };
217
- protoOf(AbstractTuPrologCommand).o3t = function (context) {
218
- return this.m5t_1;
246
+ protoOf(AbstractTuPrologCommand).x3w = function (context) {
247
+ return this.v5w_1;
219
248
  };
220
- protoOf(AbstractTuPrologCommand).u5t = function (e) {
249
+ protoOf(AbstractTuPrologCommand).d5x = function (query) {
250
+ var tmp = get_terminal(this);
251
+ var tmp_0 = '[' + formatLocalTimestamp(System_instance.yk().fl()) + '] ' + TextStyles_bold_getInstance().p5e('?-');
252
+ // Inline function 'kotlin.text.trimEnd' call
253
+ var tmp$ret$0 = toString(trimEnd(isCharSequence(query) ? query : THROW_CCE()));
254
+ tmp.f5u(tmp_0 + (' ' + removeSuffix(tmp$ret$0, '.') + '.'));
255
+ };
256
+ protoOf(AbstractTuPrologCommand).e5x = function (e) {
221
257
  var tmp0_safe_receiver = e.message;
222
258
  var tmp;
223
259
  if (tmp0_safe_receiver == null) {
@@ -229,16 +265,16 @@
229
265
  if (charSequenceLength(tmp0_safe_receiver) > 0) {
230
266
  var it = charCodeAt(tmp0_safe_receiver, 0);
231
267
  var tmp$ret$2 = isLowerCase(it) ? titlecase(it) : toString_0(it);
232
- tmp_0 = toString(tmp$ret$2) + substring(tmp0_safe_receiver, 1);
268
+ tmp_0 = toString(tmp$ret$2) + substring_0(tmp0_safe_receiver, 1);
233
269
  } else {
234
270
  tmp_0 = tmp0_safe_receiver;
235
271
  }
236
272
  tmp = tmp_0;
237
273
  }
238
- this.q3u('# ' + tmp, VOID, true);
274
+ this.z3x('# ' + tmp, VOID, true);
239
275
  };
240
- protoOf(AbstractTuPrologCommand).v5t = function () {
241
- var query = prompt(get_terminal(this), '?-', VOID, VOID, VOID, VOID, VOID, ' ');
276
+ protoOf(AbstractTuPrologCommand).f5x = function () {
277
+ var query = prompt(get_terminal(this), '[' + formatLocalTimestamp(System_instance.yk().fl()) + '] ' + TextStyles_bold_getInstance().p5e('?-'), VOID, VOID, VOID, VOID, VOID, ' ');
242
278
  var tmp;
243
279
  if (query == null) {
244
280
  throw NullInputException_init_$Create$('The standard input has been close unexpectedly');
@@ -253,10 +289,11 @@
253
289
  }
254
290
  return tmp;
255
291
  };
256
- protoOf(AbstractTuPrologCommand).w5t = function (solutions, operatorSet, groundQueriesHaveBooleanSolution) {
257
- var first = true;
292
+ protoOf(AbstractTuPrologCommand).g5x = function (timedSolutions, operatorSet, groundQueriesHaveBooleanSolution) {
293
+ var solutions = timedSolutions.n();
294
+ var number = 0;
258
295
  $l$loop: while (solutions.q()) {
259
- if (!first) {
296
+ if (number > 0) {
260
297
  var tmp0_safe_receiver = prompt(get_terminal(this), '', VOID, VOID, VOID, false);
261
298
  var tmp;
262
299
  if (tmp0_safe_receiver == null) {
@@ -268,20 +305,21 @@
268
305
  var cmd = tmp;
269
306
  if (!(cmd === ';'))
270
307
  break $l$loop;
271
- } else {
272
- first = false;
273
308
  }
274
- printSolution(this, solutions.r(), operatorSet, groundQueriesHaveBooleanSolution);
309
+ var tmp_0 = solutions.r();
310
+ number = number + 1 | 0;
311
+ printSolution(this, tmp_0, number, operatorSet, groundQueriesHaveBooleanSolution);
275
312
  }
276
- printEndOfSolutions(this);
313
+ printEndOfSolutions(this, timedSolutions);
277
314
  };
278
- protoOf(AbstractTuPrologCommand).x5t = function (solutions, maxSolutions, operatorSet, groundQueriesHaveBooleanSolution) {
315
+ protoOf(AbstractTuPrologCommand).h5x = function (timedSolutions, maxSolutions, operatorSet, groundQueriesHaveBooleanSolution) {
316
+ var solutions = timedSolutions.n();
279
317
  var i = 0;
280
318
  while (i < maxSolutions && solutions.q()) {
281
319
  i = i + 1 | 0;
282
- printSolution(this, solutions.r(), operatorSet, groundQueriesHaveBooleanSolution);
320
+ printSolution(this, solutions.r(), i, operatorSet, groundQueriesHaveBooleanSolution);
283
321
  }
284
- printEndOfSolutions(this);
322
+ printEndOfSolutions(this, timedSolutions);
285
323
  };
286
324
  function NullInputException_init_$Init$(message, cause, $this) {
287
325
  TuPrologException_init_$Init$(message, cause, $this);
@@ -301,23 +339,23 @@
301
339
  captureStack(this, NullInputException);
302
340
  }
303
341
  function Companion() {
304
- this.y5t_1 = 1000;
342
+ this.i5x_1 = 1000;
305
343
  }
306
344
  var Companion_instance_4;
307
- function Companion_getInstance_1() {
345
+ function Companion_getInstance_2() {
308
346
  return Companion_instance_4;
309
347
  }
310
348
  function _get_files__hkfg7a($this) {
311
349
  var tmp = KProperty1;
312
- return $this.y5u_1.b45($this, getPropertyCallableRef('files', 1, tmp, TuPrologCmd$_get_files_$ref_c1qk0p(), null));
350
+ return $this.i5y_1.k48($this, getPropertyCallableRef('files', 1, tmp, TuPrologCmd$_get_files_$ref_c1qk0p(), null));
313
351
  }
314
352
  function _get_timeout__tg4wg($this) {
315
353
  var tmp = KProperty1;
316
- return $this.z5u_1.b45($this, getPropertyCallableRef('timeout', 1, tmp, TuPrologCmd$_get_timeout_$ref_q0nd1f(), null));
354
+ return $this.j5y_1.k48($this, getPropertyCallableRef('timeout', 1, tmp, TuPrologCmd$_get_timeout_$ref_q0nd1f(), null));
317
355
  }
318
356
  function _get_oop__e6e8e9($this) {
319
357
  var tmp = KProperty1;
320
- return $this.a5v_1.b45($this, getPropertyCallableRef('oop', 1, tmp, TuPrologCmd$_get_oop_$ref_nvbbou(), null));
358
+ return $this.k5y_1.k48($this, getPropertyCallableRef('oop', 1, tmp, TuPrologCmd$_get_oop_$ref_nvbbou(), null));
321
359
  }
322
360
  function loadTheory($this) {
323
361
  var theory = Companion_instance_0.emptyWithDefaultUnificator();
@@ -327,44 +365,44 @@
327
365
  if (isReadableFile(file)) {
328
366
  try {
329
367
  var t = loadTheoryFromFile(file);
330
- $this.q3u('# Successfully loaded ' + t.s().toString() + ' clauses from ' + file);
368
+ $this.z3x('# Successfully loaded ' + t.s().toString() + ' clauses from ' + file);
331
369
  theory = theory.plusTheory(t);
332
370
  } catch ($p) {
333
371
  if ($p instanceof ParseException) {
334
372
  var e = $p;
335
- $this.q3u(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);
373
+ $this.z3x(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);
336
374
  } else {
337
375
  throw $p;
338
376
  }
339
377
  }
340
378
  }
341
379
  }
342
- $this.q3u('');
380
+ $this.z3x('');
343
381
  return theory;
344
382
  }
345
383
  function readEvalPrintLoop($this, solver) {
346
384
  try {
347
- var query = $this.v5t();
385
+ var query = $this.f5x();
348
386
  while (!(query == null)) {
349
387
  try {
350
- var goal = parseStructWithOperators(Companion_getInstance(), query, solver.c1y());
351
- var solutions = solver.solveWithTimeout(goal, $this.b5v()).n();
352
- $this.w5t(solutions, solver.c1y(), equals(solver.u1x().get(GroundQueriesHaveBooleanSolution_getInstance()), GroundQueriesHaveBooleanSolution_getInstance().s2c_1));
388
+ var goal = parseStructWithOperators(Companion_getInstance(), query, solver.u23());
389
+ var solutions = timed(solver.solveWithTimeout(goal, $this.l5y()));
390
+ $this.g5x(solutions, solver.u23(), equals(solver.m23().get(GroundQueriesHaveBooleanSolution_getInstance()), GroundQueriesHaveBooleanSolution_getInstance().m2j_1));
353
391
  } catch ($p) {
354
392
  if ($p instanceof ParseException) {
355
393
  var e = $p;
356
- $this.u5t(e);
394
+ $this.e5x(e);
357
395
  } else {
358
396
  throw $p;
359
397
  }
360
398
  }
361
- $this.q3u('');
362
- query = $this.v5t();
399
+ $this.z3x('');
400
+ query = $this.f5x();
363
401
  }
364
402
  } catch ($p_0) {
365
403
  if ($p_0 instanceof NullInputException) {
366
404
  var _unused_var__etf5q3 = $p_0;
367
- $this.q3u('\n# goodbye.');
405
+ $this.z3x('\n# goodbye.');
368
406
  throw new ProgramResult(0);
369
407
  } else {
370
408
  throw $p_0;
@@ -374,17 +412,17 @@
374
412
  function TuPrologCmd$_get_files_$ref_c1qk0p() {
375
413
  return constructCallableReference(function (p0) {
376
414
  return _get_files__hkfg7a(p0);
377
- }, 1, 0, 161);
415
+ }, 1, 0, 112);
378
416
  }
379
417
  function TuPrologCmd$_get_timeout_$ref_q0nd1f() {
380
418
  return constructCallableReference(function (p0) {
381
419
  return _get_timeout__tg4wg(p0);
382
- }, 1, 0, 162);
420
+ }, 1, 0, 113);
383
421
  }
384
422
  function TuPrologCmd$_get_oop_$ref_nvbbou() {
385
423
  return constructCallableReference(function (p0) {
386
424
  return _get_oop__e6e8e9(p0);
387
- }, 1, 0, 163);
425
+ }, 1, 0, 114);
388
426
  }
389
427
  function TuPrologCmd$getSolver$lambda$lambda($formatter) {
390
428
  return function (it) {
@@ -393,95 +431,94 @@
393
431
  }
394
432
  function TuPrologCmd$getSolver$lambda(this$0) {
395
433
  return function (w) {
396
- this$0.q3u('# ' + w.message, VOID, true);
434
+ this$0.z3x('# ' + w.message, VOID, true);
397
435
  var sep = '\n at ';
398
- var formatter = Companion_instance_1.prettyExpressionsPrettyVariables(w.v8().c1y());
399
- var tmp = w.q1x();
436
+ var formatter = Companion_instance_1.prettyExpressionsPrettyVariables(w.x8().u23());
437
+ var tmp = w.h23();
400
438
  var stacktrace = joinToString(tmp, sep, VOID, VOID, VOID, VOID, TuPrologCmd$getSolver$lambda$lambda(formatter));
401
- this$0.q3u('# at ' + stacktrace, VOID, true);
439
+ this$0.z3x('# at ' + stacktrace, VOID, true);
402
440
  return Unit_instance;
403
441
  };
404
442
  }
405
- function TuPrologCmd$getSolver$lambda_0($this$flag) {
406
- return $this$flag.n2d_1;
407
- }
408
443
  function TuPrologCmd(additionalLibraries) {
409
444
  AbstractTuPrologCommand.call(this, 'Start a Prolog Read-Eval-Print loop', VOID, 'java -jar 2p-repl.jar', true, VOID, VOID, VOID, true);
410
- this.x5u_1 = additionalLibraries;
445
+ this.h5y_1 = additionalLibraries;
411
446
  var tmp = this;
412
447
  var tmp_0 = multiple(option(this, ['-T', '--theory'], 'Path of theory file to be loaded'));
413
448
  var tmp_1 = KProperty1;
414
- tmp.y5u_1 = tmp_0.o45(this, getPropertyCallableRef('files', 1, tmp_1, TuPrologCmd$_get_files_$ref_c1qk0p(), null));
449
+ tmp.i5y_1 = tmp_0.x48(this, getPropertyCallableRef('files', 1, tmp_1, TuPrologCmd$_get_files_$ref_c1qk0p(), null));
415
450
  var tmp_2 = this;
416
451
  var tmp_3 = default_0(int(option(this, ['-t', '--timeout'], 'Maximum amount of time for computing a solution (default: 1000 ms)')), 1000);
417
452
  var tmp_4 = KProperty1;
418
- tmp_2.z5u_1 = tmp_3.o45(this, getPropertyCallableRef('timeout', 1, tmp_4, TuPrologCmd$_get_timeout_$ref_q0nd1f(), null));
453
+ tmp_2.j5y_1 = tmp_3.x48(this, getPropertyCallableRef('timeout', 1, tmp_4, TuPrologCmd$_get_timeout_$ref_q0nd1f(), null));
419
454
  var tmp_5 = this;
420
455
  var tmp_6 = flag(option(this, ['--oop'], 'Loads the OOP library'), [], false);
421
456
  var tmp_7 = KProperty1;
422
- tmp_5.a5v_1 = tmp_6.o45(this, getPropertyCallableRef('oop', 1, tmp_7, TuPrologCmd$_get_oop_$ref_nvbbou(), null));
457
+ tmp_5.k5y_1 = tmp_6.x48(this, getPropertyCallableRef('oop', 1, tmp_7, TuPrologCmd$_get_oop_$ref_nvbbou(), null));
423
458
  }
424
- protoOf(TuPrologCmd).c3w = function () {
425
- if (this.x2f().k3v() == null) {
426
- readEvalPrintLoop(this, this.c5v());
459
+ protoOf(TuPrologCmd).l3z = function () {
460
+ if (this.i2n().t3y() == null) {
461
+ readEvalPrintLoop(this, this.m5y());
427
462
  }
428
463
  };
429
- protoOf(TuPrologCmd).b5v = function () {
430
- return fromInt(_get_timeout__tg4wg(this));
464
+ protoOf(TuPrologCmd).l5y = function () {
465
+ Companion_getInstance_0();
466
+ // Inline function 'kotlin.time.Companion.milliseconds' call
467
+ var this_0 = fromInt(_get_timeout__tg4wg(this));
468
+ return toDuration(this_0, DurationUnit_MILLISECONDS_getInstance());
431
469
  };
432
- protoOf(TuPrologCmd).c5v = function () {
433
- this.q3u('# 2P-Kt version 3.0.7');
470
+ protoOf(TuPrologCmd).m5y = function () {
471
+ this.z3x('# 2P-Kt version 4.0.0');
434
472
  var theory = loadTheory(this);
435
473
  var tmp = Companion_instance_2;
436
474
  var outputChannel = tmp.of(TuPrologCmd$getSolver$lambda(this));
437
475
  var tmp_0;
438
476
  if (_get_oop__e6e8e9(this)) {
439
- tmp_0 = Companion_instance_3.of(arrayConcat([[IOLib_getInstance(), OOPLib_getInstance()], this.x5u_1]));
477
+ tmp_0 = Companion_instance_3.of(arrayConcat([[IOLib_getInstance(), OOPLib_getInstance()], this.h5y_1]));
440
478
  } else {
441
- tmp_0 = Companion_instance_3.of(arrayConcat([[IOLib_getInstance()], this.x5u_1]));
479
+ tmp_0 = Companion_instance_3.of(arrayConcat([[IOLib_getInstance()], this.h5y_1]));
442
480
  }
443
481
  var libraries = tmp_0;
444
- var tmp_1 = Companion_getInstance_0().y20().newBuilder().setRuntime(libraries).setStaticKb(theory);
445
- var tmp_2 = TrackVariables_getInstance();
446
482
  // Inline function 'kotlin.also' call
447
- var this_0 = tmp_1.setNotableFlagByValue(tmp_2, TuPrologCmd$getSolver$lambda_0).setWarnings(outputChannel).build();
483
+ var this_0 = Companion_getInstance_1().e27().newBuilder().setRuntime(libraries).setStaticKb(theory).setWarnings(outputChannel).build();
448
484
  // Inline function 'kotlin.collections.iterator' call
449
- var _iterator__ex2g4s = this_0.t1x().d1().n();
485
+ var _iterator__ex2g4s = this_0.l23().d1().n();
450
486
  while (_iterator__ex2g4s.q()) {
451
487
  // Inline function 'kotlin.collections.component2' call
452
488
  var library = _iterator__ex2g4s.r().f1();
453
- this.q3u('# Successfully loaded library `' + library.e2j() + '`');
489
+ this.z3x('# Successfully loaded library `' + library.c2r() + '`');
454
490
  }
455
- this.q3u('');
491
+ this.z3x('');
456
492
  return this_0;
457
493
  };
458
494
  function _get_query__c6g9vb($this) {
459
495
  var tmp = KProperty1;
460
- return $this.b5w_1.b45($this, getPropertyCallableRef('query', 1, tmp, TuPrologSolveQuery$_get_query_$ref_bkd3qt(), null));
496
+ return $this.l5z_1.k48($this, getPropertyCallableRef('query', 1, tmp, TuPrologSolveQuery$_get_query_$ref_bkd3qt(), null));
461
497
  }
462
498
  function _get_maxSolutions__ysux2t($this) {
463
499
  var tmp = KProperty1;
464
- return $this.c5w_1.b45($this, getPropertyCallableRef('maxSolutions', 1, tmp, TuPrologSolveQuery$_get_maxSolutions_$ref_o23pc7(), null));
500
+ return $this.m5z_1.k48($this, getPropertyCallableRef('maxSolutions', 1, tmp, TuPrologSolveQuery$_get_maxSolutions_$ref_o23pc7(), null));
465
501
  }
466
502
  function _get_parentCommand__z09ff4($this) {
467
- var tmp0_safe_receiver = $this.x2f().b3s_1;
468
- var tmp = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.c3s_1;
503
+ var tmp0_safe_receiver = $this.i2n().k3v_1;
504
+ var tmp = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.l3v_1;
469
505
  return tmp instanceof TuPrologCmd ? tmp : THROW_CCE();
470
506
  }
471
507
  function evalAndPrint($this, solver) {
472
508
  try {
473
- var duration = _get_parentCommand__z09ff4($this).b5v();
474
- var solutions = solver.solveWithTimeout(parseStruct(Companion_getInstance(), _get_query__c6g9vb($this)), duration).n();
475
- var groundQueriesHaveBooleanSolution = equals(solver.u1x().get(GroundQueriesHaveBooleanSolution_getInstance()), GroundQueriesHaveBooleanSolution_getInstance().s2c_1);
509
+ $this.d5x(_get_query__c6g9vb($this));
510
+ var duration = _get_parentCommand__z09ff4($this).l5y();
511
+ var solutions = timed(solver.solveWithTimeout(parseStruct(Companion_getInstance(), _get_query__c6g9vb($this)), duration));
512
+ var groundQueriesHaveBooleanSolution = equals(solver.m23().get(GroundQueriesHaveBooleanSolution_getInstance()), GroundQueriesHaveBooleanSolution_getInstance().m2j_1);
476
513
  if (_get_maxSolutions__ysux2t($this) === 0) {
477
- $this.w5t(solutions, solver.c1y(), groundQueriesHaveBooleanSolution);
514
+ $this.g5x(solutions, solver.u23(), groundQueriesHaveBooleanSolution);
478
515
  } else {
479
- $this.x5t(solutions, _get_maxSolutions__ysux2t($this), solver.c1y(), groundQueriesHaveBooleanSolution);
516
+ $this.h5x(solutions, _get_maxSolutions__ysux2t($this), solver.u23(), groundQueriesHaveBooleanSolution);
480
517
  }
481
518
  } catch ($p) {
482
519
  if ($p instanceof ParseException) {
483
520
  var e = $p;
484
- $this.u5t(e);
521
+ $this.e5x(e);
485
522
  } else {
486
523
  throw $p;
487
524
  }
@@ -493,7 +530,7 @@
493
530
  // Inline function 'com.github.ajalt.clikt.parameters.arguments.ArgumentTransformContext.require' call
494
531
  if (!!isBlank(it)) {
495
532
  var tmp$ret$3 = $message;
496
- $this$validate.k44(tmp$ret$3);
533
+ $this$validate.t47(tmp$ret$3);
497
534
  }
498
535
  return Unit_instance;
499
536
  };
@@ -501,12 +538,12 @@
501
538
  function TuPrologSolveQuery$_get_query_$ref_bkd3qt() {
502
539
  return constructCallableReference(function (p0) {
503
540
  return _get_query__c6g9vb(p0);
504
- }, 1, 0, 164);
541
+ }, 1, 0, 115);
505
542
  }
506
543
  function TuPrologSolveQuery$_get_maxSolutions_$ref_o23pc7() {
507
544
  return constructCallableReference(function (p0) {
508
545
  return _get_maxSolutions__ysux2t(p0);
509
- }, 1, 0, 165);
546
+ }, 1, 0, 116);
510
547
  }
511
548
  function TuPrologSolveQuery() {
512
549
  AbstractTuPrologCommand.call(this, 'Compute a particular query and then terminate', VOID, 'solve');
@@ -517,14 +554,14 @@
517
554
  // Inline function 'com.github.ajalt.clikt.parameters.arguments.check' call
518
555
  var tmp_0 = validate(tmp0, TuPrologSolveQuery$query$delegate$lambda(message));
519
556
  var tmp_1 = KProperty1;
520
- tmp.b5w_1 = tmp_0.d45(this, getPropertyCallableRef('query', 1, tmp_1, TuPrologSolveQuery$_get_query_$ref_bkd3qt(), null));
557
+ tmp.l5z_1 = tmp_0.m48(this, getPropertyCallableRef('query', 1, tmp_1, TuPrologSolveQuery$_get_query_$ref_bkd3qt(), null));
521
558
  var tmp_2 = this;
522
559
  var tmp_3 = default_0(int(option(this, ['-n', '--numberOfSolutions'], 'Number of solution to calculate')), 0);
523
560
  var tmp_4 = KProperty1;
524
- tmp_2.c5w_1 = tmp_3.o45(this, getPropertyCallableRef('maxSolutions', 1, tmp_4, TuPrologSolveQuery$_get_maxSolutions_$ref_o23pc7(), null));
561
+ tmp_2.m5z_1 = tmp_3.x48(this, getPropertyCallableRef('maxSolutions', 1, tmp_4, TuPrologSolveQuery$_get_maxSolutions_$ref_o23pc7(), null));
525
562
  }
526
- protoOf(TuPrologSolveQuery).c3w = function () {
527
- var solver = _get_parentCommand__z09ff4(this).c5v();
563
+ protoOf(TuPrologSolveQuery).l3z = function () {
564
+ var solver = _get_parentCommand__z09ff4(this).m5y();
528
565
  evalAndPrint(this, solver);
529
566
  };
530
567
  function isReadableFile(path) {