subroutineparse_chunksrecursiveprivate
recursive subroutine parse_chunks(t, parent, chunks)
Parse chunks into node parent.
Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
| t | type(tree_t) | inout | the conversion | |
| parent | integer | in | the node | |
| chunks | type(string_t) | in | dimension(:) | the chunks |
Calls
Source
Show the code
recursive subroutine parse_chunks(t, parent, chunks)
type(tree_t), intent(inout) :: t !! the conversion
integer, intent(in) :: parent !! the node
type(string_t), intent(in) :: chunks(:) !! the chunks
type(string_t), allocatable :: stack(:)
character(len=:), allocatable :: block
integer :: n, k
t%depth = t%depth + 1
n = size(chunks)
allocate (stack(n))
do k = 1, n
stack(n - k + 1)%s = chunks(k)%s
end do
do while (n > 0)
call move_alloc(stack(n)%s, block)
n = n - 1
call parse_block(t, parent, block, stack, n)
end do
t%depth = t%depth - 1
end subroutine parse_chunks