Indices of the code tokens of a statement: no blanks, line breaks, comments, continuation
markers, preprocessor lines or ; separators.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=*), | intent(in) | :: | src |
source text |
||
| type(token_list_t), | intent(in) | :: | tokens |
tokens of |
||
| type(statement_t), | intent(in) | :: | stmt |
the statement |
function code_tokens(src, tokens, stmt) result(idx) !! Indices of the code tokens of a statement: no blanks, line breaks, comments, continuation !! markers, preprocessor lines or `;` separators. character(len=*), intent(in) :: src !! source text type(token_list_t), intent(in) :: tokens !! tokens of `src` type(statement_t), intent(in) :: stmt !! the statement integer, allocatable :: idx(:) integer :: k, n allocate (idx(stmt%last - stmt%first + 1)) n = 0 do k = stmt%first, stmt%last if (.not. is_code_kind(tokens%tok(k)%kind)) cycle if (tokens%tok(k)%kind == TK_OP) then if (src(tokens%tok(k)%first:tokens%tok(k)%last) == ';') cycle end if n = n + 1 idx(n) = k end do idx = idx(1:n) end function code_tokens