The gap wanted before each token (GAP_KEEP, GAP_MIN1 or a number of blanks).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(source_t), | intent(in) | :: | source |
the source |
||
| type(statement_view_t), | intent(in) | :: | views(:) |
the view of each item (see statement_views) |
||
| type(whitespace_options_t), | intent(in) | :: | ws |
modes of the whitespace rules |
||
| integer, | intent(in) | :: | comment_spacing |
blanks before a trailing comment, or -1 to keep them |
function compute_gaps(source, views, ws, comment_spacing) result(gap) !! The gap wanted before each token (`GAP_KEEP`, `GAP_MIN1` or a number of blanks). type(source_t), intent(in) :: source !! the source type(statement_view_t), intent(in) :: views(:) !! the view of each item (see [[statement_views]]) type(whitespace_options_t), intent(in) :: ws !! modes of the whitespace rules integer, intent(in) :: comment_spacing !! blanks before a trailing comment, or -1 to keep them integer, allocatable :: gap(:) integer :: k allocate (gap(source%tokens%n)) gap = GAP_KEEP do k = 1, source%stmts%n if (source%stmts%s(k)%kind == SK_CODE) call statement_gaps(source%text, source%tokens, views(k), ws, gap) end do if (comment_spacing >= 0) call comment_gaps(source, comment_spacing, gap) end function compute_gaps