Преглед изворни кода

fixed previously semantically incorrect LHS and NAC combiner

tpinna пре 10 година
родитељ
комит
334f3df640
1 измењених фајлова са 10 додато и 3 уклоњено
  1. 10 3
      integration/code/pn_interface.alc

+ 10 - 3
integration/code/pn_interface.alc

@@ -375,6 +375,9 @@ Element function tf_matchAll(tf_ma_transformation: Element, tf_ma_pattern : Elem
 
 Element function mergeLHSNAC(tf_er_lhs : Element, tf_er_nac: Element):
 	
+	if (read_nr_out(tf_er_nac)==0):
+		return tf_er_lhs
+	
 	//timing info
 	Integer starttime
 	starttime = current_time()
@@ -388,6 +391,7 @@ Element function mergeLHSNAC(tf_er_lhs : Element, tf_er_nac: Element):
 	Boolean allow_match
 	Integer nac_index
 	Boolean plabel_match_exists
+	
 	while(list_len(tf_er_lhs) > 0):
 		lhs_match = set_pop(tf_er_lhs)
 		allow_match=True
@@ -397,15 +401,18 @@ Element function mergeLHSNAC(tf_er_lhs : Element, tf_er_nac: Element):
 			nac_index = nac_index + 1 
 			lhs_match_keys = dict_keys(lhs_match)
 			plabel_match_exists = False //we assume that the nac prohibits all
-			while (bool_and(read_nr_out(lhs_match_keys)>0, allow_match)):
+			allow_match=False
+			while (read_nr_out(lhs_match_keys)>0):
 				lhs_match_key = set_pop(lhs_match_keys)
 				if dict_in(nac_match, lhs_match_key):
 					plabel_match_exists = True //the assumption is disproved, which means we can continue looking
-					if (element_eq(nac_match[lhs_match_key]["hn"],lhs_match[lhs_match_key]["hn"])):
-						allow_match = False
+					if bool_not(element_eq(nac_match[lhs_match_key]["hn"],lhs_match[lhs_match_key]["hn"])):
+						allow_match = True
 			if bool_not(plabel_match_exists): //if the assumption is not disproved, the nac prohibits all matches and no matches should remain after merge
+				log("plabel match didn't seem to exist")
 				return create_node()
 		if (allow_match):
+			log("allow match")
 			list_append(final_matches, lhs_match)
 	
 	//timing info