tree_graph__regex Subroutine

private pure recursive subroutine tree_graph__regex(self)

Type Bound

tree_t

Arguments

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

Source Code

   pure recursive subroutine tree_graph__regex(self)
      implicit none
      class(tree_t), intent(inout) :: self

      type(tree_node_t) :: node, left, right

      call self%term()

      ! When term's analysis is valid,
      if (self%is_valid_pattern) then

         left = self%get_top()

         do while (self%tape%current_token == tk_union)
            call self%tape%get_token()

            call self%term()
            if (.not. self%is_valid_pattern) exit

            right = self%get_top()

            node = make_tree_node(op_union)
            call self%register_connector(node, left, right)

            left = self%get_top()
         end do
      
      else
         if (self%code /= SYNTAX_VALID) then
            return
         end if
      end if

   end subroutine tree_graph__regex