private void deltraverse ( Nfa nfa , State leftend , State s ) { Arc a ; State to ; if ( s . nouts == 0 ) { return ; /* nothing to do */ } if ( s . tmp != null ) { return ; /* already in progress */ } s . tmp = s ; /* mark as in progress */ while ( ( a = s . outs ) != null ) { to = a . to ; deltraverse ( nfa , leftend , to ) ; assert to . nouts == 0 || to . tmp != null ; nfa . freearc ( a ) ; if ( to . nins == 0 && to . tmp == null ) { assert to . nouts == 0 ; nfa . freestate ( to ) ; } } assert s . no != State . FREESTATE ; /* we're still here */ assert s == leftend || s . nins != 0 ; /* and still reachable */ assert s . nouts == 0 ; /* but have no outarcs */ s . tmp = null ; /* we're done here */ }
deltraverse - the recursive heart of delsub This routine s basic job is to destroy all out - arcs of the state .