mevento 2.0.3 → 2.0.5
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/fesm2020/mevento.mjs
CHANGED
|
@@ -345,7 +345,7 @@ class Lexer {
|
|
|
345
345
|
return new Token(TokenType.stringConst, ret, lastL, lastC);
|
|
346
346
|
}
|
|
347
347
|
_skipLineComment() {
|
|
348
|
-
while (!this._isLineEnd(this._currentChar) === true) {
|
|
348
|
+
while (!this._isLineEnd(this._currentChar) === true && this._currentChar != -1) {
|
|
349
349
|
this._advance();
|
|
350
350
|
}
|
|
351
351
|
}
|
|
@@ -871,14 +871,16 @@ class Parser {
|
|
|
871
871
|
return this._arrayExpression();
|
|
872
872
|
case TokenType.lbrace:
|
|
873
873
|
return this._objectExpression();
|
|
874
|
+
case TokenType.IF:
|
|
875
|
+
return this._ifStatement();
|
|
874
876
|
default:
|
|
875
877
|
return this._variable();
|
|
876
878
|
}
|
|
877
879
|
}
|
|
878
880
|
_term() {
|
|
879
881
|
let node = this._factor();
|
|
880
|
-
node = this._tryParsingMemberExpression(node);
|
|
881
882
|
node = this._tryParsingFunctionCall(node);
|
|
883
|
+
node = this._tryParsingMemberExpression(node);
|
|
882
884
|
return node;
|
|
883
885
|
}
|
|
884
886
|
_expression() {
|
|
@@ -1208,8 +1210,8 @@ class Parser {
|
|
|
1208
1210
|
case TokenType.eol:
|
|
1209
1211
|
this._eatEOL();
|
|
1210
1212
|
return this._statement();
|
|
1211
|
-
case TokenType.IF:
|
|
1212
|
-
|
|
1213
|
+
// case TokenType.IF:
|
|
1214
|
+
// return this._ifStatement();
|
|
1213
1215
|
case TokenType.WHILE_TILL:
|
|
1214
1216
|
return this._whileLoop();
|
|
1215
1217
|
case TokenType.FOR_LOOP:
|
|
@@ -1535,7 +1537,7 @@ class MEvento extends NodeVisitor {
|
|
|
1535
1537
|
if (op.type === TokenType.not) {
|
|
1536
1538
|
return _boolValue(argValue) === false;
|
|
1537
1539
|
}
|
|
1538
|
-
if (isNum(argValue)) {
|
|
1540
|
+
if (!isNum(argValue)) {
|
|
1539
1541
|
throw new Error(`Operation ${op.value} not allowed no num value`);
|
|
1540
1542
|
}
|
|
1541
1543
|
if (op.type === TokenType.plus) {
|
|
@@ -1946,7 +1948,7 @@ class MEventoAsync extends MEvento {
|
|
|
1946
1948
|
if (op.type === TokenType.not) {
|
|
1947
1949
|
return _boolValue(argValue) === false;
|
|
1948
1950
|
}
|
|
1949
|
-
if (isNum(argValue)) {
|
|
1951
|
+
if (!isNum(argValue)) {
|
|
1950
1952
|
throw new Error(`Operation ${op.value} not allowed no num value`);
|
|
1951
1953
|
}
|
|
1952
1954
|
if (op.type === TokenType.plus) {
|