소스 검색

Cleaning object_operations

Yentl Van Tendeloo 9 년 전
부모
커밋
51c59b91aa
2개의 변경된 파일18개의 추가작업 그리고 24개의 파일을 삭제
  1. 17 17
      bootstrap/object_operations.alc
  2. 1 7
      interface/HUTN/grammars/actionlanguage.g

+ 17 - 17
bootstrap/object_operations.alc

@@ -16,12 +16,12 @@ Element function allInstances(model_ai : Element, type_ai : Element):
 	length_ai = read_nr_out(type_mapping_ai)
 
 	Element edge_ai
-	while (integer_lt(counter_ai, length_ai)):
+	while (counter_ai < length_ai):
 		edge_ai = read_out(type_mapping_ai, counter_ai)
 		if (element_eq(read_edge_dst(edge_ai), type_ai)):
 			// Found an element of the specified type
 			set_add(result_ai, read_edge_dst(read_out(edge_ai, 0)))
-		counter_ai = integer_addition(counter_ai, 1)
+		counter_ai = counter_ai + 1
 	
 	return result_ai
 
@@ -38,11 +38,11 @@ Element function allOutgoingAssociationInstances(model_aoai : Element, source_ao
 	result_aoai = create_node()
 
 	Element edge_aoai
-	while (integer_lt(counter_aoai, length_aoai)):
+	while (counter_aoai < length_aoai):
 		edge_aoai = read_out(source_aoai, counter_aoai)
 		if (element_eq(dict_read_node(dict_read(model_aoai, "type_mapping"), edge_aoai), assoc_aoai)):
 			set_add(result_aoai, edge_aoai)
-		counter_aoai = integer_addition(counter_aoai, 1)
+		counter_aoai = counter_aoai + 1
 	return result_aoai
 
 Element function allIncomingAssociationInstances(model_aiai : Element, source_aiai : Element, assoc_aiai : Element):
@@ -53,7 +53,7 @@ Element function allIncomingAssociationInstances(model_aiai : Element, source_ai
 	allinsts_aiai = allInstances(model_aiai, assoc_aiai)
 
 	Element understudy_aiai
-	while (integer_lt(0, read_nr_out(allinsts_aiai))):
+	while (0 < read_nr_out(allinsts_aiai)):
 		understudy_aiai = set_pop(allinsts_aiai)
 		if (element_eq(read_edge_dst(understudy_aiai), source_aiai)):
 			set_add(result_aiai, understudy_aiai)
@@ -71,11 +71,11 @@ Element function findAttribute(source_fa : Element, attr_name_fa : Element, type
 		Element edge_fa
 		counter_fa = read_nr_out(source_fa)
 		i_fa = 0
-		while (integer_lt(i_fa, counter_fa)):
+		while (i_fa < counter_fa):
 			edge_fa = read_out(source_fa, i_fa)
 			if (element_eq(dict_read_node(types_fa, edge_fa), inheritance_link_fa)):
 				return find_attribute(read_edge_dst(edge_fa), attr_name_fa, types_fa, inheritance_link_fa)
-			i_fa = integer_addition(i_fa, 1)
+			i_fa = i_fa + 1
 		// No return at the moment, as this crashes the MvK
 		log("ERROR: could not find attribute")
 
@@ -109,7 +109,7 @@ Element function deleteAttribute(model_da : Element, source_da : Element, attr_n
 	found_elements_da = allOutgoingAssociationInstances(model_da, source_da, edge_da)
 
 	Element rm_element_da
-	if (integer_gt(list_len(found_elements_da), 0)):
+	if (list_len(found_elements_da) > 0):
 		rm_element_da = read_edge_dst(set_pop(found_elements_da))
 		dict_delete(dict_read(model_da, "type_mapping"), rm_element_da)
 		delete_element(rm_element_da)
@@ -125,10 +125,10 @@ Element function getAttributeList(model_gali : Element, mm_gali : Element):
 
 	// Filter them
 	Element e_gali
-	while (integer_lt(0, read_nr_out(set_gali_own))):
+	while (0 < read_nr_out(set_gali_own)):
 		e_gali = set_pop(set_gali_own)
-		if (type_eq(typeof(e_gali), String)):
-			if (type_eq(typeof(dict_read(mm_gali, e_gali)), Type)):
+		if (typeof(e_gali) == String):
+			if (typeof(dict_read(mm_gali, e_gali)) == Type):
 				// This is a primitive type, so add to the list
 				dict_add(result_gali, e_gali, dict_read(mm_gali, e_gali))
 
@@ -140,12 +140,12 @@ Element function getAttributeList(model_gali : Element, mm_gali : Element):
 	Integer max_gali
 	Element set_gali_super
 	Element found_key_gali
-	while (integer_lt(0, read_nr_out(found_elements_gali))):
+	while (0 < read_nr_out(found_elements_gali)):
 		// Now find the destination of these associations, which are the superclasses of this model
 		dict_gali_super = getAttributeList(model_gali, read_edge_dst(set_pop(found_elements_gali)))
 		set_gali_super = dict_keys(dict_gali_super)
 		// Merge the two
-		while (integer_lt(0, read_nr_out(set_gali_super))):
+		while (0 < read_nr_out(set_gali_super)):
 			found_key_gali = set_pop(set_gali_super)
 			dict_add(result_gali, found_key_gali, dict_read(dict_gali_super, found_key_gali))
 
@@ -160,9 +160,9 @@ Element function getInstantiatableAttributes(model_gili : Element, element_gili
 
 	// Filter them
 	Element e_gili
-	while (integer_lt(0, read_nr_out(set_gili_own))):
+	while (0 < read_nr_out(set_gili_own)):
 		e_gili = set_pop(set_gili_own)
-		if (bool_and(type_eq(typeof(e_gili), String), type_eq(typeof(dict_read(element_gili, e_gili)), Type))):
+		if (bool_and(typeof(e_gili) == String, typeof(dict_read(element_gili, e_gili)) == Type)):
 			// This is a primitive type, so add to the list
 			dict_add(result_gili, e_gili, dict_read(element_gili, e_gili))
 
@@ -174,7 +174,7 @@ String function getName(m : Element, e : Element):
 	s = dict_read(m, "model")
 	element_keys = dict_keys(s)
 
-	while (integer_lt(0, read_nr_out(element_keys))):
+	while (0 < read_nr_out(element_keys)):
 		Element key
 		key = set_pop(element_keys)
 		if (element_eq(dict_read_node(s, key), e)):
@@ -186,7 +186,7 @@ String function reverseNameLookup(s_rnl : Element, e_rnl : Element):
 	Element element_keys_rnl
 	element_keys_rnl = dict_keys(s_rnl)
 
-	while (integer_lt(0, read_nr_out(element_keys_rnl))):
+	while (0 < read_nr_out(element_keys_rnl)):
 		Element key_rnl
 		key_rnl = set_pop(element_keys_rnl)
 		if (element_eq(dict_read_node(s_rnl, key_rnl), e_rnl)):

+ 1 - 7
interface/HUTN/grammars/actionlanguage.g

@@ -73,7 +73,7 @@ grammar{
     parenthesized
         :   LPAREN expression RPAREN;
 
-    atomvalue: string | integer | float | bool | dictionary | list | type_specifier | actionname | deref;
+    atomvalue: string | integer | float | bool | type_specifier | actionname | deref;
 
     deref: QUESTIONMARK ANYTHING?;
 
@@ -91,12 +91,6 @@ grammar{
 
     func_call: rvalue LPAREN (expression (COMMA expression)*)? RPAREN;
 
-    dictionary: LCURLY (dict_item (COMMA dict_item)*)? RCURLY;
-
-    list: LSQUARE (expression (COMMA expression)+)? RSQUARE;
-
-    dict_item: expression COLON expression;
-
     ifelse: IF expression COLON newline block
         (indent ELIF expression COLON newline block)#[0]*
         (indent ELSE COLON newline block)#[0]?;