Fixed bug where chunk was wrongly output

This commit is contained in:
Lukasz Baldyga committed 2020-11-30 21:30:03 +00:00
1 parent 97fb3a04ca
commit 8c80ae322b
1 file changed
+6 -2
@@ -255,10 +255,14 @@ namespace Advanced_Software_Engineering {
//exit flow //exit flow
case "end": case "end":
if (parameterLength == 0) { if (parameterLength == 0) {
if (currentChunk == null) throw new Exception("Cannot end at chunk level 0"); //Todo, describe better if (currentChunk == null) throw new Exception("Cannot end at root level"); //Todo, describe better
verbChunks.Remove(currentChunk); verbChunks.Remove(currentChunk);
return currentChunk; chunkDepth = verbChunks.Count - 1;
tmpVerb = currentChunk;
currentChunk = verbChunks[chunkDepth];
} else throw new Exception(command + " doesn't take parameters"); } else throw new Exception(command + " doesn't take parameters");
break;
default: default:
throw new Exception("Unknown command or cannot parse"); throw new Exception("Unknown command or cannot parse");