fdoc

subroutinefind_definitionpureprivate

pure subroutine find_definition(block, at)

Find a definition line in block.

Arguments

NameTypeIntentAttributesDescription
blockcharacter(len=*)in

the chunk

atintegerout

where it starts, or 0

Source

Show the code
pure subroutine find_definition(block, at)
    character(len=*), intent(in) :: block   !! the chunk
    integer, intent(out) :: at              !! where it starts, or 0
    integer :: i, j, first

    at = 0
    i = 1
    do while (i <= len(block))
        first = verify(block(i:)//'x', ' ')
        if (first <= 4 .and. i + first <= len(block)) then
            if (block(i + first - 1:i + first) == ': ') then
                at = i
                return
            end if
        end if
        j = index(block(i:), NL)
        if (j == 0) return
        i = i + j
    end do
end subroutine find_definition

Graphs

Called by