subroutineread_useprivate
subroutine read_use(u, line)
Read a use statement.
Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
| u | type(entity_t) | inout | the unit | |
| line | character(len=*) | in | the statement |
Calls
Source
Show the code
subroutine read_use(u, line)
type(entity_t), intent(inout) :: u !! the unit
character(len=*), intent(in) :: line !! the statement
character(len=:), allocatable :: rest, name, spec
integer :: at
rest = strip(line(4:))
at = top_index(rest, '::')
if (at > 0 .and. (index(rest, ',') == 0 .or. index(rest, ',') < at .or. at > 0)) then
if (at < index(rest//',', ',') .or. index(rest, ',') > 0 .and. at > 0) rest = strip(rest(at + 2:))
end if
at = index(rest, ',')
if (at > 0) then
name = lowercase(strip(rest(:at - 1)))
spec = strip(rest(at + 1:))
else
name = lowercase(rest)
spec = ''
end if
u%more%uses = [u%more%uses, use_t(name, spec, 0)]
end subroutine read_use