Formatter directive (one of the DIR_* constants) of a comment token.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=*), | intent(in) | :: | src |
source text |
||
| type(token_t), | intent(in) | :: | t |
a comment token of |
integer function directive(src, t) !! Formatter directive (one of the DIR_* constants) of a comment token. character(len=*), intent(in) :: src !! source text type(token_t), intent(in) :: t !! a comment token of `src` character(len=:), allocatable :: text integer :: n directive = DIR_NONE if (t%sub /= CM_FORMATTER) return text = token_text(src, t) n = len(text) do while (n > 0) ! without trailing blanks and tabs if (text(n:n) /= ' ' .and. text(n:n) /= achar(9)) exit n = n - 1 end do text = text(1:n) if (text == '!&<') then directive = DIR_OFF else if (text == '!&>') then directive = DIR_ON else if (len(text) == 2) then directive = DIR_KEEP else if (text(3:3) == ' ') then directive = DIR_KEEP end if end function directive