|
@@ -277,7 +277,6 @@ export class IVProgParser {
|
|
}
|
|
}
|
|
this.definedFuncsNameList.push(id);
|
|
this.definedFuncsNameList.push(id);
|
|
}
|
|
}
|
|
-
|
|
|
|
checkVariableDuplicate (variableID, sourceInfo) {
|
|
checkVariableDuplicate (variableID, sourceInfo) {
|
|
const index = this.getCurrentVariableStack().indexOf(variableID);
|
|
const index = this.getCurrentVariableStack().indexOf(variableID);
|
|
if (index !== -1) {
|
|
if (index !== -1) {
|
|
@@ -970,6 +969,7 @@ export class IVProgParser {
|
|
}
|
|
}
|
|
|
|
|
|
parseSwitchCase () {
|
|
parseSwitchCase () {
|
|
|
|
+ const token = this.getToken();
|
|
this.pushScope(IVProgParser.BREAKABLE);
|
|
this.pushScope(IVProgParser.BREAKABLE);
|
|
this.pos++;
|
|
this.pos++;
|
|
this.checkOpenParenthesis();
|
|
this.checkOpenParenthesis();
|
|
@@ -990,10 +990,13 @@ export class IVProgParser {
|
|
this.consumeNewLines();
|
|
this.consumeNewLines();
|
|
|
|
|
|
this.popScope();
|
|
this.popScope();
|
|
- return new Commands.Switch(exp, casesList);
|
|
|
|
|
|
+ const command = new Commands.Switch(exp, casesList);
|
|
|
|
+ command.sourceInfo = SourceInfo.createSourceInfo(token);
|
|
|
|
+ return command;
|
|
}
|
|
}
|
|
|
|
|
|
parseRepeatUntil () {
|
|
parseRepeatUntil () {
|
|
|
|
+ const token = this.getToken();
|
|
this.pos++;
|
|
this.pos++;
|
|
this.consumeNewLines();
|
|
this.consumeNewLines();
|
|
this.pushScope(IVProgParser.BREAKABLE);
|
|
this.pushScope(IVProgParser.BREAKABLE);
|
|
@@ -1016,7 +1019,9 @@ export class IVProgParser {
|
|
this.pos++;
|
|
this.pos++;
|
|
this.checkEOS();
|
|
this.checkEOS();
|
|
this.popScope();
|
|
this.popScope();
|
|
- return new Commands.RepeatUntil(condition, commandsBlock);
|
|
|
|
|
|
+ const command = new Commands.RepeatUntil(condition, commandsBlock);
|
|
|
|
+ command.sourceInfo = SourceInfo.createSourceInfo(token);
|
|
|
|
+ return command;
|
|
}
|
|
}
|
|
|
|
|
|
parseIfThenElse () {
|
|
parseIfThenElse () {
|
|
@@ -1134,7 +1139,7 @@ export class IVProgParser {
|
|
this.checkEOS();
|
|
this.checkEOS();
|
|
}
|
|
}
|
|
this.pos++;
|
|
this.pos++;
|
|
- const returnCommand = new Commands.Return(exp);
|
|
|
|
|
|
+ const returnCommand = new Commands.Return(exp);
|
|
returnCommand.sourceInfo = SourceInfo.createSourceInfo(token);
|
|
returnCommand.sourceInfo = SourceInfo.createSourceInfo(token);
|
|
return returnCommand;
|
|
return returnCommand;
|
|
}
|
|
}
|
|
@@ -1276,6 +1281,7 @@ export class IVProgParser {
|
|
this.consumeNewLines();
|
|
this.consumeNewLines();
|
|
const block = this.parseCommandBlock(true);
|
|
const block = this.parseCommandBlock(true);
|
|
const defaultCase = new Commands.Case(null);
|
|
const defaultCase = new Commands.Case(null);
|
|
|
|
+ defaultCase.sourceInfo = SourceInfo.createSourceInfo(token);
|
|
defaultCase.setCommands(block.commands);
|
|
defaultCase.setCommands(block.commands);
|
|
return [defaultCase];
|
|
return [defaultCase];
|
|
} else {
|
|
} else {
|
|
@@ -1288,6 +1294,7 @@ export class IVProgParser {
|
|
this.consumeNewLines();
|
|
this.consumeNewLines();
|
|
const block = this.parseCommandBlock(true);
|
|
const block = this.parseCommandBlock(true);
|
|
const aCase = new Commands.Case(exp);
|
|
const aCase = new Commands.Case(exp);
|
|
|
|
+ aCase.sourceInfo = SourceInfo.createSourceInfo(token);
|
|
aCase.setCommands(block.commands);
|
|
aCase.setCommands(block.commands);
|
|
const caseToken = this.getToken();
|
|
const caseToken = this.getToken();
|
|
if (caseToken.type === this.ruleNames.RK_CASE) {
|
|
if (caseToken.type === this.ruleNames.RK_CASE) {
|