def __init__(self, SM_State, StateIndex, InitStateF, EngineType, FromStateIndexList): assert isinstance(SM_State, State) assert isinstance(StateIndex, (int, long)) assert type(InitStateF) is bool assert EngineType in E_EngineTypes assert isinstance(FromStateIndexList, set) self.__index = StateIndex self.__init_state_f = InitStateF self.__engine_type = EngineType if self.__init_state_f: if E_StateIndices.NONE not in FromStateIndexList: FromStateIndexList.add(E_StateIndices.NONE) # Test "quex/engine/analyzer/mega_state/template/TEST/best_matching_pair.py" would not work! # assert len(FromStateIndexList) != 0 # (*) Entry Action if EngineType == E_EngineTypes.FORWARD: self.entry = Entry(self.__index, FromStateIndexList) elif EngineType == E_EngineTypes.BACKWARD_PRE_CONTEXT: pre_context_id_fulfilled_list = [ origin.pattern_id() for origin in SM_State.origins() \ if origin.is_acceptance() ] self.entry = Entry(self.__index, FromStateIndexList, pre_context_id_fulfilled_list) elif EngineType == E_EngineTypes.BACKWARD_INPUT_POSITION: self.entry = Entry(self.__index, FromStateIndexList) else: assert False # (*) Transition if EngineType == E_EngineTypes.BACKWARD_INPUT_POSITION: # During backward input detection, an acceptance SM_State triggers a # return from the searcher, thus no further transitions are necessary. # (orphaned states, also, need to be deleted). ## if SM_State.is_acceptance(): assert state.transitions().is_empty() pass self.transition_map = SM_State.transitions().get_trigger_map() self.__target_index_list = SM_State.transitions().get_map().keys() # Currently, the following is only used for path compression. If the alternative # is implemented, then the following is no longer necessary. self.map_target_index_to_character_set = SM_State.transitions( ).get_map() # (*) Drop Out if EngineType == E_EngineTypes.FORWARD: # DropOut and Entry interact and require sophisticated analysis # => See "Analyzer.get_drop_out_object(...)" self.drop_out = None elif EngineType == E_EngineTypes.BACKWARD_PRE_CONTEXT: self.drop_out = DropOutBackward() elif EngineType == E_EngineTypes.BACKWARD_INPUT_POSITION: self.drop_out = DropOutBackwardInputPositionDetection( SM_State.is_acceptance()) self._origin_list = SM_State.origins().get_list()
def __init__(self, EngineType, InitStateIndex, dial_db): self.__engine_type = EngineType self.__init_state_index = InitStateIndex self.__state_db = {} self.dial_db = dial_db self.drop_out = Processor(E_StateIndices.DROP_OUT, Entry(self.dial_db)) self.__state_machine_id = None
def __init__(self, StateIndex, TheTransitionMap): # Empty transition maps are reported as 'None' Processor.__init__(self, StateIndex, Entry()) self.map_target_index_to_character_set = None self.transition_map = TheTransitionMap
def __init__(self, EngineType): if EngineType.is_FORWARD(): index = E_StateIndices.RELOAD_FORWARD else: index = E_StateIndices.RELOAD_BACKWARD Processor.__init__(self, index, Entry())
def __init__(self, Code, Name=""): Processor.__init__(self, index.get(), Entry()) self.__incidence_id = None self.__code = Code self.__name = Name
def __init__(self, Code, Name, IncidenceId=None): Processor.__init__(self, index.get(), Entry()) self.__incidence_id = IncidenceId self.__code = Code self.__name = Name self.__requires_goto_loop_entry_f = False
def __init__(self, EngineType, dial_db): if EngineType.is_FORWARD(): index = E_StateIndices.RELOAD_FORWARD else: index = E_StateIndices.RELOAD_BACKWARD Processor.__init__(self, index, Entry(dial_db)) self.engine_type = EngineType self.dial_db = dial_db