Private
Public Access
Multiline and nested ifs now possible
This commit is contained in:
1 parent
affc6d6e53
commit
97fb3a04ca
1 file changed
+9
-1
@@ -94,7 +94,7 @@ namespace Advanced_Software_Engineering {
|
||||
currentChunk = verbChunks[chunkDepth];
|
||||
parsed = true;
|
||||
tmpVerb = new NoOp();
|
||||
} else if(commandParameters.Length >= 2) {
|
||||
} else if (commandParameters.Length >= 2) {
|
||||
string commandAfterIf = fullCommand.Substring(fullCommand.IndexOf(",") + 1); // find the first ,
|
||||
IValue conditional = ValueFactory.CreateValue(rootValueStorage, commandParameters[0]); //make the conditional
|
||||
IVerb AfterIf = MakeVerb(drawer, commandAfterIf); //make the following command
|
||||
@@ -252,6 +252,14 @@ namespace Advanced_Software_Engineering {
|
||||
} else throw new Exception(command + " has an incorrect number of parameters");
|
||||
break;
|
||||
|
||||
//exit flow
|
||||
case "end":
|
||||
if (parameterLength == 0) {
|
||||
if (currentChunk == null) throw new Exception("Cannot end at chunk level 0"); //Todo, describe better
|
||||
verbChunks.Remove(currentChunk);
|
||||
return currentChunk;
|
||||
} else throw new Exception(command + " doesn't take parameters");
|
||||
|
||||
default:
|
||||
throw new Exception("Unknown command or cannot parse");
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user