subroutinefind_definitionpureprivate
pure subroutine find_definition(block, at)
Find a definition line in block.
Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
| block | character(len=*) | in | the chunk | |
| at | integer | out | 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