fdoc

functionis_attribute_statementprivate

logical function is_attribute_statement(low)

True if low starts with a word that gives attributes to names listed after it.

Arguments

NameTypeIntentAttributesDescription
lowcharacter(len=*)in

the statement, in lowercase

Result

NameTypeAttributesDescription
is_attribute_statementlogical

Calls

Source

Show the code
logical function is_attribute_statement(low)
    character(len=*), intent(in) :: low     !! the statement, in lowercase
    character(len=:), allocatable :: compact
    integer :: k, n

    is_attribute_statement = .false.
    if (starts_word(low, 'bind')) then
        is_attribute_statement = index(low, ')') > 0
        return
    end if
    if (starts_word(low, 'intent')) then
        is_attribute_statement = .true.
        return
    end if
    do k = 1, size(ATTRIBUTE_WORDS)
        if (.not. starts_word(low, trim(ATTRIBUTE_WORDS(k)))) cycle
        n = len_trim(ATTRIBUTE_WORDS(k))
        compact = strip(low(n + 1:))
        if (len(compact) == 0) then
            is_attribute_statement = trim(ATTRIBUTE_WORDS(k)) == 'save'
            return
        end if
        ! not an assignment to a variable named like the attribute
        is_attribute_statement = compact(1:1) /= '=' .and. compact(1:1) /= '%'
        return
    end do
end function is_attribute_statement

Graphs

Calls

Called by