diff --git a/fortran_linter/main.py b/fortran_linter/main.py index 32d55c5..db09c84 100755 --- a/fortran_linter/main.py +++ b/fortran_linter/main.py @@ -1,6 +1,7 @@ import logging import re from collections.abc import Callable, Iterator +from typing import Any logging.basicConfig(filename="myapp.log", level=logging.DEBUG) re_strings = re.compile(r"([\"']).*?\1") @@ -222,8 +223,34 @@ def format_rule(self, rule: RAW_RULE_T, fmt: dict) -> RULE_T: INDENTER_RULES = ( re.compile( - r"\b(if.*then|do|select|while|subroutine|function|module(?!\s*procedure)|interface)\b", - re.I, + r""" + ( + (?P + # Note: we match on "then" rather than "if.*then" + # so that we allow if (...) & \n then + .*(?P\bthen)|( + ^\s*\b + # Possibly match optional label (foo: do) + (?P