added support for generic types

"<" and ">" in the type reference are now recognised
This commit is contained in:
Jonas_Jones 2025-03-04 19:40:12 +01:00
parent 3307cb7377
commit 153ede2eda

View file

@ -60,7 +60,7 @@ def is_line_field_declaration(line:str) -> bool:
"""
if "public" not in line and "private" not in line and "protected" not in line:
return
field_pattern = re.compile(r'^\s*(public|private|protected|\s)*\s*(static|final|\s)*\s*(\w[\w\d]*)\s+(\w[\w\d]*)\s*(=\s*[^;]*)?;')
field_pattern = re.compile(r'^\s*(public|private|protected|\s)*\s*(static|final|\s)*\s*(\w[\w\d,<>\s]*)\s+(\w[\w\d]*)\s*(=\s*[^;]*)?;')
match = field_pattern.match(line.strip())
return match is not None
@ -69,7 +69,7 @@ def get_field_visibility(line):
"""
Checks if the line is a field declaration and returns its visibility (+, -, or #).
"""
field_pattern = re.compile(r'^\s*(public|private|protected|\s)*\s*(static|final|\s)*\s*(\w[\w\d]*)\s+(\w[\w\d]*)\s*(=\s*[^;]*)?;')
field_pattern = re.compile(r'^\s*(public|private|protected|\s)*\s*(static|final|\s)*\s*(\w[\w\d,<>\s]*)\s+(\w[\w\d]*)\s*(=\s*[^;]*)?;')
match = field_pattern.match(line.strip())
if match:
# Check for the access modifier in the line and return the corresponding symbol