Browse Source

Properly exit with failure in case of command parsing errors

git-svn-id: https://svn.inf.ethz.ch/svn/lecturers/a2/trunk@8590 8c9fc860-2736-0410-a75d-ab315db34111
negelef 6 years ago
parent
commit
187a66df45
1 changed files with 5 additions and 1 deletions
  1. 5 1
      source/Compiler.Mod

+ 5 - 1
source/Compiler.Mod

@@ -313,7 +313,7 @@ TYPE
 		IF options.GetString("platform", name) OR GetDefaultPlatform(name) THEN
 			defaults := platforms.Get(name);
 			IF defaults = NIL THEN 	
-				error.String("Unknown platform"); error.Ln 
+				error.String("Unknown platform"); error.Ln; result := FALSE;
 			ELSE
 				parsed := options.ParseStaged(defaults, error) & parsed;
 				input.SetPos(position);
@@ -488,6 +488,8 @@ TYPE
 					replacement := replacement.next;
 				END;
 			END;
+		ELSE
+			context.result := Commands.CommandParseError;
 		END;
 		IF error THEN context.result := Commands.CommandError ELSE context.result := Commands.Ok END;
 
@@ -511,6 +513,8 @@ TYPE
 				error := ~Modules(filename, reader, 0, diagnostics, context.out, options, importCache);
 			END;
 			context.out.Update;
+		ELSE
+			context.result := Commands.CommandParseError;
 		END;
 	END CompileReader;