diff --git a/puml_generator.py b/puml_generator.py index 5279ca5..0877394 100644 --- a/puml_generator.py +++ b/puml_generator.py @@ -96,7 +96,10 @@ def is_line_method_declaration(line:str, class_type:str) -> bool: :param line: The line to check. :return: True if the line is a method declaration, False otherwise. """ - method_pattern = re.compile(r'^\s*(public|private|protected|\s)*\s*(static|final|\s)*\s*(\w[\w\d]*)\s+(\w[\w\d]*)\s*\(.*\)\s*{') + # Sometimes these slip in as method declarations + if "else if" in line: + return False + 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*;$')