This subroutine gets the next DFA nodes index from current index and symbol,
and stores the result in next
and next_set
.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(automaton_t), | intent(in) | :: | self | |||
integer(kind=int32), | intent(in) | :: | curr | |||
character(len=*), | intent(in) | :: | symbol | |||
integer(kind=int32), | intent(inout) | :: | next | |||
type(nfa_state_set_t), | intent(inout) | :: | next_set |
pure subroutine automaton__destination(self, curr, symbol, next, next_set) implicit none class(automaton_t), intent(in) :: self integer(int32), intent(in) :: curr character(*), intent(in) :: symbol integer(int32), intent(inout) :: next type(nfa_state_set_t), intent(inout) :: next_set integer :: i ! Get a set of NFAs for which current state can transition, excluding epsilon-transitions. next_set = self%get_reachable(curr, symbol) ! Initialize the next value next = DFA_INVALID_INDEX ! Scan the entire DFA nodes. do i = 1, self%dfa%dfa_top-1 ! If there is an existing node corresponding to the NFA state set, ! return the index of that node. if (equivalent_nfa_state_set(next_set, self%dfa%nodes(i)%nfa_set)) then next = i return end if end do end subroutine automaton__destination