mevento 2.0.0 → 2.0.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/esm2020/lib/mevento.mjs +18 -6
- package/fesm2015/mevento.mjs +17 -5
- package/fesm2015/mevento.mjs.map +1 -1
- package/fesm2020/mevento.mjs +17 -5
- package/fesm2020/mevento.mjs.map +1 -1
- package/lib/mevento.d.ts +12 -4
- package/package.json +1 -1
package/fesm2015/mevento.mjs
CHANGED
|
@@ -855,7 +855,7 @@ class Parser {
|
|
|
855
855
|
case TokenType.minus:
|
|
856
856
|
case TokenType.not:
|
|
857
857
|
this._eat(this.currentToken.type);
|
|
858
|
-
return new UnaryExpressionAST(token, this.
|
|
858
|
+
return new UnaryExpressionAST(token, this._term());
|
|
859
859
|
case TokenType.numberConst:
|
|
860
860
|
this._eat(TokenType.numberConst);
|
|
861
861
|
return new LiteralAST(token, token.value.toString());
|
|
@@ -1769,8 +1769,11 @@ class MEvento extends NodeVisitor {
|
|
|
1769
1769
|
unregisterFunction(id) {
|
|
1770
1770
|
delete this._functionsRegistry[id];
|
|
1771
1771
|
}
|
|
1772
|
-
execute(source, cache = true) {
|
|
1772
|
+
execute(source, cache = true, input) {
|
|
1773
1773
|
const module = MEvento.compile(source, cache);
|
|
1774
|
+
if (input) {
|
|
1775
|
+
Object.keys(input).forEach(k => this.changeVariable(k, input[k]));
|
|
1776
|
+
}
|
|
1774
1777
|
return this.visit(module);
|
|
1775
1778
|
}
|
|
1776
1779
|
static compile(source, cache = false) {
|
|
@@ -1791,9 +1794,12 @@ class MEvento extends NodeVisitor {
|
|
|
1791
1794
|
static unregister(id) {
|
|
1792
1795
|
delete MEvento._globalFunctionsRegistry[id];
|
|
1793
1796
|
}
|
|
1794
|
-
static run(source, cache = false) {
|
|
1797
|
+
static run(source, cache = false, input) {
|
|
1795
1798
|
const mevento = new MEvento();
|
|
1796
1799
|
const module = MEvento.compile(source, cache);
|
|
1800
|
+
if (input) {
|
|
1801
|
+
Object.keys(input).forEach(k => mevento.changeVariable(k, input[k]));
|
|
1802
|
+
}
|
|
1797
1803
|
return mevento.visit(module);
|
|
1798
1804
|
}
|
|
1799
1805
|
static newInstance() {
|
|
@@ -2194,16 +2200,22 @@ class MEventoAsync extends MEvento {
|
|
|
2194
2200
|
unregisterFunction(id) {
|
|
2195
2201
|
delete this._functionsRegistry[id];
|
|
2196
2202
|
}
|
|
2197
|
-
execute(source, cache = true) {
|
|
2203
|
+
execute(source, cache = true, input) {
|
|
2198
2204
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2199
2205
|
const module = MEvento.compile(source, cache);
|
|
2206
|
+
if (input) {
|
|
2207
|
+
Object.keys(input).forEach(k => this.changeVariable(k, input[k]));
|
|
2208
|
+
}
|
|
2200
2209
|
return yield this.visit(module);
|
|
2201
2210
|
});
|
|
2202
2211
|
}
|
|
2203
|
-
static run(source, cache = false) {
|
|
2212
|
+
static run(source, cache = false, input) {
|
|
2204
2213
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2205
2214
|
const mevento = new MEventoAsync();
|
|
2206
2215
|
const module = MEvento.compile(source, cache);
|
|
2216
|
+
if (input) {
|
|
2217
|
+
Object.keys(input).forEach(k => mevento.changeVariable(k, input[k]));
|
|
2218
|
+
}
|
|
2207
2219
|
return yield mevento.visit(module);
|
|
2208
2220
|
});
|
|
2209
2221
|
}
|