fdoc

subroutinesplit_attributes

subroutine split_attributes(rest, attributes, names)

Split what follows the type of a declaration into its attributes and the names declared.

Arguments

NameTypeIntentAttributesDescription
restcharacter(len=*)in

what follows the type

attributestype(string_t)outallocatabledimension(:)

the attributes

namescharacter(len=:)outallocatable

the names declared, with what goes with them

Calls

Source

Show the code
subroutine split_attributes(rest, attributes, names)
    character(len=*), intent(in) :: rest                !! what follows the type
    type(string_t), allocatable, intent(out) :: attributes(:)   !! the attributes
    character(len=:), allocatable, intent(out) :: names !! the names declared, with what goes with them
    integer :: at

    allocate (attributes(0))
    at = top_index(rest, '::')
    if (len(rest) > 0) then
        if (rest(1:1) == ',' .and. at > 0) then
            attributes = top_split(rest(2:at - 1), ',')
            names = strip(rest(at + 2:))
            return
        end if
    end if
    if (at > 0) then
        names = strip(rest(at + 2:))
    else
        names = strip(rest)
    end if
end subroutine split_attributes

Graphs

Calls

Called by