Index of the ) that closes the ( at code token j (counting only parentheses), or 0 if
token j is not ( or it is not closed.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(statement_view_t), | intent(in) | :: | v |
the statement |
||
| integer, | intent(in) | :: | j |
index into |
pure integer function view_closing(v, j) result(c) !! Index of the `)` that closes the `(` at code token `j` (counting only parentheses), or 0 if !! token `j` is not `(` or it is not closed. class(statement_view_t), intent(in) :: v !! the statement integer, intent(in) :: j !! index into `v%code(:)` integer :: d if (.not. v%is(j, '(')) then c = 0 return end if d = 0 do c = j, v%n if (v%is(c, '(')) then d = d + 1 else if (v%is(c, ')')) then d = d - 1 if (d == 0) return end if end do c = 0 end function view_closing