ソースを参照

Clearer error when unknown compiler input

Yentl Van Tendeloo 8 年 前
コミット
b043f7d10d
1 ファイル変更6 行追加2 行削除
  1. 6 2
      bootstrap/constructors.alc

+ 6 - 2
bootstrap/constructors.alc

@@ -7,7 +7,7 @@ include "modelling.alh"
 Element while_stack = ?
 Element variable_map = ?
 
-Action function construct_top():
+Element function construct_top():
 	String command
 	while (True):
 		command = input()
@@ -19,6 +19,8 @@ Action function construct_top():
 			return construct_top_funcdef(True)!
 		else:
 			log("ERROR (1): did not understand command " + cast_e2s(command))
+			output("ERROR: compiled code not understood: " + cast_e2s(command))
+			return read_root()!
 
 Action function construct_global():
 	Action this_element
@@ -117,7 +119,7 @@ Action function construct_top_funcdef(mutable : Boolean):
 
 	return global!
 
-Action function construct_unknown():
+Element function construct_unknown():
 	String elem
 	Element new_model
 	Element new_model_model
@@ -156,6 +158,8 @@ Action function construct_unknown():
 		return construct_unknown()!
 	else:
 		log("ERROR (2): did not understand command " + cast_e2s(elem))
+		output("ERROR: compiled code not understood: " + cast_e2s(elem))
+		return read_root()!
 
 Action function construct_if():
 	Action this_element