ffmt_options Module

Formatting options: all the settings, with their defaults, and the modes they take. The modules that apply them (ffmt_whitespace, ffmt_case, ffmt_relational, ffmt_layout) use this module, not the other way round, so it depends on nothing.


Used by

  • module~~ffmt_options~~UsedByGraph module~ffmt_options ffmt_options module~ffmt_case ffmt_case module~ffmt_case->module~ffmt_options module~ffmt_cli ffmt_cli module~ffmt_cli->module~ffmt_options module~ffmt_format ffmt_format module~ffmt_cli->module~ffmt_format module~ffmt_settings ffmt_settings module~ffmt_cli->module~ffmt_settings module~ffmt_config ffmt_config module~ffmt_cli->module~ffmt_config module~ffmt_format->module~ffmt_options module~ffmt_format->module~ffmt_case module~ffmt_layout ffmt_layout module~ffmt_format->module~ffmt_layout module~ffmt_relational ffmt_relational module~ffmt_format->module~ffmt_relational module~ffmt_whitespace ffmt_whitespace module~ffmt_format->module~ffmt_whitespace module~ffmt_layout->module~ffmt_options module~ffmt_layout->module~ffmt_case module~ffmt_layout->module~ffmt_whitespace module~ffmt_relational->module~ffmt_options module~ffmt_settings->module~ffmt_options module~ffmt_whitespace->module~ffmt_options module~ffmt_config->module~ffmt_settings

Variables

Type Visibility Attributes Name Initial
integer, public, parameter :: CASE_KEEP = 0

leave the case as it is

integer, public, parameter :: CASE_LOWER = 1

lowercase

integer, public, parameter :: CASE_UPPER = 2

uppercase

integer, public, parameter :: CONT_ALIGN = 1

align continuation lines with the first item after the innermost open bracket, or after the first =

integer, public, parameter :: CONT_INDENT = 2

indent continuation lines by a fixed amount

integer, public, parameter :: REL_KEEP = 0

leave the spelling as it is

integer, public, parameter :: REL_LETTERS = 2

< becomes .lt., ...

integer, public, parameter :: REL_SYMBOLS = 1

.lt. becomes <, ...

integer, public, parameter :: WS_ADD = 1

at least one blank on each side

integer, public, parameter :: WS_KEEP = 0

leave the blanks as they are

integer, public, parameter :: WS_REMOVE = 2

no blanks


Derived Types

type, public ::  case_options_t

Letter case of keywords, dot operators and logical constants, intrinsic procedures, the constants of the intrinsic modules, and kinds.

Components

Type Visibility Attributes Name Initial
integer, public :: constants = CASE_KEEP

constants and types of iso_fortran_env and iso_c_binding: output_unit, int64, c_int, c_ptr

integer, public :: keywords = CASE_KEEP

if, end do, integer, intent(in), ...

integer, public :: operators = CASE_KEEP

.and., .eq., .true., ...

integer, public :: procedures = CASE_KEEP

intrinsic procedures where they are called: size(a), call cpu_time(t)

integer, public :: types = CASE_KEEP

suffixes 2_int64 and prefixes ck_'a', exponent letters 1.0e-3

type, public ::  format_options_t

All options that control formatting. The defaults give 4-space indentation with the bodies of modules and programs not indented, and aligned continuation lines.

Components

Type Visibility Attributes Name Initial
integer, public :: base_indent = 0

columns added to the indentation of every line, so that even program units are indented (4 for code that starts in column 5)

integer, public :: comment_spacing = -1

blanks before a trailing comment, or -1 to keep them; comments aligned with one on the line before or after are kept

integer, public :: continuation = CONT_ALIGN

layout of continuation lines (CONT_ALIGN or CONT_INDENT)

integer, public :: continuation_indent = 4

extra indentation of continuation lines, used with CONT_INDENT and when there is nothing to align with

integer, public :: indent = 4

spaces per indentation level

logical, public :: indent_comments = .true.

re-indent comment lines like the code around them

logical, public :: indent_fypp = .false.

indent the code inside fypp blocks (#:if, #:for, #:def, ...), and the fypp directive lines with the code around them

logical, public :: indent_procedures = .true.

indent the bodies of subroutines and functions

logical, public :: indent_units = .false.

indent the bodies of modules, submodules and main programs

logical, public :: keep_column1_comments = .false.

leave comment lines that start in column 1 there (with indent_comments)

type(case_options_t), public :: letter_case

letter case of keywords and operators

integer, public :: line_length = 132

maximum line length (0 for no limit). Alignment that would make a line longer falls back to a smaller indentation.

integer, public :: relational = REL_KEEP

spelling of relational operators: REL_KEEP, REL_SYMBOLS (.lt. becomes <) or REL_LETTERS (< becomes .lt.)

logical, public :: sort_use = .false.

sort the use statements of each group by module name

logical, public :: sort_use_only = .false.

sort the names in only: lists

type(whitespace_options_t), public :: spaces

whitespace rules within lines

logical, public :: split_lines = .true.

split code lines that are longer than line_length

type, public ::  whitespace_options_t

Modes of the whitespace rules. The defaults follow the most common style in practice where it is clear-cut, and keep the rest.

Components

Type Visibility Attributes Name Initial
integer, public :: assignment = WS_ADD

= outside brackets: assignments, initializations, do i = 1, n

integer, public :: comma = WS_KEEP

,: with WS_ADD, no blank before and at least one after

integer, public :: concat = WS_REMOVE

//

integer, public :: conditional = WS_ADD

? and : of a conditional expression (c ? a : b) (F2023)

integer, public :: control_paren = WS_ADD

between if, while, select case, where, ... and (, and between ) and a final then

integer, public :: declarations = WS_ADD

::

integer, public :: defined_operators = WS_KEEP

binary user-defined operators: a .plus. b

integer, public :: keyword_args = WS_REMOVE

= inside brackets: f(x=1), intent=, len=*

integer, public :: logical = WS_KEEP

.and. .or. .eqv. .neqv.

integer, public :: mult_div = WS_KEEP

binary * /

integer, public :: percent = WS_REMOVE

%

integer, public :: plus_minus = WS_KEEP

binary + -

integer, public :: pointer = WS_ADD

=>: pointer assignment, renames, associate

integer, public :: power = WS_REMOVE

**

integer, public :: relational = WS_KEEP

== /= < <= > >= and .eq. etc.

integer, public :: slice_colon = WS_REMOVE

: inside brackets: a(1:n)