Last byte of a preprocessor line at i, including continuation lines: a trailing \ for
cpp, a trailing & for fypp. The final line break is not included.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=*), | intent(in) | :: | src |
source text |
||
| integer, | intent(in) | :: | i |
first byte of the directive ( |
integer function preproc_end(src, i) result(j) !! Last byte of a preprocessor line at `i`, including continuation lines: a trailing `\` for !! cpp, a trailing `&` for fypp. The final line break is not included. character(len=*), intent(in) :: src !! source text integer, intent(in) :: i !! first byte of the directive (`#`, `$` or `@`) logical :: fypp integer :: k fypp = src(i:i) /= '#' .or. peek(src, i + 1) == ':' .or. peek(src, i + 1) == '!' j = line_end(src, i) do k = last_nonblank(src, i, j) if (k == 0) exit if (fypp) then if (src(k:k) /= '&') exit else if (src(k:k) /= '\') exit end if k = j + 1 ! the line break if (k > len(src)) exit if (src(k:k) == CR .and. peek(src, k + 1) == LF) k = k + 1 if (k + 1 > len(src)) exit j = line_end(src, k + 1) if (j < k + 1) j = k ! an empty continuation line end do end function preproc_end