|
@@ -781,9 +781,9 @@ export class IVProgParser {
|
|
return this.parseIDCommand();
|
|
return this.parseIDCommand();
|
|
} else if (token.type === this.lexerClass.RK_RETURN) {
|
|
} else if (token.type === this.lexerClass.RK_RETURN) {
|
|
return this.parseReturn();
|
|
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();
|
|
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();
|
|
return this.parseFor();
|
|
} else if (token.type === this.lexerClass.RK_BREAK ) {
|
|
} else if (token.type === this.lexerClass.RK_BREAK ) {
|
|
if(!this.insideScope(IVProgParser.BREAKABLE)) {
|
|
if(!this.insideScope(IVProgParser.BREAKABLE)) {
|
|
@@ -796,7 +796,7 @@ export class IVProgParser {
|
|
} else if (token.type === this.lexerClass.RK_SWITCH) {
|
|
} else if (token.type === this.lexerClass.RK_SWITCH) {
|
|
return this.parseSwitchCase();
|
|
return this.parseSwitchCase();
|
|
} else if (token.type === this.lexerClass.RK_DO) {
|
|
} else if (token.type === this.lexerClass.RK_DO) {
|
|
- return this.parseDoWhile();
|
|
|
|
|
|
+ return this.parseDoUntil();
|
|
} else if (token.type === this.lexerClass.RK_IF) {
|
|
} else if (token.type === this.lexerClass.RK_IF) {
|
|
return this.parseIfThenElse();
|
|
return this.parseIfThenElse();
|
|
} else if (this.checkEOS(true)){
|
|
} else if (this.checkEOS(true)){
|
|
@@ -831,15 +831,15 @@ export class IVProgParser {
|
|
return new Commands.Switch(exp, casesList);
|
|
return new Commands.Switch(exp, casesList);
|
|
}
|
|
}
|
|
|
|
|
|
- parseDoWhile () {
|
|
|
|
|
|
+ parseDoUntil () {
|
|
this.pos++;
|
|
this.pos++;
|
|
this.consumeNewLines();
|
|
this.consumeNewLines();
|
|
this.pushScope(IVProgParser.BREAKABLE);
|
|
this.pushScope(IVProgParser.BREAKABLE);
|
|
const commandsBlock = this.parseCommandBlock();
|
|
const commandsBlock = this.parseCommandBlock();
|
|
this.consumeNewLines(); //Maybe not...
|
|
this.consumeNewLines(); //Maybe not...
|
|
const whileToken = this.getToken();
|
|
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.pos++;
|
|
this.checkOpenParenthesis();
|
|
this.checkOpenParenthesis();
|
|
@@ -851,7 +851,7 @@ export class IVProgParser {
|
|
this.pos++;
|
|
this.pos++;
|
|
this.checkEOS();
|
|
this.checkEOS();
|
|
this.popScope();
|
|
this.popScope();
|
|
- return new Commands.DoWhile(condition, commandsBlock);
|
|
|
|
|
|
+ return new Commands.DoUntil(condition, commandsBlock);
|
|
}
|
|
}
|
|
|
|
|
|
parseIfThenElse () {
|
|
parseIfThenElse () {
|
|
@@ -909,7 +909,7 @@ export class IVProgParser {
|
|
// END parse ID
|
|
// END parse ID
|
|
const for_from = this.parseForParameters(this.lexerClass.RK_FOR_FROM);
|
|
const for_from = this.parseForParameters(this.lexerClass.RK_FOR_FROM);
|
|
const for_to = this.parseForParameters(this.lexerClass.RK_FOR_TO);
|
|
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();
|
|
this.consumeNewLines();
|
|
const commandsBlock = this.parseCommandBlock();
|
|
const commandsBlock = this.parseCommandBlock();
|
|
this.popScope();
|
|
this.popScope();
|