|
@@ -191,6 +191,15 @@ export class IVProgParser {
|
|
return true;
|
|
return true;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ consumeForSemiColon () {
|
|
|
|
+ const eosToken = this.getToken();
|
|
|
|
+ if (eosToken.type === this.lexerClass.EOS && eosToken.text.match(';')) {
|
|
|
|
+ this.pos++;
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ throw SyntaxError.createError(';', eosToken);
|
|
|
|
+ }
|
|
|
|
+
|
|
parseGlobalVariables () {
|
|
parseGlobalVariables () {
|
|
const decl = this.parseMaybeConst();
|
|
const decl = this.parseMaybeConst();
|
|
const eosToken = this.getToken();
|
|
const eosToken = this.getToken();
|
|
@@ -631,6 +640,7 @@ export class IVProgParser {
|
|
return new Commands.IfThenElse(logicalExpression, cmdBlocks, elseBlock);
|
|
return new Commands.IfThenElse(logicalExpression, cmdBlocks, elseBlock);
|
|
}
|
|
}
|
|
this.popScope();
|
|
this.popScope();
|
|
|
|
+
|
|
return new Commands.IfThenElse(logicalExpression, cmdBlocks, null);
|
|
return new Commands.IfThenElse(logicalExpression, cmdBlocks, null);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -643,8 +653,7 @@ export class IVProgParser {
|
|
const attribution = this.parseForAssign();
|
|
const attribution = this.parseForAssign();
|
|
this.consumeNewLines();
|
|
this.consumeNewLines();
|
|
const condition = this.parseExpressionOR();
|
|
const condition = this.parseExpressionOR();
|
|
- this.checkEOS();
|
|
|
|
- this.pos++;
|
|
|
|
|
|
+ this.consumeForSemiColon();
|
|
const increment = this.parseForAssign(true);
|
|
const increment = this.parseForAssign(true);
|
|
this.checkCloseParenthesis()
|
|
this.checkCloseParenthesis()
|
|
this.pos++;
|
|
this.pos++;
|
|
@@ -721,8 +730,7 @@ export class IVProgParser {
|
|
this.pos++
|
|
this.pos++
|
|
const exp = this.parseExpressionOR();
|
|
const exp = this.parseExpressionOR();
|
|
if(!isLast) {
|
|
if(!isLast) {
|
|
- this.checkEOS();
|
|
|
|
- this.pos++;
|
|
|
|
|
|
+ this.consumeForSemiColon();
|
|
}
|
|
}
|
|
return new Commands.Assign(id, exp);
|
|
return new Commands.Assign(id, exp);
|
|
}
|
|
}
|