Sorting use statements, and the names in their only: lists, alphabetically ignoring case.
A group of use statements is a run of them with nothing between them: a blank line, comment,
preprocessor line or any other statement ends the group, so statements in different #if
branches never mix. A statement moves with its continuation lines and trailing comment.
Statements that share a line with another (;) or that are protected by formatter directives
stay where they are and end the group. Statements of one group that use the same module keep
their order.
The names of an only: list are sorted by their local name (c => x sorts as c). A list that
is not sorted yet is rewritten: on one line, for line splitting to break again, or broken at
commas to fit a given width, with its continuation lines starting below the first name. A
statement with a comment or preprocessor line before its last line is left alone.
True if statement v is a use statement.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(statement_view_t), | intent(in) | :: | v |
the statement |
Sort key of a use statement: the module name in lowercase.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(statement_view_t), | intent(in) | :: | v |
the |
Positions in v%code where the items of a use statement's only: list start. Each item
ends before the comma in front of the next one, the last at the end of the statement. Empty
if there is no only: list, the list is empty, or it has an empty item.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(statement_view_t), | intent(in) | :: | v |
the |
src with the use statements of each group sorted by module name (if statements) and
the names of only: lists sorted (if only_lists).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=*), | intent(in) | :: | src |
source text |
||
| logical, | intent(in) | :: | statements |
sort the |
||
| logical, | intent(in) | :: | only_lists |
sort the names of |
||
| integer, | intent(in) | :: | width |
line length to fit a rewritten |
The order in which keys are sorted (a stable sort, comparing in ASCII order).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(string_t), | intent(in) | :: | keys(:) |
the sort keys |
True if stmt takes up whole lines on its own, ending with a line break, so that it can
be moved.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(token_list_t), | intent(in) | :: | tokens |
tokens of the source |
||
| type(statement_t), | intent(in) | :: | stmt |
the statement, a range of |
Replace text, the text of stmt, by the statement with its only: list sorted, unless the
list is sorted already or the statement cannot be rewritten safely. With width > 0, the
list is broken after commas so that its lines fit in width columns where possible.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=*), | intent(in) | :: | src |
source text |
||
| type(token_list_t), | intent(in) | :: | tokens |
tokens of |
||
| type(statement_t), | intent(in) | :: | stmt |
the |
||
| type(statement_view_t), | intent(in) | :: | v |
the view of |
||
| integer, | intent(in) | :: | width |
line length to fit the list into, or 0 |
||
| character(len=:), | intent(inout), | allocatable | :: | text |
text of |