def indentation_count_character_set(self): """Returns the superset of all characters that are involved in indentation counting. That is the set of character that can appear between newline and the first non whitespace character. """ result = NumberSet() for character_set in self.space_db.values(): result.unite_with(character_set.get()) for character_set in self.grid_db.values(): result.unite_with(character_set.get()) return result
def __wildcard_value_match(self, WildCardValue): result = NumberSet() value_list = self.get_wildcard_value_matches(WildCardValue) if value_list == []: return None for value in value_list: result.unite_with(NumberSet(self.code_point_db[value])) return result
def __wildcard_value_match(self, WildCardValue): result = NumberSet() value_list = self.get_wildcard_value_matches(WildCardValue) if value_list == []: return None for value in value_list: result.unite_with(NumberSet(self.code_point_db[value])) # No decoupling, since result is computed each fresh and new return result
def is_DFA_compliant(self): """Checks if the current state transitions are DFA compliant, i.e. it investigates if trigger sets pointing to different targets intersect. RETURN: True => OK False => Same triggers point to different target. This cannot be part of a deterministic finite automaton (DFA). """ # DFA's do not have epsilon transitions if len(self.__epsilon_target_index_list) != 0: return False # check wether trigger sets intersect all_trigger_sets = NumberSet() for trigger_set in self.__db.values(): if all_trigger_sets.has_intersection(trigger_set): return False else: all_trigger_sets.unite_with(trigger_set) return True
def get_trigger_set_union(self): result = NumberSet() for trigger_set in self.__db.values(): result.unite_with(trigger_set) return result