Browse Source

Removed a lot of parentheses in bootstrap

Yentl Van Tendeloo 7 years ago
parent
commit
cc83b6ea51

+ 5 - 5
bootstrap/conformance_scd.alc

@@ -194,13 +194,13 @@ String function conformance_scd(model : Element):
 							// A lower cardinality was defined at the target
 							if (integer_gt(cardinalities[check_type]["tlc"], instances)):
 								String error
-								error = (("Lower cardinality violation for outgoing edge of type " + check_type) + " at ") + model_info(model, model_name)
+								error = "Lower cardinality violation for outgoing edge of type " + check_type + " at " + model_info(model, model_name)
 								return error!
 						if (dict_in(cardinalities[check_type], "tuc")):
 							// An upper cardinality was defined at the target
 							if (integer_lt(cardinalities[check_type]["tuc"], instances)):
 								String error
-								error = (("Upper cardinality violation for outgoing edge of type " + check_type) + " at ") + model_info(model, model_name)
+								error = "Upper cardinality violation for outgoing edge of type " + check_type + " at " + model_info(model, model_name)
 								return error!
 
 			// Identical, but for outgoing, and thus for A in the figure
@@ -218,13 +218,13 @@ String function conformance_scd(model : Element):
 							// A lower cardinality was defined at the source
 							if (integer_gt(cardinalities[check_type]["slc"], instances)):
 								String error
-								error = (("Lower cardinality violation for incoming edge of type " + check_type) + " at ") + model_info(model, model_name)
+								error = "Lower cardinality violation for incoming edge of type " + check_type + " at " + model_info(model, model_name)
 								return error!
 						if (dict_in(cardinalities[check_type], "suc")):
 							// An upper cardinality was defined at the source
 							if (integer_lt(cardinalities[check_type]["suc"], instances)):
 								String error
-								error = (("Upper cardinality violation for incoming edge of type " + check_type) + " at ") + model_info(model, model_name)
+								error = "Upper cardinality violation for incoming edge of type " + check_type + " at " + model_info(model, model_name)
 								return error!
 
 			constraint_function = read_attribute(metamodel, typing[model_name], "constraint")
@@ -281,7 +281,7 @@ String function conformance_scd(model : Element):
 			result = check_location_conformance(model["model"][complex_instance], complex_type)
 
 			if (result != "OK"):
-				return ((("Complex attribute doesn't match for: " + complex_instance) + "\n Message: ") + result)!
+				return "Complex attribute doesn't match for: " + complex_instance + "\n Message: " + result!
 
 	// Structure seems fine, now do global constraints
 	Element global_constraints

+ 1 - 1
bootstrap/core_algorithm.alc

@@ -1450,7 +1450,7 @@ String function cmd_model_list_full(location : String):
 					name = get_filename(read_attribute(core, m, "name")) + "/"
 				else:
 					name = get_filename(read_attribute(core, m, "name"))
-				result = result + (((((((permissions + " ") + owner) + " ") + group) + " ") + name) + "\n")
+				result = result + permissions + " " + owner + " " + group + " " + name + "\n"
 			return result!
 		else:
 			return "Permission denied to folder: " + location!

+ 13 - 13
bootstrap/mini_modify.alc

@@ -29,10 +29,10 @@ String function pretty_print(model : Element):
 		type = read_type(model["metamodel"], read_type(model, v_m))
 
 		if (bool_or(type == "Class", type == "Association")):
-			result = result + ((("  " + v_m) + " : ") + read_type(model, v_m))
+			result = result + "  " + v_m + " : " + read_type(model, v_m)
 			result = result + "\n"
 			if (type == "Association"):
-				result = result + ((("    " + reverseKeyLookup(model["model"], read_edge_src(model["model"][v_m]))) + " --> ") + reverseKeyLookup(model["model"], read_edge_dst(model["model"][v_m])))
+				result = result + "    " + reverseKeyLookup(model["model"], read_edge_src(model["model"][v_m])) + " --> " + reverseKeyLookup(model["model"], read_edge_dst(model["model"][v_m]))
 				result = result + "\n"
 
 			// Defines attributes
@@ -40,7 +40,7 @@ String function pretty_print(model : Element):
 			attr_keys = dict_keys(attr_list)
 			while (set_len(attr_keys) > 0):
 				attr_key = set_pop(attr_keys)
-				result = result + (((("      " + attr_key) + " : ") + cast_v2s(attr_list[attr_key])))
+				result = result + "      " + attr_key + " : " + cast_v2s(attr_list[attr_key])
 				result = result + "\n"
 
 			// Has attributes
@@ -49,9 +49,9 @@ String function pretty_print(model : Element):
 			while (set_len(attr_keys) > 0):
 				attr_key = set_pop(attr_keys)
 				if (element_eq(read_attribute(model, v_m, attr_key), read_root())):
-					result = result + (((("      " + cast_v2s(attr_key)) + " : ") + cast_v2s(attr_list[attr_key])) + " = (undefined)")
+					result = result + "      " + cast_v2s(attr_key) + " : " + cast_v2s(attr_list[attr_key]) + " = (undefined)"
 				else:
-					result = result + ((((("      " + cast_v2s(attr_key)) + " : ") + cast_v2s(attr_list[attr_key])) + " = ") + cast_v2s(read_attribute(model, v_m, attr_key)))
+					result = result + "      " + cast_v2s(attr_key) + " : " + cast_v2s(attr_list[attr_key]) + " = " + cast_v2s(read_attribute(model, v_m, attr_key))
 				result = result + "\n"
 		else:
 			log("Skip instance: " + type)
@@ -229,7 +229,7 @@ String function cmd_list(model : Element):
 		// Filter out anonymous objects
 		if (bool_not(string_startswith(v_m, "__"))):
 			typename = read_type(model, v_m)
-			result = (result + ((("  " + v_m) + " : ") + typename)) + "\n"
+			result = result + "  " + v_m + " : " + typename + "\n"
 	
 	return result!
 
@@ -245,7 +245,7 @@ String function cmd_list_full(model : Element):
 		v_m = set_pop(keys_m)
 		// Filter out anonymous objects
 		typename = read_type(model, v_m)
-		result = (result + ((("  " + v_m) + " : ") + typename)) + "\n"
+		result = result + "  " + v_m + " : " + typename + "\n"
 	
 	return result!
 
@@ -299,12 +299,12 @@ String function cmd_read(model : Element, element_name : String):
 
 	result = "Success: "
 	if (dict_in(model["model"], element_name)):
-		result = ((result + "Type: ") + read_type(model, element_name)) + "\n"
+		result = result + "Type: " + read_type(model, element_name) + "\n"
 		if (is_edge(model["model"][element_name])):
-			result = ((result + "Source: ") + reverseKeyLookup(model["model"], read_edge_src(model["model"][element_name]))) + "\n"
-			result = ((result + "Destination: ") + reverseKeyLookup(model["model"], read_edge_dst(model["model"][element_name]))) + "\n"
+			result = result + "Source: " + reverseKeyLookup(model["model"], read_edge_src(model["model"][element_name])) + "\n"
+			result = result + "Destination: " + reverseKeyLookup(model["model"], read_edge_dst(model["model"][element_name])) + "\n"
 		if (has_value(model["model"][element_name])):
-			result = ((result + "Value: ") + cast_v2s(model["model"][element_name])) + "\n"
+			result = result + "Value: " + cast_v2s(model["model"][element_name]) + "\n"
 		return result!
 	else:
 		return "Element not found: " + element_name!
@@ -321,7 +321,7 @@ String function cmd_read_attrs(model : Element, element_name : String):
 		attr_keys = dict_keys(attr_list)
 		while (0 < set_len(attr_keys)):
 			attr_key = set_pop(attr_keys)
-			result = ((((string_join(result, attr_key) + " : ") + cast_v2s(attr_list[attr_key])) + " = ") + cast_v2s(read_attribute(model, element_name, attr_key))) + "\n"
+			result = string_join(result, attr_key) + " : " + cast_v2s(attr_list[attr_key]) + " = " + cast_v2s(read_attribute(model, element_name, attr_key)) + "\n"
 		return result!
 	else:
 		return "Element not found: " + element_name!
@@ -336,7 +336,7 @@ String function cmd_types(model : Element):
 	while (set_len(keys_t) > 0):
 		v_t = set_pop(keys_t)
 		if (bool_not(string_startswith(v_t, "__"))):
-			result = (result + string_join(("  " + v_t) + " : ", read_type(model["metamodel"], v_t))) + "\n"
+			result = result + string_join("  " + v_t + " : ", read_type(model["metamodel"], v_t)) + "\n"
 
 	return result!
 

+ 1 - 1
bootstrap/services.alc

@@ -16,7 +16,7 @@ String function comm_newPort():
 	String attempt
 	attempt = "__hierarchy"
 	while (dict_in(root, attempt)):
-		attempt = (("__" + get_taskname()) + "_") + cast_v2s(services)
+		attempt = "__" + get_taskname() + "_" + cast_v2s(services)
 		services = services + 1
 
 	// Create queues

+ 8 - 8
bootstrap/utils.alc

@@ -28,11 +28,11 @@ String function JSON_print(model : Element):
 				first = False
 
 			result = result + "{"
-			result = (((result + "\"id\": \"") + v_m) + "\"")
-			result = (((result + ",") + "\"type\": \"") + read_type(model, v_m)) + "\""
+			result = result + "\"id\": \"" + v_m + "\""
+			result = result + "," + "\"type\": \"" + read_type(model, v_m) + "\""
 			if (type == "Association"):
-				result = (((result + ", \"__source\": \"") + reverseKeyLookup(model["model"], read_edge_src(model["model"][v_m]))) + "\"")
-				result = (((result + ", \"__target\": \"") + reverseKeyLookup(model["model"], read_edge_dst(model["model"][v_m]))) + "\"")
+				result = result + ", \"__source\": \"" + reverseKeyLookup(model["model"], read_edge_src(model["model"][v_m])) + "\""
+				result = result + ", \"__target\": \"" + reverseKeyLookup(model["model"], read_edge_dst(model["model"][v_m])) + "\""
 
 			// Has attributes
 			attr_keys = dict_keys(getAttributeList(model, v_m))
@@ -40,15 +40,15 @@ String function JSON_print(model : Element):
 				attr_key = set_pop(attr_keys)
 				attr_value = read_attribute(model, v_m, attr_key)
 				if (element_eq(attr_value, read_root())):
-					result = (((result + ", \"") + attr_key) + "\": null")
+					result = result + ", \"" + attr_key + "\": null"
 				else:
 					if (is_physical_boolean(attr_value)):
 						if (attr_value):
-							result = ((result + ", \"") + attr_key) + "\": true"
+							result = result + ", \"" + attr_key + "\": true"
 						else:
-							result = ((result + ", \"") + attr_key) + "\": false"
+							result = result + ", \"" + attr_key + "\": false"
 					else:
-						result = ((((result + ", \"") + attr_key) + "\": ") + cast_v2s(attr_value))
+						result = result + ", \"" + attr_key + "\": " + cast_v2s(attr_value)
 
 			result = result + "}"
 	result = result + "]"