@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-core.js
CHANGED
|
@@ -83,7 +83,7 @@
|
|
|
83
83
|
setMetadataFor(InvalidTermTypeException, 'InvalidTermTypeException', classMeta, ParseException, undefined, undefined, undefined, []);
|
|
84
84
|
setMetadataFor(Companion, 'Companion', objectMeta, undefined, undefined, undefined, undefined, []);
|
|
85
85
|
function parseTerm(input) {
|
|
86
|
-
return this.parseTermWithOperators(input, this.
|
|
86
|
+
return this.parseTermWithOperators(input, this.c3j());
|
|
87
87
|
}
|
|
88
88
|
function parseStructWithOperators(input, operators) {
|
|
89
89
|
var tmp$ret$2;
|
|
@@ -109,7 +109,7 @@
|
|
|
109
109
|
return tmp$ret$2;
|
|
110
110
|
}
|
|
111
111
|
function parseStruct(input) {
|
|
112
|
-
return this.parseStructWithOperators(input, this.
|
|
112
|
+
return this.parseStructWithOperators(input, this.c3j());
|
|
113
113
|
}
|
|
114
114
|
function parseConstantWithOperators(input, operators) {
|
|
115
115
|
var tmp$ret$2;
|
|
@@ -135,7 +135,7 @@
|
|
|
135
135
|
return tmp$ret$2;
|
|
136
136
|
}
|
|
137
137
|
function parseConstant(input) {
|
|
138
|
-
return this.parseConstantWithOperators(input, this.
|
|
138
|
+
return this.parseConstantWithOperators(input, this.c3j());
|
|
139
139
|
}
|
|
140
140
|
function parseVarWithOperators(input, operators) {
|
|
141
141
|
var tmp$ret$2;
|
|
@@ -161,7 +161,7 @@
|
|
|
161
161
|
return tmp$ret$2;
|
|
162
162
|
}
|
|
163
163
|
function parseVar(input) {
|
|
164
|
-
return this.parseVarWithOperators(input, this.
|
|
164
|
+
return this.parseVarWithOperators(input, this.c3j());
|
|
165
165
|
}
|
|
166
166
|
function parseAtomWithOperators(input, operators) {
|
|
167
167
|
var tmp$ret$2;
|
|
@@ -187,7 +187,7 @@
|
|
|
187
187
|
return tmp$ret$2;
|
|
188
188
|
}
|
|
189
189
|
function parseAtom(input) {
|
|
190
|
-
return this.parseAtomWithOperators(input, this.
|
|
190
|
+
return this.parseAtomWithOperators(input, this.c3j());
|
|
191
191
|
}
|
|
192
192
|
function parseNumericWithOperators(input, operators) {
|
|
193
193
|
var tmp$ret$2;
|
|
@@ -213,7 +213,7 @@
|
|
|
213
213
|
return tmp$ret$2;
|
|
214
214
|
}
|
|
215
215
|
function parseNumeric(input) {
|
|
216
|
-
return this.parseNumericWithOperators(input, this.
|
|
216
|
+
return this.parseNumericWithOperators(input, this.c3j());
|
|
217
217
|
}
|
|
218
218
|
function parseIntegerWithOperators(input, operators) {
|
|
219
219
|
var tmp$ret$2;
|
|
@@ -239,7 +239,7 @@
|
|
|
239
239
|
return tmp$ret$2;
|
|
240
240
|
}
|
|
241
241
|
function parseInteger(input) {
|
|
242
|
-
return this.parseIntegerWithOperators(input, this.
|
|
242
|
+
return this.parseIntegerWithOperators(input, this.c3j());
|
|
243
243
|
}
|
|
244
244
|
function parseRealWithOperators(input, operators) {
|
|
245
245
|
var tmp$ret$2;
|
|
@@ -265,7 +265,7 @@
|
|
|
265
265
|
return tmp$ret$2;
|
|
266
266
|
}
|
|
267
267
|
function parseReal(input) {
|
|
268
|
-
return this.parseRealWithOperators(input, this.
|
|
268
|
+
return this.parseRealWithOperators(input, this.c3j());
|
|
269
269
|
}
|
|
270
270
|
function parseClauseWithOperators(input, operators) {
|
|
271
271
|
var tmp$ret$2;
|
|
@@ -291,7 +291,7 @@
|
|
|
291
291
|
return tmp$ret$2;
|
|
292
292
|
}
|
|
293
293
|
function parseClause(input) {
|
|
294
|
-
return this.parseClauseWithOperators(input, this.
|
|
294
|
+
return this.parseClauseWithOperators(input, this.c3j());
|
|
295
295
|
}
|
|
296
296
|
function parseRuleWithOperators(input, operators) {
|
|
297
297
|
var tmp$ret$2;
|
|
@@ -317,7 +317,7 @@
|
|
|
317
317
|
return tmp$ret$2;
|
|
318
318
|
}
|
|
319
319
|
function parseRule(input) {
|
|
320
|
-
return this.parseRuleWithOperators(input, this.
|
|
320
|
+
return this.parseRuleWithOperators(input, this.c3j());
|
|
321
321
|
}
|
|
322
322
|
function parseFactWithOperators(input, operators) {
|
|
323
323
|
var tmp$ret$2;
|
|
@@ -343,7 +343,7 @@
|
|
|
343
343
|
return tmp$ret$2;
|
|
344
344
|
}
|
|
345
345
|
function parseFact(input) {
|
|
346
|
-
return this.parseFactWithOperators(input, this.
|
|
346
|
+
return this.parseFactWithOperators(input, this.c3j());
|
|
347
347
|
}
|
|
348
348
|
function parseDirectiveWithOperators(input, operators) {
|
|
349
349
|
var tmp$ret$2;
|
|
@@ -369,7 +369,7 @@
|
|
|
369
369
|
return tmp$ret$2;
|
|
370
370
|
}
|
|
371
371
|
function parseDirective(input) {
|
|
372
|
-
return this.parseDirectiveWithOperators(input, this.
|
|
372
|
+
return this.parseDirectiveWithOperators(input, this.c3j());
|
|
373
373
|
}
|
|
374
374
|
setMetadataFor(TermParser, 'TermParser', interfaceMeta, undefined, undefined, undefined, undefined, []);
|
|
375
375
|
setMetadataFor(Companion_0, 'Companion', objectMeta, undefined, undefined, undefined, undefined, []);
|
|
@@ -402,8 +402,8 @@
|
|
|
402
402
|
}
|
|
403
403
|
function InvalidTermTypeException(input, term, type, offendingSymbol, line, column, message, throwable) {
|
|
404
404
|
ParseException.call(this, input, offendingSymbol, line, column, message, throwable);
|
|
405
|
-
this.
|
|
406
|
-
this.
|
|
405
|
+
this.k3i_1 = term;
|
|
406
|
+
this.l3i_1 = type;
|
|
407
407
|
captureStack(this, InvalidTermTypeException);
|
|
408
408
|
}
|
|
409
409
|
function ParseException(input, offendingSymbol, line, column, message, throwable) {
|
|
@@ -415,34 +415,34 @@
|
|
|
415
415
|
this.clauseIndex = -1;
|
|
416
416
|
captureStack(this, ParseException);
|
|
417
417
|
}
|
|
418
|
-
ParseException.prototype.
|
|
418
|
+
ParseException.prototype.m3i = function (_set____db54di) {
|
|
419
419
|
this.input = _set____db54di;
|
|
420
420
|
};
|
|
421
|
-
ParseException.prototype.
|
|
421
|
+
ParseException.prototype.n3i = function () {
|
|
422
422
|
return this.input;
|
|
423
423
|
};
|
|
424
|
-
ParseException.prototype.
|
|
424
|
+
ParseException.prototype.o3i = function (_set____db54di) {
|
|
425
425
|
this.offendingSymbol = _set____db54di;
|
|
426
426
|
};
|
|
427
|
-
ParseException.prototype.
|
|
427
|
+
ParseException.prototype.p3i = function () {
|
|
428
428
|
return this.offendingSymbol;
|
|
429
429
|
};
|
|
430
|
-
ParseException.prototype.
|
|
430
|
+
ParseException.prototype.q3i = function (_set____db54di) {
|
|
431
431
|
this.line = _set____db54di;
|
|
432
432
|
};
|
|
433
|
-
ParseException.prototype.
|
|
433
|
+
ParseException.prototype.r3i = function () {
|
|
434
434
|
return this.line;
|
|
435
435
|
};
|
|
436
|
-
ParseException.prototype.
|
|
436
|
+
ParseException.prototype.s3i = function (_set____db54di) {
|
|
437
437
|
this.column = _set____db54di;
|
|
438
438
|
};
|
|
439
|
-
ParseException.prototype.
|
|
439
|
+
ParseException.prototype.t3i = function () {
|
|
440
440
|
return this.column;
|
|
441
441
|
};
|
|
442
|
-
ParseException.prototype.
|
|
442
|
+
ParseException.prototype.u3i = function (_set____db54di) {
|
|
443
443
|
this.clauseIndex = _set____db54di;
|
|
444
444
|
};
|
|
445
|
-
ParseException.prototype.
|
|
445
|
+
ParseException.prototype.v3i = function () {
|
|
446
446
|
return this.clauseIndex;
|
|
447
447
|
};
|
|
448
448
|
ParseException.prototype.toString = function () {
|
|
@@ -453,39 +453,39 @@
|
|
|
453
453
|
Companion_instance = this;
|
|
454
454
|
}
|
|
455
455
|
Companion.prototype.withNoOperator = function (scope) {
|
|
456
|
-
return this.
|
|
456
|
+
return this.w3i(scope === void 1 ? Companion_getInstance().empty() : scope);
|
|
457
457
|
};
|
|
458
|
-
Companion.prototype.
|
|
459
|
-
return this.
|
|
458
|
+
Companion.prototype.w3i = function (scope) {
|
|
459
|
+
return this.x3i(Companion_getInstance_0().EMPTY, scope);
|
|
460
460
|
};
|
|
461
461
|
Companion.prototype.withStandardOperators = function (scope) {
|
|
462
|
-
return this.
|
|
462
|
+
return this.y3i(scope === void 1 ? Companion_getInstance().empty() : scope);
|
|
463
463
|
};
|
|
464
|
-
Companion.prototype.
|
|
465
|
-
return this.
|
|
464
|
+
Companion.prototype.y3i = function (scope) {
|
|
465
|
+
return this.x3i(Companion_getInstance_0().STANDARD, scope);
|
|
466
466
|
};
|
|
467
467
|
Companion.prototype.withDefaultOperators = function (scope) {
|
|
468
|
-
return this.
|
|
468
|
+
return this.z3i(scope === void 1 ? Companion_getInstance().empty() : scope);
|
|
469
469
|
};
|
|
470
|
-
Companion.prototype.
|
|
471
|
-
return this.
|
|
470
|
+
Companion.prototype.z3i = function (scope) {
|
|
471
|
+
return this.x3i(Companion_getInstance_0().DEFAULT, scope);
|
|
472
472
|
};
|
|
473
|
-
Companion.prototype.
|
|
473
|
+
Companion.prototype.a3j = function (scope, $mask0, $handler) {
|
|
474
474
|
if (!(($mask0 & 1) === 0))
|
|
475
475
|
scope = Companion_getInstance().empty();
|
|
476
|
-
return this.
|
|
476
|
+
return this.z3i(scope);
|
|
477
477
|
};
|
|
478
478
|
Companion.prototype.withOperatorSet = function (operators, scope) {
|
|
479
|
-
return this.
|
|
479
|
+
return this.x3i(operators, scope === void 1 ? Companion_getInstance().empty() : scope);
|
|
480
480
|
};
|
|
481
|
-
Companion.prototype.
|
|
481
|
+
Companion.prototype.x3i = function (operators, scope) {
|
|
482
482
|
return termParserWithOperators(operators, scope);
|
|
483
483
|
};
|
|
484
484
|
Companion.prototype.withOperators = function (operators, scope) {
|
|
485
|
-
return this.
|
|
485
|
+
return this.b3j(operators, scope === void 1 ? Companion_getInstance().empty() : scope);
|
|
486
486
|
};
|
|
487
|
-
Companion.prototype.
|
|
488
|
-
return this.
|
|
487
|
+
Companion.prototype.b3j = function (operators, scope) {
|
|
488
|
+
return this.x3i(OperatorSet_init_$Create$(operators.slice()), scope);
|
|
489
489
|
};
|
|
490
490
|
var Companion_instance;
|
|
491
491
|
function Companion_getInstance_6() {
|
|
@@ -527,7 +527,7 @@
|
|
|
527
527
|
}
|
|
528
528
|
function get_defaultParser() {
|
|
529
529
|
var tmp = Companion_getInstance_6();
|
|
530
|
-
return tmp.
|
|
530
|
+
return tmp.a3j(null, 1, null);
|
|
531
531
|
}
|
|
532
532
|
function toAssociativity(_this__u8e3s4) {
|
|
533
533
|
return _this__u8e3s4.toString();
|
|
@@ -536,13 +536,13 @@
|
|
|
536
536
|
return Unit_getInstance();
|
|
537
537
|
}
|
|
538
538
|
function onOperatorDefined($this, operator) {
|
|
539
|
-
$this.
|
|
540
|
-
$this.
|
|
539
|
+
$this.d3j_1.addOperator(operator.k1i_1, toAssociativity(operator.l1i_1), operator.m1i_1);
|
|
540
|
+
$this.e3j_1($this.d3j_1, operator);
|
|
541
541
|
}
|
|
542
542
|
function Companion_0() {
|
|
543
543
|
Companion_instance_0 = this;
|
|
544
544
|
}
|
|
545
|
-
Companion_0.prototype.
|
|
545
|
+
Companion_0.prototype.f3j = function (parser) {
|
|
546
546
|
return new DynamicOpListener(parser, DynamicOpListener$Companion$of$lambda);
|
|
547
547
|
};
|
|
548
548
|
var Companion_instance_0;
|
|
@@ -557,10 +557,10 @@
|
|
|
557
557
|
function DynamicOpListener(parser, operatorDefinedCallback) {
|
|
558
558
|
Companion_getInstance_7();
|
|
559
559
|
PrologParserListener.call(this);
|
|
560
|
-
this.
|
|
561
|
-
this.
|
|
560
|
+
this.d3j_1 = parser;
|
|
561
|
+
this.e3j_1 = operatorDefinedCallback;
|
|
562
562
|
}
|
|
563
|
-
DynamicOpListener.prototype.
|
|
563
|
+
DynamicOpListener.prototype.g3j = function (ctx) {
|
|
564
564
|
var expr = ctx.expression();
|
|
565
565
|
if (ctx.exception != null) {
|
|
566
566
|
return Unit_getInstance();
|
|
@@ -582,19 +582,19 @@
|
|
|
582
582
|
if (tmp) {
|
|
583
583
|
var tmp_1 = ctx.accept(PrologVisitor_init_$Create$(null, 1, null));
|
|
584
584
|
var directive = isInterface(tmp_1, Directive) ? tmp_1 : THROW_CCE();
|
|
585
|
-
var op = directive.
|
|
585
|
+
var op = directive.jy();
|
|
586
586
|
var tmp_2;
|
|
587
587
|
var tmp_3;
|
|
588
588
|
var tmp_4;
|
|
589
589
|
var tmp_5;
|
|
590
590
|
var tmp_6;
|
|
591
591
|
if (isInterface(op, Struct)) {
|
|
592
|
-
tmp_6 = op.
|
|
592
|
+
tmp_6 = op.wv() === 3;
|
|
593
593
|
} else {
|
|
594
594
|
tmp_6 = false;
|
|
595
595
|
}
|
|
596
596
|
if (tmp_6) {
|
|
597
|
-
tmp_5 = op.
|
|
597
|
+
tmp_5 = op.cw() === 'op';
|
|
598
598
|
} else {
|
|
599
599
|
tmp_5 = false;
|
|
600
600
|
}
|
|
@@ -611,7 +611,7 @@
|
|
|
611
611
|
tmp_3 = false;
|
|
612
612
|
}
|
|
613
613
|
if (tmp_3) {
|
|
614
|
-
tmp_2 = op.
|
|
614
|
+
tmp_2 = op.gx();
|
|
615
615
|
} else {
|
|
616
616
|
tmp_2 = false;
|
|
617
617
|
}
|
|
@@ -621,7 +621,7 @@
|
|
|
621
621
|
var tmp$ret$0;
|
|
622
622
|
// Inline function 'kotlin.math.max' call
|
|
623
623
|
var tmp_9 = op.get(0);
|
|
624
|
-
var tmp0_max = (isInterface(tmp_9, Numeric) ? tmp_9 : THROW_CCE()).
|
|
624
|
+
var tmp0_max = (isInterface(tmp_9, Numeric) ? tmp_9 : THROW_CCE()).m10().toInt();
|
|
625
625
|
tmp$ret$0 = Math.max(0, tmp0_max);
|
|
626
626
|
var tmp1_min = tmp$ret$0;
|
|
627
627
|
tmp$ret$1 = Math.min(1200, tmp1_min);
|
|
@@ -635,10 +635,10 @@
|
|
|
635
635
|
var tmp$ret$3;
|
|
636
636
|
$l$block: {
|
|
637
637
|
// Inline function 'kotlin.sequences.all' call
|
|
638
|
-
var tmp2_all = operator.
|
|
638
|
+
var tmp2_all = operator.gu();
|
|
639
639
|
var tmp0_iterator = tmp2_all.j();
|
|
640
640
|
while (tmp0_iterator.m()) {
|
|
641
|
-
var element = tmp0_iterator.
|
|
641
|
+
var element = tmp0_iterator.n();
|
|
642
642
|
var tmp$ret$2;
|
|
643
643
|
// Inline function 'it.unibo.tuprolog.core.parsing.DynamicOpListener.exitClause.<anonymous>' call
|
|
644
644
|
tmp$ret$2 = isInterface(element, Atom);
|
|
@@ -650,10 +650,10 @@
|
|
|
650
650
|
tmp$ret$3 = true;
|
|
651
651
|
}
|
|
652
652
|
if (tmp$ret$3) {
|
|
653
|
-
var tmp_10 = operator.
|
|
653
|
+
var tmp_10 = operator.gu();
|
|
654
654
|
var tmp2_iterator = map(tmp_10, DynamicOpListener$exitClause$lambda).j();
|
|
655
655
|
while (tmp2_iterator.m()) {
|
|
656
|
-
var it = tmp2_iterator.
|
|
656
|
+
var it = tmp2_iterator.n();
|
|
657
657
|
onOperatorDefined(this, new Operator(it.b1(), specifier, priority));
|
|
658
658
|
}
|
|
659
659
|
}
|
|
@@ -663,7 +663,7 @@
|
|
|
663
663
|
}
|
|
664
664
|
};
|
|
665
665
|
DynamicOpListener.prototype.exitClause = function (ctx) {
|
|
666
|
-
return this.
|
|
666
|
+
return this.g3j(ctx);
|
|
667
667
|
};
|
|
668
668
|
function parseException(token, message) {
|
|
669
669
|
return new ParseException(null, token.text, token.line, token.column, message, null);
|
|
@@ -755,13 +755,13 @@
|
|
|
755
755
|
return map(tmp_1, PrologParserFactory$parseClauses$lambda_2);
|
|
756
756
|
}
|
|
757
757
|
function PrologParserFactory$newErrorListener$1($whileParsing) {
|
|
758
|
-
this.
|
|
758
|
+
this.h3j_1 = $whileParsing;
|
|
759
759
|
}
|
|
760
760
|
PrologParserFactory$newErrorListener$1.prototype.syntaxError = function (recognizer, offendingSymbol, line, column, msg, e) {
|
|
761
761
|
if (recognizer instanceof PrologParser) {
|
|
762
762
|
recognizer.removeParseListeners();
|
|
763
763
|
}
|
|
764
|
-
throw new ParseException(this.
|
|
764
|
+
throw new ParseException(this.h3j_1, symbolToString(this, offendingSymbol), line, column + 1 | 0, msg, e);
|
|
765
765
|
};
|
|
766
766
|
function PrologParserFactory$parseClauses$lambda(it) {
|
|
767
767
|
return it + 1 | 0;
|
|
@@ -793,15 +793,15 @@
|
|
|
793
793
|
function PrologParserFactory() {
|
|
794
794
|
PrologParserFactory_instance = this;
|
|
795
795
|
}
|
|
796
|
-
PrologParserFactory.prototype.
|
|
797
|
-
var parser = this.
|
|
796
|
+
PrologParserFactory.prototype.i3j = function (string, withOperators) {
|
|
797
|
+
var parser = this.j3j(string, withOperators);
|
|
798
798
|
return parseExpression(this, parser, string);
|
|
799
799
|
};
|
|
800
|
-
PrologParserFactory.prototype.
|
|
801
|
-
var parser = this.
|
|
800
|
+
PrologParserFactory.prototype.k3j = function (source, withOperators) {
|
|
801
|
+
var parser = this.j3j(source, withOperators);
|
|
802
802
|
return parseClauses(this, parser, source);
|
|
803
803
|
};
|
|
804
|
-
PrologParserFactory.prototype.
|
|
804
|
+
PrologParserFactory.prototype.j3j = function (source, operators) {
|
|
805
805
|
var stream = new InputStream(source);
|
|
806
806
|
var lexer = new PrologLexer(stream);
|
|
807
807
|
lexer.removeErrorListeners();
|
|
@@ -811,17 +811,17 @@
|
|
|
811
811
|
var originalErrorStrategy = parser._errHandler;
|
|
812
812
|
parser._errHandler = new BailErrorStrategy();
|
|
813
813
|
parser._interp.predictionMode = PredictionMode.SLL;
|
|
814
|
-
return to(this.
|
|
814
|
+
return to(this.l3j(parser, operators), originalErrorStrategy);
|
|
815
815
|
};
|
|
816
|
-
PrologParserFactory.prototype.
|
|
816
|
+
PrologParserFactory.prototype.l3j = function (prologParser, operators) {
|
|
817
817
|
// Inline function 'kotlin.collections.forEach' call
|
|
818
818
|
var tmp0_iterator = operators.j();
|
|
819
819
|
while (tmp0_iterator.m()) {
|
|
820
|
-
var element = tmp0_iterator.
|
|
820
|
+
var element = tmp0_iterator.n();
|
|
821
821
|
// Inline function 'it.unibo.tuprolog.core.parsing.PrologParserFactory.addOperators.<anonymous>' call
|
|
822
|
-
prologParser.addOperator(element.
|
|
822
|
+
prologParser.addOperator(element.k1i_1, toAssociativity(element.l1i_1), element.m1i_1);
|
|
823
823
|
}
|
|
824
|
-
prologParser.addParseListener(Companion_getInstance_7().
|
|
824
|
+
prologParser.addParseListener(Companion_getInstance_7().f3j(prologParser));
|
|
825
825
|
return prologParser;
|
|
826
826
|
};
|
|
827
827
|
var PrologParserFactory_instance;
|
|
@@ -946,9 +946,9 @@
|
|
|
946
946
|
}
|
|
947
947
|
function postfix($this, term, ops) {
|
|
948
948
|
var operator = ops.j();
|
|
949
|
-
var result = $this.
|
|
949
|
+
var result = $this.m3j_1.structOf(operator.n(), [term]);
|
|
950
950
|
while (operator.m()) {
|
|
951
|
-
result = $this.
|
|
951
|
+
result = $this.m3j_1.structOf(operator.n(), [result]);
|
|
952
952
|
}
|
|
953
953
|
return result;
|
|
954
954
|
}
|
|
@@ -976,12 +976,12 @@
|
|
|
976
976
|
return prefix($this, tmp, tmp$ret$2);
|
|
977
977
|
}
|
|
978
978
|
function prefix($this, term, ops) {
|
|
979
|
-
var i = ops.
|
|
979
|
+
var i = ops.p() - 1 | 0;
|
|
980
980
|
var tmp0 = i;
|
|
981
981
|
i = tmp0 - 1 | 0;
|
|
982
|
-
var result = $this.
|
|
982
|
+
var result = $this.m3j_1.structOf(ops.o(tmp0), [term]);
|
|
983
983
|
while (i >= 0) {
|
|
984
|
-
result = $this.
|
|
984
|
+
result = $this.m3j_1.structOf(ops.o(i), [result]);
|
|
985
985
|
var tmp1 = i;
|
|
986
986
|
i = tmp1 - 1 | 0;
|
|
987
987
|
}
|
|
@@ -1010,7 +1010,7 @@
|
|
|
1010
1010
|
var tmp0_mapTo = ArrayList_init_$Create$(collectionSizeOrDefault(tmp0_map, 10));
|
|
1011
1011
|
var tmp0_iterator = tmp0_map.j();
|
|
1012
1012
|
while (tmp0_iterator.m()) {
|
|
1013
|
-
var item = tmp0_iterator.
|
|
1013
|
+
var item = tmp0_iterator.n();
|
|
1014
1014
|
var tmp$ret$0;
|
|
1015
1015
|
// Inline function 'it.unibo.tuprolog.core.parsing.PrologVisitor.visitInfixNonAssociativeExpression.<anonymous>' call
|
|
1016
1016
|
tmp$ret$0 = item.accept($this);
|
|
@@ -1042,13 +1042,13 @@
|
|
|
1042
1042
|
return infixNonAssociative($this, operands, operators);
|
|
1043
1043
|
}
|
|
1044
1044
|
function infixNonAssociative($this, terms, ops) {
|
|
1045
|
-
return $this.
|
|
1045
|
+
return $this.m3j_1.structOf(ops.o(0), [terms.o(0), terms.o(1)]);
|
|
1046
1046
|
}
|
|
1047
1047
|
function handleOuters($this, expression, outers) {
|
|
1048
1048
|
var result = expression;
|
|
1049
1049
|
var tmp0_iterator = outers.j();
|
|
1050
1050
|
while (tmp0_iterator.m()) {
|
|
1051
|
-
var o = tmp0_iterator.
|
|
1051
|
+
var o = tmp0_iterator.n();
|
|
1052
1052
|
var tmp = listOf(result);
|
|
1053
1053
|
var tmp$ret$2;
|
|
1054
1054
|
// Inline function 'kotlin.collections.map' call
|
|
@@ -1110,16 +1110,16 @@
|
|
|
1110
1110
|
return result;
|
|
1111
1111
|
}
|
|
1112
1112
|
function infixRight($this, terms, ops) {
|
|
1113
|
-
var i = terms.
|
|
1114
|
-
var j = ops.
|
|
1113
|
+
var i = terms.p() - 1 | 0;
|
|
1114
|
+
var j = ops.p() - 1 | 0;
|
|
1115
1115
|
var tmp0 = j;
|
|
1116
1116
|
j = tmp0 - 1 | 0;
|
|
1117
|
-
var result = $this.
|
|
1117
|
+
var result = $this.m3j_1.structOf(ops.o(tmp0), [terms.o(i - 1 | 0), terms.o(i)]);
|
|
1118
1118
|
i = i - 2 | 0;
|
|
1119
1119
|
while (i >= 0) {
|
|
1120
1120
|
var tmp1 = j;
|
|
1121
1121
|
j = tmp1 - 1 | 0;
|
|
1122
|
-
result = $this.
|
|
1122
|
+
result = $this.m3j_1.structOf(ops.o(tmp1), [terms.o(i), result]);
|
|
1123
1123
|
var tmp2 = i;
|
|
1124
1124
|
i = tmp2 - 1 | 0;
|
|
1125
1125
|
}
|
|
@@ -1130,17 +1130,17 @@
|
|
|
1130
1130
|
var j = 0;
|
|
1131
1131
|
var tmp0 = j;
|
|
1132
1132
|
j = tmp0 + 1 | 0;
|
|
1133
|
-
var tmp = ops.
|
|
1133
|
+
var tmp = ops.o(tmp0);
|
|
1134
1134
|
var tmp1 = i;
|
|
1135
1135
|
i = tmp1 + 1 | 0;
|
|
1136
|
-
var tmp_0 = terms.
|
|
1136
|
+
var tmp_0 = terms.o(tmp1);
|
|
1137
1137
|
var tmp2 = i;
|
|
1138
1138
|
i = tmp2 + 1 | 0;
|
|
1139
|
-
var result = $this.
|
|
1140
|
-
while (i < terms.
|
|
1139
|
+
var result = $this.m3j_1.structOf(tmp, [tmp_0, terms.o(tmp2)]);
|
|
1140
|
+
while (i < terms.p()) {
|
|
1141
1141
|
var tmp3 = j;
|
|
1142
1142
|
j = tmp3 + 1 | 0;
|
|
1143
|
-
result = $this.
|
|
1143
|
+
result = $this.m3j_1.structOf(ops.o(tmp3), [result, terms.o(i)]);
|
|
1144
1144
|
var tmp4 = i;
|
|
1145
1145
|
i = tmp4 + 1 | 0;
|
|
1146
1146
|
}
|
|
@@ -1155,7 +1155,7 @@
|
|
|
1155
1155
|
var tmp0_mapTo = ArrayList_init_$Create$(collectionSizeOrDefault(tmp0_map, 10));
|
|
1156
1156
|
var tmp0_iterator = tmp0_map.j();
|
|
1157
1157
|
while (tmp0_iterator.m()) {
|
|
1158
|
-
var item = tmp0_iterator.
|
|
1158
|
+
var item = tmp0_iterator.n();
|
|
1159
1159
|
var tmp$ret$0;
|
|
1160
1160
|
// Inline function 'it.unibo.tuprolog.core.parsing.PrologVisitor.listOfOperands.<anonymous>' call
|
|
1161
1161
|
tmp$ret$0 = ensureNotNull(item).accept($this);
|
|
@@ -1205,7 +1205,7 @@
|
|
|
1205
1205
|
}
|
|
1206
1206
|
function PrologVisitor$visitExpression$ref($boundThis) {
|
|
1207
1207
|
var l = function (p0) {
|
|
1208
|
-
return $boundThis.
|
|
1208
|
+
return $boundThis.n3j(p0);
|
|
1209
1209
|
};
|
|
1210
1210
|
l.callableName = 'visitExpression';
|
|
1211
1211
|
return l;
|
|
@@ -1217,30 +1217,30 @@
|
|
|
1217
1217
|
}
|
|
1218
1218
|
function PrologVisitor(scope) {
|
|
1219
1219
|
PrologParserVisitor.call(this);
|
|
1220
|
-
this.
|
|
1220
|
+
this.m3j_1 = scope;
|
|
1221
1221
|
}
|
|
1222
|
-
PrologVisitor.prototype.
|
|
1223
|
-
return this.
|
|
1222
|
+
PrologVisitor.prototype.o3j = function (ctx) {
|
|
1223
|
+
return this.p3j(ctx.term());
|
|
1224
1224
|
};
|
|
1225
1225
|
PrologVisitor.prototype.visitSingletonTerm = function (ctx) {
|
|
1226
|
-
return this.
|
|
1226
|
+
return this.o3j(ctx);
|
|
1227
1227
|
};
|
|
1228
|
-
PrologVisitor.prototype.
|
|
1229
|
-
return this.
|
|
1228
|
+
PrologVisitor.prototype.q3j = function (ctx) {
|
|
1229
|
+
return this.n3j(ctx.expression());
|
|
1230
1230
|
};
|
|
1231
1231
|
PrologVisitor.prototype.visitSingletonExpression = function (ctx) {
|
|
1232
|
-
return this.
|
|
1232
|
+
return this.q3j(ctx);
|
|
1233
1233
|
};
|
|
1234
|
-
PrologVisitor.prototype.
|
|
1234
|
+
PrologVisitor.prototype.r3j = function (ctx) {
|
|
1235
1235
|
return toClause(ctx.expression().accept(this), null, ensureNotNull(ctx.start).line, ensureNotNull(ctx.start).column);
|
|
1236
1236
|
};
|
|
1237
1237
|
PrologVisitor.prototype.visitClause = function (ctx) {
|
|
1238
|
-
return this.
|
|
1238
|
+
return this.r3j(ctx);
|
|
1239
1239
|
};
|
|
1240
|
-
PrologVisitor.prototype.
|
|
1240
|
+
PrologVisitor.prototype.n3j = function (ctx) {
|
|
1241
1241
|
var tmp;
|
|
1242
1242
|
if (ctx.isTerm) {
|
|
1243
|
-
tmp = this.
|
|
1243
|
+
tmp = this.p3j(ensureNotNull(ctx.left));
|
|
1244
1244
|
} else if (contains(Associativity.INFIX, ctx.associativity)) {
|
|
1245
1245
|
tmp = visitInfixExpression(this, ctx);
|
|
1246
1246
|
} else if (contains(Associativity.POSTFIX, ctx.associativity)) {
|
|
@@ -1253,12 +1253,12 @@
|
|
|
1253
1253
|
return handleOuters(this, tmp, flatten_0(this, asList(ctx.outers)));
|
|
1254
1254
|
};
|
|
1255
1255
|
PrologVisitor.prototype.visitExpression = function (ctx) {
|
|
1256
|
-
return this.
|
|
1256
|
+
return this.n3j(ctx);
|
|
1257
1257
|
};
|
|
1258
|
-
PrologVisitor.prototype.
|
|
1258
|
+
PrologVisitor.prototype.p3j = function (ctx) {
|
|
1259
1259
|
var tmp;
|
|
1260
1260
|
if (ctx.isExpr) {
|
|
1261
|
-
tmp = this.
|
|
1261
|
+
tmp = this.n3j(ctx.expression());
|
|
1262
1262
|
} else {
|
|
1263
1263
|
var tmp_0 = ctx.children[0].accept(this);
|
|
1264
1264
|
tmp = (!(tmp_0 == null) ? isInterface(tmp_0, Term) : false) ? tmp_0 : THROW_CCE();
|
|
@@ -1266,23 +1266,23 @@
|
|
|
1266
1266
|
return tmp;
|
|
1267
1267
|
};
|
|
1268
1268
|
PrologVisitor.prototype.visitTerm = function (ctx) {
|
|
1269
|
-
return this.
|
|
1269
|
+
return this.p3j(ctx);
|
|
1270
1270
|
};
|
|
1271
|
-
PrologVisitor.prototype.
|
|
1271
|
+
PrologVisitor.prototype.s3j = function (ctx) {
|
|
1272
1272
|
var value = parseInteger_0(this, ctx);
|
|
1273
1273
|
return Companion_getInstance_4().ofBigInteger(value);
|
|
1274
1274
|
};
|
|
1275
1275
|
PrologVisitor.prototype.visitInteger = function (ctx) {
|
|
1276
|
-
return this.
|
|
1276
|
+
return this.s3j(ctx);
|
|
1277
1277
|
};
|
|
1278
|
-
PrologVisitor.prototype.
|
|
1278
|
+
PrologVisitor.prototype.t3j = function (ctx) {
|
|
1279
1279
|
var tmp = ctx.children[0].accept(this);
|
|
1280
1280
|
return (!(tmp == null) ? isInterface(tmp, Term) : false) ? tmp : THROW_CCE();
|
|
1281
1281
|
};
|
|
1282
1282
|
PrologVisitor.prototype.visitNumber = function (ctx) {
|
|
1283
|
-
return this.
|
|
1283
|
+
return this.t3j(ctx);
|
|
1284
1284
|
};
|
|
1285
|
-
PrologVisitor.prototype.
|
|
1285
|
+
PrologVisitor.prototype.u3j = function (ctx) {
|
|
1286
1286
|
var raw = ctx.value.text;
|
|
1287
1287
|
if (!(ctx.sign == null)) {
|
|
1288
1288
|
var tmp0_safe_receiver = ctx.sign;
|
|
@@ -1303,40 +1303,40 @@
|
|
|
1303
1303
|
return tmp;
|
|
1304
1304
|
};
|
|
1305
1305
|
PrologVisitor.prototype.visitReal = function (ctx) {
|
|
1306
|
-
return this.
|
|
1306
|
+
return this.u3j(ctx);
|
|
1307
1307
|
};
|
|
1308
|
-
PrologVisitor.prototype.
|
|
1308
|
+
PrologVisitor.prototype.v3j = function (ctx) {
|
|
1309
1309
|
var tmp;
|
|
1310
1310
|
if (ctx.isAnonymous) {
|
|
1311
|
-
tmp = this.
|
|
1311
|
+
tmp = this.m3j_1.anonymous();
|
|
1312
1312
|
} else {
|
|
1313
|
-
tmp = this.
|
|
1313
|
+
tmp = this.m3j_1.varOf(ctx.value.text);
|
|
1314
1314
|
}
|
|
1315
1315
|
return tmp;
|
|
1316
1316
|
};
|
|
1317
1317
|
PrologVisitor.prototype.visitVariable = function (ctx) {
|
|
1318
|
-
return this.
|
|
1318
|
+
return this.v3j(ctx);
|
|
1319
1319
|
};
|
|
1320
|
-
PrologVisitor.prototype.
|
|
1320
|
+
PrologVisitor.prototype.w3j = function (ctx) {
|
|
1321
1321
|
if (ctx.isList) {
|
|
1322
|
-
return this.
|
|
1322
|
+
return this.m3j_1.listOf([]);
|
|
1323
1323
|
} else if (ctx.isBlock) {
|
|
1324
|
-
return this.
|
|
1324
|
+
return this.m3j_1.setOf([]);
|
|
1325
1325
|
}
|
|
1326
1326
|
var tmp;
|
|
1327
1327
|
if (ctx.arity === 0) {
|
|
1328
|
-
tmp = this.
|
|
1328
|
+
tmp = this.m3j_1.atomOf(ctx.functor.text);
|
|
1329
1329
|
} else {
|
|
1330
1330
|
var tmp_0 = ctx.functor.text;
|
|
1331
1331
|
var tmp_1 = asSequence_0(ctx.args);
|
|
1332
|
-
tmp = this.
|
|
1332
|
+
tmp = this.m3j_1.structOfSequence(tmp_0, map(tmp_1, PrologVisitor$visitExpression$ref(this)));
|
|
1333
1333
|
}
|
|
1334
1334
|
return tmp;
|
|
1335
1335
|
};
|
|
1336
1336
|
PrologVisitor.prototype.visitStructure = function (ctx) {
|
|
1337
|
-
return this.
|
|
1337
|
+
return this.w3j(ctx);
|
|
1338
1338
|
};
|
|
1339
|
-
PrologVisitor.prototype.
|
|
1339
|
+
PrologVisitor.prototype.x3j = function (ctx) {
|
|
1340
1340
|
var tmp$ret$1;
|
|
1341
1341
|
// Inline function 'kotlin.collections.map' call
|
|
1342
1342
|
var tmp0_map = ctx.items;
|
|
@@ -1349,7 +1349,7 @@
|
|
|
1349
1349
|
while (inductionVariable < last) {
|
|
1350
1350
|
var item = indexedObject[inductionVariable];
|
|
1351
1351
|
inductionVariable = inductionVariable + 1 | 0;
|
|
1352
|
-
tmp0_mapTo.g(this.
|
|
1352
|
+
tmp0_mapTo.g(this.n3j(item));
|
|
1353
1353
|
}
|
|
1354
1354
|
tmp$ret$0 = tmp0_mapTo;
|
|
1355
1355
|
tmp$ret$1 = tmp$ret$0;
|
|
@@ -1357,19 +1357,19 @@
|
|
|
1357
1357
|
var tmp;
|
|
1358
1358
|
if (ctx.hasTail) {
|
|
1359
1359
|
var tmp0_safe_receiver = ctx.tail;
|
|
1360
|
-
tmp = this.
|
|
1360
|
+
tmp = this.m3j_1.v11(terms, tmp0_safe_receiver == null ? null : tmp0_safe_receiver.accept(this));
|
|
1361
1361
|
} else {
|
|
1362
|
-
tmp = this.
|
|
1362
|
+
tmp = this.m3j_1.listOfIterable(terms);
|
|
1363
1363
|
}
|
|
1364
1364
|
return tmp;
|
|
1365
1365
|
};
|
|
1366
1366
|
PrologVisitor.prototype.visitList = function (ctx) {
|
|
1367
|
-
return this.
|
|
1367
|
+
return this.x3j(ctx);
|
|
1368
1368
|
};
|
|
1369
|
-
PrologVisitor.prototype.
|
|
1369
|
+
PrologVisitor.prototype.y3j = function (ctx) {
|
|
1370
1370
|
var tmp;
|
|
1371
1371
|
if (ctx.length === 1) {
|
|
1372
|
-
tmp = this.
|
|
1372
|
+
tmp = this.m3j_1.setOf([ctx.items[0].accept(this)]);
|
|
1373
1373
|
} else {
|
|
1374
1374
|
var tmp$ret$1;
|
|
1375
1375
|
// Inline function 'kotlin.collections.map' call
|
|
@@ -1383,32 +1383,32 @@
|
|
|
1383
1383
|
while (inductionVariable < last) {
|
|
1384
1384
|
var item = indexedObject[inductionVariable];
|
|
1385
1385
|
inductionVariable = inductionVariable + 1 | 0;
|
|
1386
|
-
tmp0_mapTo.g(this.
|
|
1386
|
+
tmp0_mapTo.g(this.n3j(item));
|
|
1387
1387
|
}
|
|
1388
1388
|
tmp$ret$0 = tmp0_mapTo;
|
|
1389
1389
|
tmp$ret$1 = tmp$ret$0;
|
|
1390
|
-
tmp = this.
|
|
1390
|
+
tmp = this.m3j_1.setOfIterable(tmp$ret$1);
|
|
1391
1391
|
}
|
|
1392
1392
|
return tmp;
|
|
1393
1393
|
};
|
|
1394
1394
|
PrologVisitor.prototype.visitBlock = function (ctx) {
|
|
1395
|
-
return this.
|
|
1395
|
+
return this.y3j(ctx);
|
|
1396
1396
|
};
|
|
1397
1397
|
function termParserWithOperators(operators, scope) {
|
|
1398
1398
|
return new TermParserImpl(scope, operators);
|
|
1399
1399
|
}
|
|
1400
1400
|
function TermParserImpl(scope, defaultOperatorSet) {
|
|
1401
|
-
this.
|
|
1402
|
-
this.
|
|
1401
|
+
this.z3j_1 = scope;
|
|
1402
|
+
this.a3k_1 = defaultOperatorSet;
|
|
1403
1403
|
}
|
|
1404
|
-
TermParserImpl.prototype.
|
|
1405
|
-
return this.
|
|
1404
|
+
TermParserImpl.prototype.c3j = function () {
|
|
1405
|
+
return this.a3k_1;
|
|
1406
1406
|
};
|
|
1407
|
-
TermParserImpl.prototype.
|
|
1408
|
-
return PrologParserFactory_getInstance().
|
|
1407
|
+
TermParserImpl.prototype.b3k = function (input, operators) {
|
|
1408
|
+
return PrologParserFactory_getInstance().i3j(input, operators).accept(new PrologVisitor(this.z3j_1));
|
|
1409
1409
|
};
|
|
1410
1410
|
TermParserImpl.prototype.parseTermWithOperators = function (input, operators) {
|
|
1411
|
-
return this.
|
|
1411
|
+
return this.b3k(input, operators);
|
|
1412
1412
|
};
|
|
1413
1413
|
//region block: post-declaration
|
|
1414
1414
|
TermParserImpl.prototype.parseTerm = parseTerm;
|