priority Function

private pure function priority(text, kind) result(prio)

How good a place the end of a token with this text is for a line break (1 is best).

Arguments

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

lowercase text of the token

integer, intent(in) :: kind

token kind (TK_*)

Return Value integer


Called by

proc~~priority~~CalledByGraph proc~priority priority proc~break_point break_point proc~break_point->proc~priority proc~split_long_lines split_long_lines proc~split_long_lines->proc~break_point proc~format_text format_text proc~format_text->proc~split_long_lines proc~process_text process_text proc~process_text->proc~format_text proc~process_file process_file proc~process_file->proc~process_text proc~process_stdin process_stdin proc~process_stdin->proc~process_text proc~run run proc~run->proc~process_file proc~run->proc~process_stdin

Source Code

pure integer function priority(text, kind) result(prio)
    !! How good a place the end of a token with this text is for a line break (1 is best).
    character(len=*), intent(in) :: text   !! lowercase text of the token
    integer, intent(in) :: kind            !! token kind (`TK_*`)
    prio = 4
    select case (kind)
    case (TK_OP)
        select case (text)
        case (',')
            prio = 1
        case ('(', '[')
            prio = 3
        case (')', ']', '%', ':')
            prio = 4
        case default
            prio = 2
        end select
    case (TK_DOTOP)
        if (text /= '.true.' .and. text /= '.false.' .and. text /= '.not.') prio = 2
    end select
end function priority