Whitespace rules within lines: the blanks wanted between pairs of adjacent tokens.
Each rule has a mode: WS_ADD makes sure there is at least one blank on each side (more are
kept, so column alignment survives), WS_REMOVE removes the blanks, and WS_KEEP leaves them as
they are. Rules only look at tokens on the same line; blanks are never added or removed next to a
line break, a continuation & or a comment.
Statements where operators have other meanings are recognized: unary +/-, * in real*8,
print * and (*), / in array constructors, and in data, common, namelist, save and
equivalence statements. format statements are left alone.
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| integer, | public, | parameter | :: | GAP_KEEP | = | -1 |
as in the input |
| integer, | public, | parameter | :: | GAP_MIN1 | = | -2 |
at least one blank |
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 |
Tokens that would run together with a following word: names, numbers and BOZ literals.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer, | intent(in) | :: | kind |
token kind ( |
Ask for spacing blanks before each trailing comment (one after code or a continuation &),
unless a trailing comment on the line before or after starts in the same column: comments
lined up in a column are left as they are.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(source_t), | intent(in) | :: | source |
the source |
||
| integer, | intent(in) | :: | spacing |
blanks wanted before a trailing comment |
||
| integer, | intent(inout) | :: | gap(:) |
gap wanted before each token, set for the comments |
Set the gaps wanted before the tokens of one code statement.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=*), | intent(in) | :: | src |
the source text |
||
| type(token_list_t), | intent(in) | :: | tokens |
its tokens |
||
| type(statement_view_t), | intent(in) | :: | v |
the statement |
||
| type(whitespace_options_t), | intent(in) | :: | ws |
modes of the whitespace rules |
||
| integer, | intent(inout) | :: | gap(:) |
gap wanted before each token, set where a rule applies |