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/fesm2020/mevento.mjs
CHANGED
|
@@ -883,11 +883,14 @@ class Parser {
|
|
|
883
883
|
_objectProperties() {
|
|
884
884
|
const properties = [];
|
|
885
885
|
if (this.currentToken?.type != TokenType.rbrace) {
|
|
886
|
+
this._eatEOL();
|
|
886
887
|
properties.push(this._property());
|
|
887
888
|
}
|
|
888
889
|
while (this.currentToken?.type === TokenType.comma) {
|
|
889
890
|
this._eat(TokenType.comma);
|
|
891
|
+
this._eatEOL();
|
|
890
892
|
properties.push(this._property());
|
|
893
|
+
this._eatEOL();
|
|
891
894
|
}
|
|
892
895
|
return properties;
|
|
893
896
|
}
|
|
@@ -1265,7 +1268,7 @@ class MEventScope {
|
|
|
1265
1268
|
this.parent = parent;
|
|
1266
1269
|
}
|
|
1267
1270
|
resolve(key) {
|
|
1268
|
-
return Object.keys(this.memory).includes(key) ? this.memory[key] : (this.parent
|
|
1271
|
+
return Object.keys(this.memory).includes(key) ? this.memory[key] : (this.parent?.resolve(key) ?? null);
|
|
1269
1272
|
}
|
|
1270
1273
|
change(key, value, declare = true) {
|
|
1271
1274
|
if (Object.keys(this.memory).includes(key)) {
|
|
@@ -1287,27 +1290,27 @@ class MEvento extends NodeVisitor {
|
|
|
1287
1290
|
constructor() {
|
|
1288
1291
|
super();
|
|
1289
1292
|
this.rootScope = new MEventScope("Program", {});
|
|
1290
|
-
this.
|
|
1293
|
+
this.currentScope = this.rootScope;
|
|
1291
1294
|
this.debug = false;
|
|
1292
1295
|
this._functionsRegistry = {};
|
|
1293
1296
|
this._functionsRegistry = { ...MEvento._globalFunctionsRegistry };
|
|
1294
1297
|
}
|
|
1295
1298
|
resolve(name) {
|
|
1296
|
-
return this.
|
|
1299
|
+
return this.currentScope?.resolve(name) ?? null;
|
|
1297
1300
|
}
|
|
1298
1301
|
changeVariable(name, value) {
|
|
1299
|
-
if (this.
|
|
1302
|
+
if (this.currentScope?.change(name, value)) {
|
|
1300
1303
|
return value;
|
|
1301
1304
|
}
|
|
1302
1305
|
else
|
|
1303
1306
|
return null;
|
|
1304
1307
|
}
|
|
1305
1308
|
pushScope(name) {
|
|
1306
|
-
const scope = new MEventScope(name, {}, this.
|
|
1307
|
-
this.
|
|
1309
|
+
const scope = new MEventScope(name, {}, this.currentScope);
|
|
1310
|
+
this.currentScope = scope;
|
|
1308
1311
|
}
|
|
1309
1312
|
popScope() {
|
|
1310
|
-
this.
|
|
1313
|
+
this.currentScope = this.currentScope?.parent;
|
|
1311
1314
|
}
|
|
1312
1315
|
log(message) {
|
|
1313
1316
|
if (this.debug) {
|
|
@@ -1337,7 +1340,7 @@ class MEvento extends NodeVisitor {
|
|
|
1337
1340
|
}
|
|
1338
1341
|
visitIdentifierAST(node) {
|
|
1339
1342
|
const id = node.value;
|
|
1340
|
-
return this
|
|
1343
|
+
return this?.resolve(id) ?? null;
|
|
1341
1344
|
}
|
|
1342
1345
|
visitLiteralAST(node) {
|
|
1343
1346
|
const value = node.value;
|