@tuprolog/2p-full 0.31.21 → 0.32.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 +198 -215
- package/2p-bdd.js.map +1 -1
- package/2p-core.js +3282 -5092
- package/2p-core.js.map +1 -1
- package/2p-full.js +6 -6
- package/2p-io-lib.js +874 -1121
- package/2p-io-lib.js.map +1 -1
- package/2p-oop-lib.js +1140 -1327
- package/2p-oop-lib.js.map +1 -1
- package/2p-parser-core.js +438 -609
- package/2p-parser-core.js.map +1 -1
- package/2p-parser-js.js +7 -8
- package/2p-parser-js.js.map +1 -1
- package/2p-parser-theory.js +35 -39
- package/2p-parser-theory.js.map +1 -1
- package/2p-repl.js +152 -179
- package/2p-repl.js.map +1 -1
- package/2p-solve-classic.js +1141 -1371
- package/2p-solve-classic.js.map +1 -1
- package/2p-solve-plp.js +9 -14
- package/2p-solve-plp.js.map +1 -1
- package/2p-solve-problog.js +1689 -1981
- package/2p-solve-problog.js.map +1 -1
- package/2p-solve-streams.js +1206 -1372
- package/2p-solve-streams.js.map +1 -1
- package/2p-solve.js +4880 -6148
- package/2p-solve.js.map +1 -1
- package/2p-theory.js +1820 -2246
- package/2p-theory.js.map +1 -1
- package/2p-unify.js +290 -330
- package/2p-unify.js.map +1 -1
- package/2p-utils.js +483 -557
- package/2p-utils.js.map +1 -1
- package/clikt-clikt-js-ir.js +2243 -3266
- package/clikt-clikt-js-ir.js.map +1 -1
- package/{kotlin-kotlin-stdlib-js-ir.js → kotlin-kotlin-stdlib.js} +9559 -10329
- package/kotlin-kotlin-stdlib.js.map +1 -0
- package/kotlin_org_jetbrains_kotlin_kotlin_dom_api_compat.js +15 -0
- package/kotlin_org_jetbrains_kotlin_kotlin_dom_api_compat.js.map +1 -0
- package/kt-math.js +2926 -4247
- package/kt-math.js.map +1 -1
- package/package.json +9 -3
- package/kotlin-kotlin-stdlib-js-ir.js.map +0 -1
package/2p-parser-core.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
(function (root, factory) {
|
|
2
2
|
if (typeof define === 'function' && define.amd)
|
|
3
|
-
define(['exports', '@tuprolog/parser-utils', 'antlr4', 'antlr4/src/antlr4/error', 'antlr4/src/antlr4/atn', './kotlin-kotlin-stdlib
|
|
3
|
+
define(['exports', '@tuprolog/parser-utils', 'antlr4', 'antlr4/src/antlr4/error', 'antlr4/src/antlr4/atn', './kotlin-kotlin-stdlib.js', './2p-core.js', './2p-parser-js.js', './kt-math.js'], factory);
|
|
4
4
|
else if (typeof exports === 'object')
|
|
5
|
-
factory(module.exports, require('@tuprolog/parser-utils'), require('antlr4'), require('antlr4/src/antlr4/error'), require('antlr4/src/antlr4/atn'), require('./kotlin-kotlin-stdlib
|
|
5
|
+
factory(module.exports, require('@tuprolog/parser-utils'), require('antlr4'), require('antlr4/src/antlr4/error'), require('antlr4/src/antlr4/atn'), require('./kotlin-kotlin-stdlib.js'), require('./2p-core.js'), require('./2p-parser-js.js'), require('./kt-math.js'));
|
|
6
6
|
else {
|
|
7
7
|
if (typeof this['@tuprolog/parser-utils'] === 'undefined') {
|
|
8
8
|
throw new Error("Error loading module '2p-parser-core'. Its dependency '@tuprolog/parser-utils' was not found. Please, check whether '@tuprolog/parser-utils' is loaded prior to '2p-parser-core'.");
|
|
@@ -16,8 +16,8 @@
|
|
|
16
16
|
if (typeof this['antlr4/src/antlr4/atn'] === 'undefined') {
|
|
17
17
|
throw new Error("Error loading module '2p-parser-core'. Its dependency 'antlr4/src/antlr4/atn' was not found. Please, check whether 'antlr4/src/antlr4/atn' is loaded prior to '2p-parser-core'.");
|
|
18
18
|
}
|
|
19
|
-
if (typeof this['kotlin-kotlin-stdlib
|
|
20
|
-
throw new Error("Error loading module '2p-parser-core'. Its dependency 'kotlin-kotlin-stdlib
|
|
19
|
+
if (typeof this['kotlin-kotlin-stdlib'] === 'undefined') {
|
|
20
|
+
throw new Error("Error loading module '2p-parser-core'. Its dependency 'kotlin-kotlin-stdlib' was not found. Please, check whether 'kotlin-kotlin-stdlib' is loaded prior to '2p-parser-core'.");
|
|
21
21
|
}
|
|
22
22
|
if (typeof this['2p-core'] === 'undefined') {
|
|
23
23
|
throw new Error("Error loading module '2p-parser-core'. Its dependency '2p-core' was not found. Please, check whether '2p-core' is loaded prior to '2p-parser-core'.");
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
if (typeof this['kt-math'] === 'undefined') {
|
|
29
29
|
throw new Error("Error loading module '2p-parser-core'. Its dependency 'kt-math' was not found. Please, check whether 'kt-math' is loaded prior to '2p-parser-core'.");
|
|
30
30
|
}
|
|
31
|
-
root['2p-parser-core'] = factory(typeof this['2p-parser-core'] === 'undefined' ? {} : this['2p-parser-core'], this['@tuprolog/parser-utils'], antlr4, this['antlr4/src/antlr4/error'], this['antlr4/src/antlr4/atn'], this['kotlin-kotlin-stdlib
|
|
31
|
+
root['2p-parser-core'] = factory(typeof this['2p-parser-core'] === 'undefined' ? {} : this['2p-parser-core'], this['@tuprolog/parser-utils'], antlr4, this['antlr4/src/antlr4/error'], this['antlr4/src/antlr4/atn'], this['kotlin-kotlin-stdlib'], this['2p-core'], this['2p-parser-js'], this['kt-math']);
|
|
32
32
|
}
|
|
33
33
|
}(this, function (_, $module$_tuprolog_parser_utils_xy31vy, $module$antlr4, $module$antlr4_src_antlr4_error_s9pni7, $module$antlr4_src_antlr4_atn_66gh9q, kotlin_kotlin, kotlin_it_unibo_tuprolog_core, kotlin_it_unibo_tuprolog_parser_js, kotlin_io_github_gciatto_kt_math) {
|
|
34
34
|
'use strict';
|
|
@@ -44,362 +44,286 @@
|
|
|
44
44
|
var CommonTokenStream = $module$antlr4.CommonTokenStream;
|
|
45
45
|
var BailErrorStrategy = $module$antlr4_src_antlr4_error_s9pni7.BailErrorStrategy;
|
|
46
46
|
var PrologParserVisitor = $module$_tuprolog_parser_utils_xy31vy.PrologParserVisitor;
|
|
47
|
-
var VOID = kotlin_kotlin.$_$.
|
|
48
|
-
var captureStack = kotlin_kotlin.$_$.
|
|
49
|
-
var protoOf = kotlin_kotlin.$_$.
|
|
50
|
-
var classMeta = kotlin_kotlin.$_$.
|
|
51
|
-
var setMetadataFor = kotlin_kotlin.$_$.
|
|
47
|
+
var VOID = kotlin_kotlin.$_$.d;
|
|
48
|
+
var captureStack = kotlin_kotlin.$_$.q5;
|
|
49
|
+
var protoOf = kotlin_kotlin.$_$.u6;
|
|
50
|
+
var classMeta = kotlin_kotlin.$_$.v5;
|
|
51
|
+
var setMetadataFor = kotlin_kotlin.$_$.v6;
|
|
52
52
|
var TuPrologException = kotlin_it_unibo_tuprolog_core.$_$.l1;
|
|
53
53
|
var TuPrologException_init_$Init$ = kotlin_it_unibo_tuprolog_core.$_$.m;
|
|
54
|
-
var ensureNotNull = kotlin_kotlin.$_$.
|
|
55
|
-
var replace = kotlin_kotlin.$_$.
|
|
56
|
-
var _Char___init__impl__6a9atx = kotlin_kotlin.$_$.
|
|
57
|
-
var Char = kotlin_kotlin.$_$.
|
|
54
|
+
var ensureNotNull = kotlin_kotlin.$_$.yb;
|
|
55
|
+
var replace = kotlin_kotlin.$_$.ha;
|
|
56
|
+
var _Char___init__impl__6a9atx = kotlin_kotlin.$_$.k1;
|
|
57
|
+
var Char = kotlin_kotlin.$_$.hb;
|
|
58
|
+
var toString = kotlin_kotlin.$_$.o1;
|
|
59
|
+
var Struct = kotlin_it_unibo_tuprolog_core.$_$.z1;
|
|
60
|
+
var isInterface = kotlin_kotlin.$_$.j6;
|
|
61
|
+
var Numeric = kotlin_it_unibo_tuprolog_core.$_$.w1;
|
|
62
|
+
var Atom = kotlin_it_unibo_tuprolog_core.$_$.o1;
|
|
58
63
|
var Companion_getInstance = kotlin_it_unibo_tuprolog_core.$_$.q;
|
|
59
|
-
var
|
|
64
|
+
var Companion_instance = kotlin_it_unibo_tuprolog_core.$_$.c1;
|
|
60
65
|
var OperatorSet_init_$Create$ = kotlin_it_unibo_tuprolog_core.$_$.n;
|
|
61
|
-
var objectMeta = kotlin_kotlin.$_$.
|
|
62
|
-
var Struct = kotlin_it_unibo_tuprolog_core.$_$.z1;
|
|
63
|
-
var isInterface = kotlin_kotlin.$_$.g6;
|
|
66
|
+
var objectMeta = kotlin_kotlin.$_$.t6;
|
|
64
67
|
var getKClass = kotlin_kotlin.$_$.c;
|
|
65
|
-
var Unit_getInstance = kotlin_kotlin.$_$.v1;
|
|
66
68
|
var Constant = kotlin_it_unibo_tuprolog_core.$_$.q1;
|
|
67
69
|
var Var = kotlin_it_unibo_tuprolog_core.$_$.b3;
|
|
68
|
-
var Atom = kotlin_it_unibo_tuprolog_core.$_$.o1;
|
|
69
|
-
var Numeric = kotlin_it_unibo_tuprolog_core.$_$.w1;
|
|
70
70
|
var Integer = kotlin_it_unibo_tuprolog_core.$_$.u1;
|
|
71
71
|
var Real = kotlin_it_unibo_tuprolog_core.$_$.x1;
|
|
72
72
|
var Clause = kotlin_it_unibo_tuprolog_core.$_$.p1;
|
|
73
73
|
var Rule = kotlin_it_unibo_tuprolog_core.$_$.y1;
|
|
74
74
|
var Fact = kotlin_it_unibo_tuprolog_core.$_$.s1;
|
|
75
75
|
var Directive = kotlin_it_unibo_tuprolog_core.$_$.r1;
|
|
76
|
-
var interfaceMeta = kotlin_kotlin.$_$.
|
|
77
|
-
var
|
|
78
|
-
var
|
|
79
|
-
var
|
|
80
|
-
var
|
|
81
|
-
var
|
|
76
|
+
var interfaceMeta = kotlin_kotlin.$_$.f6;
|
|
77
|
+
var Companion_instance_0 = kotlin_it_unibo_tuprolog_core.$_$.v;
|
|
78
|
+
var Unit_instance = kotlin_kotlin.$_$.y1;
|
|
79
|
+
var THROW_CCE = kotlin_kotlin.$_$.vb;
|
|
80
|
+
var contains = kotlin_kotlin.$_$.s2;
|
|
81
|
+
var Companion_getInstance_0 = kotlin_it_unibo_tuprolog_core.$_$.r;
|
|
82
|
+
var map = kotlin_kotlin.$_$.q8;
|
|
82
83
|
var Operator = kotlin_it_unibo_tuprolog_core.$_$.n1;
|
|
83
84
|
var List = kotlin_it_unibo_tuprolog_core.$_$.v1;
|
|
84
|
-
var
|
|
85
|
-
var coerceAtLeast = kotlin_kotlin.$_$.
|
|
85
|
+
var toString_0 = kotlin_kotlin.$_$.z6;
|
|
86
|
+
var coerceAtLeast = kotlin_kotlin.$_$.k7;
|
|
86
87
|
var isRecognitionException = kotlin_it_unibo_tuprolog_parser_js.$_$.b;
|
|
87
88
|
var isParseCancellationException = kotlin_it_unibo_tuprolog_parser_js.$_$.a;
|
|
88
|
-
var generateSequence = kotlin_kotlin.$_$.
|
|
89
|
-
var takeWhile = kotlin_kotlin.$_$.
|
|
90
|
-
var to = kotlin_kotlin.$_$.
|
|
91
|
-
var
|
|
92
|
-
var charSequenceGet = kotlin_kotlin.$_$.
|
|
93
|
-
var Char__toInt_impl_vasixd = kotlin_kotlin.$_$.
|
|
94
|
-
var contains_0 = kotlin_kotlin.$_$.
|
|
95
|
-
var plus = kotlin_kotlin.$_$.
|
|
96
|
-
var ArrayList_init_$Create$ = kotlin_kotlin.$_$.
|
|
97
|
-
var IllegalStateException_init_$Create$ = kotlin_kotlin.$_$.
|
|
98
|
-
var listOf = kotlin_kotlin.$_$.
|
|
99
|
-
var asList = kotlin_kotlin.$_$.
|
|
100
|
-
var plus_0 = kotlin_kotlin.$_$.
|
|
101
|
-
var collectionSizeOrDefault = kotlin_kotlin.$_$.
|
|
102
|
-
var toList = kotlin_kotlin.$_$.
|
|
103
|
-
var flatMap = kotlin_kotlin.$_$.
|
|
104
|
-
var asSequence = kotlin_kotlin.$_$.
|
|
105
|
-
var toList_0 = kotlin_kotlin.$_$.
|
|
106
|
-
var sequenceOf = kotlin_kotlin.$_$.
|
|
107
|
-
var asSequence_0 = kotlin_kotlin.$_$.
|
|
108
|
-
var plus_1 = kotlin_kotlin.$_$.
|
|
109
|
-
var IllegalArgumentException_init_$Create$ = kotlin_kotlin.$_$.
|
|
89
|
+
var generateSequence = kotlin_kotlin.$_$.j8;
|
|
90
|
+
var takeWhile = kotlin_kotlin.$_$.z8;
|
|
91
|
+
var to = kotlin_kotlin.$_$.hc;
|
|
92
|
+
var Companion_getInstance_1 = kotlin_io_github_gciatto_kt_math.$_$.e;
|
|
93
|
+
var charSequenceGet = kotlin_kotlin.$_$.t5;
|
|
94
|
+
var Char__toInt_impl_vasixd = kotlin_kotlin.$_$.n1;
|
|
95
|
+
var contains_0 = kotlin_kotlin.$_$.m9;
|
|
96
|
+
var plus = kotlin_kotlin.$_$.cc;
|
|
97
|
+
var ArrayList_init_$Create$ = kotlin_kotlin.$_$.f;
|
|
98
|
+
var IllegalStateException_init_$Create$ = kotlin_kotlin.$_$.y;
|
|
99
|
+
var listOf = kotlin_kotlin.$_$.r3;
|
|
100
|
+
var asList = kotlin_kotlin.$_$.j2;
|
|
101
|
+
var plus_0 = kotlin_kotlin.$_$.k4;
|
|
102
|
+
var collectionSizeOrDefault = kotlin_kotlin.$_$.q2;
|
|
103
|
+
var toList = kotlin_kotlin.$_$.x4;
|
|
104
|
+
var flatMap = kotlin_kotlin.$_$.h8;
|
|
105
|
+
var asSequence = kotlin_kotlin.$_$.n2;
|
|
106
|
+
var toList_0 = kotlin_kotlin.$_$.d9;
|
|
107
|
+
var sequenceOf = kotlin_kotlin.$_$.w8;
|
|
108
|
+
var asSequence_0 = kotlin_kotlin.$_$.o2;
|
|
109
|
+
var plus_1 = kotlin_kotlin.$_$.u8;
|
|
110
|
+
var IllegalArgumentException_init_$Create$ = kotlin_kotlin.$_$.v;
|
|
110
111
|
var Term = kotlin_it_unibo_tuprolog_core.$_$.y2;
|
|
111
|
-
var
|
|
112
|
-
var
|
|
113
|
-
var NumberFormatException = kotlin_kotlin.$_$.
|
|
112
|
+
var Companion_getInstance_2 = kotlin_it_unibo_tuprolog_core.$_$.x;
|
|
113
|
+
var Companion_getInstance_3 = kotlin_it_unibo_tuprolog_core.$_$.a1;
|
|
114
|
+
var NumberFormatException = kotlin_kotlin.$_$.sb;
|
|
114
115
|
//endregion
|
|
115
116
|
//region block: pre-declaration
|
|
116
117
|
setMetadataFor(ParseException, 'ParseException', classMeta, TuPrologException);
|
|
117
118
|
setMetadataFor(InvalidTermTypeException, 'InvalidTermTypeException', classMeta, ParseException);
|
|
118
119
|
setMetadataFor(Companion, 'Companion', objectMeta);
|
|
119
120
|
function parseTerm(input) {
|
|
120
|
-
return this.parseTermWithOperators(input, this.
|
|
121
|
+
return this.parseTermWithOperators(input, this.a3i());
|
|
121
122
|
}
|
|
122
123
|
function parseStructWithOperators(input, operators) {
|
|
123
|
-
var tmp$ret$2;
|
|
124
124
|
// Inline function 'it.unibo.tuprolog.core.parsing.Companion.parseAs' call
|
|
125
|
-
var tmp1_parseAs = Companion_getInstance_6();
|
|
126
|
-
var tmp$ret$1;
|
|
127
125
|
// Inline function 'kotlin.let' call
|
|
128
|
-
var tmp0_let = this.parseTermWithOperators(input, operators);
|
|
129
126
|
// Inline function 'kotlin.contracts.contract' call
|
|
130
|
-
var tmp$ret$0;
|
|
131
127
|
// Inline function 'it.unibo.tuprolog.core.parsing.Companion.parseAs.<anonymous>' call
|
|
132
|
-
var
|
|
128
|
+
var it = this.parseTermWithOperators(input, operators);
|
|
129
|
+
var tmp0_elvis_lhs = isInterface(it, Struct) ? it : null;
|
|
133
130
|
var tmp;
|
|
134
131
|
if (tmp0_elvis_lhs == null) {
|
|
135
|
-
throw new InvalidTermTypeException(input,
|
|
132
|
+
throw new InvalidTermTypeException(input, it, getKClass(Struct));
|
|
136
133
|
} else {
|
|
137
134
|
tmp = tmp0_elvis_lhs;
|
|
138
135
|
}
|
|
139
|
-
|
|
140
|
-
tmp$ret$1 = tmp$ret$0;
|
|
141
|
-
tmp$ret$2 = tmp$ret$1;
|
|
142
|
-
return tmp$ret$2;
|
|
136
|
+
return tmp;
|
|
143
137
|
}
|
|
144
138
|
function parseStruct(input) {
|
|
145
|
-
return this.parseStructWithOperators(input, this.
|
|
139
|
+
return this.parseStructWithOperators(input, this.a3i());
|
|
146
140
|
}
|
|
147
141
|
function parseConstantWithOperators(input, operators) {
|
|
148
|
-
var tmp$ret$2;
|
|
149
142
|
// Inline function 'it.unibo.tuprolog.core.parsing.Companion.parseAs' call
|
|
150
|
-
var tmp1_parseAs = Companion_getInstance_6();
|
|
151
|
-
var tmp$ret$1;
|
|
152
143
|
// Inline function 'kotlin.let' call
|
|
153
|
-
var tmp0_let = this.parseTermWithOperators(input, operators);
|
|
154
144
|
// Inline function 'kotlin.contracts.contract' call
|
|
155
|
-
var tmp$ret$0;
|
|
156
145
|
// Inline function 'it.unibo.tuprolog.core.parsing.Companion.parseAs.<anonymous>' call
|
|
157
|
-
var
|
|
146
|
+
var it = this.parseTermWithOperators(input, operators);
|
|
147
|
+
var tmp0_elvis_lhs = isInterface(it, Constant) ? it : null;
|
|
158
148
|
var tmp;
|
|
159
149
|
if (tmp0_elvis_lhs == null) {
|
|
160
|
-
throw new InvalidTermTypeException(input,
|
|
150
|
+
throw new InvalidTermTypeException(input, it, getKClass(Constant));
|
|
161
151
|
} else {
|
|
162
152
|
tmp = tmp0_elvis_lhs;
|
|
163
153
|
}
|
|
164
|
-
|
|
165
|
-
tmp$ret$1 = tmp$ret$0;
|
|
166
|
-
tmp$ret$2 = tmp$ret$1;
|
|
167
|
-
return tmp$ret$2;
|
|
154
|
+
return tmp;
|
|
168
155
|
}
|
|
169
156
|
function parseConstant(input) {
|
|
170
|
-
return this.parseConstantWithOperators(input, this.
|
|
157
|
+
return this.parseConstantWithOperators(input, this.a3i());
|
|
171
158
|
}
|
|
172
159
|
function parseVarWithOperators(input, operators) {
|
|
173
|
-
var tmp$ret$2;
|
|
174
160
|
// Inline function 'it.unibo.tuprolog.core.parsing.Companion.parseAs' call
|
|
175
|
-
var tmp1_parseAs = Companion_getInstance_6();
|
|
176
|
-
var tmp$ret$1;
|
|
177
161
|
// Inline function 'kotlin.let' call
|
|
178
|
-
var tmp0_let = this.parseTermWithOperators(input, operators);
|
|
179
162
|
// Inline function 'kotlin.contracts.contract' call
|
|
180
|
-
var tmp$ret$0;
|
|
181
163
|
// Inline function 'it.unibo.tuprolog.core.parsing.Companion.parseAs.<anonymous>' call
|
|
182
|
-
var
|
|
164
|
+
var it = this.parseTermWithOperators(input, operators);
|
|
165
|
+
var tmp0_elvis_lhs = isInterface(it, Var) ? it : null;
|
|
183
166
|
var tmp;
|
|
184
167
|
if (tmp0_elvis_lhs == null) {
|
|
185
|
-
throw new InvalidTermTypeException(input,
|
|
168
|
+
throw new InvalidTermTypeException(input, it, getKClass(Var));
|
|
186
169
|
} else {
|
|
187
170
|
tmp = tmp0_elvis_lhs;
|
|
188
171
|
}
|
|
189
|
-
|
|
190
|
-
tmp$ret$1 = tmp$ret$0;
|
|
191
|
-
tmp$ret$2 = tmp$ret$1;
|
|
192
|
-
return tmp$ret$2;
|
|
172
|
+
return tmp;
|
|
193
173
|
}
|
|
194
174
|
function parseVar(input) {
|
|
195
|
-
return this.parseVarWithOperators(input, this.
|
|
175
|
+
return this.parseVarWithOperators(input, this.a3i());
|
|
196
176
|
}
|
|
197
177
|
function parseAtomWithOperators(input, operators) {
|
|
198
|
-
var tmp$ret$2;
|
|
199
178
|
// Inline function 'it.unibo.tuprolog.core.parsing.Companion.parseAs' call
|
|
200
|
-
var tmp1_parseAs = Companion_getInstance_6();
|
|
201
|
-
var tmp$ret$1;
|
|
202
179
|
// Inline function 'kotlin.let' call
|
|
203
|
-
var tmp0_let = this.parseTermWithOperators(input, operators);
|
|
204
180
|
// Inline function 'kotlin.contracts.contract' call
|
|
205
|
-
var tmp$ret$0;
|
|
206
181
|
// Inline function 'it.unibo.tuprolog.core.parsing.Companion.parseAs.<anonymous>' call
|
|
207
|
-
var
|
|
182
|
+
var it = this.parseTermWithOperators(input, operators);
|
|
183
|
+
var tmp0_elvis_lhs = isInterface(it, Atom) ? it : null;
|
|
208
184
|
var tmp;
|
|
209
185
|
if (tmp0_elvis_lhs == null) {
|
|
210
|
-
throw new InvalidTermTypeException(input,
|
|
186
|
+
throw new InvalidTermTypeException(input, it, getKClass(Atom));
|
|
211
187
|
} else {
|
|
212
188
|
tmp = tmp0_elvis_lhs;
|
|
213
189
|
}
|
|
214
|
-
|
|
215
|
-
tmp$ret$1 = tmp$ret$0;
|
|
216
|
-
tmp$ret$2 = tmp$ret$1;
|
|
217
|
-
return tmp$ret$2;
|
|
190
|
+
return tmp;
|
|
218
191
|
}
|
|
219
192
|
function parseAtom(input) {
|
|
220
|
-
return this.parseAtomWithOperators(input, this.
|
|
193
|
+
return this.parseAtomWithOperators(input, this.a3i());
|
|
221
194
|
}
|
|
222
195
|
function parseNumericWithOperators(input, operators) {
|
|
223
|
-
var tmp$ret$2;
|
|
224
196
|
// Inline function 'it.unibo.tuprolog.core.parsing.Companion.parseAs' call
|
|
225
|
-
var tmp1_parseAs = Companion_getInstance_6();
|
|
226
|
-
var tmp$ret$1;
|
|
227
197
|
// Inline function 'kotlin.let' call
|
|
228
|
-
var tmp0_let = this.parseTermWithOperators(input, operators);
|
|
229
198
|
// Inline function 'kotlin.contracts.contract' call
|
|
230
|
-
var tmp$ret$0;
|
|
231
199
|
// Inline function 'it.unibo.tuprolog.core.parsing.Companion.parseAs.<anonymous>' call
|
|
232
|
-
var
|
|
200
|
+
var it = this.parseTermWithOperators(input, operators);
|
|
201
|
+
var tmp0_elvis_lhs = isInterface(it, Numeric) ? it : null;
|
|
233
202
|
var tmp;
|
|
234
203
|
if (tmp0_elvis_lhs == null) {
|
|
235
|
-
throw new InvalidTermTypeException(input,
|
|
204
|
+
throw new InvalidTermTypeException(input, it, getKClass(Numeric));
|
|
236
205
|
} else {
|
|
237
206
|
tmp = tmp0_elvis_lhs;
|
|
238
207
|
}
|
|
239
|
-
|
|
240
|
-
tmp$ret$1 = tmp$ret$0;
|
|
241
|
-
tmp$ret$2 = tmp$ret$1;
|
|
242
|
-
return tmp$ret$2;
|
|
208
|
+
return tmp;
|
|
243
209
|
}
|
|
244
210
|
function parseNumeric(input) {
|
|
245
|
-
return this.parseNumericWithOperators(input, this.
|
|
211
|
+
return this.parseNumericWithOperators(input, this.a3i());
|
|
246
212
|
}
|
|
247
213
|
function parseIntegerWithOperators(input, operators) {
|
|
248
|
-
var tmp$ret$2;
|
|
249
214
|
// Inline function 'it.unibo.tuprolog.core.parsing.Companion.parseAs' call
|
|
250
|
-
var tmp1_parseAs = Companion_getInstance_6();
|
|
251
|
-
var tmp$ret$1;
|
|
252
215
|
// Inline function 'kotlin.let' call
|
|
253
|
-
var tmp0_let = this.parseTermWithOperators(input, operators);
|
|
254
216
|
// Inline function 'kotlin.contracts.contract' call
|
|
255
|
-
var tmp$ret$0;
|
|
256
217
|
// Inline function 'it.unibo.tuprolog.core.parsing.Companion.parseAs.<anonymous>' call
|
|
257
|
-
var
|
|
218
|
+
var it = this.parseTermWithOperators(input, operators);
|
|
219
|
+
var tmp0_elvis_lhs = isInterface(it, Integer) ? it : null;
|
|
258
220
|
var tmp;
|
|
259
221
|
if (tmp0_elvis_lhs == null) {
|
|
260
|
-
throw new InvalidTermTypeException(input,
|
|
222
|
+
throw new InvalidTermTypeException(input, it, getKClass(Integer));
|
|
261
223
|
} else {
|
|
262
224
|
tmp = tmp0_elvis_lhs;
|
|
263
225
|
}
|
|
264
|
-
|
|
265
|
-
tmp$ret$1 = tmp$ret$0;
|
|
266
|
-
tmp$ret$2 = tmp$ret$1;
|
|
267
|
-
return tmp$ret$2;
|
|
226
|
+
return tmp;
|
|
268
227
|
}
|
|
269
228
|
function parseInteger(input) {
|
|
270
|
-
return this.parseIntegerWithOperators(input, this.
|
|
229
|
+
return this.parseIntegerWithOperators(input, this.a3i());
|
|
271
230
|
}
|
|
272
231
|
function parseRealWithOperators(input, operators) {
|
|
273
|
-
var tmp$ret$2;
|
|
274
232
|
// Inline function 'it.unibo.tuprolog.core.parsing.Companion.parseAs' call
|
|
275
|
-
var tmp1_parseAs = Companion_getInstance_6();
|
|
276
|
-
var tmp$ret$1;
|
|
277
233
|
// Inline function 'kotlin.let' call
|
|
278
|
-
var tmp0_let = this.parseTermWithOperators(input, operators);
|
|
279
234
|
// Inline function 'kotlin.contracts.contract' call
|
|
280
|
-
var tmp$ret$0;
|
|
281
235
|
// Inline function 'it.unibo.tuprolog.core.parsing.Companion.parseAs.<anonymous>' call
|
|
282
|
-
var
|
|
236
|
+
var it = this.parseTermWithOperators(input, operators);
|
|
237
|
+
var tmp0_elvis_lhs = isInterface(it, Real) ? it : null;
|
|
283
238
|
var tmp;
|
|
284
239
|
if (tmp0_elvis_lhs == null) {
|
|
285
|
-
throw new InvalidTermTypeException(input,
|
|
240
|
+
throw new InvalidTermTypeException(input, it, getKClass(Real));
|
|
286
241
|
} else {
|
|
287
242
|
tmp = tmp0_elvis_lhs;
|
|
288
243
|
}
|
|
289
|
-
|
|
290
|
-
tmp$ret$1 = tmp$ret$0;
|
|
291
|
-
tmp$ret$2 = tmp$ret$1;
|
|
292
|
-
return tmp$ret$2;
|
|
244
|
+
return tmp;
|
|
293
245
|
}
|
|
294
246
|
function parseReal(input) {
|
|
295
|
-
return this.parseRealWithOperators(input, this.
|
|
247
|
+
return this.parseRealWithOperators(input, this.a3i());
|
|
296
248
|
}
|
|
297
249
|
function parseClauseWithOperators(input, operators) {
|
|
298
|
-
var tmp$ret$2;
|
|
299
250
|
// Inline function 'it.unibo.tuprolog.core.parsing.Companion.parseAs' call
|
|
300
|
-
var tmp1_parseAs = Companion_getInstance_6();
|
|
301
|
-
var tmp$ret$1;
|
|
302
251
|
// Inline function 'kotlin.let' call
|
|
303
|
-
var tmp0_let = this.parseTermWithOperators(input, operators);
|
|
304
252
|
// Inline function 'kotlin.contracts.contract' call
|
|
305
|
-
var tmp$ret$0;
|
|
306
253
|
// Inline function 'it.unibo.tuprolog.core.parsing.Companion.parseAs.<anonymous>' call
|
|
307
|
-
var
|
|
254
|
+
var it = this.parseTermWithOperators(input, operators);
|
|
255
|
+
var tmp0_elvis_lhs = isInterface(it, Clause) ? it : null;
|
|
308
256
|
var tmp;
|
|
309
257
|
if (tmp0_elvis_lhs == null) {
|
|
310
|
-
throw new InvalidTermTypeException(input,
|
|
258
|
+
throw new InvalidTermTypeException(input, it, getKClass(Clause));
|
|
311
259
|
} else {
|
|
312
260
|
tmp = tmp0_elvis_lhs;
|
|
313
261
|
}
|
|
314
|
-
|
|
315
|
-
tmp$ret$1 = tmp$ret$0;
|
|
316
|
-
tmp$ret$2 = tmp$ret$1;
|
|
317
|
-
return tmp$ret$2;
|
|
262
|
+
return tmp;
|
|
318
263
|
}
|
|
319
264
|
function parseClause(input) {
|
|
320
|
-
return this.parseClauseWithOperators(input, this.
|
|
265
|
+
return this.parseClauseWithOperators(input, this.a3i());
|
|
321
266
|
}
|
|
322
267
|
function parseRuleWithOperators(input, operators) {
|
|
323
|
-
var tmp$ret$2;
|
|
324
268
|
// Inline function 'it.unibo.tuprolog.core.parsing.Companion.parseAs' call
|
|
325
|
-
var tmp1_parseAs = Companion_getInstance_6();
|
|
326
|
-
var tmp$ret$1;
|
|
327
269
|
// Inline function 'kotlin.let' call
|
|
328
|
-
var tmp0_let = this.parseTermWithOperators(input, operators);
|
|
329
270
|
// Inline function 'kotlin.contracts.contract' call
|
|
330
|
-
var tmp$ret$0;
|
|
331
271
|
// Inline function 'it.unibo.tuprolog.core.parsing.Companion.parseAs.<anonymous>' call
|
|
332
|
-
var
|
|
272
|
+
var it = this.parseTermWithOperators(input, operators);
|
|
273
|
+
var tmp0_elvis_lhs = isInterface(it, Rule) ? it : null;
|
|
333
274
|
var tmp;
|
|
334
275
|
if (tmp0_elvis_lhs == null) {
|
|
335
|
-
throw new InvalidTermTypeException(input,
|
|
276
|
+
throw new InvalidTermTypeException(input, it, getKClass(Rule));
|
|
336
277
|
} else {
|
|
337
278
|
tmp = tmp0_elvis_lhs;
|
|
338
279
|
}
|
|
339
|
-
|
|
340
|
-
tmp$ret$1 = tmp$ret$0;
|
|
341
|
-
tmp$ret$2 = tmp$ret$1;
|
|
342
|
-
return tmp$ret$2;
|
|
280
|
+
return tmp;
|
|
343
281
|
}
|
|
344
282
|
function parseRule(input) {
|
|
345
|
-
return this.parseRuleWithOperators(input, this.
|
|
283
|
+
return this.parseRuleWithOperators(input, this.a3i());
|
|
346
284
|
}
|
|
347
285
|
function parseFactWithOperators(input, operators) {
|
|
348
|
-
var tmp$ret$2;
|
|
349
286
|
// Inline function 'it.unibo.tuprolog.core.parsing.Companion.parseAs' call
|
|
350
|
-
var tmp1_parseAs = Companion_getInstance_6();
|
|
351
|
-
var tmp$ret$1;
|
|
352
287
|
// Inline function 'kotlin.let' call
|
|
353
|
-
var tmp0_let = this.parseTermWithOperators(input, operators);
|
|
354
288
|
// Inline function 'kotlin.contracts.contract' call
|
|
355
|
-
var tmp$ret$0;
|
|
356
289
|
// Inline function 'it.unibo.tuprolog.core.parsing.Companion.parseAs.<anonymous>' call
|
|
357
|
-
var
|
|
290
|
+
var it = this.parseTermWithOperators(input, operators);
|
|
291
|
+
var tmp0_elvis_lhs = isInterface(it, Fact) ? it : null;
|
|
358
292
|
var tmp;
|
|
359
293
|
if (tmp0_elvis_lhs == null) {
|
|
360
|
-
throw new InvalidTermTypeException(input,
|
|
294
|
+
throw new InvalidTermTypeException(input, it, getKClass(Fact));
|
|
361
295
|
} else {
|
|
362
296
|
tmp = tmp0_elvis_lhs;
|
|
363
297
|
}
|
|
364
|
-
|
|
365
|
-
tmp$ret$1 = tmp$ret$0;
|
|
366
|
-
tmp$ret$2 = tmp$ret$1;
|
|
367
|
-
return tmp$ret$2;
|
|
298
|
+
return tmp;
|
|
368
299
|
}
|
|
369
300
|
function parseFact(input) {
|
|
370
|
-
return this.parseFactWithOperators(input, this.
|
|
301
|
+
return this.parseFactWithOperators(input, this.a3i());
|
|
371
302
|
}
|
|
372
303
|
function parseDirectiveWithOperators(input, operators) {
|
|
373
|
-
var tmp$ret$2;
|
|
374
304
|
// Inline function 'it.unibo.tuprolog.core.parsing.Companion.parseAs' call
|
|
375
|
-
var tmp1_parseAs = Companion_getInstance_6();
|
|
376
|
-
var tmp$ret$1;
|
|
377
305
|
// Inline function 'kotlin.let' call
|
|
378
|
-
var tmp0_let = this.parseTermWithOperators(input, operators);
|
|
379
306
|
// Inline function 'kotlin.contracts.contract' call
|
|
380
|
-
var tmp$ret$0;
|
|
381
307
|
// Inline function 'it.unibo.tuprolog.core.parsing.Companion.parseAs.<anonymous>' call
|
|
382
|
-
var
|
|
308
|
+
var it = this.parseTermWithOperators(input, operators);
|
|
309
|
+
var tmp0_elvis_lhs = isInterface(it, Directive) ? it : null;
|
|
383
310
|
var tmp;
|
|
384
311
|
if (tmp0_elvis_lhs == null) {
|
|
385
|
-
throw new InvalidTermTypeException(input,
|
|
312
|
+
throw new InvalidTermTypeException(input, it, getKClass(Directive));
|
|
386
313
|
} else {
|
|
387
314
|
tmp = tmp0_elvis_lhs;
|
|
388
315
|
}
|
|
389
|
-
|
|
390
|
-
tmp$ret$1 = tmp$ret$0;
|
|
391
|
-
tmp$ret$2 = tmp$ret$1;
|
|
392
|
-
return tmp$ret$2;
|
|
316
|
+
return tmp;
|
|
393
317
|
}
|
|
394
318
|
function parseDirective(input) {
|
|
395
|
-
return this.parseDirectiveWithOperators(input, this.
|
|
319
|
+
return this.parseDirectiveWithOperators(input, this.a3i());
|
|
396
320
|
}
|
|
397
321
|
setMetadataFor(TermParser, 'TermParser', interfaceMeta);
|
|
398
322
|
setMetadataFor(Companion_0, 'Companion', objectMeta);
|
|
399
323
|
setMetadataFor(DynamicOpListener, 'DynamicOpListener', classMeta, PrologParserListener);
|
|
400
324
|
setMetadataFor(PrologParserFactory$newErrorListener$1, VOID, classMeta);
|
|
401
325
|
setMetadataFor(PrologParserFactory, 'PrologParserFactory', objectMeta);
|
|
402
|
-
setMetadataFor(PrologVisitor, 'PrologVisitor', classMeta, PrologParserVisitor);
|
|
326
|
+
setMetadataFor(PrologVisitor, 'PrologVisitor', classMeta, PrologParserVisitor, VOID, PrologVisitor);
|
|
403
327
|
setMetadataFor(TermParserImpl, 'TermParserImpl', classMeta, VOID, [TermParser]);
|
|
404
328
|
//endregion
|
|
405
329
|
function InvalidTermTypeException(input, term, type, offendingSymbol, line, column, message, throwable) {
|
|
@@ -413,12 +337,12 @@
|
|
|
413
337
|
offendingSymbol = tmp;
|
|
414
338
|
line = line === VOID ? 1 : line;
|
|
415
339
|
column = column === VOID ? 1 : column;
|
|
416
|
-
message = message === VOID ? 'Expected ' + type.
|
|
340
|
+
message = message === VOID ? 'Expected ' + type.s6() + ', got: ' + offendingSymbol : message;
|
|
417
341
|
throwable = throwable === VOID ? null : throwable;
|
|
418
342
|
ParseException.call(this, input, offendingSymbol, line, column, message, throwable);
|
|
419
343
|
captureStack(this, InvalidTermTypeException);
|
|
420
|
-
this.
|
|
421
|
-
this.
|
|
344
|
+
this.j3h_1 = term;
|
|
345
|
+
this.k3h_1 = type;
|
|
422
346
|
}
|
|
423
347
|
function ParseException(input, offendingSymbol, line, column, message, throwable) {
|
|
424
348
|
TuPrologException_init_$Init$(message, throwable, this);
|
|
@@ -429,82 +353,114 @@
|
|
|
429
353
|
this.column = column;
|
|
430
354
|
this.clauseIndex = -1;
|
|
431
355
|
}
|
|
432
|
-
protoOf(ParseException).
|
|
356
|
+
protoOf(ParseException).l3h = function (_set____db54di) {
|
|
433
357
|
this.input = _set____db54di;
|
|
434
358
|
};
|
|
435
|
-
protoOf(ParseException).
|
|
359
|
+
protoOf(ParseException).m3h = function () {
|
|
436
360
|
return this.input;
|
|
437
361
|
};
|
|
438
|
-
protoOf(ParseException).
|
|
362
|
+
protoOf(ParseException).n3h = function (_set____db54di) {
|
|
439
363
|
this.offendingSymbol = _set____db54di;
|
|
440
364
|
};
|
|
441
|
-
protoOf(ParseException).
|
|
365
|
+
protoOf(ParseException).o3h = function () {
|
|
442
366
|
return this.offendingSymbol;
|
|
443
367
|
};
|
|
444
|
-
protoOf(ParseException).
|
|
368
|
+
protoOf(ParseException).p3h = function (_set____db54di) {
|
|
445
369
|
this.line = _set____db54di;
|
|
446
370
|
};
|
|
447
|
-
protoOf(ParseException).
|
|
371
|
+
protoOf(ParseException).q3h = function () {
|
|
448
372
|
return this.line;
|
|
449
373
|
};
|
|
450
|
-
protoOf(ParseException).
|
|
374
|
+
protoOf(ParseException).r3h = function (_set____db54di) {
|
|
451
375
|
this.column = _set____db54di;
|
|
452
376
|
};
|
|
453
|
-
protoOf(ParseException).
|
|
377
|
+
protoOf(ParseException).s3h = function () {
|
|
454
378
|
return this.column;
|
|
455
379
|
};
|
|
456
|
-
protoOf(ParseException).
|
|
380
|
+
protoOf(ParseException).t3h = function (_set____db54di) {
|
|
457
381
|
this.clauseIndex = _set____db54di;
|
|
458
382
|
};
|
|
459
|
-
protoOf(ParseException).
|
|
383
|
+
protoOf(ParseException).u3h = function () {
|
|
460
384
|
return this.clauseIndex;
|
|
461
385
|
};
|
|
462
386
|
protoOf(ParseException).toString = function () {
|
|
463
|
-
return "ParseException{message='" + replace(ensureNotNull(this.message), '\\n', '\\\\n') + new Char(_Char___init__impl__6a9atx(39)) + ', line=' + this.line + ', column=' + this.column + ", offendingSymbol='" + this.offendingSymbol + new Char(_Char___init__impl__6a9atx(39)) +
|
|
387
|
+
return "ParseException{message='" + replace(ensureNotNull(this.message), '\\n', '\\\\n') + new Char(_Char___init__impl__6a9atx(39)) + ', line=' + this.line + ', column=' + this.column + ", offendingSymbol='" + this.offendingSymbol + new Char(_Char___init__impl__6a9atx(39)) + toString(_Char___init__impl__6a9atx(125));
|
|
464
388
|
};
|
|
389
|
+
function get_isOpDirective(_this__u8e3s4) {
|
|
390
|
+
var tmp;
|
|
391
|
+
var tmp_0;
|
|
392
|
+
var tmp_1;
|
|
393
|
+
var tmp_2;
|
|
394
|
+
var tmp_3;
|
|
395
|
+
if (isInterface(_this__u8e3s4, Struct)) {
|
|
396
|
+
tmp_3 = _this__u8e3s4.kw() === 3;
|
|
397
|
+
} else {
|
|
398
|
+
tmp_3 = false;
|
|
399
|
+
}
|
|
400
|
+
if (tmp_3) {
|
|
401
|
+
tmp_2 = _this__u8e3s4.qw() === 'op';
|
|
402
|
+
} else {
|
|
403
|
+
tmp_2 = false;
|
|
404
|
+
}
|
|
405
|
+
if (tmp_2) {
|
|
406
|
+
tmp_1 = _this__u8e3s4.ux();
|
|
407
|
+
} else {
|
|
408
|
+
tmp_1 = false;
|
|
409
|
+
}
|
|
410
|
+
if (tmp_1) {
|
|
411
|
+
var tmp_4 = _this__u8e3s4.get(0);
|
|
412
|
+
tmp_0 = isInterface(tmp_4, Numeric);
|
|
413
|
+
} else {
|
|
414
|
+
tmp_0 = false;
|
|
415
|
+
}
|
|
416
|
+
if (tmp_0) {
|
|
417
|
+
var tmp_5 = _this__u8e3s4.get(1);
|
|
418
|
+
tmp = isInterface(tmp_5, Atom);
|
|
419
|
+
} else {
|
|
420
|
+
tmp = false;
|
|
421
|
+
}
|
|
422
|
+
return tmp;
|
|
423
|
+
}
|
|
465
424
|
function Companion() {
|
|
466
|
-
Companion_instance = this;
|
|
467
425
|
}
|
|
468
|
-
protoOf(Companion).
|
|
469
|
-
return this.
|
|
426
|
+
protoOf(Companion).v3h = function (scope) {
|
|
427
|
+
return this.w3h(Companion_getInstance().EMPTY, scope);
|
|
470
428
|
};
|
|
471
429
|
protoOf(Companion).withNoOperator = function (scope, $super) {
|
|
472
|
-
scope = scope === VOID ?
|
|
473
|
-
return $super === VOID ? this.
|
|
430
|
+
scope = scope === VOID ? Companion_instance.empty() : scope;
|
|
431
|
+
return $super === VOID ? this.v3h(scope) : $super.v3h.call(this, scope);
|
|
474
432
|
};
|
|
475
|
-
protoOf(Companion).
|
|
476
|
-
return this.
|
|
433
|
+
protoOf(Companion).x3h = function (scope) {
|
|
434
|
+
return this.w3h(Companion_getInstance().STANDARD, scope);
|
|
477
435
|
};
|
|
478
436
|
protoOf(Companion).withStandardOperators = function (scope, $super) {
|
|
479
|
-
scope = scope === VOID ?
|
|
480
|
-
return $super === VOID ? this.
|
|
437
|
+
scope = scope === VOID ? Companion_instance.empty() : scope;
|
|
438
|
+
return $super === VOID ? this.x3h(scope) : $super.x3h.call(this, scope);
|
|
481
439
|
};
|
|
482
|
-
protoOf(Companion).
|
|
483
|
-
return this.
|
|
440
|
+
protoOf(Companion).y3h = function (scope) {
|
|
441
|
+
return this.w3h(Companion_getInstance().DEFAULT, scope);
|
|
484
442
|
};
|
|
485
443
|
protoOf(Companion).withDefaultOperators = function (scope, $super) {
|
|
486
|
-
scope = scope === VOID ?
|
|
487
|
-
return $super === VOID ? this.
|
|
444
|
+
scope = scope === VOID ? Companion_instance.empty() : scope;
|
|
445
|
+
return $super === VOID ? this.y3h(scope) : $super.y3h.call(this, scope);
|
|
488
446
|
};
|
|
489
|
-
protoOf(Companion).
|
|
447
|
+
protoOf(Companion).w3h = function (operators, scope) {
|
|
490
448
|
return termParserWithOperators(operators, scope);
|
|
491
449
|
};
|
|
492
450
|
protoOf(Companion).withOperatorSet = function (operators, scope, $super) {
|
|
493
|
-
scope = scope === VOID ?
|
|
494
|
-
return $super === VOID ? this.
|
|
451
|
+
scope = scope === VOID ? Companion_instance.empty() : scope;
|
|
452
|
+
return $super === VOID ? this.w3h(operators, scope) : $super.w3h.call(this, operators, scope);
|
|
495
453
|
};
|
|
496
|
-
protoOf(Companion).
|
|
497
|
-
return this.
|
|
454
|
+
protoOf(Companion).z3h = function (operators, scope) {
|
|
455
|
+
return this.w3h(OperatorSet_init_$Create$(operators.slice()), scope);
|
|
498
456
|
};
|
|
499
457
|
protoOf(Companion).withOperators = function (operators, scope, $super) {
|
|
500
|
-
scope = scope === VOID ?
|
|
501
|
-
return $super === VOID ? this.
|
|
458
|
+
scope = scope === VOID ? Companion_instance.empty() : scope;
|
|
459
|
+
return $super === VOID ? this.z3h(operators, scope) : $super.z3h.call(this, operators, scope);
|
|
502
460
|
};
|
|
503
|
-
var
|
|
504
|
-
function
|
|
505
|
-
|
|
506
|
-
new Companion();
|
|
507
|
-
return Companion_instance;
|
|
461
|
+
var Companion_instance_1;
|
|
462
|
+
function Companion_getInstance_4() {
|
|
463
|
+
return Companion_instance_1;
|
|
508
464
|
}
|
|
509
465
|
function TermParser() {
|
|
510
466
|
}
|
|
@@ -512,13 +468,12 @@
|
|
|
512
468
|
source = source === VOID ? null : source;
|
|
513
469
|
line = line === VOID ? 0 : line;
|
|
514
470
|
column = column === VOID ? 0 : column;
|
|
515
|
-
var tmp0_subject = _this__u8e3s4;
|
|
516
471
|
var tmp;
|
|
517
|
-
if (isInterface(
|
|
472
|
+
if (isInterface(_this__u8e3s4, Clause)) {
|
|
518
473
|
tmp = _this__u8e3s4;
|
|
519
474
|
} else {
|
|
520
|
-
if (isInterface(
|
|
521
|
-
tmp =
|
|
475
|
+
if (isInterface(_this__u8e3s4, Struct)) {
|
|
476
|
+
tmp = Companion_instance_0.of(_this__u8e3s4);
|
|
522
477
|
} else {
|
|
523
478
|
throw new InvalidTermTypeException(source, _this__u8e3s4, getKClass(Clause), VOID, line, column);
|
|
524
479
|
}
|
|
@@ -532,43 +487,39 @@
|
|
|
532
487
|
return get_defaultParser().parseStruct(input);
|
|
533
488
|
}
|
|
534
489
|
function get_defaultParser() {
|
|
535
|
-
return
|
|
490
|
+
return Companion_instance_1.withDefaultOperators();
|
|
536
491
|
}
|
|
537
492
|
function toAssociativity(_this__u8e3s4) {
|
|
538
493
|
return _this__u8e3s4.toString();
|
|
539
494
|
}
|
|
540
495
|
function DynamicOpListener$Companion$of$lambda($this$$receiver, it) {
|
|
541
|
-
return
|
|
496
|
+
return Unit_instance;
|
|
542
497
|
}
|
|
543
498
|
function onOperatorDefined($this, operator) {
|
|
544
|
-
$this.
|
|
545
|
-
$this.
|
|
499
|
+
$this.b3i_1.addOperator(operator.p1i_1, toAssociativity(operator.q1i_1), operator.r1i_1);
|
|
500
|
+
$this.c3i_1($this.b3i_1, operator);
|
|
546
501
|
}
|
|
547
502
|
function Companion_0() {
|
|
548
|
-
Companion_instance_0 = this;
|
|
549
503
|
}
|
|
550
|
-
protoOf(Companion_0).
|
|
504
|
+
protoOf(Companion_0).d3i = function (parser) {
|
|
551
505
|
return new DynamicOpListener(parser, DynamicOpListener$Companion$of$lambda);
|
|
552
506
|
};
|
|
553
|
-
var
|
|
554
|
-
function
|
|
555
|
-
|
|
556
|
-
new Companion_0();
|
|
557
|
-
return Companion_instance_0;
|
|
507
|
+
var Companion_instance_2;
|
|
508
|
+
function Companion_getInstance_5() {
|
|
509
|
+
return Companion_instance_2;
|
|
558
510
|
}
|
|
559
511
|
function DynamicOpListener$exitClause$lambda(it) {
|
|
560
512
|
return isInterface(it, Atom) ? it : THROW_CCE();
|
|
561
513
|
}
|
|
562
514
|
function DynamicOpListener(parser, operatorDefinedCallback) {
|
|
563
|
-
Companion_getInstance_7();
|
|
564
515
|
PrologParserListener.call(this);
|
|
565
|
-
this.
|
|
566
|
-
this.
|
|
516
|
+
this.b3i_1 = parser;
|
|
517
|
+
this.c3i_1 = operatorDefinedCallback;
|
|
567
518
|
}
|
|
568
|
-
protoOf(DynamicOpListener).
|
|
519
|
+
protoOf(DynamicOpListener).e3i = function (ctx) {
|
|
569
520
|
var expr = ctx.expression();
|
|
570
521
|
if (ctx.exception != null) {
|
|
571
|
-
return
|
|
522
|
+
return Unit_instance;
|
|
572
523
|
}
|
|
573
524
|
var tmp;
|
|
574
525
|
var tmp_0;
|
|
@@ -587,67 +538,28 @@
|
|
|
587
538
|
if (tmp) {
|
|
588
539
|
var tmp_1 = ctx.accept(new PrologVisitor());
|
|
589
540
|
var directive = isInterface(tmp_1, Directive) ? tmp_1 : THROW_CCE();
|
|
590
|
-
var op = directive.
|
|
591
|
-
|
|
592
|
-
var tmp_3;
|
|
593
|
-
var tmp_4;
|
|
594
|
-
var tmp_5;
|
|
595
|
-
var tmp_6;
|
|
596
|
-
if (isInterface(op, Struct)) {
|
|
597
|
-
tmp_6 = op.qv() === 3;
|
|
598
|
-
} else {
|
|
599
|
-
tmp_6 = false;
|
|
600
|
-
}
|
|
601
|
-
if (tmp_6) {
|
|
602
|
-
tmp_5 = op.wv() === 'op';
|
|
603
|
-
} else {
|
|
604
|
-
tmp_5 = false;
|
|
605
|
-
}
|
|
606
|
-
if (tmp_5) {
|
|
607
|
-
var tmp_7 = op.get(0);
|
|
608
|
-
tmp_4 = isInterface(tmp_7, Numeric);
|
|
609
|
-
} else {
|
|
610
|
-
tmp_4 = false;
|
|
611
|
-
}
|
|
612
|
-
if (tmp_4) {
|
|
613
|
-
var tmp_8 = op.get(1);
|
|
614
|
-
tmp_3 = isInterface(tmp_8, Atom);
|
|
615
|
-
} else {
|
|
616
|
-
tmp_3 = false;
|
|
617
|
-
}
|
|
618
|
-
if (tmp_3) {
|
|
619
|
-
tmp_2 = op.rw();
|
|
620
|
-
} else {
|
|
621
|
-
tmp_2 = false;
|
|
622
|
-
}
|
|
623
|
-
if (tmp_2) {
|
|
624
|
-
var tmp$ret$1;
|
|
541
|
+
var op = directive.xy();
|
|
542
|
+
if (get_isOpDirective(op)) {
|
|
625
543
|
// Inline function 'kotlin.math.min' call
|
|
626
|
-
var tmp$ret$0;
|
|
627
544
|
// Inline function 'kotlin.math.max' call
|
|
628
|
-
var
|
|
629
|
-
var
|
|
630
|
-
|
|
631
|
-
var
|
|
632
|
-
|
|
633
|
-
var priority = tmp$ret$1;
|
|
634
|
-
var specifier = Companion_getInstance_2().fromTerm(op.get(1));
|
|
545
|
+
var tmp_2 = (isInterface(op, Struct) ? op : THROW_CCE()).get(0);
|
|
546
|
+
var b = (isInterface(tmp_2, Numeric) ? tmp_2 : THROW_CCE()).y10().toInt();
|
|
547
|
+
var b_0 = Math.max(0, b);
|
|
548
|
+
var priority = Math.min(1200, b_0);
|
|
549
|
+
var specifier = Companion_getInstance_0().fromTerm(op.get(1));
|
|
635
550
|
var operator = op.get(2);
|
|
636
551
|
if (isInterface(operator, Atom)) {
|
|
637
|
-
onOperatorDefined(this, new Operator(operator.
|
|
552
|
+
onOperatorDefined(this, new Operator(operator.r2(), specifier, priority));
|
|
638
553
|
} else {
|
|
639
554
|
if (isInterface(operator, List)) {
|
|
640
555
|
var tmp$ret$3;
|
|
641
556
|
$l$block: {
|
|
642
557
|
// Inline function 'kotlin.sequences.all' call
|
|
643
|
-
var
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
var element = tmp0_iterator.n();
|
|
647
|
-
var tmp$ret$2;
|
|
558
|
+
var tmp0_iterator = operator.uu().r();
|
|
559
|
+
while (tmp0_iterator.s()) {
|
|
560
|
+
var element = tmp0_iterator.u();
|
|
648
561
|
// Inline function 'it.unibo.tuprolog.core.parsing.DynamicOpListener.exitClause.<anonymous>' call
|
|
649
|
-
|
|
650
|
-
if (!tmp$ret$2) {
|
|
562
|
+
if (!isInterface(element, Atom)) {
|
|
651
563
|
tmp$ret$3 = false;
|
|
652
564
|
break $l$block;
|
|
653
565
|
}
|
|
@@ -655,11 +567,11 @@
|
|
|
655
567
|
tmp$ret$3 = true;
|
|
656
568
|
}
|
|
657
569
|
if (tmp$ret$3) {
|
|
658
|
-
var
|
|
659
|
-
var tmp2_iterator = map(
|
|
660
|
-
while (tmp2_iterator.
|
|
661
|
-
var it = tmp2_iterator.
|
|
662
|
-
onOperatorDefined(this, new Operator(it.
|
|
570
|
+
var tmp_3 = operator.uu();
|
|
571
|
+
var tmp2_iterator = map(tmp_3, DynamicOpListener$exitClause$lambda).r();
|
|
572
|
+
while (tmp2_iterator.s()) {
|
|
573
|
+
var it = tmp2_iterator.u();
|
|
574
|
+
onOperatorDefined(this, new Operator(it.r2(), specifier, priority));
|
|
663
575
|
}
|
|
664
576
|
}
|
|
665
577
|
}
|
|
@@ -668,7 +580,7 @@
|
|
|
668
580
|
}
|
|
669
581
|
};
|
|
670
582
|
protoOf(DynamicOpListener).exitClause = function (ctx) {
|
|
671
|
-
return this.
|
|
583
|
+
return this.e3i(ctx);
|
|
672
584
|
};
|
|
673
585
|
function parseException(token, message) {
|
|
674
586
|
return new ParseException(null, token.text, token.line, token.column, message, null);
|
|
@@ -678,7 +590,7 @@
|
|
|
678
590
|
if (obj instanceof Token) {
|
|
679
591
|
tmp = obj.text;
|
|
680
592
|
} else {
|
|
681
|
-
tmp =
|
|
593
|
+
tmp = toString_0(obj);
|
|
682
594
|
}
|
|
683
595
|
return tmp;
|
|
684
596
|
}
|
|
@@ -688,7 +600,7 @@
|
|
|
688
600
|
function parseExpression($this, parserAndErrorStrategy, source) {
|
|
689
601
|
var mark = -1;
|
|
690
602
|
var index = -1;
|
|
691
|
-
var parser = parserAndErrorStrategy.
|
|
603
|
+
var parser = parserAndErrorStrategy.ye_1;
|
|
692
604
|
var tmp;
|
|
693
605
|
try {
|
|
694
606
|
mark = parser.getTokenStream().mark();
|
|
@@ -696,23 +608,21 @@
|
|
|
696
608
|
tmp = parser.singletonExpression();
|
|
697
609
|
} catch ($p) {
|
|
698
610
|
var tmp_0;
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
throw e instanceof Error ? e : THROW_CCE();
|
|
713
|
-
}
|
|
714
|
-
tmp_0 = tmp_1;
|
|
611
|
+
var e = $p;
|
|
612
|
+
var tmp_1;
|
|
613
|
+
if (isParseCancellationException(e) ? parser._interp.predictionMode === PredictionMode.SLL : false) {
|
|
614
|
+
parser.getTokenStream().seek(index);
|
|
615
|
+
parser._interp.predictionMode = PredictionMode.LL;
|
|
616
|
+
parser._errHandler = parserAndErrorStrategy.ze_1;
|
|
617
|
+
parser.addErrorListener(newErrorListener($this, source));
|
|
618
|
+
tmp_1 = parseExpression($this, parserAndErrorStrategy, source);
|
|
619
|
+
} else if (e.clause !== null ? isRecognitionException(e.cause) : false) {
|
|
620
|
+
var tmp_2 = e.cause;
|
|
621
|
+
throw tmp_2 instanceof RecognitionException ? tmp_2 : THROW_CCE();
|
|
622
|
+
} else {
|
|
623
|
+
throw e instanceof Error ? e : THROW_CCE();
|
|
715
624
|
}
|
|
625
|
+
tmp_0 = tmp_1;
|
|
716
626
|
tmp = tmp_0;
|
|
717
627
|
}
|
|
718
628
|
finally {
|
|
@@ -723,7 +633,7 @@
|
|
|
723
633
|
function parseClause_0($this, parserAndErrorStrategy, source) {
|
|
724
634
|
var mark = -1;
|
|
725
635
|
var index = -1;
|
|
726
|
-
var parser = parserAndErrorStrategy.
|
|
636
|
+
var parser = parserAndErrorStrategy.ye_1;
|
|
727
637
|
var tmp;
|
|
728
638
|
try {
|
|
729
639
|
mark = parser.getTokenStream().mark();
|
|
@@ -731,23 +641,21 @@
|
|
|
731
641
|
tmp = parser.optClause();
|
|
732
642
|
} catch ($p) {
|
|
733
643
|
var tmp_0;
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
throw e instanceof Error ? e : THROW_CCE();
|
|
748
|
-
}
|
|
749
|
-
tmp_0 = tmp_1;
|
|
644
|
+
var e = $p;
|
|
645
|
+
var tmp_1;
|
|
646
|
+
if (isParseCancellationException(e) ? parser._interp.predictionMode === PredictionMode.SLL : false) {
|
|
647
|
+
parser.getTokenStream().seek(index);
|
|
648
|
+
parser._interp.predictionMode = PredictionMode.LL;
|
|
649
|
+
parser._errHandler = parserAndErrorStrategy.ze_1;
|
|
650
|
+
parser.addErrorListener(newErrorListener($this, source));
|
|
651
|
+
tmp_1 = parseClause_0($this, parserAndErrorStrategy, source);
|
|
652
|
+
} else if (e.clause !== null ? isRecognitionException(e.cause) : false) {
|
|
653
|
+
var tmp_2 = e.cause;
|
|
654
|
+
throw tmp_2 instanceof RecognitionException ? tmp_2 : THROW_CCE();
|
|
655
|
+
} else {
|
|
656
|
+
throw e instanceof Error ? e : THROW_CCE();
|
|
750
657
|
}
|
|
658
|
+
tmp_0 = tmp_1;
|
|
751
659
|
tmp = tmp_0;
|
|
752
660
|
}
|
|
753
661
|
finally {
|
|
@@ -762,13 +670,13 @@
|
|
|
762
670
|
return map(tmp_1, PrologParserFactory$parseClauses$lambda_2);
|
|
763
671
|
}
|
|
764
672
|
function PrologParserFactory$newErrorListener$1($whileParsing) {
|
|
765
|
-
this.
|
|
673
|
+
this.f3i_1 = $whileParsing;
|
|
766
674
|
}
|
|
767
675
|
protoOf(PrologParserFactory$newErrorListener$1).syntaxError = function (recognizer, offendingSymbol, line, column, msg, e) {
|
|
768
676
|
if (recognizer instanceof PrologParser) {
|
|
769
677
|
recognizer.removeParseListeners();
|
|
770
678
|
}
|
|
771
|
-
throw new ParseException(this.
|
|
679
|
+
throw new ParseException(this.f3i_1, symbolToString(this, offendingSymbol), line, column + 1 | 0, msg, e);
|
|
772
680
|
};
|
|
773
681
|
function PrologParserFactory$parseClauses$lambda(it) {
|
|
774
682
|
return it + 1 | 0;
|
|
@@ -777,7 +685,7 @@
|
|
|
777
685
|
return function (it) {
|
|
778
686
|
var tmp;
|
|
779
687
|
try {
|
|
780
|
-
tmp = parseClause_0(
|
|
688
|
+
tmp = parseClause_0(PrologParserFactory_instance, $parser, $source);
|
|
781
689
|
} catch ($p) {
|
|
782
690
|
var tmp_0;
|
|
783
691
|
if ($p instanceof ParseException) {
|
|
@@ -787,7 +695,6 @@
|
|
|
787
695
|
} else {
|
|
788
696
|
throw $p;
|
|
789
697
|
}
|
|
790
|
-
tmp = tmp_0;
|
|
791
698
|
}
|
|
792
699
|
return tmp;
|
|
793
700
|
};
|
|
@@ -799,17 +706,16 @@
|
|
|
799
706
|
return it.clause();
|
|
800
707
|
}
|
|
801
708
|
function PrologParserFactory() {
|
|
802
|
-
PrologParserFactory_instance = this;
|
|
803
709
|
}
|
|
804
|
-
protoOf(PrologParserFactory).
|
|
805
|
-
var parser = this.
|
|
710
|
+
protoOf(PrologParserFactory).g3i = function (string, withOperators) {
|
|
711
|
+
var parser = this.h3i(string, withOperators);
|
|
806
712
|
return parseExpression(this, parser, string);
|
|
807
713
|
};
|
|
808
|
-
protoOf(PrologParserFactory).
|
|
809
|
-
var parser = this.
|
|
714
|
+
protoOf(PrologParserFactory).i3i = function (source, withOperators) {
|
|
715
|
+
var parser = this.h3i(source, withOperators);
|
|
810
716
|
return parseClauses(this, parser, source);
|
|
811
717
|
};
|
|
812
|
-
protoOf(PrologParserFactory).
|
|
718
|
+
protoOf(PrologParserFactory).h3i = function (source, operators) {
|
|
813
719
|
var stream = new InputStream(source);
|
|
814
720
|
var lexer = new PrologLexer(stream);
|
|
815
721
|
lexer.removeErrorListeners();
|
|
@@ -819,23 +725,21 @@
|
|
|
819
725
|
var originalErrorStrategy = parser._errHandler;
|
|
820
726
|
parser._errHandler = new BailErrorStrategy();
|
|
821
727
|
parser._interp.predictionMode = PredictionMode.SLL;
|
|
822
|
-
return to(this.
|
|
728
|
+
return to(this.j3i(parser, operators), originalErrorStrategy);
|
|
823
729
|
};
|
|
824
|
-
protoOf(PrologParserFactory).
|
|
730
|
+
protoOf(PrologParserFactory).j3i = function (prologParser, operators) {
|
|
825
731
|
// Inline function 'kotlin.collections.forEach' call
|
|
826
|
-
var tmp0_iterator = operators.
|
|
827
|
-
while (tmp0_iterator.
|
|
828
|
-
var element = tmp0_iterator.
|
|
732
|
+
var tmp0_iterator = operators.r();
|
|
733
|
+
while (tmp0_iterator.s()) {
|
|
734
|
+
var element = tmp0_iterator.u();
|
|
829
735
|
// Inline function 'it.unibo.tuprolog.core.parsing.PrologParserFactory.addOperators.<anonymous>' call
|
|
830
|
-
prologParser.addOperator(element.
|
|
736
|
+
prologParser.addOperator(element.p1i_1, toAssociativity(element.q1i_1), element.r1i_1);
|
|
831
737
|
}
|
|
832
|
-
prologParser.addParseListener(
|
|
738
|
+
prologParser.addParseListener(Companion_instance_2.d3i(prologParser));
|
|
833
739
|
return prologParser;
|
|
834
740
|
};
|
|
835
741
|
var PrologParserFactory_instance;
|
|
836
742
|
function PrologParserFactory_getInstance() {
|
|
837
|
-
if (PrologParserFactory_instance == null)
|
|
838
|
-
new PrologParserFactory();
|
|
839
743
|
return PrologParserFactory_instance;
|
|
840
744
|
}
|
|
841
745
|
function parseInteger_0($this, ctx) {
|
|
@@ -844,65 +748,44 @@
|
|
|
844
748
|
var clean;
|
|
845
749
|
if (ctx.isBin) {
|
|
846
750
|
base = 2;
|
|
847
|
-
var tmp$ret$1;
|
|
848
751
|
// Inline function 'kotlin.text.substring' call
|
|
849
|
-
var tmp$ret$0;
|
|
850
752
|
// Inline function 'kotlin.js.asDynamic' call
|
|
851
|
-
|
|
852
|
-
tmp$ret$1 = tmp$ret$0.substring(2);
|
|
853
|
-
clean = tmp$ret$1;
|
|
753
|
+
clean = str.substring(2);
|
|
854
754
|
} else if (ctx.isOct) {
|
|
855
755
|
base = 8;
|
|
856
|
-
var tmp$ret$3;
|
|
857
756
|
// Inline function 'kotlin.text.substring' call
|
|
858
|
-
var tmp$ret$2;
|
|
859
757
|
// Inline function 'kotlin.js.asDynamic' call
|
|
860
|
-
|
|
861
|
-
tmp$ret$3 = tmp$ret$2.substring(2);
|
|
862
|
-
clean = tmp$ret$3;
|
|
758
|
+
clean = str.substring(2);
|
|
863
759
|
} else if (ctx.isHex) {
|
|
864
760
|
base = 16;
|
|
865
|
-
var tmp$ret$5;
|
|
866
761
|
// Inline function 'kotlin.text.substring' call
|
|
867
|
-
var tmp$ret$4;
|
|
868
762
|
// Inline function 'kotlin.js.asDynamic' call
|
|
869
|
-
|
|
870
|
-
tmp$ret$5 = tmp$ret$4.substring(2);
|
|
871
|
-
clean = tmp$ret$5;
|
|
763
|
+
clean = str.substring(2);
|
|
872
764
|
} else if (ctx.isChar) {
|
|
873
|
-
var tmp$ret$7;
|
|
874
765
|
// Inline function 'kotlin.text.substring' call
|
|
875
|
-
var tmp$ret$6;
|
|
876
766
|
// Inline function 'kotlin.js.asDynamic' call
|
|
877
|
-
|
|
878
|
-
tmp$ret$7 = tmp$ret$6.substring(2);
|
|
879
|
-
clean = tmp$ret$7;
|
|
767
|
+
clean = str.substring(2);
|
|
880
768
|
if (!(clean.length === 1)) {
|
|
881
769
|
throw parseException(ctx.value, 'Invalid character literal: ' + ctx.value.text);
|
|
882
770
|
}
|
|
883
|
-
var tmp$ret$10;
|
|
884
771
|
// Inline function 'kotlin.with' call
|
|
885
|
-
var tmp =
|
|
886
|
-
var tmp$ret$8;
|
|
772
|
+
var tmp = Companion_getInstance_1();
|
|
887
773
|
// Inline function 'kotlin.code' call
|
|
888
|
-
var
|
|
889
|
-
tmp$ret$8 = Char__toInt_impl_vasixd(
|
|
890
|
-
var tmp1_with = tmp.of(tmp$ret$8);
|
|
774
|
+
var this_0 = charSequenceGet(clean, 0);
|
|
775
|
+
var tmp$ret$8 = Char__toInt_impl_vasixd(this_0);
|
|
891
776
|
// Inline function 'kotlin.contracts.contract' call
|
|
892
|
-
var tmp$ret$9;
|
|
893
777
|
// Inline function 'it.unibo.tuprolog.core.parsing.PrologVisitor.parseInteger.<anonymous>' call
|
|
778
|
+
var $this$with = tmp.of(tmp$ret$8);
|
|
894
779
|
var tmp_0;
|
|
895
780
|
var tmp0_safe_receiver = ctx.sign;
|
|
896
781
|
var tmp1_safe_receiver = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.text;
|
|
897
782
|
var tmp2_elvis_lhs = tmp1_safe_receiver == null ? null : contains_0(tmp1_safe_receiver, '-');
|
|
898
783
|
if (tmp2_elvis_lhs == null ? false : tmp2_elvis_lhs) {
|
|
899
|
-
tmp_0 =
|
|
784
|
+
tmp_0 = $this$with.unaryMinus();
|
|
900
785
|
} else {
|
|
901
|
-
tmp_0 =
|
|
786
|
+
tmp_0 = $this$with;
|
|
902
787
|
}
|
|
903
|
-
|
|
904
|
-
tmp$ret$10 = tmp$ret$9;
|
|
905
|
-
return tmp$ret$10;
|
|
788
|
+
return tmp_0;
|
|
906
789
|
} else {
|
|
907
790
|
base = 10;
|
|
908
791
|
clean = str;
|
|
@@ -911,72 +794,59 @@
|
|
|
911
794
|
var tmp0_safe_receiver_0 = ctx.sign;
|
|
912
795
|
clean = plus(tmp0_safe_receiver_0 == null ? null : tmp0_safe_receiver_0.text, clean);
|
|
913
796
|
}
|
|
914
|
-
return
|
|
797
|
+
return Companion_getInstance_1().parseWithRadix(clean, base);
|
|
915
798
|
}
|
|
916
799
|
function visitPostfixExpression($this, ctx) {
|
|
917
800
|
var tmp0_safe_receiver = ctx.left;
|
|
918
801
|
var tmp = ensureNotNull(tmp0_safe_receiver == null ? null : tmp0_safe_receiver.accept($this));
|
|
919
|
-
var tmp$ret$2;
|
|
920
802
|
// Inline function 'kotlin.collections.map' call
|
|
921
|
-
var
|
|
922
|
-
var tmp$ret$1;
|
|
803
|
+
var this_0 = ctx.operators;
|
|
923
804
|
// Inline function 'kotlin.collections.mapTo' call
|
|
924
|
-
var
|
|
925
|
-
var indexedObject = tmp1_map;
|
|
805
|
+
var destination = ArrayList_init_$Create$(this_0.length);
|
|
926
806
|
var inductionVariable = 0;
|
|
927
|
-
var last =
|
|
807
|
+
var last = this_0.length;
|
|
928
808
|
while (inductionVariable < last) {
|
|
929
|
-
var item =
|
|
809
|
+
var item = this_0[inductionVariable];
|
|
930
810
|
inductionVariable = inductionVariable + 1 | 0;
|
|
931
|
-
var tmp$ret$0;
|
|
932
811
|
// Inline function 'it.unibo.tuprolog.core.parsing.PrologVisitor.visitPostfixExpression.<anonymous>' call
|
|
933
|
-
tmp$ret$0 = item.symbol.text;
|
|
934
|
-
|
|
812
|
+
var tmp$ret$0 = item.symbol.text;
|
|
813
|
+
destination.o(tmp$ret$0);
|
|
935
814
|
}
|
|
936
|
-
|
|
937
|
-
tmp$ret$2 = tmp$ret$1;
|
|
938
|
-
return postfix($this, tmp, tmp$ret$2);
|
|
815
|
+
return postfix($this, tmp, destination);
|
|
939
816
|
}
|
|
940
817
|
function postfix($this, term, ops) {
|
|
941
|
-
var operator = ops.
|
|
942
|
-
var result = $this.
|
|
943
|
-
while (operator.
|
|
944
|
-
result = $this.
|
|
818
|
+
var operator = ops.r();
|
|
819
|
+
var result = $this.k3i_1.structOf(operator.u(), [term]);
|
|
820
|
+
while (operator.s()) {
|
|
821
|
+
result = $this.k3i_1.structOf(operator.u(), [result]);
|
|
945
822
|
}
|
|
946
823
|
return result;
|
|
947
824
|
}
|
|
948
825
|
function visitPrefixExpression($this, ctx) {
|
|
949
826
|
var tmp = ctx.right[0].accept($this);
|
|
950
|
-
var tmp$ret$2;
|
|
951
827
|
// Inline function 'kotlin.collections.map' call
|
|
952
|
-
var
|
|
953
|
-
var tmp$ret$1;
|
|
828
|
+
var this_0 = ctx.operators;
|
|
954
829
|
// Inline function 'kotlin.collections.mapTo' call
|
|
955
|
-
var
|
|
956
|
-
var indexedObject = tmp1_map;
|
|
830
|
+
var destination = ArrayList_init_$Create$(this_0.length);
|
|
957
831
|
var inductionVariable = 0;
|
|
958
|
-
var last =
|
|
832
|
+
var last = this_0.length;
|
|
959
833
|
while (inductionVariable < last) {
|
|
960
|
-
var item =
|
|
834
|
+
var item = this_0[inductionVariable];
|
|
961
835
|
inductionVariable = inductionVariable + 1 | 0;
|
|
962
|
-
var tmp$ret$0;
|
|
963
836
|
// Inline function 'it.unibo.tuprolog.core.parsing.PrologVisitor.visitPrefixExpression.<anonymous>' call
|
|
964
|
-
tmp$ret$0 = item.symbol.text;
|
|
965
|
-
|
|
837
|
+
var tmp$ret$0 = item.symbol.text;
|
|
838
|
+
destination.o(tmp$ret$0);
|
|
966
839
|
}
|
|
967
|
-
|
|
968
|
-
tmp$ret$2 = tmp$ret$1;
|
|
969
|
-
return prefix($this, tmp, tmp$ret$2);
|
|
840
|
+
return prefix($this, tmp, destination);
|
|
970
841
|
}
|
|
971
842
|
function prefix($this, term, ops) {
|
|
972
|
-
var i = ops.
|
|
843
|
+
var i = ops.l() - 1 | 0;
|
|
973
844
|
var tmp0 = i;
|
|
974
845
|
i = tmp0 - 1 | 0;
|
|
975
|
-
var result = $this.
|
|
846
|
+
var result = $this.k3i_1.structOf(ops.c1(tmp0), [term]);
|
|
976
847
|
while (i >= 0) {
|
|
977
|
-
result = $this.
|
|
978
|
-
|
|
979
|
-
i = tmp1 - 1 | 0;
|
|
848
|
+
result = $this.k3i_1.structOf(ops.c1(i), [result]);
|
|
849
|
+
i = i - 1 | 0;
|
|
980
850
|
}
|
|
981
851
|
return result;
|
|
982
852
|
}
|
|
@@ -990,131 +860,109 @@
|
|
|
990
860
|
} else if (tmp0_subject === Associativity.XFX) {
|
|
991
861
|
tmp = visitInfixNonAssociativeExpression($this, ctx);
|
|
992
862
|
} else {
|
|
993
|
-
|
|
863
|
+
var message = 'Non-infix associativity ' + ctx.associativity + ' in infix expression';
|
|
864
|
+
throw IllegalStateException_init_$Create$(toString_0(message));
|
|
994
865
|
}
|
|
995
866
|
return tmp;
|
|
996
867
|
}
|
|
997
868
|
function visitInfixNonAssociativeExpression($this, ctx) {
|
|
998
|
-
var tmp$ret$2;
|
|
999
869
|
// Inline function 'kotlin.collections.map' call
|
|
1000
|
-
var
|
|
1001
|
-
var tmp$ret$1;
|
|
870
|
+
var this_0 = plus_0(listOf(ensureNotNull(ctx.left)), asList(ctx.right));
|
|
1002
871
|
// Inline function 'kotlin.collections.mapTo' call
|
|
1003
|
-
var
|
|
1004
|
-
var tmp0_iterator =
|
|
1005
|
-
while (tmp0_iterator.
|
|
1006
|
-
var item = tmp0_iterator.
|
|
1007
|
-
var tmp$ret$0;
|
|
872
|
+
var destination = ArrayList_init_$Create$(collectionSizeOrDefault(this_0, 10));
|
|
873
|
+
var tmp0_iterator = this_0.r();
|
|
874
|
+
while (tmp0_iterator.s()) {
|
|
875
|
+
var item = tmp0_iterator.u();
|
|
1008
876
|
// Inline function 'it.unibo.tuprolog.core.parsing.PrologVisitor.visitInfixNonAssociativeExpression.<anonymous>' call
|
|
1009
|
-
tmp$ret$0 = item.accept($this);
|
|
1010
|
-
|
|
877
|
+
var tmp$ret$0 = item.accept($this);
|
|
878
|
+
destination.o(tmp$ret$0);
|
|
1011
879
|
}
|
|
1012
|
-
|
|
1013
|
-
tmp$ret$2 = tmp$ret$1;
|
|
1014
|
-
var operands = tmp$ret$2;
|
|
1015
|
-
var tmp$ret$5;
|
|
880
|
+
var operands = destination;
|
|
1016
881
|
// Inline function 'kotlin.collections.map' call
|
|
1017
|
-
var
|
|
1018
|
-
var tmp$ret$4;
|
|
882
|
+
var this_1 = ctx.operators;
|
|
1019
883
|
// Inline function 'kotlin.collections.mapTo' call
|
|
1020
|
-
var
|
|
1021
|
-
var indexedObject = tmp3_map;
|
|
884
|
+
var destination_0 = ArrayList_init_$Create$(this_1.length);
|
|
1022
885
|
var inductionVariable = 0;
|
|
1023
|
-
var last =
|
|
886
|
+
var last = this_1.length;
|
|
1024
887
|
while (inductionVariable < last) {
|
|
1025
|
-
var item_0 =
|
|
888
|
+
var item_0 = this_1[inductionVariable];
|
|
1026
889
|
inductionVariable = inductionVariable + 1 | 0;
|
|
1027
|
-
var tmp$ret$3;
|
|
1028
890
|
// Inline function 'it.unibo.tuprolog.core.parsing.PrologVisitor.visitInfixNonAssociativeExpression.<anonymous>' call
|
|
1029
|
-
tmp$ret$3 = item_0.symbol.text;
|
|
1030
|
-
|
|
891
|
+
var tmp$ret$3 = item_0.symbol.text;
|
|
892
|
+
destination_0.o(tmp$ret$3);
|
|
1031
893
|
}
|
|
1032
|
-
|
|
1033
|
-
tmp$ret$5 = tmp$ret$4;
|
|
1034
|
-
var operators = tmp$ret$5;
|
|
894
|
+
var operators = destination_0;
|
|
1035
895
|
return infixNonAssociative($this, operands, operators);
|
|
1036
896
|
}
|
|
1037
897
|
function infixNonAssociative($this, terms, ops) {
|
|
1038
|
-
return $this.
|
|
898
|
+
return $this.k3i_1.structOf(ops.c1(0), [terms.c1(0), terms.c1(1)]);
|
|
1039
899
|
}
|
|
1040
900
|
function handleOuters($this, expression, outers) {
|
|
1041
901
|
var result = expression;
|
|
1042
|
-
var tmp0_iterator = outers.
|
|
1043
|
-
while (tmp0_iterator.
|
|
1044
|
-
var o = tmp0_iterator.
|
|
902
|
+
var tmp0_iterator = outers.r();
|
|
903
|
+
while (tmp0_iterator.s()) {
|
|
904
|
+
var o = tmp0_iterator.u();
|
|
1045
905
|
var tmp = listOf(result);
|
|
1046
|
-
var tmp$ret$2;
|
|
1047
906
|
// Inline function 'kotlin.collections.map' call
|
|
1048
|
-
var
|
|
1049
|
-
var tmp$ret$1;
|
|
907
|
+
var this_0 = o.right;
|
|
1050
908
|
// Inline function 'kotlin.collections.mapTo' call
|
|
1051
|
-
var
|
|
1052
|
-
var indexedObject = tmp1_map;
|
|
909
|
+
var destination = ArrayList_init_$Create$(this_0.length);
|
|
1053
910
|
var inductionVariable = 0;
|
|
1054
|
-
var last =
|
|
911
|
+
var last = this_0.length;
|
|
1055
912
|
while (inductionVariable < last) {
|
|
1056
|
-
var item =
|
|
913
|
+
var item = this_0[inductionVariable];
|
|
1057
914
|
inductionVariable = inductionVariable + 1 | 0;
|
|
1058
|
-
var tmp$ret$0;
|
|
1059
915
|
// Inline function 'it.unibo.tuprolog.core.parsing.PrologVisitor.handleOuters.<anonymous>' call
|
|
1060
|
-
tmp$ret$0 = item.accept($this);
|
|
1061
|
-
|
|
916
|
+
var tmp$ret$0 = item.accept($this);
|
|
917
|
+
destination.o(tmp$ret$0);
|
|
1062
918
|
}
|
|
1063
|
-
|
|
1064
|
-
tmp$ret$2 = tmp$ret$1;
|
|
1065
|
-
var operands = plus_0(tmp, tmp$ret$2);
|
|
1066
|
-
var tmp$ret$5;
|
|
919
|
+
var operands = plus_0(tmp, destination);
|
|
1067
920
|
// Inline function 'kotlin.collections.map' call
|
|
1068
|
-
var
|
|
1069
|
-
var tmp$ret$4;
|
|
921
|
+
var this_1 = o.operators;
|
|
1070
922
|
// Inline function 'kotlin.collections.mapTo' call
|
|
1071
|
-
var
|
|
1072
|
-
var indexedObject_0 = tmp3_map;
|
|
923
|
+
var destination_0 = ArrayList_init_$Create$(this_1.length);
|
|
1073
924
|
var inductionVariable_0 = 0;
|
|
1074
|
-
var last_0 =
|
|
925
|
+
var last_0 = this_1.length;
|
|
1075
926
|
while (inductionVariable_0 < last_0) {
|
|
1076
|
-
var item_0 =
|
|
927
|
+
var item_0 = this_1[inductionVariable_0];
|
|
1077
928
|
inductionVariable_0 = inductionVariable_0 + 1 | 0;
|
|
1078
|
-
var tmp$ret$3;
|
|
1079
929
|
// Inline function 'it.unibo.tuprolog.core.parsing.PrologVisitor.handleOuters.<anonymous>' call
|
|
1080
|
-
tmp$ret$3 = item_0.symbol.text;
|
|
1081
|
-
|
|
930
|
+
var tmp$ret$3 = item_0.symbol.text;
|
|
931
|
+
destination_0.o(tmp$ret$3);
|
|
1082
932
|
}
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
var operators = tmp$ret$5;
|
|
1086
|
-
var tmp1_subject = o.associativity;
|
|
933
|
+
var operators = destination_0;
|
|
934
|
+
var associativity = o.associativity;
|
|
1087
935
|
var tmp_0;
|
|
1088
|
-
if (
|
|
936
|
+
if (associativity === Associativity.XFY) {
|
|
1089
937
|
tmp_0 = infixRight($this, operands, operators);
|
|
1090
|
-
} else if (
|
|
938
|
+
} else if (associativity === Associativity.XF ? true : associativity === Associativity.YF) {
|
|
1091
939
|
tmp_0 = postfix($this, result, operators);
|
|
1092
|
-
} else if (
|
|
940
|
+
} else if (associativity === Associativity.XFX) {
|
|
1093
941
|
tmp_0 = infixNonAssociative($this, operands, operators);
|
|
1094
|
-
} else if (
|
|
942
|
+
} else if (associativity === Associativity.YFX) {
|
|
1095
943
|
tmp_0 = infixLeft($this, operands, operators);
|
|
1096
|
-
} else if (
|
|
944
|
+
} else if (associativity === Associativity.FX ? true : associativity === Associativity.FY) {
|
|
1097
945
|
tmp_0 = prefix($this, result, operators);
|
|
1098
946
|
} else {
|
|
1099
|
-
|
|
947
|
+
var message = 'Invalid associativity: ' + associativity;
|
|
948
|
+
throw IllegalStateException_init_$Create$(toString_0(message));
|
|
1100
949
|
}
|
|
1101
950
|
result = tmp_0;
|
|
1102
951
|
}
|
|
1103
952
|
return result;
|
|
1104
953
|
}
|
|
1105
954
|
function infixRight($this, terms, ops) {
|
|
1106
|
-
var i = terms.
|
|
1107
|
-
var j = ops.
|
|
955
|
+
var i = terms.l() - 1 | 0;
|
|
956
|
+
var j = ops.l() - 1 | 0;
|
|
1108
957
|
var tmp0 = j;
|
|
1109
958
|
j = tmp0 - 1 | 0;
|
|
1110
|
-
var result = $this.
|
|
959
|
+
var result = $this.k3i_1.structOf(ops.c1(tmp0), [terms.c1(i - 1 | 0), terms.c1(i)]);
|
|
1111
960
|
i = i - 2 | 0;
|
|
1112
961
|
while (i >= 0) {
|
|
1113
962
|
var tmp1 = j;
|
|
1114
963
|
j = tmp1 - 1 | 0;
|
|
1115
|
-
result = $this.
|
|
1116
|
-
|
|
1117
|
-
i = tmp2 - 1 | 0;
|
|
964
|
+
result = $this.k3i_1.structOf(ops.c1(tmp1), [terms.c1(i), result]);
|
|
965
|
+
i = i - 1 | 0;
|
|
1118
966
|
}
|
|
1119
967
|
return result;
|
|
1120
968
|
}
|
|
@@ -1123,62 +971,50 @@
|
|
|
1123
971
|
var j = 0;
|
|
1124
972
|
var tmp0 = j;
|
|
1125
973
|
j = tmp0 + 1 | 0;
|
|
1126
|
-
var tmp = ops.
|
|
974
|
+
var tmp = ops.c1(tmp0);
|
|
1127
975
|
var tmp1 = i;
|
|
1128
976
|
i = tmp1 + 1 | 0;
|
|
1129
|
-
var tmp_0 = terms.
|
|
977
|
+
var tmp_0 = terms.c1(tmp1);
|
|
1130
978
|
var tmp2 = i;
|
|
1131
979
|
i = tmp2 + 1 | 0;
|
|
1132
|
-
var result = $this.
|
|
1133
|
-
while (i < terms.
|
|
980
|
+
var result = $this.k3i_1.structOf(tmp, [tmp_0, terms.c1(tmp2)]);
|
|
981
|
+
while (i < terms.l()) {
|
|
1134
982
|
var tmp3 = j;
|
|
1135
983
|
j = tmp3 + 1 | 0;
|
|
1136
|
-
result = $this.
|
|
1137
|
-
|
|
1138
|
-
i = tmp4 + 1 | 0;
|
|
984
|
+
result = $this.k3i_1.structOf(ops.c1(tmp3), [result, terms.c1(i)]);
|
|
985
|
+
i = i + 1 | 0;
|
|
1139
986
|
}
|
|
1140
987
|
return result;
|
|
1141
988
|
}
|
|
1142
989
|
function listOfOperands($this, ctx) {
|
|
1143
|
-
var tmp$ret$2;
|
|
1144
990
|
// Inline function 'kotlin.collections.map' call
|
|
1145
|
-
var
|
|
1146
|
-
var tmp$ret$1;
|
|
991
|
+
var this_0 = plus_0(listOf(ctx.left), toList(ctx.right));
|
|
1147
992
|
// Inline function 'kotlin.collections.mapTo' call
|
|
1148
|
-
var
|
|
1149
|
-
var tmp0_iterator =
|
|
1150
|
-
while (tmp0_iterator.
|
|
1151
|
-
var item = tmp0_iterator.
|
|
1152
|
-
var tmp$ret$0;
|
|
993
|
+
var destination = ArrayList_init_$Create$(collectionSizeOrDefault(this_0, 10));
|
|
994
|
+
var tmp0_iterator = this_0.r();
|
|
995
|
+
while (tmp0_iterator.s()) {
|
|
996
|
+
var item = tmp0_iterator.u();
|
|
1153
997
|
// Inline function 'it.unibo.tuprolog.core.parsing.PrologVisitor.listOfOperands.<anonymous>' call
|
|
1154
|
-
tmp$ret$0 = ensureNotNull(item).accept($this);
|
|
1155
|
-
|
|
998
|
+
var tmp$ret$0 = ensureNotNull(item).accept($this);
|
|
999
|
+
destination.o(tmp$ret$0);
|
|
1156
1000
|
}
|
|
1157
|
-
|
|
1158
|
-
tmp$ret$2 = tmp$ret$1;
|
|
1159
|
-
return tmp$ret$2;
|
|
1001
|
+
return destination;
|
|
1160
1002
|
}
|
|
1161
1003
|
function listOfOperators($this, ctx) {
|
|
1162
|
-
var tmp$ret$2;
|
|
1163
1004
|
// Inline function 'kotlin.collections.map' call
|
|
1164
|
-
var
|
|
1165
|
-
var tmp$ret$1;
|
|
1005
|
+
var this_0 = ctx.operators;
|
|
1166
1006
|
// Inline function 'kotlin.collections.mapTo' call
|
|
1167
|
-
var
|
|
1168
|
-
var indexedObject = tmp1_map;
|
|
1007
|
+
var destination = ArrayList_init_$Create$(this_0.length);
|
|
1169
1008
|
var inductionVariable = 0;
|
|
1170
|
-
var last =
|
|
1009
|
+
var last = this_0.length;
|
|
1171
1010
|
while (inductionVariable < last) {
|
|
1172
|
-
var item =
|
|
1011
|
+
var item = this_0[inductionVariable];
|
|
1173
1012
|
inductionVariable = inductionVariable + 1 | 0;
|
|
1174
|
-
var tmp$ret$0;
|
|
1175
1013
|
// Inline function 'it.unibo.tuprolog.core.parsing.PrologVisitor.listOfOperators.<anonymous>' call
|
|
1176
|
-
tmp$ret$0 = item.symbol.text;
|
|
1177
|
-
|
|
1014
|
+
var tmp$ret$0 = item.symbol.text;
|
|
1015
|
+
destination.o(tmp$ret$0);
|
|
1178
1016
|
}
|
|
1179
|
-
|
|
1180
|
-
tmp$ret$2 = tmp$ret$1;
|
|
1181
|
-
return tmp$ret$2;
|
|
1017
|
+
return destination;
|
|
1182
1018
|
}
|
|
1183
1019
|
function visitInfixRightAssociativeExpression($this, ctx) {
|
|
1184
1020
|
return infixRight($this, listOfOperands($this, ctx), listOfOperators($this, ctx));
|
|
@@ -1187,10 +1023,8 @@
|
|
|
1187
1023
|
return infixLeft($this, listOfOperands($this, ctx), listOfOperators($this, ctx));
|
|
1188
1024
|
}
|
|
1189
1025
|
function flatten($this, outers) {
|
|
1190
|
-
var tmp$ret$0;
|
|
1191
1026
|
// Inline function 'kotlin.sequences.asSequence' call
|
|
1192
|
-
tmp
|
|
1193
|
-
var tmp = tmp$ret$0;
|
|
1027
|
+
var tmp = outers;
|
|
1194
1028
|
return flatMap(tmp, PrologVisitor$flatten$lambda($this));
|
|
1195
1029
|
}
|
|
1196
1030
|
function flatten_0($this, outers) {
|
|
@@ -1198,7 +1032,7 @@
|
|
|
1198
1032
|
}
|
|
1199
1033
|
function PrologVisitor$visitExpression$ref($boundThis) {
|
|
1200
1034
|
var l = function (p0) {
|
|
1201
|
-
return $boundThis.
|
|
1035
|
+
return $boundThis.l3i(p0);
|
|
1202
1036
|
};
|
|
1203
1037
|
l.callableName = 'visitExpression';
|
|
1204
1038
|
return l;
|
|
@@ -1209,32 +1043,32 @@
|
|
|
1209
1043
|
};
|
|
1210
1044
|
}
|
|
1211
1045
|
function PrologVisitor(scope) {
|
|
1212
|
-
scope = scope === VOID ?
|
|
1046
|
+
scope = scope === VOID ? Companion_instance.empty() : scope;
|
|
1213
1047
|
PrologParserVisitor.call(this);
|
|
1214
|
-
this.
|
|
1048
|
+
this.k3i_1 = scope;
|
|
1215
1049
|
}
|
|
1216
|
-
protoOf(PrologVisitor).
|
|
1217
|
-
return this.
|
|
1050
|
+
protoOf(PrologVisitor).m3i = function (ctx) {
|
|
1051
|
+
return this.n3i(ctx.term());
|
|
1218
1052
|
};
|
|
1219
1053
|
protoOf(PrologVisitor).visitSingletonTerm = function (ctx) {
|
|
1220
|
-
return this.
|
|
1054
|
+
return this.m3i(ctx);
|
|
1221
1055
|
};
|
|
1222
|
-
protoOf(PrologVisitor).
|
|
1223
|
-
return this.
|
|
1056
|
+
protoOf(PrologVisitor).o3i = function (ctx) {
|
|
1057
|
+
return this.l3i(ctx.expression());
|
|
1224
1058
|
};
|
|
1225
1059
|
protoOf(PrologVisitor).visitSingletonExpression = function (ctx) {
|
|
1226
|
-
return this.
|
|
1060
|
+
return this.o3i(ctx);
|
|
1227
1061
|
};
|
|
1228
|
-
protoOf(PrologVisitor).
|
|
1062
|
+
protoOf(PrologVisitor).p3i = function (ctx) {
|
|
1229
1063
|
return termToClause(ctx.expression().accept(this), null, ensureNotNull(ctx.start).line, ensureNotNull(ctx.start).column);
|
|
1230
1064
|
};
|
|
1231
1065
|
protoOf(PrologVisitor).visitClause = function (ctx) {
|
|
1232
|
-
return this.
|
|
1066
|
+
return this.p3i(ctx);
|
|
1233
1067
|
};
|
|
1234
|
-
protoOf(PrologVisitor).
|
|
1068
|
+
protoOf(PrologVisitor).l3i = function (ctx) {
|
|
1235
1069
|
var tmp;
|
|
1236
1070
|
if (ctx.isTerm) {
|
|
1237
|
-
tmp = this.
|
|
1071
|
+
tmp = this.n3i(ensureNotNull(ctx.left));
|
|
1238
1072
|
} else if (contains(Associativity.INFIX, ctx.associativity)) {
|
|
1239
1073
|
tmp = visitInfixExpression(this, ctx);
|
|
1240
1074
|
} else if (contains(Associativity.POSTFIX, ctx.associativity)) {
|
|
@@ -1247,12 +1081,12 @@
|
|
|
1247
1081
|
return handleOuters(this, tmp, flatten_0(this, asList(ctx.outers)));
|
|
1248
1082
|
};
|
|
1249
1083
|
protoOf(PrologVisitor).visitExpression = function (ctx) {
|
|
1250
|
-
return this.
|
|
1084
|
+
return this.l3i(ctx);
|
|
1251
1085
|
};
|
|
1252
|
-
protoOf(PrologVisitor).
|
|
1086
|
+
protoOf(PrologVisitor).n3i = function (ctx) {
|
|
1253
1087
|
var tmp;
|
|
1254
1088
|
if (ctx.isExpr) {
|
|
1255
|
-
tmp = this.
|
|
1089
|
+
tmp = this.l3i(ctx.expression());
|
|
1256
1090
|
} else {
|
|
1257
1091
|
var tmp_0 = ctx.children[0].accept(this);
|
|
1258
1092
|
tmp = (!(tmp_0 == null) ? isInterface(tmp_0, Term) : false) ? tmp_0 : THROW_CCE();
|
|
@@ -1260,23 +1094,23 @@
|
|
|
1260
1094
|
return tmp;
|
|
1261
1095
|
};
|
|
1262
1096
|
protoOf(PrologVisitor).visitTerm = function (ctx) {
|
|
1263
|
-
return this.
|
|
1097
|
+
return this.n3i(ctx);
|
|
1264
1098
|
};
|
|
1265
|
-
protoOf(PrologVisitor).
|
|
1099
|
+
protoOf(PrologVisitor).q3i = function (ctx) {
|
|
1266
1100
|
var value = parseInteger_0(this, ctx);
|
|
1267
|
-
return
|
|
1101
|
+
return Companion_getInstance_2().ofBigInteger(value);
|
|
1268
1102
|
};
|
|
1269
1103
|
protoOf(PrologVisitor).visitInteger = function (ctx) {
|
|
1270
|
-
return this.
|
|
1104
|
+
return this.q3i(ctx);
|
|
1271
1105
|
};
|
|
1272
|
-
protoOf(PrologVisitor).
|
|
1106
|
+
protoOf(PrologVisitor).r3i = function (ctx) {
|
|
1273
1107
|
var tmp = ctx.children[0].accept(this);
|
|
1274
1108
|
return (!(tmp == null) ? isInterface(tmp, Term) : false) ? tmp : THROW_CCE();
|
|
1275
1109
|
};
|
|
1276
1110
|
protoOf(PrologVisitor).visitNumber = function (ctx) {
|
|
1277
|
-
return this.
|
|
1111
|
+
return this.r3i(ctx);
|
|
1278
1112
|
};
|
|
1279
|
-
protoOf(PrologVisitor).
|
|
1113
|
+
protoOf(PrologVisitor).s3i = function (ctx) {
|
|
1280
1114
|
var raw = ctx.value.text;
|
|
1281
1115
|
if (!(ctx.sign == null)) {
|
|
1282
1116
|
var tmp0_safe_receiver = ctx.sign;
|
|
@@ -1284,7 +1118,7 @@
|
|
|
1284
1118
|
}
|
|
1285
1119
|
var tmp;
|
|
1286
1120
|
try {
|
|
1287
|
-
tmp =
|
|
1121
|
+
tmp = Companion_getInstance_3().parse(raw);
|
|
1288
1122
|
} catch ($p) {
|
|
1289
1123
|
var tmp_0;
|
|
1290
1124
|
if ($p instanceof NumberFormatException) {
|
|
@@ -1293,118 +1127,108 @@
|
|
|
1293
1127
|
} else {
|
|
1294
1128
|
throw $p;
|
|
1295
1129
|
}
|
|
1296
|
-
tmp = tmp_0;
|
|
1297
1130
|
}
|
|
1298
1131
|
return tmp;
|
|
1299
1132
|
};
|
|
1300
1133
|
protoOf(PrologVisitor).visitReal = function (ctx) {
|
|
1301
|
-
return this.
|
|
1134
|
+
return this.s3i(ctx);
|
|
1302
1135
|
};
|
|
1303
|
-
protoOf(PrologVisitor).
|
|
1136
|
+
protoOf(PrologVisitor).t3i = function (ctx) {
|
|
1304
1137
|
var tmp;
|
|
1305
1138
|
if (ctx.isAnonymous) {
|
|
1306
|
-
tmp = this.
|
|
1139
|
+
tmp = this.k3i_1.anonymous();
|
|
1307
1140
|
} else {
|
|
1308
|
-
tmp = this.
|
|
1141
|
+
tmp = this.k3i_1.varOf(ctx.value.text);
|
|
1309
1142
|
}
|
|
1310
1143
|
return tmp;
|
|
1311
1144
|
};
|
|
1312
1145
|
protoOf(PrologVisitor).visitVariable = function (ctx) {
|
|
1313
|
-
return this.
|
|
1146
|
+
return this.t3i(ctx);
|
|
1314
1147
|
};
|
|
1315
|
-
protoOf(PrologVisitor).
|
|
1148
|
+
protoOf(PrologVisitor).u3i = function (ctx) {
|
|
1149
|
+
var tmp;
|
|
1316
1150
|
if (ctx.isList) {
|
|
1317
|
-
|
|
1151
|
+
tmp = this.k3i_1.listOf([]);
|
|
1318
1152
|
} else if (ctx.isBlock) {
|
|
1319
|
-
|
|
1320
|
-
}
|
|
1321
|
-
|
|
1322
|
-
if (ctx.arity === 0) {
|
|
1323
|
-
tmp = this.h3h_1.atomOf(ctx.functor.text);
|
|
1153
|
+
tmp = this.k3i_1.setOf([]);
|
|
1154
|
+
} else if (ctx.arity === 0) {
|
|
1155
|
+
tmp = this.k3i_1.atomOf(ctx.functor.text);
|
|
1324
1156
|
} else {
|
|
1325
1157
|
var tmp_0 = ctx.functor.text;
|
|
1326
1158
|
var tmp_1 = asSequence_0(ctx.args);
|
|
1327
|
-
tmp = this.
|
|
1159
|
+
tmp = this.k3i_1.structOfSequence(tmp_0, map(tmp_1, PrologVisitor$visitExpression$ref(this)));
|
|
1328
1160
|
}
|
|
1329
1161
|
return tmp;
|
|
1330
1162
|
};
|
|
1331
1163
|
protoOf(PrologVisitor).visitStructure = function (ctx) {
|
|
1332
|
-
return this.
|
|
1164
|
+
return this.u3i(ctx);
|
|
1333
1165
|
};
|
|
1334
|
-
protoOf(PrologVisitor).
|
|
1335
|
-
var tmp$ret$1;
|
|
1166
|
+
protoOf(PrologVisitor).v3i = function (ctx) {
|
|
1336
1167
|
// Inline function 'kotlin.collections.map' call
|
|
1337
|
-
var
|
|
1338
|
-
var tmp$ret$0;
|
|
1168
|
+
var this_0 = ctx.items;
|
|
1339
1169
|
// Inline function 'kotlin.collections.mapTo' call
|
|
1340
|
-
var
|
|
1341
|
-
var indexedObject = tmp1_map;
|
|
1170
|
+
var destination = ArrayList_init_$Create$(this_0.length);
|
|
1342
1171
|
var inductionVariable = 0;
|
|
1343
|
-
var last =
|
|
1172
|
+
var last = this_0.length;
|
|
1344
1173
|
while (inductionVariable < last) {
|
|
1345
|
-
var item =
|
|
1174
|
+
var item = this_0[inductionVariable];
|
|
1346
1175
|
inductionVariable = inductionVariable + 1 | 0;
|
|
1347
|
-
|
|
1176
|
+
var tmp$ret$0 = this.l3i(item);
|
|
1177
|
+
destination.o(tmp$ret$0);
|
|
1348
1178
|
}
|
|
1349
|
-
|
|
1350
|
-
tmp$ret$1 = tmp$ret$0;
|
|
1351
|
-
var terms = tmp$ret$1;
|
|
1179
|
+
var terms = destination;
|
|
1352
1180
|
var tmp;
|
|
1353
1181
|
if (ctx.hasTail) {
|
|
1354
1182
|
var tmp0_safe_receiver = ctx.tail;
|
|
1355
|
-
tmp = this.
|
|
1183
|
+
tmp = this.k3i_1.h12(terms, tmp0_safe_receiver == null ? null : tmp0_safe_receiver.accept(this));
|
|
1356
1184
|
} else {
|
|
1357
|
-
tmp = this.
|
|
1185
|
+
tmp = this.k3i_1.listOfIterable(terms);
|
|
1358
1186
|
}
|
|
1359
1187
|
return tmp;
|
|
1360
1188
|
};
|
|
1361
1189
|
protoOf(PrologVisitor).visitList = function (ctx) {
|
|
1362
|
-
return this.
|
|
1190
|
+
return this.v3i(ctx);
|
|
1363
1191
|
};
|
|
1364
|
-
protoOf(PrologVisitor).
|
|
1192
|
+
protoOf(PrologVisitor).w3i = function (ctx) {
|
|
1365
1193
|
var tmp;
|
|
1366
1194
|
if (ctx.length === 1) {
|
|
1367
|
-
tmp = this.
|
|
1195
|
+
tmp = this.k3i_1.setOf([ctx.items[0].accept(this)]);
|
|
1368
1196
|
} else {
|
|
1369
|
-
var tmp$ret$1;
|
|
1370
1197
|
// Inline function 'kotlin.collections.map' call
|
|
1371
|
-
var
|
|
1372
|
-
var tmp$ret$0;
|
|
1198
|
+
var this_0 = ctx.items;
|
|
1373
1199
|
// Inline function 'kotlin.collections.mapTo' call
|
|
1374
|
-
var
|
|
1375
|
-
var indexedObject = tmp1_map;
|
|
1200
|
+
var destination = ArrayList_init_$Create$(this_0.length);
|
|
1376
1201
|
var inductionVariable = 0;
|
|
1377
|
-
var last =
|
|
1202
|
+
var last = this_0.length;
|
|
1378
1203
|
while (inductionVariable < last) {
|
|
1379
|
-
var item =
|
|
1204
|
+
var item = this_0[inductionVariable];
|
|
1380
1205
|
inductionVariable = inductionVariable + 1 | 0;
|
|
1381
|
-
|
|
1206
|
+
var tmp$ret$0 = this.l3i(item);
|
|
1207
|
+
destination.o(tmp$ret$0);
|
|
1382
1208
|
}
|
|
1383
|
-
tmp
|
|
1384
|
-
tmp$ret$1 = tmp$ret$0;
|
|
1385
|
-
tmp = this.h3h_1.setOfIterable(tmp$ret$1);
|
|
1209
|
+
tmp = this.k3i_1.setOfIterable(destination);
|
|
1386
1210
|
}
|
|
1387
1211
|
return tmp;
|
|
1388
1212
|
};
|
|
1389
1213
|
protoOf(PrologVisitor).visitBlock = function (ctx) {
|
|
1390
|
-
return this.
|
|
1214
|
+
return this.w3i(ctx);
|
|
1391
1215
|
};
|
|
1392
1216
|
function termParserWithOperators(operators, scope) {
|
|
1393
|
-
scope = scope === VOID ?
|
|
1217
|
+
scope = scope === VOID ? Companion_instance.empty() : scope;
|
|
1394
1218
|
return new TermParserImpl(scope, operators);
|
|
1395
1219
|
}
|
|
1396
1220
|
function TermParserImpl(scope, defaultOperatorSet) {
|
|
1397
|
-
this.
|
|
1398
|
-
this.
|
|
1221
|
+
this.x3i_1 = scope;
|
|
1222
|
+
this.y3i_1 = defaultOperatorSet;
|
|
1399
1223
|
}
|
|
1400
|
-
protoOf(TermParserImpl).
|
|
1401
|
-
return this.
|
|
1224
|
+
protoOf(TermParserImpl).a3i = function () {
|
|
1225
|
+
return this.y3i_1;
|
|
1402
1226
|
};
|
|
1403
|
-
protoOf(TermParserImpl).
|
|
1404
|
-
return
|
|
1227
|
+
protoOf(TermParserImpl).z3i = function (input, operators) {
|
|
1228
|
+
return PrologParserFactory_instance.g3i(input, operators).accept(new PrologVisitor(this.x3i_1));
|
|
1405
1229
|
};
|
|
1406
1230
|
protoOf(TermParserImpl).parseTermWithOperators = function (input, operators) {
|
|
1407
|
-
return this.
|
|
1231
|
+
return this.z3i(input, operators);
|
|
1408
1232
|
};
|
|
1409
1233
|
//region block: post-declaration
|
|
1410
1234
|
protoOf(TermParserImpl).parseTerm = parseTerm;
|
|
@@ -1431,9 +1255,14 @@
|
|
|
1431
1255
|
protoOf(TermParserImpl).parseDirectiveWithOperators = parseDirectiveWithOperators;
|
|
1432
1256
|
protoOf(TermParserImpl).parseDirective = parseDirective;
|
|
1433
1257
|
//endregion
|
|
1258
|
+
//region block: init
|
|
1259
|
+
Companion_instance_1 = new Companion();
|
|
1260
|
+
Companion_instance_2 = new Companion_0();
|
|
1261
|
+
PrologParserFactory_instance = new PrologParserFactory();
|
|
1262
|
+
//endregion
|
|
1434
1263
|
//region block: exports
|
|
1435
1264
|
_.$_$ = _.$_$ || {};
|
|
1436
|
-
_.$_$.a =
|
|
1265
|
+
_.$_$.a = PrologParserFactory_instance;
|
|
1437
1266
|
_.$_$.b = ParseException;
|
|
1438
1267
|
_.$_$.c = PrologVisitor;
|
|
1439
1268
|
_.$_$.d = parseStruct_0;
|