diff --git a/lfric_styling/lfric_styling.py b/lfric_styling/lfric_styling.py index 8573dc76..7ad51182 100755 --- a/lfric_styling/lfric_styling.py +++ b/lfric_styling/lfric_styling.py @@ -30,9 +30,10 @@ def lowercase_keywords(file): with open(file, "r") as fp: lines = fp.read() for keyword in NEW_KEYWORDS: - # regex to check if a keyword is preceded with a '!' symbol + # regex to check if a keyword is preceded with a '!' symbol, + # unless the comment is an OpenMP directive starting with '!$OMP', # or if it matches a keyword and group each. - pattern = rf"((?:(?<=!)).*|(\b{re.escape(keyword.upper())}\b))" + pattern = rf"((?:(?<=!)(?!\$OMP)).*|(\b{re.escape(keyword.upper())}\b))" lines = re.sub(pattern, convert_to_lower, lines, flags=re.MULTILINE) with open(file, "w") as fp: diff --git a/lfric_styling/styling_keywords.py b/lfric_styling/styling_keywords.py index 3fbc4e3b..8427b3f1 100644 --- a/lfric_styling/styling_keywords.py +++ b/lfric_styling/styling_keywords.py @@ -3,7 +3,7 @@ # For further details please refer to the file LICENSE # which you should have received as part of this distribution. # Created date: 10/03/2025 -# Modified date: 14/03/2025 +# Modified date: 30/09/2025 # *****************************COPYRIGHT******************************* """ @@ -224,6 +224,7 @@ "ddim", "deallocate", "decode", + "default", "deferred", "delim", "derf", @@ -258,6 +259,7 @@ "dtan", "dtanh", "dtime", + "dynamic", "elemental", "else", "encode", @@ -488,12 +490,14 @@ "nextrec", "nint", "nml", + "no wait", "none", "non_intrinsic", "non_overridable", "nopass", "norm2", "not", + "nowait", "null", "nullify", "number", @@ -511,6 +515,7 @@ "pad", "parameter", "parity", + "parallel", "pass", "perror", "pointer", @@ -587,6 +592,7 @@ "save", "scale", "scan", + "schedule", "secnds", "second", "select", @@ -597,6 +603,7 @@ "sequential", "set_exponent", "shape", + "shared", "shifta", "shiftl", "shiftr", @@ -616,6 +623,7 @@ "sqrt", "srand", "stat", + "static", "status", "stat_failed_image", "stat_locked",