A ; in i:lend that is followed by more code on the line, or 0.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=*), | intent(in) | :: | src |
source text |
||
| type(token_list_t), | intent(in) | :: | tokens |
tokens of |
||
| integer, | intent(in) | :: | i |
tokens to search, up to the end of the line |
||
| integer, | intent(in) | :: | lend |
tokens to search, up to the end of the line |
pure integer function find_semicolon(src, tokens, i, lend) result(semi) !! A `;` in `i:lend` that is followed by more code on the line, or 0. character(len=*), intent(in) :: src !! source text type(token_list_t), intent(in) :: tokens !! tokens of `src` integer, intent(in) :: i, lend !! tokens to search, up to the end of the line integer :: k, m do k = i, lend if (tokens%tok(k)%kind /= TK_OP) cycle if (src(tokens%tok(k)%first:tokens%tok(k)%last) /= ';') cycle do m = k + 1, lend select case (tokens%tok(m)%kind) case (TK_SPACE, TK_NEWLINE, TK_COMMENT) cycle case default semi = k return end select end do end do semi = 0 end function find_semicolon