ó S‚ ?c@sjddlZddlmZddlmZdd„Zd„Zd„Zd„Zdd d „ƒYZ dS( iÿÿÿÿN(tLOWEST_PRIORITY(t TransitionMapc Cs?tjƒ}t|ƒ}xB|jjƒD]1\}}|jt|ƒƒ}|j||ƒq(Wx¸|jD]­}t ƒ}xb|j |ƒj ƒD]K}xB|j jƒD]1\}} |r¢| r¢|j |t| ƒƒq¢q¢WqŒWx6|jƒD](\}} |j|||j| ƒƒqèWqgW|r;|jdƒ|j|ƒn|S(sa Given a nondeterministic Machine, return a new equivalent Machine which is deterministic. s ===== State Mapping ===== (tMachinest FastMachinetStateMaptinitial_statestitemst old_to_newtepsilon_closuretmake_initial_statetstatesRt new_to_oldtkeyst transitionstadd_settset_epsilon_closuretadd_transitionstwritetdump( t old_machinetdebugt new_machinet state_maptkeyt old_statet new_stateR teventtold_target_statest old_states((s2/usr/lib/python2.7/site-packages/Pyrex/Plex/DFA.pyt nfa_to_dfa s"    !$ cCsHi}x;|jƒD]-}x$t|ƒjƒD]}d||Wq[ndS(s^ Recursively add to |state_set| states reachable from the given state by epsilon moves. iiN(tgetR t get_epsilonR R#(RR$t state_set_2R!((s2/usr/lib/python2.7/site-packages/Pyrex/Plex/DFA.pyR#Js  RcBsVeZdZdZdZdZd„Zd„Zd„Z d„Z d„Z d„Z RS(sŠ Helper class used by nfa_to_dfa() to map back and forth between sets of states from the old machine and states of the new machine. cCs||_i|_i|_dS(N(Rtold_to_new_dicttnew_to_old_dict(tselfR((s2/usr/lib/python2.7/site-packages/Pyrex/Plex/DFA.pyt__init___s  cCsr|j|ƒ}|jj|dƒ}|sn|j|ƒ}|jj|ƒ}||j|<||jt|ƒ s  %