simplified regular expression

This commit is contained in:
Jonas_Jones 2025-03-04 20:51:14 +01:00
parent ff082abfe1
commit 8afcc5ca15

View file

@ -102,7 +102,7 @@ def is_line_method_declaration(line:str, class_type:str) -> bool:
method_pattern = re.compile(r'^\s*(public|private|protected|\s)*\s*(static|final|\s)*\s*(\w[\w\d]*)\s+(\w[\w\d]*)\s*\(.*\)\s*(?:throws\s+\w[\w\d]*)?\s*{')
if class_type == "interface":
method_pattern = re.compile(r'^[a-zA-Z_][a-zA-Z0-9_]*\s+[a-zA-Z_][a-zA-Z0-9_]*\(\)\s*(?:throws\s+\w[\w\d]*)?\s*;$')
method_pattern = re.compile(r'^\w\w*\s+\w\w*\(\)\s*(?:throws\s+\w[\w\d]*)?\s*;$')
match = method_pattern.match(line.strip())
return match is not None