Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions fprettify/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,10 @@
ENDDO_RE = re.compile(SOL_STR + r"END\s*DO(\s+\w+)?" + EOL_STR, RE_FLAGS)

SELCASE_RE = re.compile(
SOL_STR + r"SELECT\s*(CASE|RANK|TYPE)\s*\(.*\)" + EOL_STR, RE_FLAGS)
SOL_STR + r"(\w+\s*:)?\s*SELECT\s*(CASE|RANK|TYPE)\s*\(.*\)" + EOL_STR, RE_FLAGS)
CASE_RE = re.compile(
SOL_STR + r"((CASE|RANK|TYPE\s+IS|CLASS\s+IS)\s*(\(.*\)|DEFAULT)|CLASS\s+DEFAULT)" + EOL_STR, RE_FLAGS)
ENDSEL_RE = re.compile(SOL_STR + r"END\s*SELECT" + EOL_STR, RE_FLAGS)
ENDSEL_RE = re.compile(SOL_STR + r"END\s*SELECT(\s+\w+)?" + EOL_STR, RE_FLAGS)

ASSOCIATE_RE = re.compile(SOL_STR + r"ASSOCIATE\s*\(.*\)" + EOL_STR, RE_FLAGS)
ENDASSOCIATE_RE = re.compile(SOL_STR + r"END\s*ASSOCIATE" + EOL_STR, RE_FLAGS)
Expand Down Expand Up @@ -269,7 +269,7 @@ def split(self, line):
LR_OPS_RE = [REL_OP_RE, LOG_OP_RE, plusminus_parser(PLUSMINUS_RE), MULTDIV_RE, PRINT_RE]

USE_RE = re.compile(
SOL_STR + "USE(\s+|(,.+?)?::\s*)\w+?((,.+?=>.+?)+|,\s*only\s*:.+?)?$" + EOL_STR, RE_FLAGS)
SOL_STR + r"USE(\s+|(,.+?)?::\s*)\w+?((,.+?=>.+?)+|,\s*only\s*:.+?)?$" + EOL_STR, RE_FLAGS)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's this do?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It prevents a warning about \s being an unrecognized escape sequence by interpreting the string as a raw string.


# markups to deactivate formatter
NO_ALIGN_RE = re.compile(SOL_STR + r"&\s*[^\s*]+")
Expand Down Expand Up @@ -1154,11 +1154,11 @@ def add_whitespace_charwise(line, spacey, scope_parser, format_decl, filename, l
line[:pos], RE_FLAGS) or
re.search(SOL_STR + r"(\w+\s*:)?\s*DO\s+WHILE\s*$",
line[:pos], RE_FLAGS) or
re.search(SOL_STR + r"(SELECT)?\s*CASE\s*$",
re.search(SOL_STR + r"(\w+\s*:)?\s*(SELECT)?\s*CASE\s*$",
line[:pos], RE_FLAGS) or
re.search(SOL_STR + r"(SELECT)?\s*RANK\s*$",
re.search(SOL_STR + r"(\w+\s*:)?\s*(SELECT)?\s*RANK\s*$",
line[:pos], RE_FLAGS) or
re.search(SOL_STR + r"SELECT\s*TYPE\s*$",
re.search(SOL_STR + r"(\w+\s*:)?\s*SELECT\s*TYPE\s*$",
line[:pos], RE_FLAGS) or
re.search(SOL_STR + r"CLASS\s*DEFAULT\s*$",
line[:pos], RE_FLAGS) or
Expand Down Expand Up @@ -1308,7 +1308,7 @@ def add_whitespace_context(line, spacey):

line = ''.join(line_parts)

for newre in [IF_RE, DO_RE, BLK_RE]:
for newre in [IF_RE, DO_RE, SELCASE_RE, BLK_RE]:
if newre.search(line) and re.search(SOL_STR + r"\w+\s*:", line):
line = ': '.join(_.strip() for _ in line.split(':', 1))

Expand Down