浏览代码

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 年之前
父节点
当前提交
187a66df45
共有 1 个文件被更改,包括 5 次插入1 次删除
  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
 		IF options.GetString("platform", name) OR GetDefaultPlatform(name) THEN
 			defaults := platforms.Get(name);
 			defaults := platforms.Get(name);
 			IF defaults = NIL THEN 	
 			IF defaults = NIL THEN 	
-				error.String("Unknown platform"); error.Ln 
+				error.String("Unknown platform"); error.Ln; result := FALSE;
 			ELSE
 			ELSE
 				parsed := options.ParseStaged(defaults, error) & parsed;
 				parsed := options.ParseStaged(defaults, error) & parsed;
 				input.SetPos(position);
 				input.SetPos(position);
@@ -488,6 +488,8 @@ TYPE
 					replacement := replacement.next;
 					replacement := replacement.next;
 				END;
 				END;
 			END;
 			END;
+		ELSE
+			context.result := Commands.CommandParseError;
 		END;
 		END;
 		IF error THEN context.result := Commands.CommandError ELSE context.result := Commands.Ok 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);
 				error := ~Modules(filename, reader, 0, diagnostics, context.out, options, importCache);
 			END;
 			END;
 			context.out.Update;
 			context.out.Update;
+		ELSE
+			context.result := Commands.CommandParseError;
 		END;
 		END;
 	END CompileReader;
 	END CompileReader;