def TERMINAL_CODE(self, TerminalStateList, TheAnalyzer): text = [ cpp._terminal_state_prolog ] terminal_door_id_list = [] for terminal in sorted(TerminalStateList, key=lambda x: x.incidence_id()): door_id = DoorID.incidence(terminal.incidence_id()) terminal_door_id_list.append(door_id) t_txt = ["%s\n __quex_debug(\"* TERMINAL %s\\n\");\n" % \ (self.LABEL(door_id), terminal.name())] code = terminal.code(TheAnalyzer) assert none_isinstance(code, list) t_txt.extend(code) t_txt.append("\n") text.extend(t_txt) text.append( "if(0) {\n" " /* Avoid unreferenced labels. */\n" ) text.extend( " %s\n" % self.GOTO(door_id) for door_id in terminal_door_id_list ) text.append("}\n") return text
def __init__(self, Code=None, SourceReference=SourceRef_VOID): # Elements of 'Code' shall not be lists. assert not isinstance(Code, list) or none_isinstance(Code, list) if Code is None: self.__code = [] elif isinstance(Code, (str, unicode)): self.__code = [Code] else: self.__code = Code self.__source_reference = SourceReference
def __init__(self, Code=None, SourceReference=SourceRef_VOID): # Elements of 'Code' shall not be lists. assert not isinstance(Code, list) or none_isinstance(Code, list) if Code is None: self.__code = [] elif isinstance(Code, (str, unicode)): self.__code = [ Code ] else: self.__code = Code self.__source_reference = SourceReference
def do(code, TheState, TheAnalyzer): assert isinstance(TheState, AnalyzerState) assert isinstance(TheAnalyzer, Analyzer) # (*) Entry _______________________________________________________________ txt, post_txt = entry.do(TheState) # (*) Transition Map ______________________________________________________ tm = relate_to_TransitionCode(TheState.transition_map) transition_block.do(txt, tm) # (*) Post-state entry to init state (if necessary) txt.extend(post_txt) # (*) Consistency check ___________________________________________________ assert none_isinstance(txt, list) assert none_is_None(txt) code.extend(txt)