greybel-interpreter 1.4.6 → 1.4.7
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/.editorconfig +14 -14
- package/.eslintrc +47 -47
- package/LICENSE +21 -21
- package/README.md +2 -2
- package/dist/context.d.ts +110 -110
- package/dist/context.js +306 -306
- package/dist/cps.d.ts +14 -14
- package/dist/cps.js +160 -160
- package/dist/handler/error.d.ts +6 -6
- package/dist/handler/error.js +12 -12
- package/dist/handler/output.d.ts +18 -18
- package/dist/handler/output.js +29 -29
- package/dist/handler/resource.d.ts +12 -12
- package/dist/handler/resource.js +28 -28
- package/dist/handler-container.d.ts +14 -14
- package/dist/handler-container.js +14 -14
- package/dist/index.d.ts +46 -46
- package/dist/index.js +132 -132
- package/dist/interpreter.d.ts +42 -42
- package/dist/interpreter.js +218 -218
- package/dist/operations/assign.d.ts +13 -13
- package/dist/operations/assign.js +46 -46
- package/dist/operations/block.d.ts +12 -12
- package/dist/operations/block.js +52 -52
- package/dist/operations/break.d.ts +10 -10
- package/dist/operations/break.js +23 -23
- package/dist/operations/call.d.ts +13 -13
- package/dist/operations/call.js +49 -49
- package/dist/operations/chunk.d.ts +12 -12
- package/dist/operations/chunk.js +33 -33
- package/dist/operations/continue.d.ts +10 -10
- package/dist/operations/continue.js +23 -23
- package/dist/operations/debugger-statement.d.ts +10 -10
- package/dist/operations/debugger-statement.js +21 -21
- package/dist/operations/evaluate.d.ts +40 -40
- package/dist/operations/evaluate.js +334 -334
- package/dist/operations/for.d.ts +14 -14
- package/dist/operations/for.js +81 -81
- package/dist/operations/function-reference.d.ts +12 -12
- package/dist/operations/function-reference.js +44 -44
- package/dist/operations/function.d.ts +14 -14
- package/dist/operations/function.js +72 -72
- package/dist/operations/if-statement.d.ts +19 -19
- package/dist/operations/if-statement.js +85 -85
- package/dist/operations/import.d.ts +17 -17
- package/dist/operations/import.js +57 -57
- package/dist/operations/include.d.ts +13 -13
- package/dist/operations/include.js +41 -41
- package/dist/operations/list.d.ts +11 -11
- package/dist/operations/list.js +42 -42
- package/dist/operations/literal.d.ts +11 -11
- package/dist/operations/literal.js +40 -40
- package/dist/operations/map.d.ts +11 -11
- package/dist/operations/map.js +44 -44
- package/dist/operations/negated-binary.d.ts +11 -11
- package/dist/operations/negated-binary.js +42 -42
- package/dist/operations/new-instance.d.ts +11 -11
- package/dist/operations/new-instance.js +39 -39
- package/dist/operations/noop.d.ts +9 -9
- package/dist/operations/noop.js +19 -19
- package/dist/operations/not.d.ts +11 -11
- package/dist/operations/not.js +35 -35
- package/dist/operations/operation.d.ts +13 -13
- package/dist/operations/operation.js +9 -9
- package/dist/operations/reference.d.ts +9 -9
- package/dist/operations/reference.js +19 -19
- package/dist/operations/resolve.d.ts +38 -38
- package/dist/operations/resolve.js +210 -210
- package/dist/operations/return.d.ts +11 -11
- package/dist/operations/return.js +45 -45
- package/dist/operations/while.d.ts +13 -13
- package/dist/operations/while.js +65 -65
- package/dist/types/base.d.ts +9 -9
- package/dist/types/base.js +5 -5
- package/dist/types/boolean.d.ts +13 -13
- package/dist/types/boolean.js +34 -34
- package/dist/types/default.d.ts +8 -8
- package/dist/types/default.js +14 -14
- package/dist/types/function.d.ts +32 -32
- package/dist/types/function.js +104 -104
- package/dist/types/interface.d.ts +24 -24
- package/dist/types/interface.js +83 -83
- package/dist/types/list.d.ts +29 -29
- package/dist/types/list.js +158 -158
- package/dist/types/map.d.ts +33 -33
- package/dist/types/map.js +200 -200
- package/dist/types/nil.d.ts +11 -11
- package/dist/types/nil.js +33 -33
- package/dist/types/number.d.ts +25 -25
- package/dist/types/number.js +69 -69
- package/dist/types/string.d.ts +31 -31
- package/dist/types/string.js +121 -121
- package/dist/types/with-intrinsics.d.ts +15 -15
- package/dist/types/with-intrinsics.js +19 -19
- package/dist/utils/deep-equal.d.ts +1 -1
- package/dist/utils/deep-equal.js +37 -37
- package/dist/utils/object-value.d.ts +7 -7
- package/dist/utils/object-value.js +42 -42
- package/dist/utils/path.d.ts +10 -10
- package/dist/utils/path.js +32 -32
- package/package.json +58 -58
|
@@ -1,334 +1,334 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
-
};
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.handle = exports.handleFunction = exports.handleNil = exports.handleInterface = exports.handleMap = exports.handleList = exports.handleString = exports.handleNumber = exports.FunctionProcessorHandler = exports.NilProcessorHandler = exports.InterfaceProcessorHandler = exports.MapProcessorHandler = exports.ListProcessorHandler = exports.StringProcessorHandler = exports.multiplyString = exports.NumberProcessorHandler = exports.GenericProcessorHandler = void 0;
|
|
16
|
-
const greyscript_core_1 = require("greyscript-core");
|
|
17
|
-
const boolean_1 = __importDefault(require("../types/boolean"));
|
|
18
|
-
const default_1 = __importDefault(require("../types/default"));
|
|
19
|
-
const function_1 = __importDefault(require("../types/function"));
|
|
20
|
-
const interface_1 = __importDefault(require("../types/interface"));
|
|
21
|
-
const list_1 = __importDefault(require("../types/list"));
|
|
22
|
-
const map_1 = __importDefault(require("../types/map"));
|
|
23
|
-
const nil_1 = __importDefault(require("../types/nil"));
|
|
24
|
-
const number_1 = __importDefault(require("../types/number"));
|
|
25
|
-
const string_1 = __importDefault(require("../types/string"));
|
|
26
|
-
const deep_equal_1 = __importDefault(require("../utils/deep-equal"));
|
|
27
|
-
const operation_1 = __importDefault(require("./operation"));
|
|
28
|
-
exports.GenericProcessorHandler = {
|
|
29
|
-
[greyscript_core_1.Operator.And]: (a, b) => new boolean_1.default(a.toTruthy() && b.toTruthy()),
|
|
30
|
-
[greyscript_core_1.Operator.Or]: (a, b) => new boolean_1.default(a.toTruthy() || b.toTruthy())
|
|
31
|
-
};
|
|
32
|
-
exports.NumberProcessorHandler = {
|
|
33
|
-
[greyscript_core_1.Operator.Plus]: (a, b) => new number_1.default(a.toNumber() + b.toNumber()),
|
|
34
|
-
[greyscript_core_1.Operator.Minus]: (a, b) => new number_1.default(a.toNumber() - b.toNumber()),
|
|
35
|
-
[greyscript_core_1.Operator.Slash]: (a, b) => new number_1.default(a.toNumber() / b.toNumber()),
|
|
36
|
-
[greyscript_core_1.Operator.Asterik]: (a, b) => new number_1.default(a.toNumber() * b.toNumber()),
|
|
37
|
-
[greyscript_core_1.Operator.Xor]: (a, b) => new number_1.default(a.toInt() ^ b.toInt()),
|
|
38
|
-
[greyscript_core_1.Operator.BitwiseOr]: (a, b) => new number_1.default(a.toInt() | b.toInt()),
|
|
39
|
-
[greyscript_core_1.Operator.LessThan]: (a, b) => new boolean_1.default(a.toNumber() < b.toNumber()),
|
|
40
|
-
[greyscript_core_1.Operator.GreaterThan]: (a, b) => new boolean_1.default(a.toNumber() > b.toNumber()),
|
|
41
|
-
[greyscript_core_1.Operator.LeftShift]: (a, b) => new number_1.default(a.toInt() << b.toInt()),
|
|
42
|
-
[greyscript_core_1.Operator.RightShift]: (a, b) => new number_1.default(a.toInt() >> b.toInt()),
|
|
43
|
-
[greyscript_core_1.Operator.UnsignedRightShift]: (a, b) => new number_1.default(a.toInt() >> b.toInt()),
|
|
44
|
-
[greyscript_core_1.Operator.BitwiseAnd]: (a, b) => new number_1.default(a.toInt() & b.toInt()),
|
|
45
|
-
[greyscript_core_1.Operator.PercentSign]: (a, b) => new number_1.default(a.toNumber() % b.toNumber()),
|
|
46
|
-
[greyscript_core_1.Operator.GreaterThanOrEqual]: (a, b) => new boolean_1.default(a.toNumber() >= b.toNumber()),
|
|
47
|
-
[greyscript_core_1.Operator.Equal]: (a, b) => new boolean_1.default(a.toNumber() === b.toNumber()),
|
|
48
|
-
[greyscript_core_1.Operator.LessThanOrEqual]: (a, b) => new boolean_1.default(a.toNumber() <= b.toNumber()),
|
|
49
|
-
[greyscript_core_1.Operator.NotEqual]: (a, b) => new boolean_1.default(a.toNumber() !== b.toNumber())
|
|
50
|
-
};
|
|
51
|
-
const multiplyString = (a, b) => {
|
|
52
|
-
const multiStr = new Array(b.toNumber()).fill(a.toString()).join('');
|
|
53
|
-
return new string_1.default(multiStr);
|
|
54
|
-
};
|
|
55
|
-
exports.multiplyString = multiplyString;
|
|
56
|
-
exports.StringProcessorHandler = {
|
|
57
|
-
[greyscript_core_1.Operator.Plus]: (a, b) => new string_1.default(a.toString() + b.toString()),
|
|
58
|
-
[greyscript_core_1.Operator.Asterik]: (a, b) => (0, exports.multiplyString)(a, b),
|
|
59
|
-
[greyscript_core_1.Operator.LessThan]: (a, b) => new boolean_1.default(a.toString().length < b.toString().length),
|
|
60
|
-
[greyscript_core_1.Operator.GreaterThan]: (a, b) => new boolean_1.default(a.toString().length > b.toString().length),
|
|
61
|
-
[greyscript_core_1.Operator.GreaterThanOrEqual]: (a, b) => new boolean_1.default(a.toString().length >= b.toString().length),
|
|
62
|
-
[greyscript_core_1.Operator.Equal]: (a, b) => new boolean_1.default(a.toString() === b.toString()),
|
|
63
|
-
[greyscript_core_1.Operator.LessThanOrEqual]: (a, b) => new boolean_1.default(a.toString().length <= b.toString().length),
|
|
64
|
-
[greyscript_core_1.Operator.NotEqual]: (a, b) => new boolean_1.default(a.toString() !== b.toString())
|
|
65
|
-
};
|
|
66
|
-
exports.ListProcessorHandler = {
|
|
67
|
-
[greyscript_core_1.Operator.Plus]: (left, right) => {
|
|
68
|
-
if (right instanceof list_1.default) {
|
|
69
|
-
return left.fork().extend(right);
|
|
70
|
-
}
|
|
71
|
-
return left;
|
|
72
|
-
},
|
|
73
|
-
[greyscript_core_1.Operator.LessThan]: (left, right) => {
|
|
74
|
-
if (right instanceof list_1.default) {
|
|
75
|
-
return new boolean_1.default(left.value.length < right.value.length);
|
|
76
|
-
}
|
|
77
|
-
return default_1.default.Void;
|
|
78
|
-
},
|
|
79
|
-
[greyscript_core_1.Operator.GreaterThan]: (left, right) => {
|
|
80
|
-
if (right instanceof list_1.default) {
|
|
81
|
-
return new boolean_1.default(left.value.length > right.value.length);
|
|
82
|
-
}
|
|
83
|
-
return default_1.default.Void;
|
|
84
|
-
},
|
|
85
|
-
[greyscript_core_1.Operator.GreaterThanOrEqual]: (left, right) => {
|
|
86
|
-
if (right instanceof list_1.default) {
|
|
87
|
-
return new boolean_1.default(left.value.length >= right.value.length);
|
|
88
|
-
}
|
|
89
|
-
return default_1.default.Void;
|
|
90
|
-
},
|
|
91
|
-
[greyscript_core_1.Operator.Equal]: (left, right) => {
|
|
92
|
-
if (right instanceof list_1.default) {
|
|
93
|
-
return new boolean_1.default((0, deep_equal_1.default)(left, right));
|
|
94
|
-
}
|
|
95
|
-
return default_1.default.Void;
|
|
96
|
-
},
|
|
97
|
-
[greyscript_core_1.Operator.LessThanOrEqual]: (left, right) => {
|
|
98
|
-
if (right instanceof list_1.default) {
|
|
99
|
-
return new boolean_1.default(left.value.length <= right.value.length);
|
|
100
|
-
}
|
|
101
|
-
return default_1.default.Void;
|
|
102
|
-
},
|
|
103
|
-
[greyscript_core_1.Operator.NotEqual]: (left, right) => {
|
|
104
|
-
if (right instanceof list_1.default) {
|
|
105
|
-
return new boolean_1.default(!(0, deep_equal_1.default)(left, right));
|
|
106
|
-
}
|
|
107
|
-
return default_1.default.Void;
|
|
108
|
-
}
|
|
109
|
-
};
|
|
110
|
-
exports.MapProcessorHandler = {
|
|
111
|
-
[greyscript_core_1.Operator.Plus]: (left, right) => {
|
|
112
|
-
if (right instanceof map_1.default) {
|
|
113
|
-
return left.fork().extend(right);
|
|
114
|
-
}
|
|
115
|
-
return left;
|
|
116
|
-
},
|
|
117
|
-
[greyscript_core_1.Operator.LessThan]: (left, right) => {
|
|
118
|
-
if (right instanceof map_1.default) {
|
|
119
|
-
return new boolean_1.default(left.value.size < right.value.size);
|
|
120
|
-
}
|
|
121
|
-
return default_1.default.Void;
|
|
122
|
-
},
|
|
123
|
-
[greyscript_core_1.Operator.GreaterThan]: (left, right) => {
|
|
124
|
-
if (right instanceof map_1.default) {
|
|
125
|
-
return new boolean_1.default(left.value.size > right.value.size);
|
|
126
|
-
}
|
|
127
|
-
return default_1.default.Void;
|
|
128
|
-
},
|
|
129
|
-
[greyscript_core_1.Operator.GreaterThanOrEqual]: (left, right) => {
|
|
130
|
-
if (right instanceof map_1.default) {
|
|
131
|
-
return new boolean_1.default(left.value.size >= right.value.size);
|
|
132
|
-
}
|
|
133
|
-
return default_1.default.Void;
|
|
134
|
-
},
|
|
135
|
-
[greyscript_core_1.Operator.Equal]: (left, right) => {
|
|
136
|
-
if (right instanceof map_1.default) {
|
|
137
|
-
return new boolean_1.default((0, deep_equal_1.default)(left, right));
|
|
138
|
-
}
|
|
139
|
-
return default_1.default.Void;
|
|
140
|
-
},
|
|
141
|
-
[greyscript_core_1.Operator.LessThanOrEqual]: (left, right) => {
|
|
142
|
-
if (right instanceof map_1.default) {
|
|
143
|
-
return new boolean_1.default(left.value.size <= right.value.size);
|
|
144
|
-
}
|
|
145
|
-
return default_1.default.Void;
|
|
146
|
-
},
|
|
147
|
-
[greyscript_core_1.Operator.NotEqual]: (left, right) => {
|
|
148
|
-
if (right instanceof map_1.default) {
|
|
149
|
-
return new boolean_1.default(!(0, deep_equal_1.default)(left, right));
|
|
150
|
-
}
|
|
151
|
-
return default_1.default.Void;
|
|
152
|
-
}
|
|
153
|
-
};
|
|
154
|
-
exports.InterfaceProcessorHandler = {
|
|
155
|
-
[greyscript_core_1.Operator.Equal]: (left, right) => new boolean_1.default(left.value === right.value),
|
|
156
|
-
[greyscript_core_1.Operator.NotEqual]: (left, right) => new boolean_1.default(left.value !== right.value)
|
|
157
|
-
};
|
|
158
|
-
exports.NilProcessorHandler = {
|
|
159
|
-
[greyscript_core_1.Operator.Equal]: (_a, b) => new boolean_1.default(b instanceof nil_1.default),
|
|
160
|
-
[greyscript_core_1.Operator.NotEqual]: (_a, b) => new boolean_1.default(!(b instanceof nil_1.default))
|
|
161
|
-
};
|
|
162
|
-
exports.FunctionProcessorHandler = {
|
|
163
|
-
[greyscript_core_1.Operator.Equal]: (a, b) => new boolean_1.default(a === b),
|
|
164
|
-
[greyscript_core_1.Operator.NotEqual]: (a, b) => new boolean_1.default(a !== b)
|
|
165
|
-
};
|
|
166
|
-
const handleNumber = (op, a, b) => {
|
|
167
|
-
if (op in exports.NumberProcessorHandler) {
|
|
168
|
-
return exports.NumberProcessorHandler[op](a, b);
|
|
169
|
-
}
|
|
170
|
-
else if (op in exports.GenericProcessorHandler) {
|
|
171
|
-
return exports.GenericProcessorHandler[op](a, b);
|
|
172
|
-
}
|
|
173
|
-
return default_1.default.Void;
|
|
174
|
-
};
|
|
175
|
-
exports.handleNumber = handleNumber;
|
|
176
|
-
const handleString = (op, a, b) => {
|
|
177
|
-
if (op in exports.StringProcessorHandler) {
|
|
178
|
-
return exports.StringProcessorHandler[op](a, b);
|
|
179
|
-
}
|
|
180
|
-
else if (op in exports.GenericProcessorHandler) {
|
|
181
|
-
return exports.GenericProcessorHandler[op](a, b);
|
|
182
|
-
}
|
|
183
|
-
return default_1.default.Void;
|
|
184
|
-
};
|
|
185
|
-
exports.handleString = handleString;
|
|
186
|
-
const handleList = (op, a, b) => {
|
|
187
|
-
const left = a;
|
|
188
|
-
const right = b;
|
|
189
|
-
if (op in exports.ListProcessorHandler) {
|
|
190
|
-
return exports.ListProcessorHandler[op](left, right);
|
|
191
|
-
}
|
|
192
|
-
else if (op in exports.GenericProcessorHandler) {
|
|
193
|
-
return exports.GenericProcessorHandler[op](a, b);
|
|
194
|
-
}
|
|
195
|
-
return default_1.default.Void;
|
|
196
|
-
};
|
|
197
|
-
exports.handleList = handleList;
|
|
198
|
-
const handleMap = (op, a, b) => {
|
|
199
|
-
const left = a;
|
|
200
|
-
const right = b;
|
|
201
|
-
if (op in exports.MapProcessorHandler) {
|
|
202
|
-
return exports.MapProcessorHandler[op](left, right);
|
|
203
|
-
}
|
|
204
|
-
else if (op in exports.GenericProcessorHandler) {
|
|
205
|
-
return exports.GenericProcessorHandler[op](a, b);
|
|
206
|
-
}
|
|
207
|
-
return default_1.default.Void;
|
|
208
|
-
};
|
|
209
|
-
exports.handleMap = handleMap;
|
|
210
|
-
const handleInterface = (op, a, b) => {
|
|
211
|
-
const left = a;
|
|
212
|
-
const right = b;
|
|
213
|
-
if (op in exports.InterfaceProcessorHandler) {
|
|
214
|
-
return exports.InterfaceProcessorHandler[op](left, right);
|
|
215
|
-
}
|
|
216
|
-
else if (op in exports.GenericProcessorHandler) {
|
|
217
|
-
return exports.GenericProcessorHandler[op](a, b);
|
|
218
|
-
}
|
|
219
|
-
return default_1.default.Void;
|
|
220
|
-
};
|
|
221
|
-
exports.handleInterface = handleInterface;
|
|
222
|
-
const handleNil = (op, a, b) => {
|
|
223
|
-
if (op in exports.NilProcessorHandler) {
|
|
224
|
-
return exports.NilProcessorHandler[op](a, b);
|
|
225
|
-
}
|
|
226
|
-
else if (op in exports.GenericProcessorHandler) {
|
|
227
|
-
return exports.GenericProcessorHandler[op](a, b);
|
|
228
|
-
}
|
|
229
|
-
return default_1.default.Void;
|
|
230
|
-
};
|
|
231
|
-
exports.handleNil = handleNil;
|
|
232
|
-
const handleFunction = (op, a, b) => {
|
|
233
|
-
if (op in exports.FunctionProcessorHandler) {
|
|
234
|
-
return exports.FunctionProcessorHandler[op](a, b);
|
|
235
|
-
}
|
|
236
|
-
else if (op in exports.GenericProcessorHandler) {
|
|
237
|
-
return exports.GenericProcessorHandler[op](a, b);
|
|
238
|
-
}
|
|
239
|
-
return default_1.default.Void;
|
|
240
|
-
};
|
|
241
|
-
exports.handleFunction = handleFunction;
|
|
242
|
-
const handle = (op, a, b) => {
|
|
243
|
-
if (a instanceof boolean_1.default) {
|
|
244
|
-
a = new number_1.default(a.toInt());
|
|
245
|
-
}
|
|
246
|
-
if (b instanceof boolean_1.default) {
|
|
247
|
-
b = new number_1.default(b.toInt());
|
|
248
|
-
}
|
|
249
|
-
if (op === greyscript_core_1.Operator.Equal && a.getCustomType() !== b.getCustomType()) {
|
|
250
|
-
return default_1.default.False;
|
|
251
|
-
}
|
|
252
|
-
else if (op === greyscript_core_1.Operator.NotEqual &&
|
|
253
|
-
a.getCustomType() !== b.getCustomType()) {
|
|
254
|
-
return default_1.default.True;
|
|
255
|
-
}
|
|
256
|
-
if (a instanceof string_1.default || b instanceof string_1.default) {
|
|
257
|
-
return (0, exports.handleString)(op, a, b);
|
|
258
|
-
}
|
|
259
|
-
else if (a instanceof number_1.default || b instanceof number_1.default) {
|
|
260
|
-
return (0, exports.handleNumber)(op, a, b);
|
|
261
|
-
}
|
|
262
|
-
else if (a instanceof list_1.default) {
|
|
263
|
-
return (0, exports.handleList)(op, a, b);
|
|
264
|
-
}
|
|
265
|
-
else if (a instanceof map_1.default) {
|
|
266
|
-
return (0, exports.handleMap)(op, a, b);
|
|
267
|
-
}
|
|
268
|
-
else if (a instanceof interface_1.default) {
|
|
269
|
-
return (0, exports.handleInterface)(op, a, b);
|
|
270
|
-
}
|
|
271
|
-
else if (a instanceof function_1.default) {
|
|
272
|
-
return (0, exports.handleFunction)(op, a, b);
|
|
273
|
-
}
|
|
274
|
-
else if (a instanceof nil_1.default) {
|
|
275
|
-
return (0, exports.handleNil)(op, a, b);
|
|
276
|
-
}
|
|
277
|
-
return default_1.default.Void;
|
|
278
|
-
};
|
|
279
|
-
exports.handle = handle;
|
|
280
|
-
class Evaluate extends operation_1.default {
|
|
281
|
-
constructor(item, target) {
|
|
282
|
-
super(null, target);
|
|
283
|
-
this.item = item;
|
|
284
|
-
}
|
|
285
|
-
build(visit) {
|
|
286
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
287
|
-
this.type = this.item.type;
|
|
288
|
-
this.op = this.item.operator;
|
|
289
|
-
this.left = yield visit(this.item.left);
|
|
290
|
-
this.right = yield visit(this.item.right);
|
|
291
|
-
return this;
|
|
292
|
-
});
|
|
293
|
-
}
|
|
294
|
-
resolveBinaryExpression(ctx, expr) {
|
|
295
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
296
|
-
const left = yield this.resolve(ctx, expr.left);
|
|
297
|
-
const right = yield this.resolve(ctx, expr.right);
|
|
298
|
-
return (0, exports.handle)(expr.op, left, right);
|
|
299
|
-
});
|
|
300
|
-
}
|
|
301
|
-
resolveLogicalExpression(ctx, expr) {
|
|
302
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
303
|
-
const left = yield this.resolve(ctx, expr.left);
|
|
304
|
-
if (expr.op === greyscript_core_1.Operator.And && !left.toTruthy()) {
|
|
305
|
-
return new boolean_1.default(false);
|
|
306
|
-
}
|
|
307
|
-
else if (expr.op === greyscript_core_1.Operator.Or && left.toTruthy()) {
|
|
308
|
-
return new boolean_1.default(true);
|
|
309
|
-
}
|
|
310
|
-
const right = yield this.resolve(ctx, expr.right);
|
|
311
|
-
return (0, exports.handle)(expr.op, left, right);
|
|
312
|
-
});
|
|
313
|
-
}
|
|
314
|
-
resolve(ctx, op) {
|
|
315
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
316
|
-
if (op instanceof Evaluate) {
|
|
317
|
-
const expr = op;
|
|
318
|
-
switch (expr.type) {
|
|
319
|
-
case greyscript_core_1.ASTType.BinaryExpression:
|
|
320
|
-
return this.resolveBinaryExpression(ctx, expr);
|
|
321
|
-
case greyscript_core_1.ASTType.LogicalExpression:
|
|
322
|
-
return this.resolveLogicalExpression(ctx, expr);
|
|
323
|
-
default:
|
|
324
|
-
break;
|
|
325
|
-
}
|
|
326
|
-
}
|
|
327
|
-
return op.handle(ctx);
|
|
328
|
-
});
|
|
329
|
-
}
|
|
330
|
-
handle(ctx) {
|
|
331
|
-
return this.resolve(ctx, this);
|
|
332
|
-
}
|
|
333
|
-
}
|
|
334
|
-
exports.default = Evaluate;
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.handle = exports.handleFunction = exports.handleNil = exports.handleInterface = exports.handleMap = exports.handleList = exports.handleString = exports.handleNumber = exports.FunctionProcessorHandler = exports.NilProcessorHandler = exports.InterfaceProcessorHandler = exports.MapProcessorHandler = exports.ListProcessorHandler = exports.StringProcessorHandler = exports.multiplyString = exports.NumberProcessorHandler = exports.GenericProcessorHandler = void 0;
|
|
16
|
+
const greyscript_core_1 = require("greyscript-core");
|
|
17
|
+
const boolean_1 = __importDefault(require("../types/boolean"));
|
|
18
|
+
const default_1 = __importDefault(require("../types/default"));
|
|
19
|
+
const function_1 = __importDefault(require("../types/function"));
|
|
20
|
+
const interface_1 = __importDefault(require("../types/interface"));
|
|
21
|
+
const list_1 = __importDefault(require("../types/list"));
|
|
22
|
+
const map_1 = __importDefault(require("../types/map"));
|
|
23
|
+
const nil_1 = __importDefault(require("../types/nil"));
|
|
24
|
+
const number_1 = __importDefault(require("../types/number"));
|
|
25
|
+
const string_1 = __importDefault(require("../types/string"));
|
|
26
|
+
const deep_equal_1 = __importDefault(require("../utils/deep-equal"));
|
|
27
|
+
const operation_1 = __importDefault(require("./operation"));
|
|
28
|
+
exports.GenericProcessorHandler = {
|
|
29
|
+
[greyscript_core_1.Operator.And]: (a, b) => new boolean_1.default(a.toTruthy() && b.toTruthy()),
|
|
30
|
+
[greyscript_core_1.Operator.Or]: (a, b) => new boolean_1.default(a.toTruthy() || b.toTruthy())
|
|
31
|
+
};
|
|
32
|
+
exports.NumberProcessorHandler = {
|
|
33
|
+
[greyscript_core_1.Operator.Plus]: (a, b) => new number_1.default(a.toNumber() + b.toNumber()),
|
|
34
|
+
[greyscript_core_1.Operator.Minus]: (a, b) => new number_1.default(a.toNumber() - b.toNumber()),
|
|
35
|
+
[greyscript_core_1.Operator.Slash]: (a, b) => new number_1.default(a.toNumber() / b.toNumber()),
|
|
36
|
+
[greyscript_core_1.Operator.Asterik]: (a, b) => new number_1.default(a.toNumber() * b.toNumber()),
|
|
37
|
+
[greyscript_core_1.Operator.Xor]: (a, b) => new number_1.default(a.toInt() ^ b.toInt()),
|
|
38
|
+
[greyscript_core_1.Operator.BitwiseOr]: (a, b) => new number_1.default(a.toInt() | b.toInt()),
|
|
39
|
+
[greyscript_core_1.Operator.LessThan]: (a, b) => new boolean_1.default(a.toNumber() < b.toNumber()),
|
|
40
|
+
[greyscript_core_1.Operator.GreaterThan]: (a, b) => new boolean_1.default(a.toNumber() > b.toNumber()),
|
|
41
|
+
[greyscript_core_1.Operator.LeftShift]: (a, b) => new number_1.default(a.toInt() << b.toInt()),
|
|
42
|
+
[greyscript_core_1.Operator.RightShift]: (a, b) => new number_1.default(a.toInt() >> b.toInt()),
|
|
43
|
+
[greyscript_core_1.Operator.UnsignedRightShift]: (a, b) => new number_1.default(a.toInt() >> b.toInt()),
|
|
44
|
+
[greyscript_core_1.Operator.BitwiseAnd]: (a, b) => new number_1.default(a.toInt() & b.toInt()),
|
|
45
|
+
[greyscript_core_1.Operator.PercentSign]: (a, b) => new number_1.default(a.toNumber() % b.toNumber()),
|
|
46
|
+
[greyscript_core_1.Operator.GreaterThanOrEqual]: (a, b) => new boolean_1.default(a.toNumber() >= b.toNumber()),
|
|
47
|
+
[greyscript_core_1.Operator.Equal]: (a, b) => new boolean_1.default(a.toNumber() === b.toNumber()),
|
|
48
|
+
[greyscript_core_1.Operator.LessThanOrEqual]: (a, b) => new boolean_1.default(a.toNumber() <= b.toNumber()),
|
|
49
|
+
[greyscript_core_1.Operator.NotEqual]: (a, b) => new boolean_1.default(a.toNumber() !== b.toNumber())
|
|
50
|
+
};
|
|
51
|
+
const multiplyString = (a, b) => {
|
|
52
|
+
const multiStr = new Array(b.toNumber()).fill(a.toString()).join('');
|
|
53
|
+
return new string_1.default(multiStr);
|
|
54
|
+
};
|
|
55
|
+
exports.multiplyString = multiplyString;
|
|
56
|
+
exports.StringProcessorHandler = {
|
|
57
|
+
[greyscript_core_1.Operator.Plus]: (a, b) => new string_1.default(a.toString() + b.toString()),
|
|
58
|
+
[greyscript_core_1.Operator.Asterik]: (a, b) => (0, exports.multiplyString)(a, b),
|
|
59
|
+
[greyscript_core_1.Operator.LessThan]: (a, b) => new boolean_1.default(a.toString().length < b.toString().length),
|
|
60
|
+
[greyscript_core_1.Operator.GreaterThan]: (a, b) => new boolean_1.default(a.toString().length > b.toString().length),
|
|
61
|
+
[greyscript_core_1.Operator.GreaterThanOrEqual]: (a, b) => new boolean_1.default(a.toString().length >= b.toString().length),
|
|
62
|
+
[greyscript_core_1.Operator.Equal]: (a, b) => new boolean_1.default(a.toString() === b.toString()),
|
|
63
|
+
[greyscript_core_1.Operator.LessThanOrEqual]: (a, b) => new boolean_1.default(a.toString().length <= b.toString().length),
|
|
64
|
+
[greyscript_core_1.Operator.NotEqual]: (a, b) => new boolean_1.default(a.toString() !== b.toString())
|
|
65
|
+
};
|
|
66
|
+
exports.ListProcessorHandler = {
|
|
67
|
+
[greyscript_core_1.Operator.Plus]: (left, right) => {
|
|
68
|
+
if (right instanceof list_1.default) {
|
|
69
|
+
return left.fork().extend(right);
|
|
70
|
+
}
|
|
71
|
+
return left;
|
|
72
|
+
},
|
|
73
|
+
[greyscript_core_1.Operator.LessThan]: (left, right) => {
|
|
74
|
+
if (right instanceof list_1.default) {
|
|
75
|
+
return new boolean_1.default(left.value.length < right.value.length);
|
|
76
|
+
}
|
|
77
|
+
return default_1.default.Void;
|
|
78
|
+
},
|
|
79
|
+
[greyscript_core_1.Operator.GreaterThan]: (left, right) => {
|
|
80
|
+
if (right instanceof list_1.default) {
|
|
81
|
+
return new boolean_1.default(left.value.length > right.value.length);
|
|
82
|
+
}
|
|
83
|
+
return default_1.default.Void;
|
|
84
|
+
},
|
|
85
|
+
[greyscript_core_1.Operator.GreaterThanOrEqual]: (left, right) => {
|
|
86
|
+
if (right instanceof list_1.default) {
|
|
87
|
+
return new boolean_1.default(left.value.length >= right.value.length);
|
|
88
|
+
}
|
|
89
|
+
return default_1.default.Void;
|
|
90
|
+
},
|
|
91
|
+
[greyscript_core_1.Operator.Equal]: (left, right) => {
|
|
92
|
+
if (right instanceof list_1.default) {
|
|
93
|
+
return new boolean_1.default((0, deep_equal_1.default)(left, right));
|
|
94
|
+
}
|
|
95
|
+
return default_1.default.Void;
|
|
96
|
+
},
|
|
97
|
+
[greyscript_core_1.Operator.LessThanOrEqual]: (left, right) => {
|
|
98
|
+
if (right instanceof list_1.default) {
|
|
99
|
+
return new boolean_1.default(left.value.length <= right.value.length);
|
|
100
|
+
}
|
|
101
|
+
return default_1.default.Void;
|
|
102
|
+
},
|
|
103
|
+
[greyscript_core_1.Operator.NotEqual]: (left, right) => {
|
|
104
|
+
if (right instanceof list_1.default) {
|
|
105
|
+
return new boolean_1.default(!(0, deep_equal_1.default)(left, right));
|
|
106
|
+
}
|
|
107
|
+
return default_1.default.Void;
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
exports.MapProcessorHandler = {
|
|
111
|
+
[greyscript_core_1.Operator.Plus]: (left, right) => {
|
|
112
|
+
if (right instanceof map_1.default) {
|
|
113
|
+
return left.fork().extend(right);
|
|
114
|
+
}
|
|
115
|
+
return left;
|
|
116
|
+
},
|
|
117
|
+
[greyscript_core_1.Operator.LessThan]: (left, right) => {
|
|
118
|
+
if (right instanceof map_1.default) {
|
|
119
|
+
return new boolean_1.default(left.value.size < right.value.size);
|
|
120
|
+
}
|
|
121
|
+
return default_1.default.Void;
|
|
122
|
+
},
|
|
123
|
+
[greyscript_core_1.Operator.GreaterThan]: (left, right) => {
|
|
124
|
+
if (right instanceof map_1.default) {
|
|
125
|
+
return new boolean_1.default(left.value.size > right.value.size);
|
|
126
|
+
}
|
|
127
|
+
return default_1.default.Void;
|
|
128
|
+
},
|
|
129
|
+
[greyscript_core_1.Operator.GreaterThanOrEqual]: (left, right) => {
|
|
130
|
+
if (right instanceof map_1.default) {
|
|
131
|
+
return new boolean_1.default(left.value.size >= right.value.size);
|
|
132
|
+
}
|
|
133
|
+
return default_1.default.Void;
|
|
134
|
+
},
|
|
135
|
+
[greyscript_core_1.Operator.Equal]: (left, right) => {
|
|
136
|
+
if (right instanceof map_1.default) {
|
|
137
|
+
return new boolean_1.default((0, deep_equal_1.default)(left, right));
|
|
138
|
+
}
|
|
139
|
+
return default_1.default.Void;
|
|
140
|
+
},
|
|
141
|
+
[greyscript_core_1.Operator.LessThanOrEqual]: (left, right) => {
|
|
142
|
+
if (right instanceof map_1.default) {
|
|
143
|
+
return new boolean_1.default(left.value.size <= right.value.size);
|
|
144
|
+
}
|
|
145
|
+
return default_1.default.Void;
|
|
146
|
+
},
|
|
147
|
+
[greyscript_core_1.Operator.NotEqual]: (left, right) => {
|
|
148
|
+
if (right instanceof map_1.default) {
|
|
149
|
+
return new boolean_1.default(!(0, deep_equal_1.default)(left, right));
|
|
150
|
+
}
|
|
151
|
+
return default_1.default.Void;
|
|
152
|
+
}
|
|
153
|
+
};
|
|
154
|
+
exports.InterfaceProcessorHandler = {
|
|
155
|
+
[greyscript_core_1.Operator.Equal]: (left, right) => new boolean_1.default(left.value === right.value),
|
|
156
|
+
[greyscript_core_1.Operator.NotEqual]: (left, right) => new boolean_1.default(left.value !== right.value)
|
|
157
|
+
};
|
|
158
|
+
exports.NilProcessorHandler = {
|
|
159
|
+
[greyscript_core_1.Operator.Equal]: (_a, b) => new boolean_1.default(b instanceof nil_1.default),
|
|
160
|
+
[greyscript_core_1.Operator.NotEqual]: (_a, b) => new boolean_1.default(!(b instanceof nil_1.default))
|
|
161
|
+
};
|
|
162
|
+
exports.FunctionProcessorHandler = {
|
|
163
|
+
[greyscript_core_1.Operator.Equal]: (a, b) => new boolean_1.default(a === b),
|
|
164
|
+
[greyscript_core_1.Operator.NotEqual]: (a, b) => new boolean_1.default(a !== b)
|
|
165
|
+
};
|
|
166
|
+
const handleNumber = (op, a, b) => {
|
|
167
|
+
if (op in exports.NumberProcessorHandler) {
|
|
168
|
+
return exports.NumberProcessorHandler[op](a, b);
|
|
169
|
+
}
|
|
170
|
+
else if (op in exports.GenericProcessorHandler) {
|
|
171
|
+
return exports.GenericProcessorHandler[op](a, b);
|
|
172
|
+
}
|
|
173
|
+
return default_1.default.Void;
|
|
174
|
+
};
|
|
175
|
+
exports.handleNumber = handleNumber;
|
|
176
|
+
const handleString = (op, a, b) => {
|
|
177
|
+
if (op in exports.StringProcessorHandler) {
|
|
178
|
+
return exports.StringProcessorHandler[op](a, b);
|
|
179
|
+
}
|
|
180
|
+
else if (op in exports.GenericProcessorHandler) {
|
|
181
|
+
return exports.GenericProcessorHandler[op](a, b);
|
|
182
|
+
}
|
|
183
|
+
return default_1.default.Void;
|
|
184
|
+
};
|
|
185
|
+
exports.handleString = handleString;
|
|
186
|
+
const handleList = (op, a, b) => {
|
|
187
|
+
const left = a;
|
|
188
|
+
const right = b;
|
|
189
|
+
if (op in exports.ListProcessorHandler) {
|
|
190
|
+
return exports.ListProcessorHandler[op](left, right);
|
|
191
|
+
}
|
|
192
|
+
else if (op in exports.GenericProcessorHandler) {
|
|
193
|
+
return exports.GenericProcessorHandler[op](a, b);
|
|
194
|
+
}
|
|
195
|
+
return default_1.default.Void;
|
|
196
|
+
};
|
|
197
|
+
exports.handleList = handleList;
|
|
198
|
+
const handleMap = (op, a, b) => {
|
|
199
|
+
const left = a;
|
|
200
|
+
const right = b;
|
|
201
|
+
if (op in exports.MapProcessorHandler) {
|
|
202
|
+
return exports.MapProcessorHandler[op](left, right);
|
|
203
|
+
}
|
|
204
|
+
else if (op in exports.GenericProcessorHandler) {
|
|
205
|
+
return exports.GenericProcessorHandler[op](a, b);
|
|
206
|
+
}
|
|
207
|
+
return default_1.default.Void;
|
|
208
|
+
};
|
|
209
|
+
exports.handleMap = handleMap;
|
|
210
|
+
const handleInterface = (op, a, b) => {
|
|
211
|
+
const left = a;
|
|
212
|
+
const right = b;
|
|
213
|
+
if (op in exports.InterfaceProcessorHandler) {
|
|
214
|
+
return exports.InterfaceProcessorHandler[op](left, right);
|
|
215
|
+
}
|
|
216
|
+
else if (op in exports.GenericProcessorHandler) {
|
|
217
|
+
return exports.GenericProcessorHandler[op](a, b);
|
|
218
|
+
}
|
|
219
|
+
return default_1.default.Void;
|
|
220
|
+
};
|
|
221
|
+
exports.handleInterface = handleInterface;
|
|
222
|
+
const handleNil = (op, a, b) => {
|
|
223
|
+
if (op in exports.NilProcessorHandler) {
|
|
224
|
+
return exports.NilProcessorHandler[op](a, b);
|
|
225
|
+
}
|
|
226
|
+
else if (op in exports.GenericProcessorHandler) {
|
|
227
|
+
return exports.GenericProcessorHandler[op](a, b);
|
|
228
|
+
}
|
|
229
|
+
return default_1.default.Void;
|
|
230
|
+
};
|
|
231
|
+
exports.handleNil = handleNil;
|
|
232
|
+
const handleFunction = (op, a, b) => {
|
|
233
|
+
if (op in exports.FunctionProcessorHandler) {
|
|
234
|
+
return exports.FunctionProcessorHandler[op](a, b);
|
|
235
|
+
}
|
|
236
|
+
else if (op in exports.GenericProcessorHandler) {
|
|
237
|
+
return exports.GenericProcessorHandler[op](a, b);
|
|
238
|
+
}
|
|
239
|
+
return default_1.default.Void;
|
|
240
|
+
};
|
|
241
|
+
exports.handleFunction = handleFunction;
|
|
242
|
+
const handle = (op, a, b) => {
|
|
243
|
+
if (a instanceof boolean_1.default) {
|
|
244
|
+
a = new number_1.default(a.toInt());
|
|
245
|
+
}
|
|
246
|
+
if (b instanceof boolean_1.default) {
|
|
247
|
+
b = new number_1.default(b.toInt());
|
|
248
|
+
}
|
|
249
|
+
if (op === greyscript_core_1.Operator.Equal && a.getCustomType() !== b.getCustomType()) {
|
|
250
|
+
return default_1.default.False;
|
|
251
|
+
}
|
|
252
|
+
else if (op === greyscript_core_1.Operator.NotEqual &&
|
|
253
|
+
a.getCustomType() !== b.getCustomType()) {
|
|
254
|
+
return default_1.default.True;
|
|
255
|
+
}
|
|
256
|
+
if (a instanceof string_1.default || b instanceof string_1.default) {
|
|
257
|
+
return (0, exports.handleString)(op, a, b);
|
|
258
|
+
}
|
|
259
|
+
else if (a instanceof number_1.default || b instanceof number_1.default) {
|
|
260
|
+
return (0, exports.handleNumber)(op, a, b);
|
|
261
|
+
}
|
|
262
|
+
else if (a instanceof list_1.default) {
|
|
263
|
+
return (0, exports.handleList)(op, a, b);
|
|
264
|
+
}
|
|
265
|
+
else if (a instanceof map_1.default) {
|
|
266
|
+
return (0, exports.handleMap)(op, a, b);
|
|
267
|
+
}
|
|
268
|
+
else if (a instanceof interface_1.default) {
|
|
269
|
+
return (0, exports.handleInterface)(op, a, b);
|
|
270
|
+
}
|
|
271
|
+
else if (a instanceof function_1.default) {
|
|
272
|
+
return (0, exports.handleFunction)(op, a, b);
|
|
273
|
+
}
|
|
274
|
+
else if (a instanceof nil_1.default) {
|
|
275
|
+
return (0, exports.handleNil)(op, a, b);
|
|
276
|
+
}
|
|
277
|
+
return default_1.default.Void;
|
|
278
|
+
};
|
|
279
|
+
exports.handle = handle;
|
|
280
|
+
class Evaluate extends operation_1.default {
|
|
281
|
+
constructor(item, target) {
|
|
282
|
+
super(null, target);
|
|
283
|
+
this.item = item;
|
|
284
|
+
}
|
|
285
|
+
build(visit) {
|
|
286
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
287
|
+
this.type = this.item.type;
|
|
288
|
+
this.op = this.item.operator;
|
|
289
|
+
this.left = yield visit(this.item.left);
|
|
290
|
+
this.right = yield visit(this.item.right);
|
|
291
|
+
return this;
|
|
292
|
+
});
|
|
293
|
+
}
|
|
294
|
+
resolveBinaryExpression(ctx, expr) {
|
|
295
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
296
|
+
const left = yield this.resolve(ctx, expr.left);
|
|
297
|
+
const right = yield this.resolve(ctx, expr.right);
|
|
298
|
+
return (0, exports.handle)(expr.op, left, right);
|
|
299
|
+
});
|
|
300
|
+
}
|
|
301
|
+
resolveLogicalExpression(ctx, expr) {
|
|
302
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
303
|
+
const left = yield this.resolve(ctx, expr.left);
|
|
304
|
+
if (expr.op === greyscript_core_1.Operator.And && !left.toTruthy()) {
|
|
305
|
+
return new boolean_1.default(false);
|
|
306
|
+
}
|
|
307
|
+
else if (expr.op === greyscript_core_1.Operator.Or && left.toTruthy()) {
|
|
308
|
+
return new boolean_1.default(true);
|
|
309
|
+
}
|
|
310
|
+
const right = yield this.resolve(ctx, expr.right);
|
|
311
|
+
return (0, exports.handle)(expr.op, left, right);
|
|
312
|
+
});
|
|
313
|
+
}
|
|
314
|
+
resolve(ctx, op) {
|
|
315
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
316
|
+
if (op instanceof Evaluate) {
|
|
317
|
+
const expr = op;
|
|
318
|
+
switch (expr.type) {
|
|
319
|
+
case greyscript_core_1.ASTType.BinaryExpression:
|
|
320
|
+
return this.resolveBinaryExpression(ctx, expr);
|
|
321
|
+
case greyscript_core_1.ASTType.LogicalExpression:
|
|
322
|
+
return this.resolveLogicalExpression(ctx, expr);
|
|
323
|
+
default:
|
|
324
|
+
break;
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
return op.handle(ctx);
|
|
328
|
+
});
|
|
329
|
+
}
|
|
330
|
+
handle(ctx) {
|
|
331
|
+
return this.resolve(ctx, this);
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
exports.default = Evaluate;
|