forgex_nfa_node_m Module

The forgex_nfa_m module defines the data structure of NFA. The nfa_t is defined as a class representing NFA.



Derived Types

type, public ::  nfa_state_node_t

Components

Type Visibility Attributes Name Initial
integer(kind=int32), public :: alloc_count_b = ALLOC_COUNT_INITTIAL
integer(kind=int32), public :: alloc_count_f = ALLOC_COUNT_INITTIAL
type(nfa_transition_t), public, allocatable :: backward(:)
integer(kind=int32), public :: backward_top = 0
type(nfa_transition_t), public, allocatable :: forward(:)
integer(kind=int32), public :: forward_top = 0
integer(kind=int32), public :: own_i

Type-Bound Procedures

procedure, public :: add_transition => nfa__add_transition
procedure, public :: merge_segments => nfa__merge_segments_of_transition
procedure, public :: realloc_b => nfa__reallocate_transition_backward
procedure, public :: realloc_f => nfa__reallocate_transition_forward

type, public ::  nfa_transition_t

Components

Type Visibility Attributes Name Initial
type(segment_t), public, allocatable :: c(:)
integer(kind=int32), public :: c_top = 0
integer(kind=int32), public :: dst = NFA_NULL_TRANSITION
logical, public :: is_registered = .false.
integer(kind=int32), public :: own_j = NFA_NULL_TRANSITION

Functions

private pure function is_exceeded(nfa_top, nfa_graph) result(res)

Arguments

Type IntentOptional Attributes Name
integer(kind=int32), intent(in) :: nfa_top
type(nfa_state_node_t), intent(in) :: nfa_graph(:)

Return Value logical


Subroutines

public pure subroutine build_nfa_graph(tree, nfa, nfa_entry, nfa_exit, nfa_top, all_segments)

Arguments

Type IntentOptional Attributes Name
type(tree_t), intent(in) :: tree
type(nfa_state_node_t), intent(inout), allocatable :: nfa(:)
integer(kind=int32), intent(inout) :: nfa_entry
integer(kind=int32), intent(inout) :: nfa_exit
integer(kind=int32), intent(inout) :: nfa_top
type(segment_t), intent(inout), allocatable :: all_segments(:)

public pure subroutine disjoin_nfa(graph, nfa_top, seg_list)

Arguments

Type IntentOptional Attributes Name
type(nfa_state_node_t), intent(inout) :: graph(:)
integer, intent(in) :: nfa_top
type(segment_t), intent(inout), allocatable :: seg_list(:)

public pure recursive subroutine generate_nfa(tree, idx, nfa_graph, nfa_top, entry, exit)

Arguments

Type IntentOptional Attributes Name
type(tree_t), intent(in) :: tree
integer(kind=int32), intent(in) :: idx
type(nfa_state_node_t), intent(inout), allocatable :: nfa_graph(:)
integer(kind=int32), intent(inout) :: nfa_top
integer(kind=int32), intent(in) :: entry
integer(kind=int32), intent(in) :: exit

public pure subroutine make_nfa_node(nfa_top)

Arguments

Type IntentOptional Attributes Name
integer(kind=int32), intent(inout) :: nfa_top

public pure subroutine nfa_deallocate(nfa)

Arguments

Type IntentOptional Attributes Name
type(nfa_state_node_t), intent(inout), allocatable :: nfa(:)

private pure subroutine disjoin_nfa_each_transition(transition, seg_list)

This subroutine updates the NFA state transitions by disjoining the segments.

Read more…

Arguments

Type IntentOptional Attributes Name
type(nfa_transition_t), intent(inout) :: transition
type(segment_t), intent(in) :: seg_list(:)

private pure recursive subroutine generate_nfa_closure(tree, idx, nfa_graph, nfa_top, entry, exit)

Arguments

Type IntentOptional Attributes Name
type(tree_t), intent(in) :: tree
integer(kind=int32), intent(in) :: idx
type(nfa_state_node_t), intent(inout), allocatable :: nfa_graph(:)
integer(kind=int32), intent(inout) :: nfa_top
integer(kind=int32), intent(in) :: entry
integer(kind=int32), intent(in) :: exit

private pure recursive subroutine generate_nfa_concatenate(tree, idx, nfa_graph, nfa_top, entry, exit)

Arguments

Type IntentOptional Attributes Name
type(tree_t), intent(in) :: tree
integer(kind=int32), intent(in) :: idx
type(nfa_state_node_t), intent(inout), allocatable :: nfa_graph(:)
integer(kind=int32), intent(inout) :: nfa_top
integer(kind=int32), intent(in) :: entry
integer(kind=int32), intent(in) :: exit

private pure subroutine nfa__add_transition(self, nfa_graph, src, dst, c)

Note that the return value of the size function on an unallocated array is undefined.

Read more…

Arguments

Type IntentOptional Attributes Name
class(nfa_state_node_t), intent(inout) :: self
type(nfa_state_node_t), intent(inout) :: nfa_graph(:)
integer(kind=int32), intent(in) :: src
integer(kind=int32), intent(in) :: dst
type(segment_t), intent(in) :: c

private pure elemental subroutine nfa__merge_segments_of_transition(self)

Arguments

Type IntentOptional Attributes Name
class(nfa_state_node_t), intent(inout) :: self

private pure subroutine nfa__reallocate_transition_backward(self)

Arguments

Type IntentOptional Attributes Name
class(nfa_state_node_t), intent(inout) :: self

private pure subroutine nfa__reallocate_transition_forward(self)

Arguments

Type IntentOptional Attributes Name
class(nfa_state_node_t), intent(inout) :: self

private pure subroutine reallocate_nfa(nfa_graph)

Arguments

Type IntentOptional Attributes Name
type(nfa_state_node_t), intent(inout), allocatable :: nfa_graph(:)

private pure subroutine update_c_top(transition)

Update c_top, which has become outdated by disjoin, to new information.

Arguments

Type IntentOptional Attributes Name
type(nfa_transition_t), intent(inout) :: transition