fdoc

functionmatch_keyprivate

logical function match_key(line, key, value)

True if line is key: value, indented by at most three blanks.

Arguments

NameTypeIntentAttributesDescription
linecharacter(len=*)in

the line

keycharacter(len=:)outallocatable

the key, in lowercase

valuecharacter(len=:)outallocatable

the value

Result

NameTypeAttributesDescription
match_keylogical

Calls

Source

Show the code
logical function match_key(line, key, value)
    character(len=*), intent(in) :: line                !! the line
    character(len=:), allocatable, intent(out) :: key   !! the key, in lowercase
    character(len=:), allocatable, intent(out) :: value !! the value
    character(len=*), parameter :: KEY_CHARS = &
                                   'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_-'
    integer :: a, b

    match_key = .false.
    a = leading_blanks(line) + 1
    if (a > 4 .or. a > len(line)) return
    b = verify(line(a:), KEY_CHARS)
    if (b <= 1) return
    b = a + b - 1
    if (line(b:b) /= ':') return
    key = lowercase(line(a:b - 1))
    value = strip(line(b + 1:))
    match_key = .true.
end function match_key

Graphs

Calls

Called by