@tuprolog/arg2p-core 0.7.2 → 0.8.1

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-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-js-ir.js', './2p-core.js', './2p-parser-js.js', './kt-math.js'], factory);
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-js-ir.js'), require('./2p-core.js'), require('./2p-parser-js.js'), require('./kt-math.js'));
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-js-ir'] === 'undefined') {
20
- throw new Error("Error loading module '2p-parser-core'. Its dependency 'kotlin-kotlin-stdlib-js-ir' was not found. Please, check whether 'kotlin-kotlin-stdlib-js-ir' is loaded prior to '2p-parser-core'.");
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-js-ir'], this['2p-core'], this['2p-parser-js'], this['kt-math']);
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,73 +44,287 @@
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.$_$.s9;
48
- var captureStack = kotlin_kotlin.$_$.p4;
49
- var protoOf = kotlin_kotlin.$_$.q5;
50
- var classMeta = kotlin_kotlin.$_$.u4;
51
- var setMetadataFor = kotlin_kotlin.$_$.r5;
52
- var TuPrologException = kotlin_it_unibo_tuprolog_core.$_$.x;
53
- var TuPrologException_init_$Init$ = kotlin_it_unibo_tuprolog_core.$_$.b;
54
- var ensureNotNull = kotlin_kotlin.$_$.i9;
55
- var replace = kotlin_kotlin.$_$.i8;
56
- var _Char___init__impl__6a9atx = kotlin_kotlin.$_$.c1;
57
- var Char = kotlin_kotlin.$_$.u8;
58
- var Clause = kotlin_it_unibo_tuprolog_core.$_$.b1;
47
+ var VOID = kotlin_kotlin.$_$.d;
48
+ var captureStack = kotlin_kotlin.$_$.z4;
49
+ var protoOf = kotlin_kotlin.$_$.a6;
50
+ var classMeta = kotlin_kotlin.$_$.e5;
51
+ var setMetadataFor = kotlin_kotlin.$_$.b6;
52
+ var TuPrologException = kotlin_it_unibo_tuprolog_core.$_$.b1;
53
+ var TuPrologException_init_$Init$ = kotlin_it_unibo_tuprolog_core.$_$.e;
54
+ var ensureNotNull = kotlin_kotlin.$_$.y9;
55
+ var replace = kotlin_kotlin.$_$.w8;
56
+ var _Char___init__impl__6a9atx = kotlin_kotlin.$_$.f1;
57
+ var Char = kotlin_kotlin.$_$.j9;
58
+ var toString = kotlin_kotlin.$_$.j1;
59
+ var Struct = kotlin_it_unibo_tuprolog_core.$_$.r1;
60
+ var isInterface = kotlin_kotlin.$_$.q5;
61
+ var Numeric = kotlin_it_unibo_tuprolog_core.$_$.n1;
62
+ var Atom = kotlin_it_unibo_tuprolog_core.$_$.e1;
63
+ var Companion_getInstance = kotlin_it_unibo_tuprolog_core.$_$.i;
64
+ var Companion_instance = kotlin_it_unibo_tuprolog_core.$_$.t;
65
+ var OperatorSet_init_$Create$ = kotlin_it_unibo_tuprolog_core.$_$.f;
66
+ var objectMeta = kotlin_kotlin.$_$.z5;
59
67
  var getKClass = kotlin_kotlin.$_$.c;
60
- var Companion_getInstance = kotlin_it_unibo_tuprolog_core.$_$.j;
61
- var Struct = kotlin_it_unibo_tuprolog_core.$_$.l1;
62
- var isInterface = kotlin_kotlin.$_$.f5;
63
- var Unit_getInstance = kotlin_kotlin.$_$.o1;
64
- var objectMeta = kotlin_kotlin.$_$.p5;
65
- var THROW_CCE = kotlin_kotlin.$_$.f9;
66
- var Atom = kotlin_it_unibo_tuprolog_core.$_$.a1;
67
- var contains = kotlin_kotlin.$_$.f2;
68
- var Directive = kotlin_it_unibo_tuprolog_core.$_$.d1;
69
- var Numeric = kotlin_it_unibo_tuprolog_core.$_$.i1;
70
- var Companion_getInstance_0 = kotlin_it_unibo_tuprolog_core.$_$.g;
71
- var map = kotlin_kotlin.$_$.h7;
72
- var Operator = kotlin_it_unibo_tuprolog_core.$_$.z;
73
- var List = kotlin_it_unibo_tuprolog_core.$_$.h1;
74
- var toString = kotlin_kotlin.$_$.v5;
75
- var coerceAtLeast = kotlin_kotlin.$_$.g6;
68
+ var Constant = kotlin_it_unibo_tuprolog_core.$_$.g1;
69
+ var Var = kotlin_it_unibo_tuprolog_core.$_$.s2;
70
+ var Integer = kotlin_it_unibo_tuprolog_core.$_$.l1;
71
+ var Real = kotlin_it_unibo_tuprolog_core.$_$.o1;
72
+ var Clause = kotlin_it_unibo_tuprolog_core.$_$.f1;
73
+ var Rule = kotlin_it_unibo_tuprolog_core.$_$.p1;
74
+ var Fact = kotlin_it_unibo_tuprolog_core.$_$.j1;
75
+ var Directive = kotlin_it_unibo_tuprolog_core.$_$.i1;
76
+ var interfaceMeta = kotlin_kotlin.$_$.n5;
77
+ var Companion_instance_0 = kotlin_it_unibo_tuprolog_core.$_$.m;
78
+ var Unit_instance = kotlin_kotlin.$_$.s1;
79
+ var THROW_CCE = kotlin_kotlin.$_$.v9;
80
+ var contains = kotlin_kotlin.$_$.l2;
81
+ var Companion_getInstance_0 = kotlin_it_unibo_tuprolog_core.$_$.j;
82
+ var map = kotlin_kotlin.$_$.s7;
83
+ var Operator = kotlin_it_unibo_tuprolog_core.$_$.d1;
84
+ var List = kotlin_it_unibo_tuprolog_core.$_$.m1;
85
+ var toString_0 = kotlin_kotlin.$_$.f6;
86
+ var coerceAtLeast = kotlin_kotlin.$_$.q6;
76
87
  var isRecognitionException = kotlin_it_unibo_tuprolog_parser_js.$_$.b;
77
88
  var isParseCancellationException = kotlin_it_unibo_tuprolog_parser_js.$_$.a;
78
- var generateSequence = kotlin_kotlin.$_$.b7;
79
- var takeWhile = kotlin_kotlin.$_$.p7;
80
- var to = kotlin_kotlin.$_$.r9;
89
+ var generateSequence = kotlin_kotlin.$_$.m7;
90
+ var takeWhile = kotlin_kotlin.$_$.c8;
91
+ var to = kotlin_kotlin.$_$.ha;
81
92
  var Companion_getInstance_1 = kotlin_io_github_gciatto_kt_math.$_$.e;
82
- var charSequenceGet = kotlin_kotlin.$_$.s4;
83
- var Char__toInt_impl_vasixd = kotlin_kotlin.$_$.f1;
84
- var contains_0 = kotlin_kotlin.$_$.b8;
85
- var plus = kotlin_kotlin.$_$.m9;
86
- var ArrayList_init_$Create$ = kotlin_kotlin.$_$.d;
87
- var IllegalStateException_init_$Create$ = kotlin_kotlin.$_$.s;
88
- var listOf = kotlin_kotlin.$_$.a3;
89
- var asList = kotlin_kotlin.$_$.x1;
90
- var plus_0 = kotlin_kotlin.$_$.s3;
91
- var collectionSizeOrDefault = kotlin_kotlin.$_$.d2;
92
- var toList = kotlin_kotlin.$_$.c4;
93
- var flatMap = kotlin_kotlin.$_$.z6;
94
- var asSequence = kotlin_kotlin.$_$.b2;
95
- var toList_0 = kotlin_kotlin.$_$.t7;
96
- var sequenceOf = kotlin_kotlin.$_$.m7;
97
- var asSequence_0 = kotlin_kotlin.$_$.c2;
98
- var plus_1 = kotlin_kotlin.$_$.l7;
99
- var Companion_getInstance_2 = kotlin_it_unibo_tuprolog_core.$_$.q;
100
- var IllegalArgumentException_init_$Create$ = kotlin_kotlin.$_$.q;
101
- var Term = kotlin_it_unibo_tuprolog_core.$_$.j2;
102
- var Companion_getInstance_3 = kotlin_it_unibo_tuprolog_core.$_$.l;
103
- var Companion_getInstance_4 = kotlin_it_unibo_tuprolog_core.$_$.o;
104
- var NumberFormatException = kotlin_kotlin.$_$.c9;
93
+ var charSequenceGet = kotlin_kotlin.$_$.c5;
94
+ var Char__toInt_impl_vasixd = kotlin_kotlin.$_$.i1;
95
+ var contains_0 = kotlin_kotlin.$_$.o8;
96
+ var plus = kotlin_kotlin.$_$.ca;
97
+ var ArrayList_init_$Create$ = kotlin_kotlin.$_$.e;
98
+ var IllegalStateException_init_$Create$ = kotlin_kotlin.$_$.v;
99
+ var listOf = kotlin_kotlin.$_$.j3;
100
+ var asList = kotlin_kotlin.$_$.d2;
101
+ var plus_0 = kotlin_kotlin.$_$.c4;
102
+ var collectionSizeOrDefault = kotlin_kotlin.$_$.j2;
103
+ var toList = kotlin_kotlin.$_$.l4;
104
+ var flatMap = kotlin_kotlin.$_$.k7;
105
+ var asSequence = kotlin_kotlin.$_$.h2;
106
+ var toList_0 = kotlin_kotlin.$_$.g8;
107
+ var sequenceOf = kotlin_kotlin.$_$.y7;
108
+ var asSequence_0 = kotlin_kotlin.$_$.i2;
109
+ var plus_1 = kotlin_kotlin.$_$.w7;
110
+ var IllegalArgumentException_init_$Create$ = kotlin_kotlin.$_$.s;
111
+ var Term = kotlin_it_unibo_tuprolog_core.$_$.q2;
112
+ var Companion_getInstance_2 = kotlin_it_unibo_tuprolog_core.$_$.o;
113
+ var Companion_getInstance_3 = kotlin_it_unibo_tuprolog_core.$_$.r;
114
+ var NumberFormatException = kotlin_kotlin.$_$.s9;
105
115
  //endregion
106
116
  //region block: pre-declaration
107
117
  setMetadataFor(ParseException, 'ParseException', classMeta, TuPrologException);
108
118
  setMetadataFor(InvalidTermTypeException, 'InvalidTermTypeException', classMeta, ParseException);
109
119
  setMetadataFor(Companion, 'Companion', objectMeta);
120
+ function parseTerm(input) {
121
+ return this.parseTermWithOperators(input, this.b39());
122
+ }
123
+ function parseStructWithOperators(input, operators) {
124
+ // Inline function 'it.unibo.tuprolog.core.parsing.Companion.parseAs' call
125
+ // Inline function 'kotlin.let' call
126
+ // Inline function 'kotlin.contracts.contract' call
127
+ // Inline function 'it.unibo.tuprolog.core.parsing.Companion.parseAs.<anonymous>' call
128
+ var it = this.parseTermWithOperators(input, operators);
129
+ var tmp0_elvis_lhs = isInterface(it, Struct) ? it : null;
130
+ var tmp;
131
+ if (tmp0_elvis_lhs == null) {
132
+ throw new InvalidTermTypeException(input, it, getKClass(Struct));
133
+ } else {
134
+ tmp = tmp0_elvis_lhs;
135
+ }
136
+ return tmp;
137
+ }
138
+ function parseStruct(input) {
139
+ return this.parseStructWithOperators(input, this.b39());
140
+ }
141
+ function parseConstantWithOperators(input, operators) {
142
+ // Inline function 'it.unibo.tuprolog.core.parsing.Companion.parseAs' call
143
+ // Inline function 'kotlin.let' call
144
+ // Inline function 'kotlin.contracts.contract' call
145
+ // Inline function 'it.unibo.tuprolog.core.parsing.Companion.parseAs.<anonymous>' call
146
+ var it = this.parseTermWithOperators(input, operators);
147
+ var tmp0_elvis_lhs = isInterface(it, Constant) ? it : null;
148
+ var tmp;
149
+ if (tmp0_elvis_lhs == null) {
150
+ throw new InvalidTermTypeException(input, it, getKClass(Constant));
151
+ } else {
152
+ tmp = tmp0_elvis_lhs;
153
+ }
154
+ return tmp;
155
+ }
156
+ function parseConstant(input) {
157
+ return this.parseConstantWithOperators(input, this.b39());
158
+ }
159
+ function parseVarWithOperators(input, operators) {
160
+ // Inline function 'it.unibo.tuprolog.core.parsing.Companion.parseAs' call
161
+ // Inline function 'kotlin.let' call
162
+ // Inline function 'kotlin.contracts.contract' call
163
+ // Inline function 'it.unibo.tuprolog.core.parsing.Companion.parseAs.<anonymous>' call
164
+ var it = this.parseTermWithOperators(input, operators);
165
+ var tmp0_elvis_lhs = isInterface(it, Var) ? it : null;
166
+ var tmp;
167
+ if (tmp0_elvis_lhs == null) {
168
+ throw new InvalidTermTypeException(input, it, getKClass(Var));
169
+ } else {
170
+ tmp = tmp0_elvis_lhs;
171
+ }
172
+ return tmp;
173
+ }
174
+ function parseVar(input) {
175
+ return this.parseVarWithOperators(input, this.b39());
176
+ }
177
+ function parseAtomWithOperators(input, operators) {
178
+ // Inline function 'it.unibo.tuprolog.core.parsing.Companion.parseAs' call
179
+ // Inline function 'kotlin.let' call
180
+ // Inline function 'kotlin.contracts.contract' call
181
+ // Inline function 'it.unibo.tuprolog.core.parsing.Companion.parseAs.<anonymous>' call
182
+ var it = this.parseTermWithOperators(input, operators);
183
+ var tmp0_elvis_lhs = isInterface(it, Atom) ? it : null;
184
+ var tmp;
185
+ if (tmp0_elvis_lhs == null) {
186
+ throw new InvalidTermTypeException(input, it, getKClass(Atom));
187
+ } else {
188
+ tmp = tmp0_elvis_lhs;
189
+ }
190
+ return tmp;
191
+ }
192
+ function parseAtom(input) {
193
+ return this.parseAtomWithOperators(input, this.b39());
194
+ }
195
+ function parseNumericWithOperators(input, operators) {
196
+ // Inline function 'it.unibo.tuprolog.core.parsing.Companion.parseAs' call
197
+ // Inline function 'kotlin.let' call
198
+ // Inline function 'kotlin.contracts.contract' call
199
+ // Inline function 'it.unibo.tuprolog.core.parsing.Companion.parseAs.<anonymous>' call
200
+ var it = this.parseTermWithOperators(input, operators);
201
+ var tmp0_elvis_lhs = isInterface(it, Numeric) ? it : null;
202
+ var tmp;
203
+ if (tmp0_elvis_lhs == null) {
204
+ throw new InvalidTermTypeException(input, it, getKClass(Numeric));
205
+ } else {
206
+ tmp = tmp0_elvis_lhs;
207
+ }
208
+ return tmp;
209
+ }
210
+ function parseNumeric(input) {
211
+ return this.parseNumericWithOperators(input, this.b39());
212
+ }
213
+ function parseIntegerWithOperators(input, operators) {
214
+ // Inline function 'it.unibo.tuprolog.core.parsing.Companion.parseAs' call
215
+ // Inline function 'kotlin.let' call
216
+ // Inline function 'kotlin.contracts.contract' call
217
+ // Inline function 'it.unibo.tuprolog.core.parsing.Companion.parseAs.<anonymous>' call
218
+ var it = this.parseTermWithOperators(input, operators);
219
+ var tmp0_elvis_lhs = isInterface(it, Integer) ? it : null;
220
+ var tmp;
221
+ if (tmp0_elvis_lhs == null) {
222
+ throw new InvalidTermTypeException(input, it, getKClass(Integer));
223
+ } else {
224
+ tmp = tmp0_elvis_lhs;
225
+ }
226
+ return tmp;
227
+ }
228
+ function parseInteger(input) {
229
+ return this.parseIntegerWithOperators(input, this.b39());
230
+ }
231
+ function parseRealWithOperators(input, operators) {
232
+ // Inline function 'it.unibo.tuprolog.core.parsing.Companion.parseAs' call
233
+ // Inline function 'kotlin.let' call
234
+ // Inline function 'kotlin.contracts.contract' call
235
+ // Inline function 'it.unibo.tuprolog.core.parsing.Companion.parseAs.<anonymous>' call
236
+ var it = this.parseTermWithOperators(input, operators);
237
+ var tmp0_elvis_lhs = isInterface(it, Real) ? it : null;
238
+ var tmp;
239
+ if (tmp0_elvis_lhs == null) {
240
+ throw new InvalidTermTypeException(input, it, getKClass(Real));
241
+ } else {
242
+ tmp = tmp0_elvis_lhs;
243
+ }
244
+ return tmp;
245
+ }
246
+ function parseReal(input) {
247
+ return this.parseRealWithOperators(input, this.b39());
248
+ }
249
+ function parseClauseWithOperators(input, operators) {
250
+ // Inline function 'it.unibo.tuprolog.core.parsing.Companion.parseAs' call
251
+ // Inline function 'kotlin.let' call
252
+ // Inline function 'kotlin.contracts.contract' call
253
+ // Inline function 'it.unibo.tuprolog.core.parsing.Companion.parseAs.<anonymous>' call
254
+ var it = this.parseTermWithOperators(input, operators);
255
+ var tmp0_elvis_lhs = isInterface(it, Clause) ? it : null;
256
+ var tmp;
257
+ if (tmp0_elvis_lhs == null) {
258
+ throw new InvalidTermTypeException(input, it, getKClass(Clause));
259
+ } else {
260
+ tmp = tmp0_elvis_lhs;
261
+ }
262
+ return tmp;
263
+ }
264
+ function parseClause(input) {
265
+ return this.parseClauseWithOperators(input, this.b39());
266
+ }
267
+ function parseRuleWithOperators(input, operators) {
268
+ // Inline function 'it.unibo.tuprolog.core.parsing.Companion.parseAs' call
269
+ // Inline function 'kotlin.let' call
270
+ // Inline function 'kotlin.contracts.contract' call
271
+ // Inline function 'it.unibo.tuprolog.core.parsing.Companion.parseAs.<anonymous>' call
272
+ var it = this.parseTermWithOperators(input, operators);
273
+ var tmp0_elvis_lhs = isInterface(it, Rule) ? it : null;
274
+ var tmp;
275
+ if (tmp0_elvis_lhs == null) {
276
+ throw new InvalidTermTypeException(input, it, getKClass(Rule));
277
+ } else {
278
+ tmp = tmp0_elvis_lhs;
279
+ }
280
+ return tmp;
281
+ }
282
+ function parseRule(input) {
283
+ return this.parseRuleWithOperators(input, this.b39());
284
+ }
285
+ function parseFactWithOperators(input, operators) {
286
+ // Inline function 'it.unibo.tuprolog.core.parsing.Companion.parseAs' call
287
+ // Inline function 'kotlin.let' call
288
+ // Inline function 'kotlin.contracts.contract' call
289
+ // Inline function 'it.unibo.tuprolog.core.parsing.Companion.parseAs.<anonymous>' call
290
+ var it = this.parseTermWithOperators(input, operators);
291
+ var tmp0_elvis_lhs = isInterface(it, Fact) ? it : null;
292
+ var tmp;
293
+ if (tmp0_elvis_lhs == null) {
294
+ throw new InvalidTermTypeException(input, it, getKClass(Fact));
295
+ } else {
296
+ tmp = tmp0_elvis_lhs;
297
+ }
298
+ return tmp;
299
+ }
300
+ function parseFact(input) {
301
+ return this.parseFactWithOperators(input, this.b39());
302
+ }
303
+ function parseDirectiveWithOperators(input, operators) {
304
+ // Inline function 'it.unibo.tuprolog.core.parsing.Companion.parseAs' call
305
+ // Inline function 'kotlin.let' call
306
+ // Inline function 'kotlin.contracts.contract' call
307
+ // Inline function 'it.unibo.tuprolog.core.parsing.Companion.parseAs.<anonymous>' call
308
+ var it = this.parseTermWithOperators(input, operators);
309
+ var tmp0_elvis_lhs = isInterface(it, Directive) ? it : null;
310
+ var tmp;
311
+ if (tmp0_elvis_lhs == null) {
312
+ throw new InvalidTermTypeException(input, it, getKClass(Directive));
313
+ } else {
314
+ tmp = tmp0_elvis_lhs;
315
+ }
316
+ return tmp;
317
+ }
318
+ function parseDirective(input) {
319
+ return this.parseDirectiveWithOperators(input, this.b39());
320
+ }
321
+ setMetadataFor(TermParser, 'TermParser', interfaceMeta);
322
+ setMetadataFor(Companion_0, 'Companion', objectMeta);
110
323
  setMetadataFor(DynamicOpListener, 'DynamicOpListener', classMeta, PrologParserListener);
111
324
  setMetadataFor(PrologParserFactory$newErrorListener$1, VOID, classMeta);
112
325
  setMetadataFor(PrologParserFactory, 'PrologParserFactory', objectMeta);
113
- setMetadataFor(PrologVisitor, 'PrologVisitor', classMeta, PrologParserVisitor);
326
+ setMetadataFor(PrologVisitor, 'PrologVisitor', classMeta, PrologParserVisitor, VOID, PrologVisitor);
327
+ setMetadataFor(TermParserImpl, 'TermParserImpl', classMeta, VOID, [TermParser]);
114
328
  //endregion
115
329
  function InvalidTermTypeException(input, term, type, offendingSymbol, line, column, message, throwable) {
116
330
  var tmp;
@@ -123,12 +337,12 @@
123
337
  offendingSymbol = tmp;
124
338
  line = line === VOID ? 1 : line;
125
339
  column = column === VOID ? 1 : column;
126
- message = message === VOID ? 'Expected ' + type.xc() + ', got: ' + offendingSymbol : message;
340
+ message = message === VOID ? 'Expected ' + type.o6() + ', got: ' + offendingSymbol : message;
127
341
  throwable = throwable === VOID ? null : throwable;
128
342
  ParseException.call(this, input, offendingSymbol, line, column, message, throwable);
129
343
  captureStack(this, InvalidTermTypeException);
130
- this.l33_1 = term;
131
- this.m33_1 = type;
344
+ this.k38_1 = term;
345
+ this.l38_1 = type;
132
346
  }
133
347
  function ParseException(input, offendingSymbol, line, column, message, throwable) {
134
348
  TuPrologException_init_$Init$(message, throwable, this);
@@ -139,91 +353,173 @@
139
353
  this.column = column;
140
354
  this.clauseIndex = -1;
141
355
  }
142
- protoOf(ParseException).n33 = function (_set____db54di) {
356
+ protoOf(ParseException).m38 = function (_set____db54di) {
143
357
  this.input = _set____db54di;
144
358
  };
145
- protoOf(ParseException).o33 = function () {
359
+ protoOf(ParseException).n38 = function () {
146
360
  return this.input;
147
361
  };
148
- protoOf(ParseException).p33 = function (_set____db54di) {
362
+ protoOf(ParseException).o38 = function (_set____db54di) {
149
363
  this.offendingSymbol = _set____db54di;
150
364
  };
151
- protoOf(ParseException).q33 = function () {
365
+ protoOf(ParseException).p38 = function () {
152
366
  return this.offendingSymbol;
153
367
  };
154
- protoOf(ParseException).r33 = function (_set____db54di) {
368
+ protoOf(ParseException).q38 = function (_set____db54di) {
155
369
  this.line = _set____db54di;
156
370
  };
157
- protoOf(ParseException).s33 = function () {
371
+ protoOf(ParseException).r38 = function () {
158
372
  return this.line;
159
373
  };
160
- protoOf(ParseException).t33 = function (_set____db54di) {
374
+ protoOf(ParseException).s38 = function (_set____db54di) {
161
375
  this.column = _set____db54di;
162
376
  };
163
- protoOf(ParseException).u33 = function () {
377
+ protoOf(ParseException).t38 = function () {
164
378
  return this.column;
165
379
  };
166
- protoOf(ParseException).v33 = function (_set____db54di) {
380
+ protoOf(ParseException).u38 = function (_set____db54di) {
167
381
  this.clauseIndex = _set____db54di;
168
382
  };
169
- protoOf(ParseException).w33 = function () {
383
+ protoOf(ParseException).v38 = function () {
170
384
  return this.clauseIndex;
171
385
  };
172
386
  protoOf(ParseException).toString = function () {
173
- 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)) + new Char(_Char___init__impl__6a9atx(125));
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));
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.tu() === 3;
397
+ } else {
398
+ tmp_3 = false;
399
+ }
400
+ if (tmp_3) {
401
+ tmp_2 = _this__u8e3s4.zu() === 'op';
402
+ } else {
403
+ tmp_2 = false;
404
+ }
405
+ if (tmp_2) {
406
+ tmp_1 = _this__u8e3s4.dw();
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
+ }
424
+ function Companion() {
425
+ }
426
+ protoOf(Companion).w38 = function (scope) {
427
+ return this.x38(Companion_getInstance().EMPTY, scope);
428
+ };
429
+ protoOf(Companion).withNoOperator = function (scope, $super) {
430
+ scope = scope === VOID ? Companion_instance.empty() : scope;
431
+ return $super === VOID ? this.w38(scope) : $super.w38.call(this, scope);
432
+ };
433
+ protoOf(Companion).y38 = function (scope) {
434
+ return this.x38(Companion_getInstance().STANDARD, scope);
435
+ };
436
+ protoOf(Companion).withStandardOperators = function (scope, $super) {
437
+ scope = scope === VOID ? Companion_instance.empty() : scope;
438
+ return $super === VOID ? this.y38(scope) : $super.y38.call(this, scope);
174
439
  };
440
+ protoOf(Companion).z38 = function (scope) {
441
+ return this.x38(Companion_getInstance().DEFAULT, scope);
442
+ };
443
+ protoOf(Companion).withDefaultOperators = function (scope, $super) {
444
+ scope = scope === VOID ? Companion_instance.empty() : scope;
445
+ return $super === VOID ? this.z38(scope) : $super.z38.call(this, scope);
446
+ };
447
+ protoOf(Companion).x38 = function (operators, scope) {
448
+ return termParserWithOperators(operators, scope);
449
+ };
450
+ protoOf(Companion).withOperatorSet = function (operators, scope, $super) {
451
+ scope = scope === VOID ? Companion_instance.empty() : scope;
452
+ return $super === VOID ? this.x38(operators, scope) : $super.x38.call(this, operators, scope);
453
+ };
454
+ protoOf(Companion).a39 = function (operators, scope) {
455
+ return this.x38(OperatorSet_init_$Create$(operators.slice()), scope);
456
+ };
457
+ protoOf(Companion).withOperators = function (operators, scope, $super) {
458
+ scope = scope === VOID ? Companion_instance.empty() : scope;
459
+ return $super === VOID ? this.a39(operators, scope) : $super.a39.call(this, operators, scope);
460
+ };
461
+ var Companion_instance_1;
462
+ function Companion_getInstance_4() {
463
+ return Companion_instance_1;
464
+ }
465
+ function TermParser() {
466
+ }
175
467
  function termToClause(_this__u8e3s4, source, line, column) {
176
468
  source = source === VOID ? null : source;
177
469
  line = line === VOID ? 0 : line;
178
470
  column = column === VOID ? 0 : column;
179
- var tmp0_subject = _this__u8e3s4;
180
471
  var tmp;
181
- if (isInterface(tmp0_subject, Clause)) {
472
+ if (isInterface(_this__u8e3s4, Clause)) {
182
473
  tmp = _this__u8e3s4;
183
474
  } else {
184
- if (isInterface(tmp0_subject, Struct)) {
185
- tmp = Companion_getInstance().of(_this__u8e3s4);
475
+ if (isInterface(_this__u8e3s4, Struct)) {
476
+ tmp = Companion_instance_0.of(_this__u8e3s4);
186
477
  } else {
187
478
  throw new InvalidTermTypeException(source, _this__u8e3s4, getKClass(Clause), VOID, line, column);
188
479
  }
189
480
  }
190
481
  return tmp;
191
482
  }
483
+ function parseStructWithOperators_0(_this__u8e3s4, input, operators) {
484
+ return get_defaultParser().parseStructWithOperators(input, operators);
485
+ }
486
+ function parseStruct_0(_this__u8e3s4, input) {
487
+ return get_defaultParser().parseStruct(input);
488
+ }
489
+ function get_defaultParser() {
490
+ return Companion_instance_1.withDefaultOperators();
491
+ }
192
492
  function toAssociativity(_this__u8e3s4) {
193
493
  return _this__u8e3s4.toString();
194
494
  }
195
495
  function DynamicOpListener$Companion$of$lambda($this$$receiver, it) {
196
- return Unit_getInstance();
496
+ return Unit_instance;
197
497
  }
198
498
  function onOperatorDefined($this, operator) {
199
- $this.x33_1.addOperator(operator.l1f_1, toAssociativity(operator.m1f_1), operator.n1f_1);
200
- $this.y33_1($this.x33_1, operator);
499
+ $this.c39_1.addOperator(operator.a1h_1, toAssociativity(operator.b1h_1), operator.c1h_1);
500
+ $this.d39_1($this.c39_1, operator);
201
501
  }
202
- function Companion() {
203
- Companion_instance = this;
502
+ function Companion_0() {
204
503
  }
205
- protoOf(Companion).z33 = function (parser) {
504
+ protoOf(Companion_0).e39 = function (parser) {
206
505
  return new DynamicOpListener(parser, DynamicOpListener$Companion$of$lambda);
207
506
  };
208
- var Companion_instance;
507
+ var Companion_instance_2;
209
508
  function Companion_getInstance_5() {
210
- if (Companion_instance == null)
211
- new Companion();
212
- return Companion_instance;
509
+ return Companion_instance_2;
213
510
  }
214
511
  function DynamicOpListener$exitClause$lambda(it) {
215
512
  return isInterface(it, Atom) ? it : THROW_CCE();
216
513
  }
217
514
  function DynamicOpListener(parser, operatorDefinedCallback) {
218
- Companion_getInstance_5();
219
515
  PrologParserListener.call(this);
220
- this.x33_1 = parser;
221
- this.y33_1 = operatorDefinedCallback;
516
+ this.c39_1 = parser;
517
+ this.d39_1 = operatorDefinedCallback;
222
518
  }
223
- protoOf(DynamicOpListener).a34 = function (ctx) {
519
+ protoOf(DynamicOpListener).f39 = function (ctx) {
224
520
  var expr = ctx.expression();
225
521
  if (ctx.exception != null) {
226
- return Unit_getInstance();
522
+ return Unit_instance;
227
523
  }
228
524
  var tmp;
229
525
  var tmp_0;
@@ -242,67 +538,28 @@
242
538
  if (tmp) {
243
539
  var tmp_1 = ctx.accept(new PrologVisitor());
244
540
  var directive = isInterface(tmp_1, Directive) ? tmp_1 : THROW_CCE();
245
- var op = directive.mv();
246
- var tmp_2;
247
- var tmp_3;
248
- var tmp_4;
249
- var tmp_5;
250
- var tmp_6;
251
- if (isInterface(op, Struct)) {
252
- tmp_6 = op.lt() === 3;
253
- } else {
254
- tmp_6 = false;
255
- }
256
- if (tmp_6) {
257
- tmp_5 = op.rt() === 'op';
258
- } else {
259
- tmp_5 = false;
260
- }
261
- if (tmp_5) {
262
- var tmp_7 = op.get(0);
263
- tmp_4 = isInterface(tmp_7, Numeric);
264
- } else {
265
- tmp_4 = false;
266
- }
267
- if (tmp_4) {
268
- var tmp_8 = op.get(1);
269
- tmp_3 = isInterface(tmp_8, Atom);
270
- } else {
271
- tmp_3 = false;
272
- }
273
- if (tmp_3) {
274
- tmp_2 = op.ku();
275
- } else {
276
- tmp_2 = false;
277
- }
278
- if (tmp_2) {
279
- var tmp$ret$1;
541
+ var op = directive.gx();
542
+ if (get_isOpDirective(op)) {
280
543
  // Inline function 'kotlin.math.min' call
281
- var tmp$ret$0;
282
544
  // Inline function 'kotlin.math.max' call
283
- var tmp_9 = op.get(0);
284
- var tmp0_max = (isInterface(tmp_9, Numeric) ? tmp_9 : THROW_CCE()).sw().toInt();
285
- tmp$ret$0 = Math.max(0, tmp0_max);
286
- var tmp1_min = tmp$ret$0;
287
- tmp$ret$1 = Math.min(1200, tmp1_min);
288
- var priority = tmp$ret$1;
545
+ var tmp_2 = (isInterface(op, Struct) ? op : THROW_CCE()).get(0);
546
+ var b = (isInterface(tmp_2, Numeric) ? tmp_2 : THROW_CCE()).hz().toInt();
547
+ var b_0 = Math.max(0, b);
548
+ var priority = Math.min(1200, b_0);
289
549
  var specifier = Companion_getInstance_0().fromTerm(op.get(1));
290
550
  var operator = op.get(2);
291
551
  if (isInterface(operator, Atom)) {
292
- onOperatorDefined(this, new Operator(operator.p2(), specifier, priority));
552
+ onOperatorDefined(this, new Operator(operator.r2(), specifier, priority));
293
553
  } else {
294
554
  if (isInterface(operator, List)) {
295
555
  var tmp$ret$3;
296
556
  $l$block: {
297
557
  // Inline function 'kotlin.sequences.all' call
298
- var tmp2_all = operator.hs();
299
- var tmp0_iterator = tmp2_all.j();
300
- while (tmp0_iterator.m()) {
301
- var element = tmp0_iterator.n();
302
- var tmp$ret$2;
558
+ var tmp0_iterator = operator.pt().r();
559
+ while (tmp0_iterator.s()) {
560
+ var element = tmp0_iterator.u();
303
561
  // Inline function 'it.unibo.tuprolog.core.parsing.DynamicOpListener.exitClause.<anonymous>' call
304
- tmp$ret$2 = isInterface(element, Atom);
305
- if (!tmp$ret$2) {
562
+ if (!isInterface(element, Atom)) {
306
563
  tmp$ret$3 = false;
307
564
  break $l$block;
308
565
  }
@@ -310,11 +567,11 @@
310
567
  tmp$ret$3 = true;
311
568
  }
312
569
  if (tmp$ret$3) {
313
- var tmp_10 = operator.hs();
314
- var tmp2_iterator = map(tmp_10, DynamicOpListener$exitClause$lambda).j();
315
- while (tmp2_iterator.m()) {
316
- var it = tmp2_iterator.n();
317
- onOperatorDefined(this, new Operator(it.p2(), specifier, priority));
570
+ var tmp_3 = operator.pt();
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));
318
575
  }
319
576
  }
320
577
  }
@@ -323,7 +580,7 @@
323
580
  }
324
581
  };
325
582
  protoOf(DynamicOpListener).exitClause = function (ctx) {
326
- return this.a34(ctx);
583
+ return this.f39(ctx);
327
584
  };
328
585
  function parseException(token, message) {
329
586
  return new ParseException(null, token.text, token.line, token.column, message, null);
@@ -333,17 +590,50 @@
333
590
  if (obj instanceof Token) {
334
591
  tmp = obj.text;
335
592
  } else {
336
- tmp = toString(obj);
593
+ tmp = toString_0(obj);
337
594
  }
338
595
  return tmp;
339
596
  }
340
597
  function newErrorListener($this, whileParsing) {
341
598
  return new PrologParserFactory$newErrorListener$1(whileParsing);
342
599
  }
343
- function parseClause($this, parserAndErrorStrategy, source) {
600
+ function parseExpression($this, parserAndErrorStrategy, source) {
601
+ var mark = -1;
602
+ var index = -1;
603
+ var parser = parserAndErrorStrategy.qd_1;
604
+ var tmp;
605
+ try {
606
+ mark = parser.getTokenStream().mark();
607
+ index = coerceAtLeast(parser.getTokenStream().index, 0);
608
+ tmp = parser.singletonExpression();
609
+ } catch ($p) {
610
+ var tmp_0;
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.rd_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();
624
+ }
625
+ tmp_0 = tmp_1;
626
+ tmp = tmp_0;
627
+ }
628
+ finally {
629
+ parser.getTokenStream().release(mark);
630
+ }
631
+ return tmp;
632
+ }
633
+ function parseClause_0($this, parserAndErrorStrategy, source) {
344
634
  var mark = -1;
345
635
  var index = -1;
346
- var parser = parserAndErrorStrategy.f4_1;
636
+ var parser = parserAndErrorStrategy.qd_1;
347
637
  var tmp;
348
638
  try {
349
639
  mark = parser.getTokenStream().mark();
@@ -351,23 +641,21 @@
351
641
  tmp = parser.optClause();
352
642
  } catch ($p) {
353
643
  var tmp_0;
354
- {
355
- var e = $p;
356
- var tmp_1;
357
- if (isParseCancellationException(e) ? parser._interp.predictionMode === PredictionMode.SLL : false) {
358
- parser.getTokenStream().seek(index);
359
- parser._interp.predictionMode = PredictionMode.LL;
360
- parser._errHandler = parserAndErrorStrategy.g4_1;
361
- parser.addErrorListener(newErrorListener($this, source));
362
- tmp_1 = parseClause($this, parserAndErrorStrategy, source);
363
- } else if (e.clause !== null ? isRecognitionException(e.cause) : false) {
364
- var tmp_2 = e.cause;
365
- throw tmp_2 instanceof RecognitionException ? tmp_2 : THROW_CCE();
366
- } else {
367
- throw e instanceof Error ? e : THROW_CCE();
368
- }
369
- 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.rd_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();
370
657
  }
658
+ tmp_0 = tmp_1;
371
659
  tmp = tmp_0;
372
660
  }
373
661
  finally {
@@ -382,13 +670,13 @@
382
670
  return map(tmp_1, PrologParserFactory$parseClauses$lambda_2);
383
671
  }
384
672
  function PrologParserFactory$newErrorListener$1($whileParsing) {
385
- this.b34_1 = $whileParsing;
673
+ this.g39_1 = $whileParsing;
386
674
  }
387
675
  protoOf(PrologParserFactory$newErrorListener$1).syntaxError = function (recognizer, offendingSymbol, line, column, msg, e) {
388
676
  if (recognizer instanceof PrologParser) {
389
677
  recognizer.removeParseListeners();
390
678
  }
391
- throw new ParseException(this.b34_1, symbolToString(this, offendingSymbol), line, column + 1 | 0, msg, e);
679
+ throw new ParseException(this.g39_1, symbolToString(this, offendingSymbol), line, column + 1 | 0, msg, e);
392
680
  };
393
681
  function PrologParserFactory$parseClauses$lambda(it) {
394
682
  return it + 1 | 0;
@@ -397,7 +685,7 @@
397
685
  return function (it) {
398
686
  var tmp;
399
687
  try {
400
- tmp = parseClause(PrologParserFactory_getInstance(), $parser, $source);
688
+ tmp = parseClause_0(PrologParserFactory_instance, $parser, $source);
401
689
  } catch ($p) {
402
690
  var tmp_0;
403
691
  if ($p instanceof ParseException) {
@@ -407,7 +695,6 @@
407
695
  } else {
408
696
  throw $p;
409
697
  }
410
- tmp = tmp_0;
411
698
  }
412
699
  return tmp;
413
700
  };
@@ -419,13 +706,16 @@
419
706
  return it.clause();
420
707
  }
421
708
  function PrologParserFactory() {
422
- PrologParserFactory_instance = this;
423
709
  }
424
- protoOf(PrologParserFactory).c34 = function (source, withOperators) {
425
- var parser = this.d34(source, withOperators);
710
+ protoOf(PrologParserFactory).h39 = function (string, withOperators) {
711
+ var parser = this.i39(string, withOperators);
712
+ return parseExpression(this, parser, string);
713
+ };
714
+ protoOf(PrologParserFactory).j39 = function (source, withOperators) {
715
+ var parser = this.i39(source, withOperators);
426
716
  return parseClauses(this, parser, source);
427
717
  };
428
- protoOf(PrologParserFactory).d34 = function (source, operators) {
718
+ protoOf(PrologParserFactory).i39 = function (source, operators) {
429
719
  var stream = new InputStream(source);
430
720
  var lexer = new PrologLexer(stream);
431
721
  lexer.removeErrorListeners();
@@ -435,90 +725,67 @@
435
725
  var originalErrorStrategy = parser._errHandler;
436
726
  parser._errHandler = new BailErrorStrategy();
437
727
  parser._interp.predictionMode = PredictionMode.SLL;
438
- return to(this.e34(parser, operators), originalErrorStrategy);
728
+ return to(this.k39(parser, operators), originalErrorStrategy);
439
729
  };
440
- protoOf(PrologParserFactory).e34 = function (prologParser, operators) {
730
+ protoOf(PrologParserFactory).k39 = function (prologParser, operators) {
441
731
  // Inline function 'kotlin.collections.forEach' call
442
- var tmp0_iterator = operators.j();
443
- while (tmp0_iterator.m()) {
444
- var element = tmp0_iterator.n();
732
+ var tmp0_iterator = operators.r();
733
+ while (tmp0_iterator.s()) {
734
+ var element = tmp0_iterator.u();
445
735
  // Inline function 'it.unibo.tuprolog.core.parsing.PrologParserFactory.addOperators.<anonymous>' call
446
- prologParser.addOperator(element.l1f_1, toAssociativity(element.m1f_1), element.n1f_1);
736
+ prologParser.addOperator(element.a1h_1, toAssociativity(element.b1h_1), element.c1h_1);
447
737
  }
448
- prologParser.addParseListener(Companion_getInstance_5().z33(prologParser));
738
+ prologParser.addParseListener(Companion_instance_2.e39(prologParser));
449
739
  return prologParser;
450
740
  };
451
741
  var PrologParserFactory_instance;
452
742
  function PrologParserFactory_getInstance() {
453
- if (PrologParserFactory_instance == null)
454
- new PrologParserFactory();
455
743
  return PrologParserFactory_instance;
456
744
  }
457
- function parseInteger($this, ctx) {
745
+ function parseInteger_0($this, ctx) {
458
746
  var str = ctx.value.text;
459
747
  var base;
460
748
  var clean;
461
749
  if (ctx.isBin) {
462
750
  base = 2;
463
- var tmp$ret$1;
464
751
  // Inline function 'kotlin.text.substring' call
465
- var tmp$ret$0;
466
752
  // Inline function 'kotlin.js.asDynamic' call
467
- tmp$ret$0 = str;
468
- tmp$ret$1 = tmp$ret$0.substring(2);
469
- clean = tmp$ret$1;
753
+ clean = str.substring(2);
470
754
  } else if (ctx.isOct) {
471
755
  base = 8;
472
- var tmp$ret$3;
473
756
  // Inline function 'kotlin.text.substring' call
474
- var tmp$ret$2;
475
757
  // Inline function 'kotlin.js.asDynamic' call
476
- tmp$ret$2 = str;
477
- tmp$ret$3 = tmp$ret$2.substring(2);
478
- clean = tmp$ret$3;
758
+ clean = str.substring(2);
479
759
  } else if (ctx.isHex) {
480
760
  base = 16;
481
- var tmp$ret$5;
482
761
  // Inline function 'kotlin.text.substring' call
483
- var tmp$ret$4;
484
762
  // Inline function 'kotlin.js.asDynamic' call
485
- tmp$ret$4 = str;
486
- tmp$ret$5 = tmp$ret$4.substring(2);
487
- clean = tmp$ret$5;
763
+ clean = str.substring(2);
488
764
  } else if (ctx.isChar) {
489
- var tmp$ret$7;
490
765
  // Inline function 'kotlin.text.substring' call
491
- var tmp$ret$6;
492
766
  // Inline function 'kotlin.js.asDynamic' call
493
- tmp$ret$6 = str;
494
- tmp$ret$7 = tmp$ret$6.substring(2);
495
- clean = tmp$ret$7;
767
+ clean = str.substring(2);
496
768
  if (!(clean.length === 1)) {
497
769
  throw parseException(ctx.value, 'Invalid character literal: ' + ctx.value.text);
498
770
  }
499
- var tmp$ret$10;
500
771
  // Inline function 'kotlin.with' call
501
772
  var tmp = Companion_getInstance_1();
502
- var tmp$ret$8;
503
773
  // Inline function 'kotlin.code' call
504
- var tmp0__get_code__88qj9g = charSequenceGet(clean, 0);
505
- tmp$ret$8 = Char__toInt_impl_vasixd(tmp0__get_code__88qj9g);
506
- 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);
507
776
  // Inline function 'kotlin.contracts.contract' call
508
- var tmp$ret$9;
509
777
  // Inline function 'it.unibo.tuprolog.core.parsing.PrologVisitor.parseInteger.<anonymous>' call
778
+ var $this$with = tmp.of(tmp$ret$8);
510
779
  var tmp_0;
511
780
  var tmp0_safe_receiver = ctx.sign;
512
781
  var tmp1_safe_receiver = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.text;
513
782
  var tmp2_elvis_lhs = tmp1_safe_receiver == null ? null : contains_0(tmp1_safe_receiver, '-');
514
783
  if (tmp2_elvis_lhs == null ? false : tmp2_elvis_lhs) {
515
- tmp_0 = tmp1_with.unaryMinus();
784
+ tmp_0 = $this$with.unaryMinus();
516
785
  } else {
517
- tmp_0 = tmp1_with;
786
+ tmp_0 = $this$with;
518
787
  }
519
- tmp$ret$9 = tmp_0;
520
- tmp$ret$10 = tmp$ret$9;
521
- return tmp$ret$10;
788
+ return tmp_0;
522
789
  } else {
523
790
  base = 10;
524
791
  clean = str;
@@ -532,67 +799,54 @@
532
799
  function visitPostfixExpression($this, ctx) {
533
800
  var tmp0_safe_receiver = ctx.left;
534
801
  var tmp = ensureNotNull(tmp0_safe_receiver == null ? null : tmp0_safe_receiver.accept($this));
535
- var tmp$ret$2;
536
802
  // Inline function 'kotlin.collections.map' call
537
- var tmp1_map = ctx.operators;
538
- var tmp$ret$1;
803
+ var this_0 = ctx.operators;
539
804
  // Inline function 'kotlin.collections.mapTo' call
540
- var tmp0_mapTo = ArrayList_init_$Create$(tmp1_map.length);
541
- var indexedObject = tmp1_map;
805
+ var destination = ArrayList_init_$Create$(this_0.length);
542
806
  var inductionVariable = 0;
543
- var last = indexedObject.length;
807
+ var last = this_0.length;
544
808
  while (inductionVariable < last) {
545
- var item = indexedObject[inductionVariable];
809
+ var item = this_0[inductionVariable];
546
810
  inductionVariable = inductionVariable + 1 | 0;
547
- var tmp$ret$0;
548
811
  // Inline function 'it.unibo.tuprolog.core.parsing.PrologVisitor.visitPostfixExpression.<anonymous>' call
549
- tmp$ret$0 = item.symbol.text;
550
- tmp0_mapTo.g(tmp$ret$0);
812
+ var tmp$ret$0 = item.symbol.text;
813
+ destination.o(tmp$ret$0);
551
814
  }
552
- tmp$ret$1 = tmp0_mapTo;
553
- tmp$ret$2 = tmp$ret$1;
554
- return postfix($this, tmp, tmp$ret$2);
815
+ return postfix($this, tmp, destination);
555
816
  }
556
817
  function postfix($this, term, ops) {
557
- var operator = ops.j();
558
- var result = $this.f34_1.structOf(operator.n(), [term]);
559
- while (operator.m()) {
560
- result = $this.f34_1.structOf(operator.n(), [result]);
818
+ var operator = ops.r();
819
+ var result = $this.l39_1.structOf(operator.u(), [term]);
820
+ while (operator.s()) {
821
+ result = $this.l39_1.structOf(operator.u(), [result]);
561
822
  }
562
823
  return result;
563
824
  }
564
825
  function visitPrefixExpression($this, ctx) {
565
826
  var tmp = ctx.right[0].accept($this);
566
- var tmp$ret$2;
567
827
  // Inline function 'kotlin.collections.map' call
568
- var tmp1_map = ctx.operators;
569
- var tmp$ret$1;
828
+ var this_0 = ctx.operators;
570
829
  // Inline function 'kotlin.collections.mapTo' call
571
- var tmp0_mapTo = ArrayList_init_$Create$(tmp1_map.length);
572
- var indexedObject = tmp1_map;
830
+ var destination = ArrayList_init_$Create$(this_0.length);
573
831
  var inductionVariable = 0;
574
- var last = indexedObject.length;
832
+ var last = this_0.length;
575
833
  while (inductionVariable < last) {
576
- var item = indexedObject[inductionVariable];
834
+ var item = this_0[inductionVariable];
577
835
  inductionVariable = inductionVariable + 1 | 0;
578
- var tmp$ret$0;
579
836
  // Inline function 'it.unibo.tuprolog.core.parsing.PrologVisitor.visitPrefixExpression.<anonymous>' call
580
- tmp$ret$0 = item.symbol.text;
581
- tmp0_mapTo.g(tmp$ret$0);
837
+ var tmp$ret$0 = item.symbol.text;
838
+ destination.o(tmp$ret$0);
582
839
  }
583
- tmp$ret$1 = tmp0_mapTo;
584
- tmp$ret$2 = tmp$ret$1;
585
- return prefix($this, tmp, tmp$ret$2);
840
+ return prefix($this, tmp, destination);
586
841
  }
587
842
  function prefix($this, term, ops) {
588
- var i = ops.p() - 1 | 0;
843
+ var i = ops.l() - 1 | 0;
589
844
  var tmp0 = i;
590
845
  i = tmp0 - 1 | 0;
591
- var result = $this.f34_1.structOf(ops.o(tmp0), [term]);
846
+ var result = $this.l39_1.structOf(ops.d1(tmp0), [term]);
592
847
  while (i >= 0) {
593
- result = $this.f34_1.structOf(ops.o(i), [result]);
594
- var tmp1 = i;
595
- i = tmp1 - 1 | 0;
848
+ result = $this.l39_1.structOf(ops.d1(i), [result]);
849
+ i = i - 1 | 0;
596
850
  }
597
851
  return result;
598
852
  }
@@ -606,131 +860,109 @@
606
860
  } else if (tmp0_subject === Associativity.XFX) {
607
861
  tmp = visitInfixNonAssociativeExpression($this, ctx);
608
862
  } else {
609
- throw IllegalStateException_init_$Create$();
863
+ var message = 'Non-infix associativity ' + ctx.associativity + ' in infix expression';
864
+ throw IllegalStateException_init_$Create$(toString_0(message));
610
865
  }
611
866
  return tmp;
612
867
  }
613
868
  function visitInfixNonAssociativeExpression($this, ctx) {
614
- var tmp$ret$2;
615
869
  // Inline function 'kotlin.collections.map' call
616
- var tmp1_map = plus_0(listOf(ensureNotNull(ctx.left)), asList(ctx.right));
617
- var tmp$ret$1;
870
+ var this_0 = plus_0(listOf(ensureNotNull(ctx.left)), asList(ctx.right));
618
871
  // Inline function 'kotlin.collections.mapTo' call
619
- var tmp0_mapTo = ArrayList_init_$Create$(collectionSizeOrDefault(tmp1_map, 10));
620
- var tmp0_iterator = tmp1_map.j();
621
- while (tmp0_iterator.m()) {
622
- var item = tmp0_iterator.n();
623
- 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();
624
876
  // Inline function 'it.unibo.tuprolog.core.parsing.PrologVisitor.visitInfixNonAssociativeExpression.<anonymous>' call
625
- tmp$ret$0 = item.accept($this);
626
- tmp0_mapTo.g(tmp$ret$0);
877
+ var tmp$ret$0 = item.accept($this);
878
+ destination.o(tmp$ret$0);
627
879
  }
628
- tmp$ret$1 = tmp0_mapTo;
629
- tmp$ret$2 = tmp$ret$1;
630
- var operands = tmp$ret$2;
631
- var tmp$ret$5;
880
+ var operands = destination;
632
881
  // Inline function 'kotlin.collections.map' call
633
- var tmp3_map = ctx.operators;
634
- var tmp$ret$4;
882
+ var this_1 = ctx.operators;
635
883
  // Inline function 'kotlin.collections.mapTo' call
636
- var tmp2_mapTo = ArrayList_init_$Create$(tmp3_map.length);
637
- var indexedObject = tmp3_map;
884
+ var destination_0 = ArrayList_init_$Create$(this_1.length);
638
885
  var inductionVariable = 0;
639
- var last = indexedObject.length;
886
+ var last = this_1.length;
640
887
  while (inductionVariable < last) {
641
- var item_0 = indexedObject[inductionVariable];
888
+ var item_0 = this_1[inductionVariable];
642
889
  inductionVariable = inductionVariable + 1 | 0;
643
- var tmp$ret$3;
644
890
  // Inline function 'it.unibo.tuprolog.core.parsing.PrologVisitor.visitInfixNonAssociativeExpression.<anonymous>' call
645
- tmp$ret$3 = item_0.symbol.text;
646
- tmp2_mapTo.g(tmp$ret$3);
891
+ var tmp$ret$3 = item_0.symbol.text;
892
+ destination_0.o(tmp$ret$3);
647
893
  }
648
- tmp$ret$4 = tmp2_mapTo;
649
- tmp$ret$5 = tmp$ret$4;
650
- var operators = tmp$ret$5;
894
+ var operators = destination_0;
651
895
  return infixNonAssociative($this, operands, operators);
652
896
  }
653
897
  function infixNonAssociative($this, terms, ops) {
654
- return $this.f34_1.structOf(ops.o(0), [terms.o(0), terms.o(1)]);
898
+ return $this.l39_1.structOf(ops.d1(0), [terms.d1(0), terms.d1(1)]);
655
899
  }
656
900
  function handleOuters($this, expression, outers) {
657
901
  var result = expression;
658
- var tmp0_iterator = outers.j();
659
- while (tmp0_iterator.m()) {
660
- var o = tmp0_iterator.n();
902
+ var tmp0_iterator = outers.r();
903
+ while (tmp0_iterator.s()) {
904
+ var o = tmp0_iterator.u();
661
905
  var tmp = listOf(result);
662
- var tmp$ret$2;
663
906
  // Inline function 'kotlin.collections.map' call
664
- var tmp1_map = o.right;
665
- var tmp$ret$1;
907
+ var this_0 = o.right;
666
908
  // Inline function 'kotlin.collections.mapTo' call
667
- var tmp0_mapTo = ArrayList_init_$Create$(tmp1_map.length);
668
- var indexedObject = tmp1_map;
909
+ var destination = ArrayList_init_$Create$(this_0.length);
669
910
  var inductionVariable = 0;
670
- var last = indexedObject.length;
911
+ var last = this_0.length;
671
912
  while (inductionVariable < last) {
672
- var item = indexedObject[inductionVariable];
913
+ var item = this_0[inductionVariable];
673
914
  inductionVariable = inductionVariable + 1 | 0;
674
- var tmp$ret$0;
675
915
  // Inline function 'it.unibo.tuprolog.core.parsing.PrologVisitor.handleOuters.<anonymous>' call
676
- tmp$ret$0 = item.accept($this);
677
- tmp0_mapTo.g(tmp$ret$0);
916
+ var tmp$ret$0 = item.accept($this);
917
+ destination.o(tmp$ret$0);
678
918
  }
679
- tmp$ret$1 = tmp0_mapTo;
680
- tmp$ret$2 = tmp$ret$1;
681
- var operands = plus_0(tmp, tmp$ret$2);
682
- var tmp$ret$5;
919
+ var operands = plus_0(tmp, destination);
683
920
  // Inline function 'kotlin.collections.map' call
684
- var tmp3_map = o.operators;
685
- var tmp$ret$4;
921
+ var this_1 = o.operators;
686
922
  // Inline function 'kotlin.collections.mapTo' call
687
- var tmp2_mapTo = ArrayList_init_$Create$(tmp3_map.length);
688
- var indexedObject_0 = tmp3_map;
923
+ var destination_0 = ArrayList_init_$Create$(this_1.length);
689
924
  var inductionVariable_0 = 0;
690
- var last_0 = indexedObject_0.length;
925
+ var last_0 = this_1.length;
691
926
  while (inductionVariable_0 < last_0) {
692
- var item_0 = indexedObject_0[inductionVariable_0];
927
+ var item_0 = this_1[inductionVariable_0];
693
928
  inductionVariable_0 = inductionVariable_0 + 1 | 0;
694
- var tmp$ret$3;
695
929
  // Inline function 'it.unibo.tuprolog.core.parsing.PrologVisitor.handleOuters.<anonymous>' call
696
- tmp$ret$3 = item_0.symbol.text;
697
- tmp2_mapTo.g(tmp$ret$3);
930
+ var tmp$ret$3 = item_0.symbol.text;
931
+ destination_0.o(tmp$ret$3);
698
932
  }
699
- tmp$ret$4 = tmp2_mapTo;
700
- tmp$ret$5 = tmp$ret$4;
701
- var operators = tmp$ret$5;
702
- var tmp1_subject = o.associativity;
933
+ var operators = destination_0;
934
+ var associativity = o.associativity;
703
935
  var tmp_0;
704
- if (tmp1_subject === Associativity.XFY) {
936
+ if (associativity === Associativity.XFY) {
705
937
  tmp_0 = infixRight($this, operands, operators);
706
- } else if (tmp1_subject === Associativity.XF ? true : tmp1_subject === Associativity.YF) {
938
+ } else if (associativity === Associativity.XF ? true : associativity === Associativity.YF) {
707
939
  tmp_0 = postfix($this, result, operators);
708
- } else if (tmp1_subject === Associativity.XFX) {
940
+ } else if (associativity === Associativity.XFX) {
709
941
  tmp_0 = infixNonAssociative($this, operands, operators);
710
- } else if (tmp1_subject === Associativity.YFX) {
942
+ } else if (associativity === Associativity.YFX) {
711
943
  tmp_0 = infixLeft($this, operands, operators);
712
- } else if (tmp1_subject === Associativity.FX ? true : tmp1_subject === Associativity.FY) {
944
+ } else if (associativity === Associativity.FX ? true : associativity === Associativity.FY) {
713
945
  tmp_0 = prefix($this, result, operators);
714
946
  } else {
715
- throw IllegalStateException_init_$Create$();
947
+ var message = 'Invalid associativity: ' + associativity;
948
+ throw IllegalStateException_init_$Create$(toString_0(message));
716
949
  }
717
950
  result = tmp_0;
718
951
  }
719
952
  return result;
720
953
  }
721
954
  function infixRight($this, terms, ops) {
722
- var i = terms.p() - 1 | 0;
723
- var j = ops.p() - 1 | 0;
955
+ var i = terms.l() - 1 | 0;
956
+ var j = ops.l() - 1 | 0;
724
957
  var tmp0 = j;
725
958
  j = tmp0 - 1 | 0;
726
- var result = $this.f34_1.structOf(ops.o(tmp0), [terms.o(i - 1 | 0), terms.o(i)]);
959
+ var result = $this.l39_1.structOf(ops.d1(tmp0), [terms.d1(i - 1 | 0), terms.d1(i)]);
727
960
  i = i - 2 | 0;
728
961
  while (i >= 0) {
729
962
  var tmp1 = j;
730
963
  j = tmp1 - 1 | 0;
731
- result = $this.f34_1.structOf(ops.o(tmp1), [terms.o(i), result]);
732
- var tmp2 = i;
733
- i = tmp2 - 1 | 0;
964
+ result = $this.l39_1.structOf(ops.d1(tmp1), [terms.d1(i), result]);
965
+ i = i - 1 | 0;
734
966
  }
735
967
  return result;
736
968
  }
@@ -739,62 +971,50 @@
739
971
  var j = 0;
740
972
  var tmp0 = j;
741
973
  j = tmp0 + 1 | 0;
742
- var tmp = ops.o(tmp0);
974
+ var tmp = ops.d1(tmp0);
743
975
  var tmp1 = i;
744
976
  i = tmp1 + 1 | 0;
745
- var tmp_0 = terms.o(tmp1);
977
+ var tmp_0 = terms.d1(tmp1);
746
978
  var tmp2 = i;
747
979
  i = tmp2 + 1 | 0;
748
- var result = $this.f34_1.structOf(tmp, [tmp_0, terms.o(tmp2)]);
749
- while (i < terms.p()) {
980
+ var result = $this.l39_1.structOf(tmp, [tmp_0, terms.d1(tmp2)]);
981
+ while (i < terms.l()) {
750
982
  var tmp3 = j;
751
983
  j = tmp3 + 1 | 0;
752
- result = $this.f34_1.structOf(ops.o(tmp3), [result, terms.o(i)]);
753
- var tmp4 = i;
754
- i = tmp4 + 1 | 0;
984
+ result = $this.l39_1.structOf(ops.d1(tmp3), [result, terms.d1(i)]);
985
+ i = i + 1 | 0;
755
986
  }
756
987
  return result;
757
988
  }
758
989
  function listOfOperands($this, ctx) {
759
- var tmp$ret$2;
760
990
  // Inline function 'kotlin.collections.map' call
761
- var tmp1_map = plus_0(listOf(ctx.left), toList(ctx.right));
762
- var tmp$ret$1;
991
+ var this_0 = plus_0(listOf(ctx.left), toList(ctx.right));
763
992
  // Inline function 'kotlin.collections.mapTo' call
764
- var tmp0_mapTo = ArrayList_init_$Create$(collectionSizeOrDefault(tmp1_map, 10));
765
- var tmp0_iterator = tmp1_map.j();
766
- while (tmp0_iterator.m()) {
767
- var item = tmp0_iterator.n();
768
- 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();
769
997
  // Inline function 'it.unibo.tuprolog.core.parsing.PrologVisitor.listOfOperands.<anonymous>' call
770
- tmp$ret$0 = ensureNotNull(item).accept($this);
771
- tmp0_mapTo.g(tmp$ret$0);
998
+ var tmp$ret$0 = ensureNotNull(item).accept($this);
999
+ destination.o(tmp$ret$0);
772
1000
  }
773
- tmp$ret$1 = tmp0_mapTo;
774
- tmp$ret$2 = tmp$ret$1;
775
- return tmp$ret$2;
1001
+ return destination;
776
1002
  }
777
1003
  function listOfOperators($this, ctx) {
778
- var tmp$ret$2;
779
1004
  // Inline function 'kotlin.collections.map' call
780
- var tmp1_map = ctx.operators;
781
- var tmp$ret$1;
1005
+ var this_0 = ctx.operators;
782
1006
  // Inline function 'kotlin.collections.mapTo' call
783
- var tmp0_mapTo = ArrayList_init_$Create$(tmp1_map.length);
784
- var indexedObject = tmp1_map;
1007
+ var destination = ArrayList_init_$Create$(this_0.length);
785
1008
  var inductionVariable = 0;
786
- var last = indexedObject.length;
1009
+ var last = this_0.length;
787
1010
  while (inductionVariable < last) {
788
- var item = indexedObject[inductionVariable];
1011
+ var item = this_0[inductionVariable];
789
1012
  inductionVariable = inductionVariable + 1 | 0;
790
- var tmp$ret$0;
791
1013
  // Inline function 'it.unibo.tuprolog.core.parsing.PrologVisitor.listOfOperators.<anonymous>' call
792
- tmp$ret$0 = item.symbol.text;
793
- tmp0_mapTo.g(tmp$ret$0);
1014
+ var tmp$ret$0 = item.symbol.text;
1015
+ destination.o(tmp$ret$0);
794
1016
  }
795
- tmp$ret$1 = tmp0_mapTo;
796
- tmp$ret$2 = tmp$ret$1;
797
- return tmp$ret$2;
1017
+ return destination;
798
1018
  }
799
1019
  function visitInfixRightAssociativeExpression($this, ctx) {
800
1020
  return infixRight($this, listOfOperands($this, ctx), listOfOperators($this, ctx));
@@ -803,10 +1023,8 @@
803
1023
  return infixLeft($this, listOfOperands($this, ctx), listOfOperators($this, ctx));
804
1024
  }
805
1025
  function flatten($this, outers) {
806
- var tmp$ret$0;
807
1026
  // Inline function 'kotlin.sequences.asSequence' call
808
- tmp$ret$0 = outers;
809
- var tmp = tmp$ret$0;
1027
+ var tmp = outers;
810
1028
  return flatMap(tmp, PrologVisitor$flatten$lambda($this));
811
1029
  }
812
1030
  function flatten_0($this, outers) {
@@ -814,7 +1032,7 @@
814
1032
  }
815
1033
  function PrologVisitor$visitExpression$ref($boundThis) {
816
1034
  var l = function (p0) {
817
- return $boundThis.g34(p0);
1035
+ return $boundThis.m39(p0);
818
1036
  };
819
1037
  l.callableName = 'visitExpression';
820
1038
  return l;
@@ -825,32 +1043,32 @@
825
1043
  };
826
1044
  }
827
1045
  function PrologVisitor(scope) {
828
- scope = scope === VOID ? Companion_getInstance_2().empty() : scope;
1046
+ scope = scope === VOID ? Companion_instance.empty() : scope;
829
1047
  PrologParserVisitor.call(this);
830
- this.f34_1 = scope;
1048
+ this.l39_1 = scope;
831
1049
  }
832
- protoOf(PrologVisitor).h34 = function (ctx) {
833
- return this.i34(ctx.term());
1050
+ protoOf(PrologVisitor).n39 = function (ctx) {
1051
+ return this.o39(ctx.term());
834
1052
  };
835
1053
  protoOf(PrologVisitor).visitSingletonTerm = function (ctx) {
836
- return this.h34(ctx);
1054
+ return this.n39(ctx);
837
1055
  };
838
- protoOf(PrologVisitor).j34 = function (ctx) {
839
- return this.g34(ctx.expression());
1056
+ protoOf(PrologVisitor).p39 = function (ctx) {
1057
+ return this.m39(ctx.expression());
840
1058
  };
841
1059
  protoOf(PrologVisitor).visitSingletonExpression = function (ctx) {
842
- return this.j34(ctx);
1060
+ return this.p39(ctx);
843
1061
  };
844
- protoOf(PrologVisitor).k34 = function (ctx) {
1062
+ protoOf(PrologVisitor).q39 = function (ctx) {
845
1063
  return termToClause(ctx.expression().accept(this), null, ensureNotNull(ctx.start).line, ensureNotNull(ctx.start).column);
846
1064
  };
847
1065
  protoOf(PrologVisitor).visitClause = function (ctx) {
848
- return this.k34(ctx);
1066
+ return this.q39(ctx);
849
1067
  };
850
- protoOf(PrologVisitor).g34 = function (ctx) {
1068
+ protoOf(PrologVisitor).m39 = function (ctx) {
851
1069
  var tmp;
852
1070
  if (ctx.isTerm) {
853
- tmp = this.i34(ensureNotNull(ctx.left));
1071
+ tmp = this.o39(ensureNotNull(ctx.left));
854
1072
  } else if (contains(Associativity.INFIX, ctx.associativity)) {
855
1073
  tmp = visitInfixExpression(this, ctx);
856
1074
  } else if (contains(Associativity.POSTFIX, ctx.associativity)) {
@@ -863,12 +1081,12 @@
863
1081
  return handleOuters(this, tmp, flatten_0(this, asList(ctx.outers)));
864
1082
  };
865
1083
  protoOf(PrologVisitor).visitExpression = function (ctx) {
866
- return this.g34(ctx);
1084
+ return this.m39(ctx);
867
1085
  };
868
- protoOf(PrologVisitor).i34 = function (ctx) {
1086
+ protoOf(PrologVisitor).o39 = function (ctx) {
869
1087
  var tmp;
870
1088
  if (ctx.isExpr) {
871
- tmp = this.g34(ctx.expression());
1089
+ tmp = this.m39(ctx.expression());
872
1090
  } else {
873
1091
  var tmp_0 = ctx.children[0].accept(this);
874
1092
  tmp = (!(tmp_0 == null) ? isInterface(tmp_0, Term) : false) ? tmp_0 : THROW_CCE();
@@ -876,23 +1094,23 @@
876
1094
  return tmp;
877
1095
  };
878
1096
  protoOf(PrologVisitor).visitTerm = function (ctx) {
879
- return this.i34(ctx);
1097
+ return this.o39(ctx);
880
1098
  };
881
- protoOf(PrologVisitor).l34 = function (ctx) {
882
- var value = parseInteger(this, ctx);
883
- return Companion_getInstance_3().ofBigInteger(value);
1099
+ protoOf(PrologVisitor).r39 = function (ctx) {
1100
+ var value = parseInteger_0(this, ctx);
1101
+ return Companion_getInstance_2().ofBigInteger(value);
884
1102
  };
885
1103
  protoOf(PrologVisitor).visitInteger = function (ctx) {
886
- return this.l34(ctx);
1104
+ return this.r39(ctx);
887
1105
  };
888
- protoOf(PrologVisitor).m34 = function (ctx) {
1106
+ protoOf(PrologVisitor).s39 = function (ctx) {
889
1107
  var tmp = ctx.children[0].accept(this);
890
1108
  return (!(tmp == null) ? isInterface(tmp, Term) : false) ? tmp : THROW_CCE();
891
1109
  };
892
1110
  protoOf(PrologVisitor).visitNumber = function (ctx) {
893
- return this.m34(ctx);
1111
+ return this.s39(ctx);
894
1112
  };
895
- protoOf(PrologVisitor).n34 = function (ctx) {
1113
+ protoOf(PrologVisitor).t39 = function (ctx) {
896
1114
  var raw = ctx.value.text;
897
1115
  if (!(ctx.sign == null)) {
898
1116
  var tmp0_safe_receiver = ctx.sign;
@@ -900,7 +1118,7 @@
900
1118
  }
901
1119
  var tmp;
902
1120
  try {
903
- tmp = Companion_getInstance_4().parse(raw);
1121
+ tmp = Companion_getInstance_3().parse(raw);
904
1122
  } catch ($p) {
905
1123
  var tmp_0;
906
1124
  if ($p instanceof NumberFormatException) {
@@ -909,107 +1127,146 @@
909
1127
  } else {
910
1128
  throw $p;
911
1129
  }
912
- tmp = tmp_0;
913
1130
  }
914
1131
  return tmp;
915
1132
  };
916
1133
  protoOf(PrologVisitor).visitReal = function (ctx) {
917
- return this.n34(ctx);
1134
+ return this.t39(ctx);
918
1135
  };
919
- protoOf(PrologVisitor).o34 = function (ctx) {
1136
+ protoOf(PrologVisitor).u39 = function (ctx) {
920
1137
  var tmp;
921
1138
  if (ctx.isAnonymous) {
922
- tmp = this.f34_1.anonymous();
1139
+ tmp = this.l39_1.anonymous();
923
1140
  } else {
924
- tmp = this.f34_1.varOf(ctx.value.text);
1141
+ tmp = this.l39_1.varOf(ctx.value.text);
925
1142
  }
926
1143
  return tmp;
927
1144
  };
928
1145
  protoOf(PrologVisitor).visitVariable = function (ctx) {
929
- return this.o34(ctx);
1146
+ return this.u39(ctx);
930
1147
  };
931
- protoOf(PrologVisitor).p34 = function (ctx) {
1148
+ protoOf(PrologVisitor).v39 = function (ctx) {
1149
+ var tmp;
932
1150
  if (ctx.isList) {
933
- return this.f34_1.listOf([]);
1151
+ tmp = this.l39_1.logicListOf([]);
934
1152
  } else if (ctx.isBlock) {
935
- return this.f34_1.setOf([]);
936
- }
937
- var tmp;
938
- if (ctx.arity === 0) {
939
- tmp = this.f34_1.atomOf(ctx.functor.text);
1153
+ tmp = this.l39_1.blockOf([]);
1154
+ } else if (ctx.arity === 0) {
1155
+ tmp = this.l39_1.atomOf(ctx.functor.text);
940
1156
  } else {
941
1157
  var tmp_0 = ctx.functor.text;
942
1158
  var tmp_1 = asSequence_0(ctx.args);
943
- tmp = this.f34_1.structOfSequence(tmp_0, map(tmp_1, PrologVisitor$visitExpression$ref(this)));
1159
+ tmp = this.l39_1.structOfSequence(tmp_0, map(tmp_1, PrologVisitor$visitExpression$ref(this)));
944
1160
  }
945
1161
  return tmp;
946
1162
  };
947
1163
  protoOf(PrologVisitor).visitStructure = function (ctx) {
948
- return this.p34(ctx);
1164
+ return this.v39(ctx);
949
1165
  };
950
- protoOf(PrologVisitor).q34 = function (ctx) {
951
- var tmp$ret$1;
1166
+ protoOf(PrologVisitor).w39 = function (ctx) {
952
1167
  // Inline function 'kotlin.collections.map' call
953
- var tmp1_map = ctx.items;
954
- var tmp$ret$0;
1168
+ var this_0 = ctx.items;
955
1169
  // Inline function 'kotlin.collections.mapTo' call
956
- var tmp0_mapTo = ArrayList_init_$Create$(tmp1_map.length);
957
- var indexedObject = tmp1_map;
1170
+ var destination = ArrayList_init_$Create$(this_0.length);
958
1171
  var inductionVariable = 0;
959
- var last = indexedObject.length;
1172
+ var last = this_0.length;
960
1173
  while (inductionVariable < last) {
961
- var item = indexedObject[inductionVariable];
1174
+ var item = this_0[inductionVariable];
962
1175
  inductionVariable = inductionVariable + 1 | 0;
963
- tmp0_mapTo.g(this.g34(item));
1176
+ var tmp$ret$0 = this.m39(item);
1177
+ destination.o(tmp$ret$0);
964
1178
  }
965
- tmp$ret$0 = tmp0_mapTo;
966
- tmp$ret$1 = tmp$ret$0;
967
- var terms = tmp$ret$1;
1179
+ var terms = destination;
968
1180
  var tmp;
969
1181
  if (ctx.hasTail) {
970
1182
  var tmp0_safe_receiver = ctx.tail;
971
- tmp = this.f34_1.hy(terms, tmp0_safe_receiver == null ? null : tmp0_safe_receiver.accept(this));
1183
+ tmp = this.l39_1.q10(terms, tmp0_safe_receiver == null ? null : tmp0_safe_receiver.accept(this));
972
1184
  } else {
973
- tmp = this.f34_1.listOfIterable(terms);
1185
+ tmp = this.l39_1.logicListOfIterable(terms);
974
1186
  }
975
1187
  return tmp;
976
1188
  };
977
1189
  protoOf(PrologVisitor).visitList = function (ctx) {
978
- return this.q34(ctx);
1190
+ return this.w39(ctx);
979
1191
  };
980
- protoOf(PrologVisitor).r34 = function (ctx) {
1192
+ protoOf(PrologVisitor).x39 = function (ctx) {
981
1193
  var tmp;
982
1194
  if (ctx.length === 1) {
983
- tmp = this.f34_1.setOf([ctx.items[0].accept(this)]);
1195
+ tmp = this.l39_1.blockOf([ctx.items[0].accept(this)]);
984
1196
  } else {
985
- var tmp$ret$1;
986
1197
  // Inline function 'kotlin.collections.map' call
987
- var tmp1_map = ctx.items;
988
- var tmp$ret$0;
1198
+ var this_0 = ctx.items;
989
1199
  // Inline function 'kotlin.collections.mapTo' call
990
- var tmp0_mapTo = ArrayList_init_$Create$(tmp1_map.length);
991
- var indexedObject = tmp1_map;
1200
+ var destination = ArrayList_init_$Create$(this_0.length);
992
1201
  var inductionVariable = 0;
993
- var last = indexedObject.length;
1202
+ var last = this_0.length;
994
1203
  while (inductionVariable < last) {
995
- var item = indexedObject[inductionVariable];
1204
+ var item = this_0[inductionVariable];
996
1205
  inductionVariable = inductionVariable + 1 | 0;
997
- tmp0_mapTo.g(this.g34(item));
1206
+ var tmp$ret$0 = this.m39(item);
1207
+ destination.o(tmp$ret$0);
998
1208
  }
999
- tmp$ret$0 = tmp0_mapTo;
1000
- tmp$ret$1 = tmp$ret$0;
1001
- tmp = this.f34_1.setOfIterable(tmp$ret$1);
1209
+ tmp = this.l39_1.blockOfIterable(destination);
1002
1210
  }
1003
1211
  return tmp;
1004
1212
  };
1005
1213
  protoOf(PrologVisitor).visitBlock = function (ctx) {
1006
- return this.r34(ctx);
1214
+ return this.x39(ctx);
1215
+ };
1216
+ function termParserWithOperators(operators, scope) {
1217
+ scope = scope === VOID ? Companion_instance.empty() : scope;
1218
+ return new TermParserImpl(scope, operators);
1219
+ }
1220
+ function TermParserImpl(scope, defaultOperatorSet) {
1221
+ this.y39_1 = scope;
1222
+ this.z39_1 = defaultOperatorSet;
1223
+ }
1224
+ protoOf(TermParserImpl).b39 = function () {
1225
+ return this.z39_1;
1007
1226
  };
1227
+ protoOf(TermParserImpl).a3a = function (input, operators) {
1228
+ return PrologParserFactory_instance.h39(input, operators).accept(new PrologVisitor(this.y39_1));
1229
+ };
1230
+ protoOf(TermParserImpl).parseTermWithOperators = function (input, operators) {
1231
+ return this.a3a(input, operators);
1232
+ };
1233
+ //region block: post-declaration
1234
+ protoOf(TermParserImpl).parseTerm = parseTerm;
1235
+ protoOf(TermParserImpl).parseStructWithOperators = parseStructWithOperators;
1236
+ protoOf(TermParserImpl).parseStruct = parseStruct;
1237
+ protoOf(TermParserImpl).parseConstantWithOperators = parseConstantWithOperators;
1238
+ protoOf(TermParserImpl).parseConstant = parseConstant;
1239
+ protoOf(TermParserImpl).parseVarWithOperators = parseVarWithOperators;
1240
+ protoOf(TermParserImpl).parseVar = parseVar;
1241
+ protoOf(TermParserImpl).parseAtomWithOperators = parseAtomWithOperators;
1242
+ protoOf(TermParserImpl).parseAtom = parseAtom;
1243
+ protoOf(TermParserImpl).parseNumericWithOperators = parseNumericWithOperators;
1244
+ protoOf(TermParserImpl).parseNumeric = parseNumeric;
1245
+ protoOf(TermParserImpl).parseIntegerWithOperators = parseIntegerWithOperators;
1246
+ protoOf(TermParserImpl).parseInteger = parseInteger;
1247
+ protoOf(TermParserImpl).parseRealWithOperators = parseRealWithOperators;
1248
+ protoOf(TermParserImpl).parseReal = parseReal;
1249
+ protoOf(TermParserImpl).parseClauseWithOperators = parseClauseWithOperators;
1250
+ protoOf(TermParserImpl).parseClause = parseClause;
1251
+ protoOf(TermParserImpl).parseRuleWithOperators = parseRuleWithOperators;
1252
+ protoOf(TermParserImpl).parseRule = parseRule;
1253
+ protoOf(TermParserImpl).parseFactWithOperators = parseFactWithOperators;
1254
+ protoOf(TermParserImpl).parseFact = parseFact;
1255
+ protoOf(TermParserImpl).parseDirectiveWithOperators = parseDirectiveWithOperators;
1256
+ protoOf(TermParserImpl).parseDirective = parseDirective;
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
1008
1263
  //region block: exports
1009
1264
  _.$_$ = _.$_$ || {};
1010
- _.$_$.a = PrologParserFactory_getInstance;
1265
+ _.$_$.a = PrologParserFactory_instance;
1011
1266
  _.$_$.b = PrologVisitor;
1012
- _.$_$.c = termToClause;
1267
+ _.$_$.c = parseStruct_0;
1268
+ _.$_$.d = parseStructWithOperators_0;
1269
+ _.$_$.e = termToClause;
1013
1270
  //endregion
1014
1271
  return _;
1015
1272
  }));