fdoc

subroutinetype_keywordprivate

subroutine type_keyword(low, n, word)

The length of the type keyword that low starts with, ignoring blanks in double precision, or 0. Its normal spelling is returned in word.

Arguments

NameTypeIntentAttributesDescription
lowcharacter(len=*)in

the statement, in lowercase

nintegerout

the length of the keyword in low

wordcharacter(len=:)outallocatable

the keyword

Calls

Source

Show the code
subroutine type_keyword(low, n, word)
    character(len=*), intent(in) :: low                 !! the statement, in lowercase
    integer, intent(out) :: n                           !! the length of the keyword in `low`
    character(len=:), allocatable, intent(out) :: word  !! the keyword
    integer :: k, at

    n = 0
    word = ''
    if (starts_with(low, 'double')) then
        at = 7 + verify(low(7:)//'x', ' ') - 1
        if (word_at(low, at, 'precision')) then
            n = at + 8
            word = 'double precision'
        else if (word_at(low, at, 'complex')) then
            n = at + 6
            word = 'double complex'
        end if
        return
    end if
    do k = 1, size(TYPE_WORDS)
        associate (w => TYPE_WORDS(k))
            if (w(1:6) == 'double') cycle
            if (starts_with(low, trim(w))) then
                n = len_trim(w)
                word = trim(w)
                return
            end if
        end associate
    end do
end subroutine type_keyword

Graphs

Calls

Called by