True for each item that must be written exactly as it is: statements with a !& comment, and
everything from a !&< line to the next !&> line, both included.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=*), | intent(in) | :: | src |
source text |
||
| type(token_list_t), | intent(in) | :: | tokens |
tokens of |
||
| type(statement_list_t), | intent(in) | :: | stmts |
items of |
function protected_items(src, tokens, stmts) result(keep) !! True for each item that must be written exactly as it is: statements with a `!&` comment, and !! everything from a `!&<` line to the next `!&>` line, both included. character(len=*), intent(in) :: src !! source text type(token_list_t), intent(in) :: tokens !! tokens of `src` type(statement_list_t), intent(in) :: stmts !! items of `tokens` logical, allocatable :: keep(:) logical :: off integer :: k, j, d allocate (keep(stmts%n)) off = .false. do k = 1, stmts%n keep(k) = off do j = stmts%s(k)%first, stmts%s(k)%last if (tokens%tok(j)%kind /= TK_COMMENT) cycle d = directive(src, tokens%tok(j)) if (stmts%s(k)%kind == SK_COMMENT .and. d == DIR_OFF) then off = .true. keep(k) = .true. else if (stmts%s(k)%kind == SK_COMMENT .and. d == DIR_ON) then off = .false. keep(k) = .true. else if (stmts%s(k)%kind == SK_CODE .and. d == DIR_KEEP) then keep(k) = .true. end if end do end do end function protected_items