mevento 1.9.0 → 1.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm2020/lib/mevento.mjs +12 -9
- package/fesm2015/mevento.mjs +13 -9
- package/fesm2015/mevento.mjs.map +1 -1
- package/fesm2020/mevento.mjs +11 -8
- package/fesm2020/mevento.mjs.map +1 -1
- package/lib/mevento.d.ts +1 -1
- package/package.json +1 -1
package/fesm2015/mevento.mjs
CHANGED
|
@@ -893,11 +893,14 @@ class Parser {
|
|
|
893
893
|
var _a, _b;
|
|
894
894
|
const properties = [];
|
|
895
895
|
if (((_a = this.currentToken) === null || _a === void 0 ? void 0 : _a.type) != TokenType.rbrace) {
|
|
896
|
+
this._eatEOL();
|
|
896
897
|
properties.push(this._property());
|
|
897
898
|
}
|
|
898
899
|
while (((_b = this.currentToken) === null || _b === void 0 ? void 0 : _b.type) === TokenType.comma) {
|
|
899
900
|
this._eat(TokenType.comma);
|
|
901
|
+
this._eatEOL();
|
|
900
902
|
properties.push(this._property());
|
|
903
|
+
this._eatEOL();
|
|
901
904
|
}
|
|
902
905
|
return properties;
|
|
903
906
|
}
|
|
@@ -1279,7 +1282,8 @@ class MEventScope {
|
|
|
1279
1282
|
this.parent = parent;
|
|
1280
1283
|
}
|
|
1281
1284
|
resolve(key) {
|
|
1282
|
-
|
|
1285
|
+
var _a, _b;
|
|
1286
|
+
return Object.keys(this.memory).includes(key) ? this.memory[key] : ((_b = (_a = this.parent) === null || _a === void 0 ? void 0 : _a.resolve(key)) !== null && _b !== void 0 ? _b : null);
|
|
1283
1287
|
}
|
|
1284
1288
|
change(key, value, declare = true) {
|
|
1285
1289
|
if (Object.keys(this.memory).includes(key)) {
|
|
@@ -1301,30 +1305,30 @@ class MEvento extends NodeVisitor {
|
|
|
1301
1305
|
constructor() {
|
|
1302
1306
|
super();
|
|
1303
1307
|
this.rootScope = new MEventScope("Program", {});
|
|
1304
|
-
this.
|
|
1308
|
+
this.currentScope = this.rootScope;
|
|
1305
1309
|
this.debug = false;
|
|
1306
1310
|
this._functionsRegistry = {};
|
|
1307
1311
|
this._functionsRegistry = Object.assign({}, MEvento._globalFunctionsRegistry);
|
|
1308
1312
|
}
|
|
1309
1313
|
resolve(name) {
|
|
1310
1314
|
var _a, _b;
|
|
1311
|
-
return (_b = (_a = this.
|
|
1315
|
+
return (_b = (_a = this.currentScope) === null || _a === void 0 ? void 0 : _a.resolve(name)) !== null && _b !== void 0 ? _b : null;
|
|
1312
1316
|
}
|
|
1313
1317
|
changeVariable(name, value) {
|
|
1314
1318
|
var _a;
|
|
1315
|
-
if ((_a = this.
|
|
1319
|
+
if ((_a = this.currentScope) === null || _a === void 0 ? void 0 : _a.change(name, value)) {
|
|
1316
1320
|
return value;
|
|
1317
1321
|
}
|
|
1318
1322
|
else
|
|
1319
1323
|
return null;
|
|
1320
1324
|
}
|
|
1321
1325
|
pushScope(name) {
|
|
1322
|
-
const scope = new MEventScope(name, {}, this.
|
|
1323
|
-
this.
|
|
1326
|
+
const scope = new MEventScope(name, {}, this.currentScope);
|
|
1327
|
+
this.currentScope = scope;
|
|
1324
1328
|
}
|
|
1325
1329
|
popScope() {
|
|
1326
1330
|
var _a;
|
|
1327
|
-
this.
|
|
1331
|
+
this.currentScope = (_a = this.currentScope) === null || _a === void 0 ? void 0 : _a.parent;
|
|
1328
1332
|
}
|
|
1329
1333
|
log(message) {
|
|
1330
1334
|
if (this.debug) {
|
|
@@ -1353,9 +1357,9 @@ class MEvento extends NodeVisitor {
|
|
|
1353
1357
|
return last;
|
|
1354
1358
|
}
|
|
1355
1359
|
visitIdentifierAST(node) {
|
|
1356
|
-
var _a
|
|
1360
|
+
var _a;
|
|
1357
1361
|
const id = node.value;
|
|
1358
|
-
return (
|
|
1362
|
+
return (_a = this === null || this === void 0 ? void 0 : this.resolve(id)) !== null && _a !== void 0 ? _a : null;
|
|
1359
1363
|
}
|
|
1360
1364
|
visitLiteralAST(node) {
|
|
1361
1365
|
const value = node.value;
|