@tuprolog/2p-full 0.32.4 → 1.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-bdd.js +136 -136
- package/2p-core.js +379 -412
- package/2p-core.js.map +1 -1
- package/2p-io-lib.js +463 -463
- package/2p-oop-lib.js +594 -594
- package/2p-oop-lib.js.map +1 -1
- package/2p-parser-core.js +114 -114
- package/2p-parser-core.js.map +1 -1
- package/2p-parser-theory.js +11 -11
- package/2p-repl.js +63 -63
- package/2p-repl.js.map +1 -1
- package/2p-solve-classic.js +794 -794
- package/2p-solve-classic.js.map +1 -1
- package/2p-solve-plp.js +1 -1
- package/2p-solve-problog.js +922 -922
- package/2p-solve-problog.js.map +1 -1
- package/2p-solve-streams.js +641 -641
- package/2p-solve.js +2877 -2867
- package/2p-solve.js.map +1 -1
- package/2p-test-dsl.js +15 -0
- package/2p-test-dsl.js.map +1 -0
- package/2p-theory.js +1342 -1065
- package/2p-theory.js.map +1 -1
- package/2p-unify.js +160 -160
- package/2p-utils.js +3 -3
- package/2p-utils.js.map +1 -1
- package/clikt-clikt-js-ir.js +1010 -1010
- package/kotlin-kotlin-stdlib.js +31 -31
- package/kotlin-kotlin-stdlib.js.map +1 -1
- package/kotlin-kotlin-test-kotlin-test-js-ir.js +15 -0
- package/kotlin-kotlin-test-kotlin-test-js-ir.js.map +1 -0
- package/package.json +1 -1
package/2p-parser-core.js
CHANGED
|
@@ -118,7 +118,7 @@
|
|
|
118
118
|
setMetadataFor(InvalidTermTypeException, 'InvalidTermTypeException', classMeta, ParseException);
|
|
119
119
|
setMetadataFor(Companion, 'Companion', objectMeta);
|
|
120
120
|
function parseTerm(input) {
|
|
121
|
-
return this.parseTermWithOperators(input, this.
|
|
121
|
+
return this.parseTermWithOperators(input, this.r3i());
|
|
122
122
|
}
|
|
123
123
|
function parseStructWithOperators(input, operators) {
|
|
124
124
|
// Inline function 'it.unibo.tuprolog.core.parsing.Companion.parseAs' call
|
|
@@ -136,7 +136,7 @@
|
|
|
136
136
|
return tmp;
|
|
137
137
|
}
|
|
138
138
|
function parseStruct(input) {
|
|
139
|
-
return this.parseStructWithOperators(input, this.
|
|
139
|
+
return this.parseStructWithOperators(input, this.r3i());
|
|
140
140
|
}
|
|
141
141
|
function parseConstantWithOperators(input, operators) {
|
|
142
142
|
// Inline function 'it.unibo.tuprolog.core.parsing.Companion.parseAs' call
|
|
@@ -154,7 +154,7 @@
|
|
|
154
154
|
return tmp;
|
|
155
155
|
}
|
|
156
156
|
function parseConstant(input) {
|
|
157
|
-
return this.parseConstantWithOperators(input, this.
|
|
157
|
+
return this.parseConstantWithOperators(input, this.r3i());
|
|
158
158
|
}
|
|
159
159
|
function parseVarWithOperators(input, operators) {
|
|
160
160
|
// Inline function 'it.unibo.tuprolog.core.parsing.Companion.parseAs' call
|
|
@@ -172,7 +172,7 @@
|
|
|
172
172
|
return tmp;
|
|
173
173
|
}
|
|
174
174
|
function parseVar(input) {
|
|
175
|
-
return this.parseVarWithOperators(input, this.
|
|
175
|
+
return this.parseVarWithOperators(input, this.r3i());
|
|
176
176
|
}
|
|
177
177
|
function parseAtomWithOperators(input, operators) {
|
|
178
178
|
// Inline function 'it.unibo.tuprolog.core.parsing.Companion.parseAs' call
|
|
@@ -190,7 +190,7 @@
|
|
|
190
190
|
return tmp;
|
|
191
191
|
}
|
|
192
192
|
function parseAtom(input) {
|
|
193
|
-
return this.parseAtomWithOperators(input, this.
|
|
193
|
+
return this.parseAtomWithOperators(input, this.r3i());
|
|
194
194
|
}
|
|
195
195
|
function parseNumericWithOperators(input, operators) {
|
|
196
196
|
// Inline function 'it.unibo.tuprolog.core.parsing.Companion.parseAs' call
|
|
@@ -208,7 +208,7 @@
|
|
|
208
208
|
return tmp;
|
|
209
209
|
}
|
|
210
210
|
function parseNumeric(input) {
|
|
211
|
-
return this.parseNumericWithOperators(input, this.
|
|
211
|
+
return this.parseNumericWithOperators(input, this.r3i());
|
|
212
212
|
}
|
|
213
213
|
function parseIntegerWithOperators(input, operators) {
|
|
214
214
|
// Inline function 'it.unibo.tuprolog.core.parsing.Companion.parseAs' call
|
|
@@ -226,7 +226,7 @@
|
|
|
226
226
|
return tmp;
|
|
227
227
|
}
|
|
228
228
|
function parseInteger(input) {
|
|
229
|
-
return this.parseIntegerWithOperators(input, this.
|
|
229
|
+
return this.parseIntegerWithOperators(input, this.r3i());
|
|
230
230
|
}
|
|
231
231
|
function parseRealWithOperators(input, operators) {
|
|
232
232
|
// Inline function 'it.unibo.tuprolog.core.parsing.Companion.parseAs' call
|
|
@@ -244,7 +244,7 @@
|
|
|
244
244
|
return tmp;
|
|
245
245
|
}
|
|
246
246
|
function parseReal(input) {
|
|
247
|
-
return this.parseRealWithOperators(input, this.
|
|
247
|
+
return this.parseRealWithOperators(input, this.r3i());
|
|
248
248
|
}
|
|
249
249
|
function parseClauseWithOperators(input, operators) {
|
|
250
250
|
// Inline function 'it.unibo.tuprolog.core.parsing.Companion.parseAs' call
|
|
@@ -262,7 +262,7 @@
|
|
|
262
262
|
return tmp;
|
|
263
263
|
}
|
|
264
264
|
function parseClause(input) {
|
|
265
|
-
return this.parseClauseWithOperators(input, this.
|
|
265
|
+
return this.parseClauseWithOperators(input, this.r3i());
|
|
266
266
|
}
|
|
267
267
|
function parseRuleWithOperators(input, operators) {
|
|
268
268
|
// Inline function 'it.unibo.tuprolog.core.parsing.Companion.parseAs' call
|
|
@@ -280,7 +280,7 @@
|
|
|
280
280
|
return tmp;
|
|
281
281
|
}
|
|
282
282
|
function parseRule(input) {
|
|
283
|
-
return this.parseRuleWithOperators(input, this.
|
|
283
|
+
return this.parseRuleWithOperators(input, this.r3i());
|
|
284
284
|
}
|
|
285
285
|
function parseFactWithOperators(input, operators) {
|
|
286
286
|
// Inline function 'it.unibo.tuprolog.core.parsing.Companion.parseAs' call
|
|
@@ -298,7 +298,7 @@
|
|
|
298
298
|
return tmp;
|
|
299
299
|
}
|
|
300
300
|
function parseFact(input) {
|
|
301
|
-
return this.parseFactWithOperators(input, this.
|
|
301
|
+
return this.parseFactWithOperators(input, this.r3i());
|
|
302
302
|
}
|
|
303
303
|
function parseDirectiveWithOperators(input, operators) {
|
|
304
304
|
// Inline function 'it.unibo.tuprolog.core.parsing.Companion.parseAs' call
|
|
@@ -316,7 +316,7 @@
|
|
|
316
316
|
return tmp;
|
|
317
317
|
}
|
|
318
318
|
function parseDirective(input) {
|
|
319
|
-
return this.parseDirectiveWithOperators(input, this.
|
|
319
|
+
return this.parseDirectiveWithOperators(input, this.r3i());
|
|
320
320
|
}
|
|
321
321
|
setMetadataFor(TermParser, 'TermParser', interfaceMeta);
|
|
322
322
|
setMetadataFor(Companion_0, 'Companion', objectMeta);
|
|
@@ -341,8 +341,8 @@
|
|
|
341
341
|
throwable = throwable === VOID ? null : throwable;
|
|
342
342
|
ParseException.call(this, input, offendingSymbol, line, column, message, throwable);
|
|
343
343
|
captureStack(this, InvalidTermTypeException);
|
|
344
|
-
this.
|
|
345
|
-
this.
|
|
344
|
+
this.a3i_1 = term;
|
|
345
|
+
this.b3i_1 = type;
|
|
346
346
|
}
|
|
347
347
|
function ParseException(input, offendingSymbol, line, column, message, throwable) {
|
|
348
348
|
TuPrologException_init_$Init$(message, throwable, this);
|
|
@@ -353,34 +353,34 @@
|
|
|
353
353
|
this.column = column;
|
|
354
354
|
this.clauseIndex = -1;
|
|
355
355
|
}
|
|
356
|
-
protoOf(ParseException).
|
|
356
|
+
protoOf(ParseException).c3i = function (_set____db54di) {
|
|
357
357
|
this.input = _set____db54di;
|
|
358
358
|
};
|
|
359
|
-
protoOf(ParseException).
|
|
359
|
+
protoOf(ParseException).d3i = function () {
|
|
360
360
|
return this.input;
|
|
361
361
|
};
|
|
362
|
-
protoOf(ParseException).
|
|
362
|
+
protoOf(ParseException).e3i = function (_set____db54di) {
|
|
363
363
|
this.offendingSymbol = _set____db54di;
|
|
364
364
|
};
|
|
365
|
-
protoOf(ParseException).
|
|
365
|
+
protoOf(ParseException).f3i = function () {
|
|
366
366
|
return this.offendingSymbol;
|
|
367
367
|
};
|
|
368
|
-
protoOf(ParseException).
|
|
368
|
+
protoOf(ParseException).g3i = function (_set____db54di) {
|
|
369
369
|
this.line = _set____db54di;
|
|
370
370
|
};
|
|
371
|
-
protoOf(ParseException).
|
|
371
|
+
protoOf(ParseException).h3i = function () {
|
|
372
372
|
return this.line;
|
|
373
373
|
};
|
|
374
|
-
protoOf(ParseException).
|
|
374
|
+
protoOf(ParseException).i3i = function (_set____db54di) {
|
|
375
375
|
this.column = _set____db54di;
|
|
376
376
|
};
|
|
377
|
-
protoOf(ParseException).
|
|
377
|
+
protoOf(ParseException).j3i = function () {
|
|
378
378
|
return this.column;
|
|
379
379
|
};
|
|
380
|
-
protoOf(ParseException).
|
|
380
|
+
protoOf(ParseException).k3i = function (_set____db54di) {
|
|
381
381
|
this.clauseIndex = _set____db54di;
|
|
382
382
|
};
|
|
383
|
-
protoOf(ParseException).
|
|
383
|
+
protoOf(ParseException).l3i = function () {
|
|
384
384
|
return this.clauseIndex;
|
|
385
385
|
};
|
|
386
386
|
protoOf(ParseException).toString = function () {
|
|
@@ -423,40 +423,40 @@
|
|
|
423
423
|
}
|
|
424
424
|
function Companion() {
|
|
425
425
|
}
|
|
426
|
-
protoOf(Companion).
|
|
427
|
-
return this.
|
|
426
|
+
protoOf(Companion).m3i = function (scope) {
|
|
427
|
+
return this.n3i(Companion_getInstance().EMPTY, scope);
|
|
428
428
|
};
|
|
429
429
|
protoOf(Companion).withNoOperator = function (scope, $super) {
|
|
430
430
|
scope = scope === VOID ? Companion_instance.empty() : scope;
|
|
431
|
-
return $super === VOID ? this.
|
|
431
|
+
return $super === VOID ? this.m3i(scope) : $super.m3i.call(this, scope);
|
|
432
432
|
};
|
|
433
|
-
protoOf(Companion).
|
|
434
|
-
return this.
|
|
433
|
+
protoOf(Companion).o3i = function (scope) {
|
|
434
|
+
return this.n3i(Companion_getInstance().STANDARD, scope);
|
|
435
435
|
};
|
|
436
436
|
protoOf(Companion).withStandardOperators = function (scope, $super) {
|
|
437
437
|
scope = scope === VOID ? Companion_instance.empty() : scope;
|
|
438
|
-
return $super === VOID ? this.
|
|
438
|
+
return $super === VOID ? this.o3i(scope) : $super.o3i.call(this, scope);
|
|
439
439
|
};
|
|
440
|
-
protoOf(Companion).
|
|
441
|
-
return this.
|
|
440
|
+
protoOf(Companion).p3i = function (scope) {
|
|
441
|
+
return this.n3i(Companion_getInstance().DEFAULT, scope);
|
|
442
442
|
};
|
|
443
443
|
protoOf(Companion).withDefaultOperators = function (scope, $super) {
|
|
444
444
|
scope = scope === VOID ? Companion_instance.empty() : scope;
|
|
445
|
-
return $super === VOID ? this.
|
|
445
|
+
return $super === VOID ? this.p3i(scope) : $super.p3i.call(this, scope);
|
|
446
446
|
};
|
|
447
|
-
protoOf(Companion).
|
|
447
|
+
protoOf(Companion).n3i = function (operators, scope) {
|
|
448
448
|
return termParserWithOperators(operators, scope);
|
|
449
449
|
};
|
|
450
450
|
protoOf(Companion).withOperatorSet = function (operators, scope, $super) {
|
|
451
451
|
scope = scope === VOID ? Companion_instance.empty() : scope;
|
|
452
|
-
return $super === VOID ? this.
|
|
452
|
+
return $super === VOID ? this.n3i(operators, scope) : $super.n3i.call(this, operators, scope);
|
|
453
453
|
};
|
|
454
|
-
protoOf(Companion).
|
|
455
|
-
return this.
|
|
454
|
+
protoOf(Companion).q3i = function (operators, scope) {
|
|
455
|
+
return this.n3i(OperatorSet_init_$Create$(operators.slice()), scope);
|
|
456
456
|
};
|
|
457
457
|
protoOf(Companion).withOperators = function (operators, scope, $super) {
|
|
458
458
|
scope = scope === VOID ? Companion_instance.empty() : scope;
|
|
459
|
-
return $super === VOID ? this.
|
|
459
|
+
return $super === VOID ? this.q3i(operators, scope) : $super.q3i.call(this, operators, scope);
|
|
460
460
|
};
|
|
461
461
|
var Companion_instance_1;
|
|
462
462
|
function Companion_getInstance_4() {
|
|
@@ -496,12 +496,12 @@
|
|
|
496
496
|
return Unit_instance;
|
|
497
497
|
}
|
|
498
498
|
function onOperatorDefined($this, operator) {
|
|
499
|
-
$this.
|
|
500
|
-
$this.
|
|
499
|
+
$this.s3i_1.addOperator(operator.l1i_1, toAssociativity(operator.m1i_1), operator.n1i_1);
|
|
500
|
+
$this.t3i_1($this.s3i_1, operator);
|
|
501
501
|
}
|
|
502
502
|
function Companion_0() {
|
|
503
503
|
}
|
|
504
|
-
protoOf(Companion_0).
|
|
504
|
+
protoOf(Companion_0).u3i = function (parser) {
|
|
505
505
|
return new DynamicOpListener(parser, DynamicOpListener$Companion$of$lambda);
|
|
506
506
|
};
|
|
507
507
|
var Companion_instance_2;
|
|
@@ -513,10 +513,10 @@
|
|
|
513
513
|
}
|
|
514
514
|
function DynamicOpListener(parser, operatorDefinedCallback) {
|
|
515
515
|
PrologParserListener.call(this);
|
|
516
|
-
this.
|
|
517
|
-
this.
|
|
516
|
+
this.s3i_1 = parser;
|
|
517
|
+
this.t3i_1 = operatorDefinedCallback;
|
|
518
518
|
}
|
|
519
|
-
protoOf(DynamicOpListener).
|
|
519
|
+
protoOf(DynamicOpListener).v3i = function (ctx) {
|
|
520
520
|
var expr = ctx.expression();
|
|
521
521
|
if (ctx.exception != null) {
|
|
522
522
|
return Unit_instance;
|
|
@@ -580,7 +580,7 @@
|
|
|
580
580
|
}
|
|
581
581
|
};
|
|
582
582
|
protoOf(DynamicOpListener).exitClause = function (ctx) {
|
|
583
|
-
return this.
|
|
583
|
+
return this.v3i(ctx);
|
|
584
584
|
};
|
|
585
585
|
function parseException(token, message) {
|
|
586
586
|
return new ParseException(null, token.text, token.line, token.column, message, null);
|
|
@@ -670,13 +670,13 @@
|
|
|
670
670
|
return map(tmp_1, PrologParserFactory$parseClauses$lambda_2);
|
|
671
671
|
}
|
|
672
672
|
function PrologParserFactory$newErrorListener$1($whileParsing) {
|
|
673
|
-
this.
|
|
673
|
+
this.w3i_1 = $whileParsing;
|
|
674
674
|
}
|
|
675
675
|
protoOf(PrologParserFactory$newErrorListener$1).syntaxError = function (recognizer, offendingSymbol, line, column, msg, e) {
|
|
676
676
|
if (recognizer instanceof PrologParser) {
|
|
677
677
|
recognizer.removeParseListeners();
|
|
678
678
|
}
|
|
679
|
-
throw new ParseException(this.
|
|
679
|
+
throw new ParseException(this.w3i_1, symbolToString(this, offendingSymbol), line, column + 1 | 0, msg, e);
|
|
680
680
|
};
|
|
681
681
|
function PrologParserFactory$parseClauses$lambda(it) {
|
|
682
682
|
return it + 1 | 0;
|
|
@@ -707,15 +707,15 @@
|
|
|
707
707
|
}
|
|
708
708
|
function PrologParserFactory() {
|
|
709
709
|
}
|
|
710
|
-
protoOf(PrologParserFactory).
|
|
711
|
-
var parser = this.
|
|
710
|
+
protoOf(PrologParserFactory).x3i = function (string, withOperators) {
|
|
711
|
+
var parser = this.y3i(string, withOperators);
|
|
712
712
|
return parseExpression(this, parser, string);
|
|
713
713
|
};
|
|
714
|
-
protoOf(PrologParserFactory).
|
|
715
|
-
var parser = this.
|
|
714
|
+
protoOf(PrologParserFactory).z3i = function (source, withOperators) {
|
|
715
|
+
var parser = this.y3i(source, withOperators);
|
|
716
716
|
return parseClauses(this, parser, source);
|
|
717
717
|
};
|
|
718
|
-
protoOf(PrologParserFactory).
|
|
718
|
+
protoOf(PrologParserFactory).y3i = function (source, operators) {
|
|
719
719
|
var stream = new InputStream(source);
|
|
720
720
|
var lexer = new PrologLexer(stream);
|
|
721
721
|
lexer.removeErrorListeners();
|
|
@@ -725,17 +725,17 @@
|
|
|
725
725
|
var originalErrorStrategy = parser._errHandler;
|
|
726
726
|
parser._errHandler = new BailErrorStrategy();
|
|
727
727
|
parser._interp.predictionMode = PredictionMode.SLL;
|
|
728
|
-
return to(this.
|
|
728
|
+
return to(this.a3j(parser, operators), originalErrorStrategy);
|
|
729
729
|
};
|
|
730
|
-
protoOf(PrologParserFactory).
|
|
730
|
+
protoOf(PrologParserFactory).a3j = function (prologParser, operators) {
|
|
731
731
|
// Inline function 'kotlin.collections.forEach' call
|
|
732
732
|
var tmp0_iterator = operators.r();
|
|
733
733
|
while (tmp0_iterator.s()) {
|
|
734
734
|
var element = tmp0_iterator.u();
|
|
735
735
|
// Inline function 'it.unibo.tuprolog.core.parsing.PrologParserFactory.addOperators.<anonymous>' call
|
|
736
|
-
prologParser.addOperator(element.
|
|
736
|
+
prologParser.addOperator(element.l1i_1, toAssociativity(element.m1i_1), element.n1i_1);
|
|
737
737
|
}
|
|
738
|
-
prologParser.addParseListener(Companion_instance_2.
|
|
738
|
+
prologParser.addParseListener(Companion_instance_2.u3i(prologParser));
|
|
739
739
|
return prologParser;
|
|
740
740
|
};
|
|
741
741
|
var PrologParserFactory_instance;
|
|
@@ -816,9 +816,9 @@
|
|
|
816
816
|
}
|
|
817
817
|
function postfix($this, term, ops) {
|
|
818
818
|
var operator = ops.r();
|
|
819
|
-
var result = $this.
|
|
819
|
+
var result = $this.b3j_1.structOf(operator.u(), [term]);
|
|
820
820
|
while (operator.s()) {
|
|
821
|
-
result = $this.
|
|
821
|
+
result = $this.b3j_1.structOf(operator.u(), [result]);
|
|
822
822
|
}
|
|
823
823
|
return result;
|
|
824
824
|
}
|
|
@@ -843,9 +843,9 @@
|
|
|
843
843
|
var i = ops.l() - 1 | 0;
|
|
844
844
|
var tmp0 = i;
|
|
845
845
|
i = tmp0 - 1 | 0;
|
|
846
|
-
var result = $this.
|
|
846
|
+
var result = $this.b3j_1.structOf(ops.c1(tmp0), [term]);
|
|
847
847
|
while (i >= 0) {
|
|
848
|
-
result = $this.
|
|
848
|
+
result = $this.b3j_1.structOf(ops.c1(i), [result]);
|
|
849
849
|
i = i - 1 | 0;
|
|
850
850
|
}
|
|
851
851
|
return result;
|
|
@@ -895,7 +895,7 @@
|
|
|
895
895
|
return infixNonAssociative($this, operands, operators);
|
|
896
896
|
}
|
|
897
897
|
function infixNonAssociative($this, terms, ops) {
|
|
898
|
-
return $this.
|
|
898
|
+
return $this.b3j_1.structOf(ops.c1(0), [terms.c1(0), terms.c1(1)]);
|
|
899
899
|
}
|
|
900
900
|
function handleOuters($this, expression, outers) {
|
|
901
901
|
var result = expression;
|
|
@@ -956,12 +956,12 @@
|
|
|
956
956
|
var j = ops.l() - 1 | 0;
|
|
957
957
|
var tmp0 = j;
|
|
958
958
|
j = tmp0 - 1 | 0;
|
|
959
|
-
var result = $this.
|
|
959
|
+
var result = $this.b3j_1.structOf(ops.c1(tmp0), [terms.c1(i - 1 | 0), terms.c1(i)]);
|
|
960
960
|
i = i - 2 | 0;
|
|
961
961
|
while (i >= 0) {
|
|
962
962
|
var tmp1 = j;
|
|
963
963
|
j = tmp1 - 1 | 0;
|
|
964
|
-
result = $this.
|
|
964
|
+
result = $this.b3j_1.structOf(ops.c1(tmp1), [terms.c1(i), result]);
|
|
965
965
|
i = i - 1 | 0;
|
|
966
966
|
}
|
|
967
967
|
return result;
|
|
@@ -977,11 +977,11 @@
|
|
|
977
977
|
var tmp_0 = terms.c1(tmp1);
|
|
978
978
|
var tmp2 = i;
|
|
979
979
|
i = tmp2 + 1 | 0;
|
|
980
|
-
var result = $this.
|
|
980
|
+
var result = $this.b3j_1.structOf(tmp, [tmp_0, terms.c1(tmp2)]);
|
|
981
981
|
while (i < terms.l()) {
|
|
982
982
|
var tmp3 = j;
|
|
983
983
|
j = tmp3 + 1 | 0;
|
|
984
|
-
result = $this.
|
|
984
|
+
result = $this.b3j_1.structOf(ops.c1(tmp3), [result, terms.c1(i)]);
|
|
985
985
|
i = i + 1 | 0;
|
|
986
986
|
}
|
|
987
987
|
return result;
|
|
@@ -1032,7 +1032,7 @@
|
|
|
1032
1032
|
}
|
|
1033
1033
|
function PrologVisitor$visitExpression$ref($boundThis) {
|
|
1034
1034
|
var l = function (p0) {
|
|
1035
|
-
return $boundThis.
|
|
1035
|
+
return $boundThis.c3j(p0);
|
|
1036
1036
|
};
|
|
1037
1037
|
l.callableName = 'visitExpression';
|
|
1038
1038
|
return l;
|
|
@@ -1045,30 +1045,30 @@
|
|
|
1045
1045
|
function PrologVisitor(scope) {
|
|
1046
1046
|
scope = scope === VOID ? Companion_instance.empty() : scope;
|
|
1047
1047
|
PrologParserVisitor.call(this);
|
|
1048
|
-
this.
|
|
1048
|
+
this.b3j_1 = scope;
|
|
1049
1049
|
}
|
|
1050
|
-
protoOf(PrologVisitor).
|
|
1051
|
-
return this.
|
|
1050
|
+
protoOf(PrologVisitor).d3j = function (ctx) {
|
|
1051
|
+
return this.e3j(ctx.term());
|
|
1052
1052
|
};
|
|
1053
1053
|
protoOf(PrologVisitor).visitSingletonTerm = function (ctx) {
|
|
1054
|
-
return this.
|
|
1054
|
+
return this.d3j(ctx);
|
|
1055
1055
|
};
|
|
1056
|
-
protoOf(PrologVisitor).
|
|
1057
|
-
return this.
|
|
1056
|
+
protoOf(PrologVisitor).f3j = function (ctx) {
|
|
1057
|
+
return this.c3j(ctx.expression());
|
|
1058
1058
|
};
|
|
1059
1059
|
protoOf(PrologVisitor).visitSingletonExpression = function (ctx) {
|
|
1060
|
-
return this.
|
|
1060
|
+
return this.f3j(ctx);
|
|
1061
1061
|
};
|
|
1062
|
-
protoOf(PrologVisitor).
|
|
1062
|
+
protoOf(PrologVisitor).g3j = function (ctx) {
|
|
1063
1063
|
return termToClause(ctx.expression().accept(this), null, ensureNotNull(ctx.start).line, ensureNotNull(ctx.start).column);
|
|
1064
1064
|
};
|
|
1065
1065
|
protoOf(PrologVisitor).visitClause = function (ctx) {
|
|
1066
|
-
return this.
|
|
1066
|
+
return this.g3j(ctx);
|
|
1067
1067
|
};
|
|
1068
|
-
protoOf(PrologVisitor).
|
|
1068
|
+
protoOf(PrologVisitor).c3j = function (ctx) {
|
|
1069
1069
|
var tmp;
|
|
1070
1070
|
if (ctx.isTerm) {
|
|
1071
|
-
tmp = this.
|
|
1071
|
+
tmp = this.e3j(ensureNotNull(ctx.left));
|
|
1072
1072
|
} else if (contains(Associativity.INFIX, ctx.associativity)) {
|
|
1073
1073
|
tmp = visitInfixExpression(this, ctx);
|
|
1074
1074
|
} else if (contains(Associativity.POSTFIX, ctx.associativity)) {
|
|
@@ -1081,12 +1081,12 @@
|
|
|
1081
1081
|
return handleOuters(this, tmp, flatten_0(this, asList(ctx.outers)));
|
|
1082
1082
|
};
|
|
1083
1083
|
protoOf(PrologVisitor).visitExpression = function (ctx) {
|
|
1084
|
-
return this.
|
|
1084
|
+
return this.c3j(ctx);
|
|
1085
1085
|
};
|
|
1086
|
-
protoOf(PrologVisitor).
|
|
1086
|
+
protoOf(PrologVisitor).e3j = function (ctx) {
|
|
1087
1087
|
var tmp;
|
|
1088
1088
|
if (ctx.isExpr) {
|
|
1089
|
-
tmp = this.
|
|
1089
|
+
tmp = this.c3j(ctx.expression());
|
|
1090
1090
|
} else {
|
|
1091
1091
|
var tmp_0 = ctx.children[0].accept(this);
|
|
1092
1092
|
tmp = (!(tmp_0 == null) ? isInterface(tmp_0, Term) : false) ? tmp_0 : THROW_CCE();
|
|
@@ -1094,23 +1094,23 @@
|
|
|
1094
1094
|
return tmp;
|
|
1095
1095
|
};
|
|
1096
1096
|
protoOf(PrologVisitor).visitTerm = function (ctx) {
|
|
1097
|
-
return this.
|
|
1097
|
+
return this.e3j(ctx);
|
|
1098
1098
|
};
|
|
1099
|
-
protoOf(PrologVisitor).
|
|
1099
|
+
protoOf(PrologVisitor).h3j = function (ctx) {
|
|
1100
1100
|
var value = parseInteger_0(this, ctx);
|
|
1101
1101
|
return Companion_getInstance_2().ofBigInteger(value);
|
|
1102
1102
|
};
|
|
1103
1103
|
protoOf(PrologVisitor).visitInteger = function (ctx) {
|
|
1104
|
-
return this.
|
|
1104
|
+
return this.h3j(ctx);
|
|
1105
1105
|
};
|
|
1106
|
-
protoOf(PrologVisitor).
|
|
1106
|
+
protoOf(PrologVisitor).i3j = function (ctx) {
|
|
1107
1107
|
var tmp = ctx.children[0].accept(this);
|
|
1108
1108
|
return (!(tmp == null) ? isInterface(tmp, Term) : false) ? tmp : THROW_CCE();
|
|
1109
1109
|
};
|
|
1110
1110
|
protoOf(PrologVisitor).visitNumber = function (ctx) {
|
|
1111
|
-
return this.
|
|
1111
|
+
return this.i3j(ctx);
|
|
1112
1112
|
};
|
|
1113
|
-
protoOf(PrologVisitor).
|
|
1113
|
+
protoOf(PrologVisitor).j3j = function (ctx) {
|
|
1114
1114
|
var raw = ctx.value.text;
|
|
1115
1115
|
if (!(ctx.sign == null)) {
|
|
1116
1116
|
var tmp0_safe_receiver = ctx.sign;
|
|
@@ -1131,39 +1131,39 @@
|
|
|
1131
1131
|
return tmp;
|
|
1132
1132
|
};
|
|
1133
1133
|
protoOf(PrologVisitor).visitReal = function (ctx) {
|
|
1134
|
-
return this.
|
|
1134
|
+
return this.j3j(ctx);
|
|
1135
1135
|
};
|
|
1136
|
-
protoOf(PrologVisitor).
|
|
1136
|
+
protoOf(PrologVisitor).k3j = function (ctx) {
|
|
1137
1137
|
var tmp;
|
|
1138
1138
|
if (ctx.isAnonymous) {
|
|
1139
|
-
tmp = this.
|
|
1139
|
+
tmp = this.b3j_1.anonymous();
|
|
1140
1140
|
} else {
|
|
1141
|
-
tmp = this.
|
|
1141
|
+
tmp = this.b3j_1.varOf(ctx.value.text);
|
|
1142
1142
|
}
|
|
1143
1143
|
return tmp;
|
|
1144
1144
|
};
|
|
1145
1145
|
protoOf(PrologVisitor).visitVariable = function (ctx) {
|
|
1146
|
-
return this.
|
|
1146
|
+
return this.k3j(ctx);
|
|
1147
1147
|
};
|
|
1148
|
-
protoOf(PrologVisitor).
|
|
1148
|
+
protoOf(PrologVisitor).l3j = function (ctx) {
|
|
1149
1149
|
var tmp;
|
|
1150
1150
|
if (ctx.isList) {
|
|
1151
|
-
tmp = this.
|
|
1151
|
+
tmp = this.b3j_1.logicListOf([]);
|
|
1152
1152
|
} else if (ctx.isBlock) {
|
|
1153
|
-
tmp = this.
|
|
1153
|
+
tmp = this.b3j_1.blockOf([]);
|
|
1154
1154
|
} else if (ctx.arity === 0) {
|
|
1155
|
-
tmp = this.
|
|
1155
|
+
tmp = this.b3j_1.atomOf(ctx.functor.text);
|
|
1156
1156
|
} else {
|
|
1157
1157
|
var tmp_0 = ctx.functor.text;
|
|
1158
1158
|
var tmp_1 = asSequence_0(ctx.args);
|
|
1159
|
-
tmp = this.
|
|
1159
|
+
tmp = this.b3j_1.structOfSequence(tmp_0, map(tmp_1, PrologVisitor$visitExpression$ref(this)));
|
|
1160
1160
|
}
|
|
1161
1161
|
return tmp;
|
|
1162
1162
|
};
|
|
1163
1163
|
protoOf(PrologVisitor).visitStructure = function (ctx) {
|
|
1164
|
-
return this.
|
|
1164
|
+
return this.l3j(ctx);
|
|
1165
1165
|
};
|
|
1166
|
-
protoOf(PrologVisitor).
|
|
1166
|
+
protoOf(PrologVisitor).m3j = function (ctx) {
|
|
1167
1167
|
// Inline function 'kotlin.collections.map' call
|
|
1168
1168
|
var this_0 = ctx.items;
|
|
1169
1169
|
// Inline function 'kotlin.collections.mapTo' call
|
|
@@ -1173,26 +1173,26 @@
|
|
|
1173
1173
|
while (inductionVariable < last) {
|
|
1174
1174
|
var item = this_0[inductionVariable];
|
|
1175
1175
|
inductionVariable = inductionVariable + 1 | 0;
|
|
1176
|
-
var tmp$ret$0 = this.
|
|
1176
|
+
var tmp$ret$0 = this.c3j(item);
|
|
1177
1177
|
destination.o(tmp$ret$0);
|
|
1178
1178
|
}
|
|
1179
1179
|
var terms = destination;
|
|
1180
1180
|
var tmp;
|
|
1181
1181
|
if (ctx.hasTail) {
|
|
1182
1182
|
var tmp0_safe_receiver = ctx.tail;
|
|
1183
|
-
tmp = this.
|
|
1183
|
+
tmp = this.b3j_1.h12(terms, tmp0_safe_receiver == null ? null : tmp0_safe_receiver.accept(this));
|
|
1184
1184
|
} else {
|
|
1185
|
-
tmp = this.
|
|
1185
|
+
tmp = this.b3j_1.logicListOfIterable(terms);
|
|
1186
1186
|
}
|
|
1187
1187
|
return tmp;
|
|
1188
1188
|
};
|
|
1189
1189
|
protoOf(PrologVisitor).visitList = function (ctx) {
|
|
1190
|
-
return this.
|
|
1190
|
+
return this.m3j(ctx);
|
|
1191
1191
|
};
|
|
1192
|
-
protoOf(PrologVisitor).
|
|
1192
|
+
protoOf(PrologVisitor).n3j = function (ctx) {
|
|
1193
1193
|
var tmp;
|
|
1194
1194
|
if (ctx.length === 1) {
|
|
1195
|
-
tmp = this.
|
|
1195
|
+
tmp = this.b3j_1.blockOf([ctx.items[0].accept(this)]);
|
|
1196
1196
|
} else {
|
|
1197
1197
|
// Inline function 'kotlin.collections.map' call
|
|
1198
1198
|
var this_0 = ctx.items;
|
|
@@ -1203,32 +1203,32 @@
|
|
|
1203
1203
|
while (inductionVariable < last) {
|
|
1204
1204
|
var item = this_0[inductionVariable];
|
|
1205
1205
|
inductionVariable = inductionVariable + 1 | 0;
|
|
1206
|
-
var tmp$ret$0 = this.
|
|
1206
|
+
var tmp$ret$0 = this.c3j(item);
|
|
1207
1207
|
destination.o(tmp$ret$0);
|
|
1208
1208
|
}
|
|
1209
|
-
tmp = this.
|
|
1209
|
+
tmp = this.b3j_1.blockOfIterable(destination);
|
|
1210
1210
|
}
|
|
1211
1211
|
return tmp;
|
|
1212
1212
|
};
|
|
1213
1213
|
protoOf(PrologVisitor).visitBlock = function (ctx) {
|
|
1214
|
-
return this.
|
|
1214
|
+
return this.n3j(ctx);
|
|
1215
1215
|
};
|
|
1216
1216
|
function termParserWithOperators(operators, scope) {
|
|
1217
1217
|
scope = scope === VOID ? Companion_instance.empty() : scope;
|
|
1218
1218
|
return new TermParserImpl(scope, operators);
|
|
1219
1219
|
}
|
|
1220
1220
|
function TermParserImpl(scope, defaultOperatorSet) {
|
|
1221
|
-
this.
|
|
1222
|
-
this.
|
|
1221
|
+
this.o3j_1 = scope;
|
|
1222
|
+
this.p3j_1 = defaultOperatorSet;
|
|
1223
1223
|
}
|
|
1224
|
-
protoOf(TermParserImpl).
|
|
1225
|
-
return this.
|
|
1224
|
+
protoOf(TermParserImpl).r3i = function () {
|
|
1225
|
+
return this.p3j_1;
|
|
1226
1226
|
};
|
|
1227
|
-
protoOf(TermParserImpl).
|
|
1228
|
-
return PrologParserFactory_instance.
|
|
1227
|
+
protoOf(TermParserImpl).q3j = function (input, operators) {
|
|
1228
|
+
return PrologParserFactory_instance.x3i(input, operators).accept(new PrologVisitor(this.o3j_1));
|
|
1229
1229
|
};
|
|
1230
1230
|
protoOf(TermParserImpl).parseTermWithOperators = function (input, operators) {
|
|
1231
|
-
return this.
|
|
1231
|
+
return this.q3j(input, operators);
|
|
1232
1232
|
};
|
|
1233
1233
|
//region block: post-declaration
|
|
1234
1234
|
protoOf(TermParserImpl).parseTerm = parseTerm;
|