|
@@ -781,9 +781,9 @@ export class IVProgParser {
|
|
|
return this.parseIDCommand();
|
|
|
} else if (token.type === this.lexerClass.RK_RETURN) {
|
|
|
return this.parseReturn();
|
|
|
- } else if (token.type === this.lexerClass.RK_WHILE) {
|
|
|
+ } else if (token.type === this.lexerClass.RK_WHILE || token.type === this.lexerClass.RK_WHILE_ALT) {
|
|
|
return this.parseWhile();
|
|
|
- } else if (token.type === this.lexerClass.RK_FOR) {
|
|
|
+ } else if (token.type === this.lexerClass.RK_FOR || token.type === this.lexerClass.RK_FOR_ALT) {
|
|
|
return this.parseFor();
|
|
|
} else if (token.type === this.lexerClass.RK_BREAK ) {
|
|
|
if(!this.insideScope(IVProgParser.BREAKABLE)) {
|
|
@@ -796,7 +796,7 @@ export class IVProgParser {
|
|
|
} else if (token.type === this.lexerClass.RK_SWITCH) {
|
|
|
return this.parseSwitchCase();
|
|
|
} else if (token.type === this.lexerClass.RK_DO) {
|
|
|
- return this.parseDoWhile();
|
|
|
+ return this.parseDoUntil();
|
|
|
} else if (token.type === this.lexerClass.RK_IF) {
|
|
|
return this.parseIfThenElse();
|
|
|
} else if (this.checkEOS(true)){
|
|
@@ -831,15 +831,15 @@ export class IVProgParser {
|
|
|
return new Commands.Switch(exp, casesList);
|
|
|
}
|
|
|
|
|
|
- parseDoWhile () {
|
|
|
+ parseDoUntil () {
|
|
|
this.pos++;
|
|
|
this.consumeNewLines();
|
|
|
this.pushScope(IVProgParser.BREAKABLE);
|
|
|
const commandsBlock = this.parseCommandBlock();
|
|
|
this.consumeNewLines(); //Maybe not...
|
|
|
const whileToken = this.getToken();
|
|
|
- if (whileToken.type !== this.lexerClass.RK_WHILE) {
|
|
|
- throw SyntaxErrorFactory.token_missing_one(this.lexer.literalNames[this.lexerClass.RK_WHILE], whileToken);
|
|
|
+ if (whileToken.type !== this.lexerClass.RK_DO_UNTIL) {
|
|
|
+ throw SyntaxErrorFactory.token_missing_one(this.lexer.literalNames[this.lexerClass.RK_DO_UNTIL], whileToken);
|
|
|
}
|
|
|
this.pos++;
|
|
|
this.checkOpenParenthesis();
|
|
@@ -851,7 +851,7 @@ export class IVProgParser {
|
|
|
this.pos++;
|
|
|
this.checkEOS();
|
|
|
this.popScope();
|
|
|
- return new Commands.DoWhile(condition, commandsBlock);
|
|
|
+ return new Commands.DoUntil(condition, commandsBlock);
|
|
|
}
|
|
|
|
|
|
parseIfThenElse () {
|
|
@@ -909,7 +909,7 @@ export class IVProgParser {
|
|
|
// END parse ID
|
|
|
const for_from = this.parseForParameters(this.lexerClass.RK_FOR_FROM);
|
|
|
const for_to = this.parseForParameters(this.lexerClass.RK_FOR_TO);
|
|
|
- let maybePass = this.parseForParameters(this.lexerClass.RK_FOR_PASS);
|
|
|
+ const maybePass = this.parseForParameters(this.lexerClass.RK_FOR_PASS);
|
|
|
this.consumeNewLines();
|
|
|
const commandsBlock = this.parseCommandBlock();
|
|
|
this.popScope();
|