@tuprolog/arg2p-core 0.7.2 → 0.7.3

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,64 +44,65 @@
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;
47
+ var VOID = kotlin_kotlin.$_$.d;
48
+ var captureStack = kotlin_kotlin.$_$.r4;
49
+ var protoOf = kotlin_kotlin.$_$.s5;
50
+ var classMeta = kotlin_kotlin.$_$.w4;
51
+ var setMetadataFor = kotlin_kotlin.$_$.t5;
52
52
  var TuPrologException = kotlin_it_unibo_tuprolog_core.$_$.x;
53
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;
59
- var getKClass = kotlin_kotlin.$_$.c;
60
- var Companion_getInstance = kotlin_it_unibo_tuprolog_core.$_$.j;
54
+ var ensureNotNull = kotlin_kotlin.$_$.k9;
55
+ var replace = kotlin_kotlin.$_$.k8;
56
+ var _Char___init__impl__6a9atx = kotlin_kotlin.$_$.f1;
57
+ var Char = kotlin_kotlin.$_$.w8;
58
+ var toString = kotlin_kotlin.$_$.j1;
61
59
  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;
60
+ var isInterface = kotlin_kotlin.$_$.i5;
61
+ var Numeric = kotlin_it_unibo_tuprolog_core.$_$.i1;
66
62
  var Atom = kotlin_it_unibo_tuprolog_core.$_$.a1;
67
- var contains = kotlin_kotlin.$_$.f2;
63
+ var Clause = kotlin_it_unibo_tuprolog_core.$_$.b1;
64
+ var getKClass = kotlin_kotlin.$_$.c;
65
+ var Companion_instance = kotlin_it_unibo_tuprolog_core.$_$.j;
66
+ var Unit_instance = kotlin_kotlin.$_$.r1;
67
+ var objectMeta = kotlin_kotlin.$_$.r5;
68
+ var THROW_CCE = kotlin_kotlin.$_$.h9;
69
+ var contains = kotlin_kotlin.$_$.i2;
68
70
  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;
71
+ var Companion_getInstance = kotlin_it_unibo_tuprolog_core.$_$.g;
72
+ var map = kotlin_kotlin.$_$.j7;
72
73
  var Operator = kotlin_it_unibo_tuprolog_core.$_$.z;
73
74
  var List = kotlin_it_unibo_tuprolog_core.$_$.h1;
74
- var toString = kotlin_kotlin.$_$.v5;
75
- var coerceAtLeast = kotlin_kotlin.$_$.g6;
75
+ var toString_0 = kotlin_kotlin.$_$.x5;
76
+ var coerceAtLeast = kotlin_kotlin.$_$.i6;
76
77
  var isRecognitionException = kotlin_it_unibo_tuprolog_parser_js.$_$.b;
77
78
  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;
81
- 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;
79
+ var generateSequence = kotlin_kotlin.$_$.d7;
80
+ var takeWhile = kotlin_kotlin.$_$.r7;
81
+ var to = kotlin_kotlin.$_$.s9;
82
+ var Companion_getInstance_0 = kotlin_io_github_gciatto_kt_math.$_$.e;
83
+ var charSequenceGet = kotlin_kotlin.$_$.u4;
84
+ var Char__toInt_impl_vasixd = kotlin_kotlin.$_$.i1;
85
+ var contains_0 = kotlin_kotlin.$_$.d8;
86
+ var plus = kotlin_kotlin.$_$.o9;
87
+ var ArrayList_init_$Create$ = kotlin_kotlin.$_$.e;
88
+ var IllegalStateException_init_$Create$ = kotlin_kotlin.$_$.v;
89
+ var listOf = kotlin_kotlin.$_$.d3;
90
+ var asList = kotlin_kotlin.$_$.a2;
91
+ var plus_0 = kotlin_kotlin.$_$.v3;
92
+ var collectionSizeOrDefault = kotlin_kotlin.$_$.g2;
93
+ var toList = kotlin_kotlin.$_$.e4;
94
+ var flatMap = kotlin_kotlin.$_$.b7;
95
+ var asSequence = kotlin_kotlin.$_$.e2;
96
+ var toList_0 = kotlin_kotlin.$_$.v7;
97
+ var sequenceOf = kotlin_kotlin.$_$.o7;
98
+ var asSequence_0 = kotlin_kotlin.$_$.f2;
99
+ var plus_1 = kotlin_kotlin.$_$.n7;
100
+ var Companion_instance_0 = kotlin_it_unibo_tuprolog_core.$_$.q;
101
+ var IllegalArgumentException_init_$Create$ = kotlin_kotlin.$_$.s;
101
102
  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;
103
+ var Companion_getInstance_1 = kotlin_it_unibo_tuprolog_core.$_$.l;
104
+ var Companion_getInstance_2 = kotlin_it_unibo_tuprolog_core.$_$.o;
105
+ var NumberFormatException = kotlin_kotlin.$_$.e9;
105
106
  //endregion
106
107
  //region block: pre-declaration
107
108
  setMetadataFor(ParseException, 'ParseException', classMeta, TuPrologException);
@@ -110,7 +111,7 @@
110
111
  setMetadataFor(DynamicOpListener, 'DynamicOpListener', classMeta, PrologParserListener);
111
112
  setMetadataFor(PrologParserFactory$newErrorListener$1, VOID, classMeta);
112
113
  setMetadataFor(PrologParserFactory, 'PrologParserFactory', objectMeta);
113
- setMetadataFor(PrologVisitor, 'PrologVisitor', classMeta, PrologParserVisitor);
114
+ setMetadataFor(PrologVisitor, 'PrologVisitor', classMeta, PrologParserVisitor, VOID, PrologVisitor);
114
115
  //endregion
115
116
  function InvalidTermTypeException(input, term, type, offendingSymbol, line, column, message, throwable) {
116
117
  var tmp;
@@ -123,12 +124,12 @@
123
124
  offendingSymbol = tmp;
124
125
  line = line === VOID ? 1 : line;
125
126
  column = column === VOID ? 1 : column;
126
- message = message === VOID ? 'Expected ' + type.xc() + ', got: ' + offendingSymbol : message;
127
+ message = message === VOID ? 'Expected ' + type.n6() + ', got: ' + offendingSymbol : message;
127
128
  throwable = throwable === VOID ? null : throwable;
128
129
  ParseException.call(this, input, offendingSymbol, line, column, message, throwable);
129
130
  captureStack(this, InvalidTermTypeException);
130
- this.l33_1 = term;
131
- this.m33_1 = type;
131
+ this.f35_1 = term;
132
+ this.g35_1 = type;
132
133
  }
133
134
  function ParseException(input, offendingSymbol, line, column, message, throwable) {
134
135
  TuPrologException_init_$Init$(message, throwable, this);
@@ -139,50 +140,84 @@
139
140
  this.column = column;
140
141
  this.clauseIndex = -1;
141
142
  }
142
- protoOf(ParseException).n33 = function (_set____db54di) {
143
+ protoOf(ParseException).h35 = function (_set____db54di) {
143
144
  this.input = _set____db54di;
144
145
  };
145
- protoOf(ParseException).o33 = function () {
146
+ protoOf(ParseException).i35 = function () {
146
147
  return this.input;
147
148
  };
148
- protoOf(ParseException).p33 = function (_set____db54di) {
149
+ protoOf(ParseException).j35 = function (_set____db54di) {
149
150
  this.offendingSymbol = _set____db54di;
150
151
  };
151
- protoOf(ParseException).q33 = function () {
152
+ protoOf(ParseException).k35 = function () {
152
153
  return this.offendingSymbol;
153
154
  };
154
- protoOf(ParseException).r33 = function (_set____db54di) {
155
+ protoOf(ParseException).l35 = function (_set____db54di) {
155
156
  this.line = _set____db54di;
156
157
  };
157
- protoOf(ParseException).s33 = function () {
158
+ protoOf(ParseException).m35 = function () {
158
159
  return this.line;
159
160
  };
160
- protoOf(ParseException).t33 = function (_set____db54di) {
161
+ protoOf(ParseException).n35 = function (_set____db54di) {
161
162
  this.column = _set____db54di;
162
163
  };
163
- protoOf(ParseException).u33 = function () {
164
+ protoOf(ParseException).o35 = function () {
164
165
  return this.column;
165
166
  };
166
- protoOf(ParseException).v33 = function (_set____db54di) {
167
+ protoOf(ParseException).p35 = function (_set____db54di) {
167
168
  this.clauseIndex = _set____db54di;
168
169
  };
169
- protoOf(ParseException).w33 = function () {
170
+ protoOf(ParseException).q35 = function () {
170
171
  return this.clauseIndex;
171
172
  };
172
173
  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));
174
+ 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));
174
175
  };
176
+ function get_isOpDirective(_this__u8e3s4) {
177
+ var tmp;
178
+ var tmp_0;
179
+ var tmp_1;
180
+ var tmp_2;
181
+ var tmp_3;
182
+ if (isInterface(_this__u8e3s4, Struct)) {
183
+ tmp_3 = _this__u8e3s4.eu() === 3;
184
+ } else {
185
+ tmp_3 = false;
186
+ }
187
+ if (tmp_3) {
188
+ tmp_2 = _this__u8e3s4.ku() === 'op';
189
+ } else {
190
+ tmp_2 = false;
191
+ }
192
+ if (tmp_2) {
193
+ tmp_1 = _this__u8e3s4.ov();
194
+ } else {
195
+ tmp_1 = false;
196
+ }
197
+ if (tmp_1) {
198
+ var tmp_4 = _this__u8e3s4.get(0);
199
+ tmp_0 = isInterface(tmp_4, Numeric);
200
+ } else {
201
+ tmp_0 = false;
202
+ }
203
+ if (tmp_0) {
204
+ var tmp_5 = _this__u8e3s4.get(1);
205
+ tmp = isInterface(tmp_5, Atom);
206
+ } else {
207
+ tmp = false;
208
+ }
209
+ return tmp;
210
+ }
175
211
  function termToClause(_this__u8e3s4, source, line, column) {
176
212
  source = source === VOID ? null : source;
177
213
  line = line === VOID ? 0 : line;
178
214
  column = column === VOID ? 0 : column;
179
- var tmp0_subject = _this__u8e3s4;
180
215
  var tmp;
181
- if (isInterface(tmp0_subject, Clause)) {
216
+ if (isInterface(_this__u8e3s4, Clause)) {
182
217
  tmp = _this__u8e3s4;
183
218
  } else {
184
- if (isInterface(tmp0_subject, Struct)) {
185
- tmp = Companion_getInstance().of(_this__u8e3s4);
219
+ if (isInterface(_this__u8e3s4, Struct)) {
220
+ tmp = Companion_instance.of(_this__u8e3s4);
186
221
  } else {
187
222
  throw new InvalidTermTypeException(source, _this__u8e3s4, getKClass(Clause), VOID, line, column);
188
223
  }
@@ -193,37 +228,33 @@
193
228
  return _this__u8e3s4.toString();
194
229
  }
195
230
  function DynamicOpListener$Companion$of$lambda($this$$receiver, it) {
196
- return Unit_getInstance();
231
+ return Unit_instance;
197
232
  }
198
233
  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);
234
+ $this.r35_1.addOperator(operator.g1g_1, toAssociativity(operator.h1g_1), operator.i1g_1);
235
+ $this.s35_1($this.r35_1, operator);
201
236
  }
202
237
  function Companion() {
203
- Companion_instance = this;
204
238
  }
205
- protoOf(Companion).z33 = function (parser) {
239
+ protoOf(Companion).t35 = function (parser) {
206
240
  return new DynamicOpListener(parser, DynamicOpListener$Companion$of$lambda);
207
241
  };
208
- var Companion_instance;
209
- function Companion_getInstance_5() {
210
- if (Companion_instance == null)
211
- new Companion();
212
- return Companion_instance;
242
+ var Companion_instance_1;
243
+ function Companion_getInstance_3() {
244
+ return Companion_instance_1;
213
245
  }
214
246
  function DynamicOpListener$exitClause$lambda(it) {
215
247
  return isInterface(it, Atom) ? it : THROW_CCE();
216
248
  }
217
249
  function DynamicOpListener(parser, operatorDefinedCallback) {
218
- Companion_getInstance_5();
219
250
  PrologParserListener.call(this);
220
- this.x33_1 = parser;
221
- this.y33_1 = operatorDefinedCallback;
251
+ this.r35_1 = parser;
252
+ this.s35_1 = operatorDefinedCallback;
222
253
  }
223
- protoOf(DynamicOpListener).a34 = function (ctx) {
254
+ protoOf(DynamicOpListener).u35 = function (ctx) {
224
255
  var expr = ctx.expression();
225
256
  if (ctx.exception != null) {
226
- return Unit_getInstance();
257
+ return Unit_instance;
227
258
  }
228
259
  var tmp;
229
260
  var tmp_0;
@@ -242,67 +273,28 @@
242
273
  if (tmp) {
243
274
  var tmp_1 = ctx.accept(new PrologVisitor());
244
275
  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;
276
+ var op = directive.rw();
277
+ if (get_isOpDirective(op)) {
280
278
  // Inline function 'kotlin.math.min' call
281
- var tmp$ret$0;
282
279
  // 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;
289
- var specifier = Companion_getInstance_0().fromTerm(op.get(1));
280
+ var tmp_2 = (isInterface(op, Struct) ? op : THROW_CCE()).get(0);
281
+ var b = (isInterface(tmp_2, Numeric) ? tmp_2 : THROW_CCE()).sy().toInt();
282
+ var b_0 = Math.max(0, b);
283
+ var priority = Math.min(1200, b_0);
284
+ var specifier = Companion_getInstance().fromTerm(op.get(1));
290
285
  var operator = op.get(2);
291
286
  if (isInterface(operator, Atom)) {
292
- onOperatorDefined(this, new Operator(operator.p2(), specifier, priority));
287
+ onOperatorDefined(this, new Operator(operator.q2(), specifier, priority));
293
288
  } else {
294
289
  if (isInterface(operator, List)) {
295
290
  var tmp$ret$3;
296
291
  $l$block: {
297
292
  // 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;
293
+ var tmp0_iterator = operator.at().o();
294
+ while (tmp0_iterator.p()) {
295
+ var element = tmp0_iterator.r();
303
296
  // Inline function 'it.unibo.tuprolog.core.parsing.DynamicOpListener.exitClause.<anonymous>' call
304
- tmp$ret$2 = isInterface(element, Atom);
305
- if (!tmp$ret$2) {
297
+ if (!isInterface(element, Atom)) {
306
298
  tmp$ret$3 = false;
307
299
  break $l$block;
308
300
  }
@@ -310,11 +302,11 @@
310
302
  tmp$ret$3 = true;
311
303
  }
312
304
  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));
305
+ var tmp_3 = operator.at();
306
+ var tmp2_iterator = map(tmp_3, DynamicOpListener$exitClause$lambda).o();
307
+ while (tmp2_iterator.p()) {
308
+ var it = tmp2_iterator.r();
309
+ onOperatorDefined(this, new Operator(it.q2(), specifier, priority));
318
310
  }
319
311
  }
320
312
  }
@@ -323,7 +315,7 @@
323
315
  }
324
316
  };
325
317
  protoOf(DynamicOpListener).exitClause = function (ctx) {
326
- return this.a34(ctx);
318
+ return this.u35(ctx);
327
319
  };
328
320
  function parseException(token, message) {
329
321
  return new ParseException(null, token.text, token.line, token.column, message, null);
@@ -333,7 +325,7 @@
333
325
  if (obj instanceof Token) {
334
326
  tmp = obj.text;
335
327
  } else {
336
- tmp = toString(obj);
328
+ tmp = toString_0(obj);
337
329
  }
338
330
  return tmp;
339
331
  }
@@ -343,7 +335,7 @@
343
335
  function parseClause($this, parserAndErrorStrategy, source) {
344
336
  var mark = -1;
345
337
  var index = -1;
346
- var parser = parserAndErrorStrategy.f4_1;
338
+ var parser = parserAndErrorStrategy.md_1;
347
339
  var tmp;
348
340
  try {
349
341
  mark = parser.getTokenStream().mark();
@@ -351,23 +343,21 @@
351
343
  tmp = parser.optClause();
352
344
  } catch ($p) {
353
345
  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;
346
+ var e = $p;
347
+ var tmp_1;
348
+ if (isParseCancellationException(e) ? parser._interp.predictionMode === PredictionMode.SLL : false) {
349
+ parser.getTokenStream().seek(index);
350
+ parser._interp.predictionMode = PredictionMode.LL;
351
+ parser._errHandler = parserAndErrorStrategy.nd_1;
352
+ parser.addErrorListener(newErrorListener($this, source));
353
+ tmp_1 = parseClause($this, parserAndErrorStrategy, source);
354
+ } else if (e.clause !== null ? isRecognitionException(e.cause) : false) {
355
+ var tmp_2 = e.cause;
356
+ throw tmp_2 instanceof RecognitionException ? tmp_2 : THROW_CCE();
357
+ } else {
358
+ throw e instanceof Error ? e : THROW_CCE();
370
359
  }
360
+ tmp_0 = tmp_1;
371
361
  tmp = tmp_0;
372
362
  }
373
363
  finally {
@@ -382,13 +372,13 @@
382
372
  return map(tmp_1, PrologParserFactory$parseClauses$lambda_2);
383
373
  }
384
374
  function PrologParserFactory$newErrorListener$1($whileParsing) {
385
- this.b34_1 = $whileParsing;
375
+ this.v35_1 = $whileParsing;
386
376
  }
387
377
  protoOf(PrologParserFactory$newErrorListener$1).syntaxError = function (recognizer, offendingSymbol, line, column, msg, e) {
388
378
  if (recognizer instanceof PrologParser) {
389
379
  recognizer.removeParseListeners();
390
380
  }
391
- throw new ParseException(this.b34_1, symbolToString(this, offendingSymbol), line, column + 1 | 0, msg, e);
381
+ throw new ParseException(this.v35_1, symbolToString(this, offendingSymbol), line, column + 1 | 0, msg, e);
392
382
  };
393
383
  function PrologParserFactory$parseClauses$lambda(it) {
394
384
  return it + 1 | 0;
@@ -397,7 +387,7 @@
397
387
  return function (it) {
398
388
  var tmp;
399
389
  try {
400
- tmp = parseClause(PrologParserFactory_getInstance(), $parser, $source);
390
+ tmp = parseClause(PrologParserFactory_instance, $parser, $source);
401
391
  } catch ($p) {
402
392
  var tmp_0;
403
393
  if ($p instanceof ParseException) {
@@ -407,7 +397,6 @@
407
397
  } else {
408
398
  throw $p;
409
399
  }
410
- tmp = tmp_0;
411
400
  }
412
401
  return tmp;
413
402
  };
@@ -419,13 +408,12 @@
419
408
  return it.clause();
420
409
  }
421
410
  function PrologParserFactory() {
422
- PrologParserFactory_instance = this;
423
411
  }
424
- protoOf(PrologParserFactory).c34 = function (source, withOperators) {
425
- var parser = this.d34(source, withOperators);
412
+ protoOf(PrologParserFactory).w35 = function (source, withOperators) {
413
+ var parser = this.x35(source, withOperators);
426
414
  return parseClauses(this, parser, source);
427
415
  };
428
- protoOf(PrologParserFactory).d34 = function (source, operators) {
416
+ protoOf(PrologParserFactory).x35 = function (source, operators) {
429
417
  var stream = new InputStream(source);
430
418
  var lexer = new PrologLexer(stream);
431
419
  lexer.removeErrorListeners();
@@ -435,23 +423,21 @@
435
423
  var originalErrorStrategy = parser._errHandler;
436
424
  parser._errHandler = new BailErrorStrategy();
437
425
  parser._interp.predictionMode = PredictionMode.SLL;
438
- return to(this.e34(parser, operators), originalErrorStrategy);
426
+ return to(this.y35(parser, operators), originalErrorStrategy);
439
427
  };
440
- protoOf(PrologParserFactory).e34 = function (prologParser, operators) {
428
+ protoOf(PrologParserFactory).y35 = function (prologParser, operators) {
441
429
  // Inline function 'kotlin.collections.forEach' call
442
- var tmp0_iterator = operators.j();
443
- while (tmp0_iterator.m()) {
444
- var element = tmp0_iterator.n();
430
+ var tmp0_iterator = operators.o();
431
+ while (tmp0_iterator.p()) {
432
+ var element = tmp0_iterator.r();
445
433
  // Inline function 'it.unibo.tuprolog.core.parsing.PrologParserFactory.addOperators.<anonymous>' call
446
- prologParser.addOperator(element.l1f_1, toAssociativity(element.m1f_1), element.n1f_1);
434
+ prologParser.addOperator(element.g1g_1, toAssociativity(element.h1g_1), element.i1g_1);
447
435
  }
448
- prologParser.addParseListener(Companion_getInstance_5().z33(prologParser));
436
+ prologParser.addParseListener(Companion_instance_1.t35(prologParser));
449
437
  return prologParser;
450
438
  };
451
439
  var PrologParserFactory_instance;
452
440
  function PrologParserFactory_getInstance() {
453
- if (PrologParserFactory_instance == null)
454
- new PrologParserFactory();
455
441
  return PrologParserFactory_instance;
456
442
  }
457
443
  function parseInteger($this, ctx) {
@@ -460,65 +446,44 @@
460
446
  var clean;
461
447
  if (ctx.isBin) {
462
448
  base = 2;
463
- var tmp$ret$1;
464
449
  // Inline function 'kotlin.text.substring' call
465
- var tmp$ret$0;
466
450
  // 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;
451
+ clean = str.substring(2);
470
452
  } else if (ctx.isOct) {
471
453
  base = 8;
472
- var tmp$ret$3;
473
454
  // Inline function 'kotlin.text.substring' call
474
- var tmp$ret$2;
475
455
  // 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;
456
+ clean = str.substring(2);
479
457
  } else if (ctx.isHex) {
480
458
  base = 16;
481
- var tmp$ret$5;
482
459
  // Inline function 'kotlin.text.substring' call
483
- var tmp$ret$4;
484
460
  // 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;
461
+ clean = str.substring(2);
488
462
  } else if (ctx.isChar) {
489
- var tmp$ret$7;
490
463
  // Inline function 'kotlin.text.substring' call
491
- var tmp$ret$6;
492
464
  // 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;
465
+ clean = str.substring(2);
496
466
  if (!(clean.length === 1)) {
497
467
  throw parseException(ctx.value, 'Invalid character literal: ' + ctx.value.text);
498
468
  }
499
- var tmp$ret$10;
500
469
  // Inline function 'kotlin.with' call
501
- var tmp = Companion_getInstance_1();
502
- var tmp$ret$8;
470
+ var tmp = Companion_getInstance_0();
503
471
  // 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);
472
+ var this_0 = charSequenceGet(clean, 0);
473
+ var tmp$ret$8 = Char__toInt_impl_vasixd(this_0);
507
474
  // Inline function 'kotlin.contracts.contract' call
508
- var tmp$ret$9;
509
475
  // Inline function 'it.unibo.tuprolog.core.parsing.PrologVisitor.parseInteger.<anonymous>' call
476
+ var $this$with = tmp.of(tmp$ret$8);
510
477
  var tmp_0;
511
478
  var tmp0_safe_receiver = ctx.sign;
512
479
  var tmp1_safe_receiver = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.text;
513
480
  var tmp2_elvis_lhs = tmp1_safe_receiver == null ? null : contains_0(tmp1_safe_receiver, '-');
514
481
  if (tmp2_elvis_lhs == null ? false : tmp2_elvis_lhs) {
515
- tmp_0 = tmp1_with.unaryMinus();
482
+ tmp_0 = $this$with.unaryMinus();
516
483
  } else {
517
- tmp_0 = tmp1_with;
484
+ tmp_0 = $this$with;
518
485
  }
519
- tmp$ret$9 = tmp_0;
520
- tmp$ret$10 = tmp$ret$9;
521
- return tmp$ret$10;
486
+ return tmp_0;
522
487
  } else {
523
488
  base = 10;
524
489
  clean = str;
@@ -527,72 +492,59 @@
527
492
  var tmp0_safe_receiver_0 = ctx.sign;
528
493
  clean = plus(tmp0_safe_receiver_0 == null ? null : tmp0_safe_receiver_0.text, clean);
529
494
  }
530
- return Companion_getInstance_1().parseWithRadix(clean, base);
495
+ return Companion_getInstance_0().parseWithRadix(clean, base);
531
496
  }
532
497
  function visitPostfixExpression($this, ctx) {
533
498
  var tmp0_safe_receiver = ctx.left;
534
499
  var tmp = ensureNotNull(tmp0_safe_receiver == null ? null : tmp0_safe_receiver.accept($this));
535
- var tmp$ret$2;
536
500
  // Inline function 'kotlin.collections.map' call
537
- var tmp1_map = ctx.operators;
538
- var tmp$ret$1;
501
+ var this_0 = ctx.operators;
539
502
  // Inline function 'kotlin.collections.mapTo' call
540
- var tmp0_mapTo = ArrayList_init_$Create$(tmp1_map.length);
541
- var indexedObject = tmp1_map;
503
+ var destination = ArrayList_init_$Create$(this_0.length);
542
504
  var inductionVariable = 0;
543
- var last = indexedObject.length;
505
+ var last = this_0.length;
544
506
  while (inductionVariable < last) {
545
- var item = indexedObject[inductionVariable];
507
+ var item = this_0[inductionVariable];
546
508
  inductionVariable = inductionVariable + 1 | 0;
547
- var tmp$ret$0;
548
509
  // 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);
510
+ var tmp$ret$0 = item.symbol.text;
511
+ destination.l(tmp$ret$0);
551
512
  }
552
- tmp$ret$1 = tmp0_mapTo;
553
- tmp$ret$2 = tmp$ret$1;
554
- return postfix($this, tmp, tmp$ret$2);
513
+ return postfix($this, tmp, destination);
555
514
  }
556
515
  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]);
516
+ var operator = ops.o();
517
+ var result = $this.z35_1.structOf(operator.r(), [term]);
518
+ while (operator.p()) {
519
+ result = $this.z35_1.structOf(operator.r(), [result]);
561
520
  }
562
521
  return result;
563
522
  }
564
523
  function visitPrefixExpression($this, ctx) {
565
524
  var tmp = ctx.right[0].accept($this);
566
- var tmp$ret$2;
567
525
  // Inline function 'kotlin.collections.map' call
568
- var tmp1_map = ctx.operators;
569
- var tmp$ret$1;
526
+ var this_0 = ctx.operators;
570
527
  // Inline function 'kotlin.collections.mapTo' call
571
- var tmp0_mapTo = ArrayList_init_$Create$(tmp1_map.length);
572
- var indexedObject = tmp1_map;
528
+ var destination = ArrayList_init_$Create$(this_0.length);
573
529
  var inductionVariable = 0;
574
- var last = indexedObject.length;
530
+ var last = this_0.length;
575
531
  while (inductionVariable < last) {
576
- var item = indexedObject[inductionVariable];
532
+ var item = this_0[inductionVariable];
577
533
  inductionVariable = inductionVariable + 1 | 0;
578
- var tmp$ret$0;
579
534
  // 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);
535
+ var tmp$ret$0 = item.symbol.text;
536
+ destination.l(tmp$ret$0);
582
537
  }
583
- tmp$ret$1 = tmp0_mapTo;
584
- tmp$ret$2 = tmp$ret$1;
585
- return prefix($this, tmp, tmp$ret$2);
538
+ return prefix($this, tmp, destination);
586
539
  }
587
540
  function prefix($this, term, ops) {
588
- var i = ops.p() - 1 | 0;
541
+ var i = ops.u() - 1 | 0;
589
542
  var tmp0 = i;
590
543
  i = tmp0 - 1 | 0;
591
- var result = $this.f34_1.structOf(ops.o(tmp0), [term]);
544
+ var result = $this.z35_1.structOf(ops.a1(tmp0), [term]);
592
545
  while (i >= 0) {
593
- result = $this.f34_1.structOf(ops.o(i), [result]);
594
- var tmp1 = i;
595
- i = tmp1 - 1 | 0;
546
+ result = $this.z35_1.structOf(ops.a1(i), [result]);
547
+ i = i - 1 | 0;
596
548
  }
597
549
  return result;
598
550
  }
@@ -606,131 +558,109 @@
606
558
  } else if (tmp0_subject === Associativity.XFX) {
607
559
  tmp = visitInfixNonAssociativeExpression($this, ctx);
608
560
  } else {
609
- throw IllegalStateException_init_$Create$();
561
+ var message = 'Non-infix associativity ' + ctx.associativity + ' in infix expression';
562
+ throw IllegalStateException_init_$Create$(toString_0(message));
610
563
  }
611
564
  return tmp;
612
565
  }
613
566
  function visitInfixNonAssociativeExpression($this, ctx) {
614
- var tmp$ret$2;
615
567
  // Inline function 'kotlin.collections.map' call
616
- var tmp1_map = plus_0(listOf(ensureNotNull(ctx.left)), asList(ctx.right));
617
- var tmp$ret$1;
568
+ var this_0 = plus_0(listOf(ensureNotNull(ctx.left)), asList(ctx.right));
618
569
  // 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;
570
+ var destination = ArrayList_init_$Create$(collectionSizeOrDefault(this_0, 10));
571
+ var tmp0_iterator = this_0.o();
572
+ while (tmp0_iterator.p()) {
573
+ var item = tmp0_iterator.r();
624
574
  // 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);
575
+ var tmp$ret$0 = item.accept($this);
576
+ destination.l(tmp$ret$0);
627
577
  }
628
- tmp$ret$1 = tmp0_mapTo;
629
- tmp$ret$2 = tmp$ret$1;
630
- var operands = tmp$ret$2;
631
- var tmp$ret$5;
578
+ var operands = destination;
632
579
  // Inline function 'kotlin.collections.map' call
633
- var tmp3_map = ctx.operators;
634
- var tmp$ret$4;
580
+ var this_1 = ctx.operators;
635
581
  // Inline function 'kotlin.collections.mapTo' call
636
- var tmp2_mapTo = ArrayList_init_$Create$(tmp3_map.length);
637
- var indexedObject = tmp3_map;
582
+ var destination_0 = ArrayList_init_$Create$(this_1.length);
638
583
  var inductionVariable = 0;
639
- var last = indexedObject.length;
584
+ var last = this_1.length;
640
585
  while (inductionVariable < last) {
641
- var item_0 = indexedObject[inductionVariable];
586
+ var item_0 = this_1[inductionVariable];
642
587
  inductionVariable = inductionVariable + 1 | 0;
643
- var tmp$ret$3;
644
588
  // 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);
589
+ var tmp$ret$3 = item_0.symbol.text;
590
+ destination_0.l(tmp$ret$3);
647
591
  }
648
- tmp$ret$4 = tmp2_mapTo;
649
- tmp$ret$5 = tmp$ret$4;
650
- var operators = tmp$ret$5;
592
+ var operators = destination_0;
651
593
  return infixNonAssociative($this, operands, operators);
652
594
  }
653
595
  function infixNonAssociative($this, terms, ops) {
654
- return $this.f34_1.structOf(ops.o(0), [terms.o(0), terms.o(1)]);
596
+ return $this.z35_1.structOf(ops.a1(0), [terms.a1(0), terms.a1(1)]);
655
597
  }
656
598
  function handleOuters($this, expression, outers) {
657
599
  var result = expression;
658
- var tmp0_iterator = outers.j();
659
- while (tmp0_iterator.m()) {
660
- var o = tmp0_iterator.n();
600
+ var tmp0_iterator = outers.o();
601
+ while (tmp0_iterator.p()) {
602
+ var o = tmp0_iterator.r();
661
603
  var tmp = listOf(result);
662
- var tmp$ret$2;
663
604
  // Inline function 'kotlin.collections.map' call
664
- var tmp1_map = o.right;
665
- var tmp$ret$1;
605
+ var this_0 = o.right;
666
606
  // Inline function 'kotlin.collections.mapTo' call
667
- var tmp0_mapTo = ArrayList_init_$Create$(tmp1_map.length);
668
- var indexedObject = tmp1_map;
607
+ var destination = ArrayList_init_$Create$(this_0.length);
669
608
  var inductionVariable = 0;
670
- var last = indexedObject.length;
609
+ var last = this_0.length;
671
610
  while (inductionVariable < last) {
672
- var item = indexedObject[inductionVariable];
611
+ var item = this_0[inductionVariable];
673
612
  inductionVariable = inductionVariable + 1 | 0;
674
- var tmp$ret$0;
675
613
  // 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);
614
+ var tmp$ret$0 = item.accept($this);
615
+ destination.l(tmp$ret$0);
678
616
  }
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;
617
+ var operands = plus_0(tmp, destination);
683
618
  // Inline function 'kotlin.collections.map' call
684
- var tmp3_map = o.operators;
685
- var tmp$ret$4;
619
+ var this_1 = o.operators;
686
620
  // Inline function 'kotlin.collections.mapTo' call
687
- var tmp2_mapTo = ArrayList_init_$Create$(tmp3_map.length);
688
- var indexedObject_0 = tmp3_map;
621
+ var destination_0 = ArrayList_init_$Create$(this_1.length);
689
622
  var inductionVariable_0 = 0;
690
- var last_0 = indexedObject_0.length;
623
+ var last_0 = this_1.length;
691
624
  while (inductionVariable_0 < last_0) {
692
- var item_0 = indexedObject_0[inductionVariable_0];
625
+ var item_0 = this_1[inductionVariable_0];
693
626
  inductionVariable_0 = inductionVariable_0 + 1 | 0;
694
- var tmp$ret$3;
695
627
  // 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);
628
+ var tmp$ret$3 = item_0.symbol.text;
629
+ destination_0.l(tmp$ret$3);
698
630
  }
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;
631
+ var operators = destination_0;
632
+ var associativity = o.associativity;
703
633
  var tmp_0;
704
- if (tmp1_subject === Associativity.XFY) {
634
+ if (associativity === Associativity.XFY) {
705
635
  tmp_0 = infixRight($this, operands, operators);
706
- } else if (tmp1_subject === Associativity.XF ? true : tmp1_subject === Associativity.YF) {
636
+ } else if (associativity === Associativity.XF ? true : associativity === Associativity.YF) {
707
637
  tmp_0 = postfix($this, result, operators);
708
- } else if (tmp1_subject === Associativity.XFX) {
638
+ } else if (associativity === Associativity.XFX) {
709
639
  tmp_0 = infixNonAssociative($this, operands, operators);
710
- } else if (tmp1_subject === Associativity.YFX) {
640
+ } else if (associativity === Associativity.YFX) {
711
641
  tmp_0 = infixLeft($this, operands, operators);
712
- } else if (tmp1_subject === Associativity.FX ? true : tmp1_subject === Associativity.FY) {
642
+ } else if (associativity === Associativity.FX ? true : associativity === Associativity.FY) {
713
643
  tmp_0 = prefix($this, result, operators);
714
644
  } else {
715
- throw IllegalStateException_init_$Create$();
645
+ var message = 'Invalid associativity: ' + associativity;
646
+ throw IllegalStateException_init_$Create$(toString_0(message));
716
647
  }
717
648
  result = tmp_0;
718
649
  }
719
650
  return result;
720
651
  }
721
652
  function infixRight($this, terms, ops) {
722
- var i = terms.p() - 1 | 0;
723
- var j = ops.p() - 1 | 0;
653
+ var i = terms.u() - 1 | 0;
654
+ var j = ops.u() - 1 | 0;
724
655
  var tmp0 = j;
725
656
  j = tmp0 - 1 | 0;
726
- var result = $this.f34_1.structOf(ops.o(tmp0), [terms.o(i - 1 | 0), terms.o(i)]);
657
+ var result = $this.z35_1.structOf(ops.a1(tmp0), [terms.a1(i - 1 | 0), terms.a1(i)]);
727
658
  i = i - 2 | 0;
728
659
  while (i >= 0) {
729
660
  var tmp1 = j;
730
661
  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;
662
+ result = $this.z35_1.structOf(ops.a1(tmp1), [terms.a1(i), result]);
663
+ i = i - 1 | 0;
734
664
  }
735
665
  return result;
736
666
  }
@@ -739,62 +669,50 @@
739
669
  var j = 0;
740
670
  var tmp0 = j;
741
671
  j = tmp0 + 1 | 0;
742
- var tmp = ops.o(tmp0);
672
+ var tmp = ops.a1(tmp0);
743
673
  var tmp1 = i;
744
674
  i = tmp1 + 1 | 0;
745
- var tmp_0 = terms.o(tmp1);
675
+ var tmp_0 = terms.a1(tmp1);
746
676
  var tmp2 = i;
747
677
  i = tmp2 + 1 | 0;
748
- var result = $this.f34_1.structOf(tmp, [tmp_0, terms.o(tmp2)]);
749
- while (i < terms.p()) {
678
+ var result = $this.z35_1.structOf(tmp, [tmp_0, terms.a1(tmp2)]);
679
+ while (i < terms.u()) {
750
680
  var tmp3 = j;
751
681
  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;
682
+ result = $this.z35_1.structOf(ops.a1(tmp3), [result, terms.a1(i)]);
683
+ i = i + 1 | 0;
755
684
  }
756
685
  return result;
757
686
  }
758
687
  function listOfOperands($this, ctx) {
759
- var tmp$ret$2;
760
688
  // Inline function 'kotlin.collections.map' call
761
- var tmp1_map = plus_0(listOf(ctx.left), toList(ctx.right));
762
- var tmp$ret$1;
689
+ var this_0 = plus_0(listOf(ctx.left), toList(ctx.right));
763
690
  // 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;
691
+ var destination = ArrayList_init_$Create$(collectionSizeOrDefault(this_0, 10));
692
+ var tmp0_iterator = this_0.o();
693
+ while (tmp0_iterator.p()) {
694
+ var item = tmp0_iterator.r();
769
695
  // 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);
696
+ var tmp$ret$0 = ensureNotNull(item).accept($this);
697
+ destination.l(tmp$ret$0);
772
698
  }
773
- tmp$ret$1 = tmp0_mapTo;
774
- tmp$ret$2 = tmp$ret$1;
775
- return tmp$ret$2;
699
+ return destination;
776
700
  }
777
701
  function listOfOperators($this, ctx) {
778
- var tmp$ret$2;
779
702
  // Inline function 'kotlin.collections.map' call
780
- var tmp1_map = ctx.operators;
781
- var tmp$ret$1;
703
+ var this_0 = ctx.operators;
782
704
  // Inline function 'kotlin.collections.mapTo' call
783
- var tmp0_mapTo = ArrayList_init_$Create$(tmp1_map.length);
784
- var indexedObject = tmp1_map;
705
+ var destination = ArrayList_init_$Create$(this_0.length);
785
706
  var inductionVariable = 0;
786
- var last = indexedObject.length;
707
+ var last = this_0.length;
787
708
  while (inductionVariable < last) {
788
- var item = indexedObject[inductionVariable];
709
+ var item = this_0[inductionVariable];
789
710
  inductionVariable = inductionVariable + 1 | 0;
790
- var tmp$ret$0;
791
711
  // 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);
712
+ var tmp$ret$0 = item.symbol.text;
713
+ destination.l(tmp$ret$0);
794
714
  }
795
- tmp$ret$1 = tmp0_mapTo;
796
- tmp$ret$2 = tmp$ret$1;
797
- return tmp$ret$2;
715
+ return destination;
798
716
  }
799
717
  function visitInfixRightAssociativeExpression($this, ctx) {
800
718
  return infixRight($this, listOfOperands($this, ctx), listOfOperators($this, ctx));
@@ -803,10 +721,8 @@
803
721
  return infixLeft($this, listOfOperands($this, ctx), listOfOperators($this, ctx));
804
722
  }
805
723
  function flatten($this, outers) {
806
- var tmp$ret$0;
807
724
  // Inline function 'kotlin.sequences.asSequence' call
808
- tmp$ret$0 = outers;
809
- var tmp = tmp$ret$0;
725
+ var tmp = outers;
810
726
  return flatMap(tmp, PrologVisitor$flatten$lambda($this));
811
727
  }
812
728
  function flatten_0($this, outers) {
@@ -814,7 +730,7 @@
814
730
  }
815
731
  function PrologVisitor$visitExpression$ref($boundThis) {
816
732
  var l = function (p0) {
817
- return $boundThis.g34(p0);
733
+ return $boundThis.a36(p0);
818
734
  };
819
735
  l.callableName = 'visitExpression';
820
736
  return l;
@@ -825,32 +741,32 @@
825
741
  };
826
742
  }
827
743
  function PrologVisitor(scope) {
828
- scope = scope === VOID ? Companion_getInstance_2().empty() : scope;
744
+ scope = scope === VOID ? Companion_instance_0.empty() : scope;
829
745
  PrologParserVisitor.call(this);
830
- this.f34_1 = scope;
746
+ this.z35_1 = scope;
831
747
  }
832
- protoOf(PrologVisitor).h34 = function (ctx) {
833
- return this.i34(ctx.term());
748
+ protoOf(PrologVisitor).b36 = function (ctx) {
749
+ return this.c36(ctx.term());
834
750
  };
835
751
  protoOf(PrologVisitor).visitSingletonTerm = function (ctx) {
836
- return this.h34(ctx);
752
+ return this.b36(ctx);
837
753
  };
838
- protoOf(PrologVisitor).j34 = function (ctx) {
839
- return this.g34(ctx.expression());
754
+ protoOf(PrologVisitor).d36 = function (ctx) {
755
+ return this.a36(ctx.expression());
840
756
  };
841
757
  protoOf(PrologVisitor).visitSingletonExpression = function (ctx) {
842
- return this.j34(ctx);
758
+ return this.d36(ctx);
843
759
  };
844
- protoOf(PrologVisitor).k34 = function (ctx) {
760
+ protoOf(PrologVisitor).e36 = function (ctx) {
845
761
  return termToClause(ctx.expression().accept(this), null, ensureNotNull(ctx.start).line, ensureNotNull(ctx.start).column);
846
762
  };
847
763
  protoOf(PrologVisitor).visitClause = function (ctx) {
848
- return this.k34(ctx);
764
+ return this.e36(ctx);
849
765
  };
850
- protoOf(PrologVisitor).g34 = function (ctx) {
766
+ protoOf(PrologVisitor).a36 = function (ctx) {
851
767
  var tmp;
852
768
  if (ctx.isTerm) {
853
- tmp = this.i34(ensureNotNull(ctx.left));
769
+ tmp = this.c36(ensureNotNull(ctx.left));
854
770
  } else if (contains(Associativity.INFIX, ctx.associativity)) {
855
771
  tmp = visitInfixExpression(this, ctx);
856
772
  } else if (contains(Associativity.POSTFIX, ctx.associativity)) {
@@ -863,12 +779,12 @@
863
779
  return handleOuters(this, tmp, flatten_0(this, asList(ctx.outers)));
864
780
  };
865
781
  protoOf(PrologVisitor).visitExpression = function (ctx) {
866
- return this.g34(ctx);
782
+ return this.a36(ctx);
867
783
  };
868
- protoOf(PrologVisitor).i34 = function (ctx) {
784
+ protoOf(PrologVisitor).c36 = function (ctx) {
869
785
  var tmp;
870
786
  if (ctx.isExpr) {
871
- tmp = this.g34(ctx.expression());
787
+ tmp = this.a36(ctx.expression());
872
788
  } else {
873
789
  var tmp_0 = ctx.children[0].accept(this);
874
790
  tmp = (!(tmp_0 == null) ? isInterface(tmp_0, Term) : false) ? tmp_0 : THROW_CCE();
@@ -876,23 +792,23 @@
876
792
  return tmp;
877
793
  };
878
794
  protoOf(PrologVisitor).visitTerm = function (ctx) {
879
- return this.i34(ctx);
795
+ return this.c36(ctx);
880
796
  };
881
- protoOf(PrologVisitor).l34 = function (ctx) {
797
+ protoOf(PrologVisitor).f36 = function (ctx) {
882
798
  var value = parseInteger(this, ctx);
883
- return Companion_getInstance_3().ofBigInteger(value);
799
+ return Companion_getInstance_1().ofBigInteger(value);
884
800
  };
885
801
  protoOf(PrologVisitor).visitInteger = function (ctx) {
886
- return this.l34(ctx);
802
+ return this.f36(ctx);
887
803
  };
888
- protoOf(PrologVisitor).m34 = function (ctx) {
804
+ protoOf(PrologVisitor).g36 = function (ctx) {
889
805
  var tmp = ctx.children[0].accept(this);
890
806
  return (!(tmp == null) ? isInterface(tmp, Term) : false) ? tmp : THROW_CCE();
891
807
  };
892
808
  protoOf(PrologVisitor).visitNumber = function (ctx) {
893
- return this.m34(ctx);
809
+ return this.g36(ctx);
894
810
  };
895
- protoOf(PrologVisitor).n34 = function (ctx) {
811
+ protoOf(PrologVisitor).h36 = function (ctx) {
896
812
  var raw = ctx.value.text;
897
813
  if (!(ctx.sign == null)) {
898
814
  var tmp0_safe_receiver = ctx.sign;
@@ -900,7 +816,7 @@
900
816
  }
901
817
  var tmp;
902
818
  try {
903
- tmp = Companion_getInstance_4().parse(raw);
819
+ tmp = Companion_getInstance_2().parse(raw);
904
820
  } catch ($p) {
905
821
  var tmp_0;
906
822
  if ($p instanceof NumberFormatException) {
@@ -909,105 +825,99 @@
909
825
  } else {
910
826
  throw $p;
911
827
  }
912
- tmp = tmp_0;
913
828
  }
914
829
  return tmp;
915
830
  };
916
831
  protoOf(PrologVisitor).visitReal = function (ctx) {
917
- return this.n34(ctx);
832
+ return this.h36(ctx);
918
833
  };
919
- protoOf(PrologVisitor).o34 = function (ctx) {
834
+ protoOf(PrologVisitor).i36 = function (ctx) {
920
835
  var tmp;
921
836
  if (ctx.isAnonymous) {
922
- tmp = this.f34_1.anonymous();
837
+ tmp = this.z35_1.anonymous();
923
838
  } else {
924
- tmp = this.f34_1.varOf(ctx.value.text);
839
+ tmp = this.z35_1.varOf(ctx.value.text);
925
840
  }
926
841
  return tmp;
927
842
  };
928
843
  protoOf(PrologVisitor).visitVariable = function (ctx) {
929
- return this.o34(ctx);
844
+ return this.i36(ctx);
930
845
  };
931
- protoOf(PrologVisitor).p34 = function (ctx) {
846
+ protoOf(PrologVisitor).j36 = function (ctx) {
847
+ var tmp;
932
848
  if (ctx.isList) {
933
- return this.f34_1.listOf([]);
849
+ tmp = this.z35_1.logicListOf([]);
934
850
  } 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);
851
+ tmp = this.z35_1.blockOf([]);
852
+ } else if (ctx.arity === 0) {
853
+ tmp = this.z35_1.atomOf(ctx.functor.text);
940
854
  } else {
941
855
  var tmp_0 = ctx.functor.text;
942
856
  var tmp_1 = asSequence_0(ctx.args);
943
- tmp = this.f34_1.structOfSequence(tmp_0, map(tmp_1, PrologVisitor$visitExpression$ref(this)));
857
+ tmp = this.z35_1.structOfSequence(tmp_0, map(tmp_1, PrologVisitor$visitExpression$ref(this)));
944
858
  }
945
859
  return tmp;
946
860
  };
947
861
  protoOf(PrologVisitor).visitStructure = function (ctx) {
948
- return this.p34(ctx);
862
+ return this.j36(ctx);
949
863
  };
950
- protoOf(PrologVisitor).q34 = function (ctx) {
951
- var tmp$ret$1;
864
+ protoOf(PrologVisitor).k36 = function (ctx) {
952
865
  // Inline function 'kotlin.collections.map' call
953
- var tmp1_map = ctx.items;
954
- var tmp$ret$0;
866
+ var this_0 = ctx.items;
955
867
  // Inline function 'kotlin.collections.mapTo' call
956
- var tmp0_mapTo = ArrayList_init_$Create$(tmp1_map.length);
957
- var indexedObject = tmp1_map;
868
+ var destination = ArrayList_init_$Create$(this_0.length);
958
869
  var inductionVariable = 0;
959
- var last = indexedObject.length;
870
+ var last = this_0.length;
960
871
  while (inductionVariable < last) {
961
- var item = indexedObject[inductionVariable];
872
+ var item = this_0[inductionVariable];
962
873
  inductionVariable = inductionVariable + 1 | 0;
963
- tmp0_mapTo.g(this.g34(item));
874
+ var tmp$ret$0 = this.a36(item);
875
+ destination.l(tmp$ret$0);
964
876
  }
965
- tmp$ret$0 = tmp0_mapTo;
966
- tmp$ret$1 = tmp$ret$0;
967
- var terms = tmp$ret$1;
877
+ var terms = destination;
968
878
  var tmp;
969
879
  if (ctx.hasTail) {
970
880
  var tmp0_safe_receiver = ctx.tail;
971
- tmp = this.f34_1.hy(terms, tmp0_safe_receiver == null ? null : tmp0_safe_receiver.accept(this));
881
+ tmp = this.z35_1.b10(terms, tmp0_safe_receiver == null ? null : tmp0_safe_receiver.accept(this));
972
882
  } else {
973
- tmp = this.f34_1.listOfIterable(terms);
883
+ tmp = this.z35_1.logicListOfIterable(terms);
974
884
  }
975
885
  return tmp;
976
886
  };
977
887
  protoOf(PrologVisitor).visitList = function (ctx) {
978
- return this.q34(ctx);
888
+ return this.k36(ctx);
979
889
  };
980
- protoOf(PrologVisitor).r34 = function (ctx) {
890
+ protoOf(PrologVisitor).l36 = function (ctx) {
981
891
  var tmp;
982
892
  if (ctx.length === 1) {
983
- tmp = this.f34_1.setOf([ctx.items[0].accept(this)]);
893
+ tmp = this.z35_1.blockOf([ctx.items[0].accept(this)]);
984
894
  } else {
985
- var tmp$ret$1;
986
895
  // Inline function 'kotlin.collections.map' call
987
- var tmp1_map = ctx.items;
988
- var tmp$ret$0;
896
+ var this_0 = ctx.items;
989
897
  // Inline function 'kotlin.collections.mapTo' call
990
- var tmp0_mapTo = ArrayList_init_$Create$(tmp1_map.length);
991
- var indexedObject = tmp1_map;
898
+ var destination = ArrayList_init_$Create$(this_0.length);
992
899
  var inductionVariable = 0;
993
- var last = indexedObject.length;
900
+ var last = this_0.length;
994
901
  while (inductionVariable < last) {
995
- var item = indexedObject[inductionVariable];
902
+ var item = this_0[inductionVariable];
996
903
  inductionVariable = inductionVariable + 1 | 0;
997
- tmp0_mapTo.g(this.g34(item));
904
+ var tmp$ret$0 = this.a36(item);
905
+ destination.l(tmp$ret$0);
998
906
  }
999
- tmp$ret$0 = tmp0_mapTo;
1000
- tmp$ret$1 = tmp$ret$0;
1001
- tmp = this.f34_1.setOfIterable(tmp$ret$1);
907
+ tmp = this.z35_1.blockOfIterable(destination);
1002
908
  }
1003
909
  return tmp;
1004
910
  };
1005
911
  protoOf(PrologVisitor).visitBlock = function (ctx) {
1006
- return this.r34(ctx);
912
+ return this.l36(ctx);
1007
913
  };
914
+ //region block: init
915
+ Companion_instance_1 = new Companion();
916
+ PrologParserFactory_instance = new PrologParserFactory();
917
+ //endregion
1008
918
  //region block: exports
1009
919
  _.$_$ = _.$_$ || {};
1010
- _.$_$.a = PrologParserFactory_getInstance;
920
+ _.$_$.a = PrologParserFactory_instance;
1011
921
  _.$_$.b = PrologVisitor;
1012
922
  _.$_$.c = termToClause;
1013
923
  //endregion