fdoc

subroutinearray_valuesprivate

subroutine array_values(array, values, stat, errmsg)

The items of a TOML array as text. An array of tables is taken to be extra_filetypes.

Arguments

NameTypeIntentAttributesDescription
arraytype(toml_array)inout

the array

valuestype(string_t)inoutallocatabledimension(:)

the items

statintegerinout

nonzero on failure

errmsgcharacter(len=:)outallocatable

what is wrong

Calls

Source

Show the code
subroutine array_values(array, values, stat, errmsg)
    type(toml_array), intent(inout) :: array            !! the array
    type(string_t), allocatable, intent(inout) :: values(:)   !! the items
    integer, intent(inout) :: stat                      !! nonzero on failure
    character(len=:), allocatable, intent(out) :: errmsg  !! what is wrong
    type(toml_table), pointer :: item
    character(len=:), allocatable :: text, part
    integer :: k, ios

    do k = 1, len(array)
        call get_value(array, k, text, stat=ios)
        if (ios == 0 .and. allocated(text)) then
            call push(values, text)
            cycle
        end if
        call get_value(array, k, item, stat=ios)
        if (ios /= 0 .or. .not. associated(item)) then
            stat = 1
            errmsg = 'expected strings or tables in an array'
            return
        end if
        text = ''
        call get_value(item, 'extension', part, '')
        text = part
        call get_value(item, 'comment', part, '')
        text = text//' '//part
        call get_value(item, 'lexer', part, '')
        if (part /= '') text = text//' '//part
        call push(values, text)
    end do
end subroutine array_values

Graphs

Calls

Called by