diff --git a/puml_generator.py b/puml_generator.py index 0877394..f3548ed 100644 --- a/puml_generator.py +++ b/puml_generator.py @@ -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*;$') + 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*;$') match = method_pattern.match(line.strip()) return match is not None @@ -112,7 +112,7 @@ def get_method_visibility(line:str) -> str: """ Checks if the line is a method declaration and returns its visibility (+, -, or #). """ - method_pattern = re.compile(r'^\s*(public|private|protected|\s)*\s*(static|final|\s)*\s*(\w[\w\d]*)\s+(\w[\w\d]*)\s*\(.*\)\s*{') + 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*{') match = method_pattern.match(line.strip()) if match: # Check for the access modifier in the line and return the corresponding symbol