subroutineread_line_directivepureprivate
pure subroutine read_line_directive(text, from, content, next)
Read a line directive whose text starts at from, joining continuation lines.
Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
| text | character(len=*) | in | the text | |
| from | integer | in | where the directive's text starts | |
| content | character(len=:) | out | allocatable | the directive's text |
| next | integer | out | the position after the directive |
Calls
Source
Show the code
pure subroutine read_line_directive(text, from, content, next)
character(len=*), intent(in) :: text !! the text
integer, intent(in) :: from !! where the directive's text starts
character(len=:), allocatable, intent(out) :: content !! the directive's text
integer, intent(out) :: next !! the position after the directive
type(buffer_t) :: b
integer :: start, e, last, q
start = skip_blanks(text, from)
do
e = end_of_line(text, start)
last = start + trim_length(text(start:e - 1)) - 1
if (last < start .or. e > len(text)) exit
if (text(last:last) /= '&') exit
call add(b, text(start:last - 1))
start = e + 1
q = skip_blanks(text, start)
if (q <= len(text)) then
if (text(q:q) == '&') start = q + 1
end if
end do
if (last >= start) call add(b, text(start:last))
call take(b, content)
next = min(e + 1, len(text) + 1)
end subroutine read_line_directive