The number of fypp blocks around each item of source. The directives are counted wherever
they are, also inside a continued statement; a directive line itself is at the level outside
its block, like else and end statements.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(source_t), | intent(in) | :: | source |
the source |
function fypp_depths(source) result(fypp) !! The number of fypp blocks around each item of `source`. The directives are counted wherever !! they are, also inside a continued statement; a directive line itself is at the level outside !! its block, like `else` and `end` statements. type(source_t), intent(in) :: source !! the source integer, allocatable :: fypp(:) integer :: k, j, d allocate (fypp(source%stmts%n)) d = 0 do k = 1, source%stmts%n fypp(k) = d do j = source%stmts%s(k)%first, source%stmts%s(k)%last if (source%tokens%tok(j)%kind /= TK_PREPROC) cycle select case (fypp_kind(token_lower(source%text, source%tokens%tok(j)))) case (FY_OPEN) d = d + 1 case (FY_MIDDLE) if (source%stmts%s(k)%kind == SK_PREPROC) fypp(k) = max(0, d - 1) case (FY_CLOSE) d = max(0, d - 1) if (source%stmts%s(k)%kind == SK_PREPROC) fypp(k) = d end select end do end do end function fypp_depths