Output column for the comment-only line with comment token j: lined up with the comment on
the line above if it was lined up with it in the input, otherwise default. Records the
comment for the next line.
| Type | Intent | Optional | 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 |
||
| integer, | intent(in) | :: | j |
the comment token |
||
| integer, | intent(in) | :: | default |
column to use if it is not lined up with the comment above |
integer function comment_column(w, src, tokens, j, default) result(col) !! Output column for the comment-only line with comment token `j`: lined up with the comment on !! the line above if it was lined up with it in the input, otherwise `default`. Records the !! comment for the next line. 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 integer, intent(in) :: j !! the comment token integer, intent(in) :: default !! column to use if it is not lined up with the comment above integer :: in_col in_col = input_column(src, tokens%tok(j)) col = default if (w%comment_in >= 0 .and. in_col == w%comment_in) col = w%comment_out col = fitting_column(w, src, tokens, j, j, [col, default, in_col], always_original=.true.) w%comment_in = in_col w%comment_out = col end function comment_column