subroutineread_type_statementprivate
subroutine read_type_statement(e, line)
Read a type statement.
Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
| e | type(entity_t) | inout | the type | |
| line | character(len=*) | in | the statement |
Calls
Source
Show the code
subroutine read_type_statement(e, line)
type(entity_t), intent(inout) :: e !! the type
character(len=*), intent(in) :: line !! the statement
type(string_t), allocatable :: parts(:)
character(len=:), allocatable :: rest, low, base
integer :: at, k, open
allocate (e%attribs(0))
rest = strip(line(5:))
at = top_index(rest, '::')
if (at > 0) then
if (rest(1:1) == ',') then
parts = top_split(rest(2:at - 1), ',')
do k = 1, size(parts)
low = lowercase(parts(k)%s)
if (starts_with(remove_blanks(low), 'extends(')) then
base = parts(k)%s(index(parts(k)%s, '(') + 1:)
e%more%extends = strip(base(:len(base) - 1))
else if (low == 'public' .or. low == 'private') then
e%permission = low
else
call push(e%attribs, parts(k)%s)
end if
end do
end if
rest = strip(rest(at + 2:))
end if
open = index(rest, '(')
if (open > 0) then
e%more%parameters_list = top_split(rest(open + 1:len(rest) - 1), ',')
e%name = strip(rest(:open - 1))
else
e%name = rest
end if
end subroutine read_type_statement