ends_with_continuation Function

private pure function ends_with_continuation(tokens, i, lend)

True if the last token of the line before any comment is a continuation &.

Arguments

Type IntentOptional Attributes Name
type(token_list_t), intent(in) :: tokens

the token list

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

Return Value logical


Called by

proc~~ends_with_continuation~~CalledByGraph proc~ends_with_continuation ends_with_continuation proc~split_statements split_statements proc~split_statements->proc~ends_with_continuation proc~parse_source parse_source proc~parse_source->proc~split_statements proc~code_signature code_signature proc~code_signature->proc~parse_source proc~convert_relational convert_relational proc~convert_relational->proc~parse_source proc~format_pass format_pass proc~format_pass->proc~parse_source proc~limit_diagnostics limit_diagnostics proc~limit_diagnostics->proc~parse_source proc~long_code_lines long_code_lines proc~long_code_lines->proc~parse_source proc~sort_use sort_use proc~sort_use->proc~parse_source proc~split_long_lines split_long_lines proc~split_long_lines->proc~parse_source proc~format_text format_text proc~format_text->proc~convert_relational proc~format_text->proc~format_pass proc~format_text->proc~limit_diagnostics proc~format_text->proc~long_code_lines proc~format_text->proc~sort_use proc~format_text->proc~split_long_lines proc~relayout relayout proc~format_text->proc~relayout proc~relayout->proc~format_pass proc~same_code same_code proc~same_code->proc~code_signature proc~process_text process_text proc~process_text->proc~format_text proc~process_file process_file proc~process_file->proc~process_text proc~process_stdin process_stdin proc~process_stdin->proc~process_text proc~run run proc~run->proc~process_file proc~run->proc~process_stdin

Source Code

pure logical function ends_with_continuation(tokens, i, lend)
    !! True if the last token of the line before any comment is a continuation `&`.
    type(token_list_t), intent(in) :: tokens   !! the token list
    integer, intent(in) :: i, lend             !! tokens to search, up to the end of the line
    integer :: k
    ends_with_continuation = .false.
    do k = lend, i, -1
        select case (tokens%tok(k)%kind)
        case (TK_SPACE, TK_NEWLINE, TK_COMMENT)
            cycle
        case (TK_CONT)
            ends_with_continuation = tokens%tok(k)%sub == CT_TRAILING
            return
        case default
            return
        end select
    end do
end function ends_with_continuation