functionchain_startprivate
integer function chain_start(v, j) result(first)
The first token of the component chain ending at name j.
Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
| v | type(statement_view_t) | in | the statement | |
| j | integer | in | the last name |
Result
| Name | Type | Attributes | Description |
|---|---|---|---|
| first | integer | private |
Source
Show the code
function chain_start(v, j) result(first)
type(statement_view_t), intent(in) :: v !! the statement
integer, intent(in) :: j !! the last name
integer :: first, k, depth
first = j
do
if (.not. v%is(first - 1, '%')) return
k = first - 2
if (v%is(k, ')')) then
depth = 0
do while (k >= 1)
if (v%is(k, ')')) depth = depth + 1
if (v%is(k, '(')) depth = depth - 1
if (depth == 0) exit
k = k - 1
end do
k = k - 1
end if
if (k < 1) return
if (v%kind_of(k) /= TK_NAME) return
first = k
end do
end function chain_start