emit_fypp_line Subroutine

private subroutine emit_fypp_line(w, src, tokens, s, ind)

A preprocessor line: a fypp directive (#:, #!, $:, @:) is indented by ind; a cpp line is written as it is. Continuation lines of the directive are not changed.

Arguments

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

the output and the alignment state

character(len=*), intent(in) :: src

the source text

type(token_list_t), intent(in) :: tokens

its tokens

type(statement_t), intent(in) :: s

the line, a preprocessor item

integer, intent(in) :: ind

indentation, in blanks


Calls

proc~~emit_fypp_line~~CallsGraph proc~emit_fypp_line emit_fypp_line proc~emit_range emit_range proc~emit_fypp_line->proc~emit_range proc~first_non_blank first_non_blank proc~emit_fypp_line->proc~first_non_blank proc~put put proc~emit_fypp_line->proc~put proc~emit_range->proc~put proc~token_text token_text proc~emit_range->proc~token_text proc~builder_append string_builder_t%builder_append proc~put->proc~builder_append proc~utf8_width utf8_width proc~put->proc~utf8_width

Called by

proc~~emit_fypp_line~~CalledByGraph proc~emit_fypp_line emit_fypp_line proc~layout layout proc~layout->proc~emit_fypp_line 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

subroutine emit_fypp_line(w, src, tokens, s, ind)
    !! A preprocessor line: a fypp directive (`#:`, `#!`, `$:`, `@:`) is indented by `ind`; a cpp line
    !! is written as it is. Continuation lines of the directive are not changed.
    type(writer_t), intent(inout) :: w            !! the output and the alignment state
    character(len=*), intent(in) :: src           !! the source text
    type(token_list_t), intent(in) :: tokens      !! its tokens
    type(statement_t), intent(in) :: s            !! the line, a preprocessor item
    integer, intent(in) :: ind                    !! indentation, in blanks
    integer :: f
    f = first_non_blank(tokens, s%first, s%last)
    if (f > s%last) then
        call emit_range(w, src, tokens, s%first, s%last)
        return
    end if
    associate (t => tokens%tok(f))
        if (t%kind /= TK_PREPROC .or. t%last == t%first) then
            call emit_range(w, src, tokens, s%first, s%last)
        else if (src(t%first:t%first) == '#' .and. index(':!', src(t%first + 1:t%first + 1)) == 0) then
            call emit_range(w, src, tokens, s%first, s%last)         ! cpp
        else
            call put(w, repeat(' ', ind))
            call emit_range(w, src, tokens, f, s%last)
        end if
    end associate
end subroutine emit_fypp_line