comment_kind Function

private function comment_kind(text) result(kind)

Comment sub-kind (one of the CM_* constants) of a comment.

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: text

comment text, from ! to the end of the line

Return Value integer


Calls

proc~~comment_kind~~CallsGraph proc~comment_kind comment_kind proc~is_letter is_letter proc~comment_kind->proc~is_letter proc~lowercase lowercase proc~comment_kind->proc~lowercase proc~peek peek proc~comment_kind->proc~peek proc~lower_char lower_char proc~lowercase->proc~lower_char

Called by

proc~~comment_kind~~CalledByGraph proc~comment_kind comment_kind proc~tokenize tokenize proc~tokenize->proc~comment_kind proc~format_text format_text proc~format_text->proc~tokenize proc~convert_relational convert_relational proc~format_text->proc~convert_relational proc~format_pass format_pass proc~format_text->proc~format_pass proc~limit_diagnostics limit_diagnostics proc~format_text->proc~limit_diagnostics proc~long_code_lines long_code_lines proc~format_text->proc~long_code_lines proc~sort_use sort_use proc~format_text->proc~sort_use proc~split_long_lines split_long_lines proc~format_text->proc~split_long_lines proc~relayout relayout proc~format_text->proc~relayout proc~parse_source parse_source proc~parse_source->proc~tokenize proc~same_code same_code proc~same_code->proc~tokenize proc~code_signature code_signature proc~same_code->proc~code_signature proc~code_signature->proc~parse_source proc~convert_relational->proc~parse_source proc~format_pass->proc~parse_source proc~limit_diagnostics->proc~parse_source proc~long_code_lines->proc~parse_source proc~process_text process_text proc~process_text->proc~format_text proc~sort_use->proc~parse_source proc~split_long_lines->proc~parse_source proc~process_file process_file proc~process_file->proc~process_text proc~process_stdin process_stdin proc~process_stdin->proc~process_text proc~relayout->proc~format_pass proc~run run proc~run->proc~process_file proc~run->proc~process_stdin

Source Code

integer function comment_kind(text) result(kind)
    !! Comment sub-kind (one of the CM_* constants) of a comment.
    character(len=*), intent(in) :: text   !! comment text, from `!` to the end of the line
    character(len=:), allocatable :: low
    character(len=*), parameter :: prefixes(*) = [character(len=6) :: &
                                                  '!dir$', '!dec$', '!gcc$', '!ibm*', '!cdir$', '!pgi$', '!ms$', '!nec$']
    integer :: k

    kind = CM_PLAIN
    low = lowercase(text)
    if (len(low) >= 2) then
        select case (low(2:2))
        case ('$')
            if (is_letter(peek(low, 3))) then
                kind = CM_DIRECTIVE
            else
                kind = CM_CONDITIONAL
            end if
            return
        case ('&')
            kind = CM_FORMATTER
            return
        end select
    end if
    do k = 1, size(prefixes)
        if (index(low, trim(prefixes(k))) == 1) then
            kind = CM_DIRECTIVE
            return
        end if
    end do
end function comment_kind