functionleading_textpureprivate
pure character(len=80) function leading_text(v, j) result(text)
The first code tokens of v from token j, in lowercase and joined by blanks, up to about 80
characters.
Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
| v | type(statement_view_t) | in | the statement | |
| j | integer | in | the first token |
Result
| Name | Type | Attributes | Description |
|---|---|---|---|
| text | character(len=80) | private |
Source
Show the code
pure function leading_text(v, j) result(text)
type(statement_view_t), intent(in) :: v !! the statement
integer, intent(in) :: j !! the first token
character(len=80) :: text
integer :: k, n, w
text = ''
n = 0
do k = j, v%n
w = v%hi(k) - v%lo(k) + 1
if (n + w >= len(text)) exit
text(n + 1:n + w) = v%low(v%lo(k):v%hi(k))
n = n + w + merge(1, 0, v%kind_of(k) == TK_NAME .and. v%kind_of(k + 1) == TK_NAME)
end do
end function leading_text