當前位置: 首頁>>代碼示例>>Python>>正文


Python StateMachine.states[end_index]方法代碼示例

本文整理匯總了Python中quex.engine.state_machine.core.StateMachine.states[end_index]方法的典型用法代碼示例。如果您正苦於以下問題:Python StateMachine.states[end_index]方法的具體用法?Python StateMachine.states[end_index]怎麽用?Python StateMachine.states[end_index]使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在quex.engine.state_machine.core.StateMachine的用法示例。


在下文中一共展示了StateMachine.states[end_index]方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test

# 需要導入模塊: from quex.engine.state_machine.core import StateMachine [as 別名]
# 或者: from quex.engine.state_machine.core.StateMachine import states[end_index] [as 別名]
def test(ByteSequenceDB):

    L = len(ByteSequenceDB[0])

    for seq in ByteSequenceDB:
        assert len(seq) == L
        for x in seq:
            assert isinstance(x, Interval)

    first_different_byte_index = -1
    for i in range(L):
        x0 = ByteSequenceDB[0][i]
        for seq in ByteSequenceDB[1:]:
            if not seq[i].is_equal(x0): 
                first_different_byte_index = i
                break
        if first_different_byte_index != -1: 
            break
    if first_different_byte_index == -1:
        first_different_byte_index = 0

    print "# Best To be Displayed by:"
    print "#"
    print "#  > " + sys.argv[0] + " " + sys.argv[1] + " | dot -Tsvg -o tmp.svg"
    print "#"
    print "# -------------------------"
    print "# Byte Sequences:     "
    i = -1
    for seq in ByteSequenceDB:
        i += 1
        print "# (%i) " % i,
        for x in seq:
            print "    " + x.get_string(Option="hex"), 
        print
    print "#    L    = %i" % L
    print "#    DIdx = %i" % first_different_byte_index



    sm = StateMachine()
    end_index = state_machine.index.get()
    sm.states[end_index] = State()

    trafo.plug_state_sequence_for_trigger_set_sequence(sm, sm.init_state_index, end_index, 
                                                       ByteSequenceDB, L, first_different_byte_index)

    if len(sm.get_orphaned_state_index_list()) != 0:
        print "Error: Orphaned States Detected!"

    print sm.get_graphviz_string(Option="hex")
開發者ID:mplucinski,項目名稱:quex,代碼行數:52,代碼來源:test-utf8_state_split.py


注:本文中的quex.engine.state_machine.core.StateMachine.states[end_index]方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。