nfa_graph__mark_epsilon_transition Subroutine

private pure recursive subroutine nfa_graph__mark_epsilon_transition(self, state_set, idx)

Type Bound

nfa_graph_t

Arguments

Type IntentOptional Attributes Name
class(nfa_graph_t), intent(in) :: self
type(nfa_state_set_t), intent(inout) :: state_set
integer, intent(in) :: idx

Source Code

   pure recursive subroutine nfa_graph__mark_epsilon_transition(self, state_set, idx)
      use :: forgex_segment_m
      use :: forgex_nfa_state_set_m
      implicit none
      class(nfa_graph_t),intent(in) :: self
      type(nfa_state_set_t), intent(inout) :: state_set
      integer, intent(in) :: idx

      type(nfa_state_node_t) :: n_node
      type(nfa_transition_t) :: n_tra
      integer :: j

      call add_nfa_state(state_set, idx)

      n_node = self%nodes(idx)

      if (.not. allocated(n_node%forward)) return

      do j = 1, n_node%forward_top

         n_tra = n_node%forward(j)

         if (.not. allocated(n_tra%c)) cycle

         if (any(n_tra%c == SEG_EPSILON) .and. .not. check_nfa_state(state_set, n_tra%dst)) then
            if (n_tra%dst /= NFA_NULL_TRANSITION) call self%mark_epsilon_transition(state_set, n_tra%dst)
         end if
      end do
   end subroutine nfa_graph__mark_epsilon_transition