diff --git a/linter.py b/linter.py index 391ca55..38c7f77 100644 --- a/linter.py +++ b/linter.py @@ -26,9 +26,10 @@ class GfortranFixedForm(Linter): multiline = True regex = ( # filename:line:col: is common for multiline and single line warnings - r'^[^:]*:(?P\d+)[:.](?P\d+):' - # Then we either have a space or (a newline, a newline, some source code, a newline, a col number, a newline) - r'(?:\s|$\r?\n^$\r?\n^.*$\r?\n^\s*\d$\r?\n)' + r'.*:(?P\d+):(?P\d+):' + # Then we either have a space or (a newline, a newline, some source code, + # a newline, a col number, a newline) + r'(?:(\s*.*\s*\d+\s*))' # Finally we have (Error|Warning): message to the end of the line r'(?:(?PError|Fatal\sError)|(?PWarning)): (?P.*$)' ) @@ -45,10 +46,11 @@ class GfortranModern(Linter): multiline = True regex = ( # filename:line:col: is common for multiline and single line warnings - r'^[^:]*:(?P\d+)[:.](?P\d+):' - # Then we either have a space or (a newline, a newline, some source code, a newline, a col number, a newline) - r'(?:\s|$\r?\n^$\r?\n^.*$\r?\n^\s*\d$\r?\n)' + r'.*:(?P\d+):(?P\d+):' + # Then we either have a space or (a newline, a newline, some source code, + # a newline, a col number, a newline) + r'(?:(\s*.*\s*\d+\s*))' # Finally we have (Error|Warning): message to the end of the line - r'(?:(?PError|Fatal\sError)|(?PWarning)): (?P.*$)' + r'(?P(Error|Fatal Error)|(?PWarning)): (?P.*)' ) tempfile_suffix = "f90"