continuation_target Function

private pure function continuation_target(w, ind, opts) result(target)

Column for the code of a continuation line: the first item after the innermost open bracket; outside brackets, the first item after an assignment, a use statement's only: or a declaration's ::; otherwise a fixed indent.

Arguments

Type IntentOptional Attributes Name
type(writer_t), intent(in) :: w

the output and the alignment state

integer, intent(in) :: ind

indentation of the statement, in blanks

type(format_options_t), intent(in) :: opts

the formatting options

Return Value integer


Called by

proc~~continuation_target~~CalledByGraph proc~continuation_target continuation_target proc~emit_statement emit_statement proc~emit_statement->proc~continuation_target proc~layout layout proc~layout->proc~emit_statement proc~format_pass format_pass proc~format_pass->proc~layout proc~format_text format_text proc~format_text->proc~format_pass proc~relayout relayout proc~format_text->proc~relayout proc~relayout->proc~format_pass 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 integer function continuation_target(w, ind, opts) result(target)
    !! Column for the code of a continuation line: the first item after the innermost open
    !! bracket; outside brackets, the first item after an assignment, a `use` statement's `only:`
    !! or a declaration's `::`; otherwise a fixed indent.
    type(writer_t), intent(in) :: w              !! the output and the alignment state
    integer, intent(in) :: ind                   !! indentation of the statement, in blanks
    type(format_options_t), intent(in) :: opts   !! the formatting options
    integer :: a
    target = ind + opts%continuation_indent
    if (opts%continuation /= CONT_ALIGN) return
    if (w%nbrackets > 0) then
        if (w%bracket_first(w%nbrackets) >= 0) target = w%bracket_first(w%nbrackets)
        return
    end if
    do a = 1, size(w%anchor_col)
        if (w%anchor_col(a) >= 0) then
            target = w%anchor_col(a)
            return
        end if
    end do
end function continuation_target