mirror of
https://github.com/isledecomp/isle.git
synced 2026-01-26 17:51:16 +00:00
More flexible match on module name. Bugfix on blank_or_comment
This commit is contained in:
parent
6e2e177bea
commit
2191f7f1cc
@ -17,12 +17,12 @@ class ReaderState(Enum):
|
|||||||
['offset', 'signature', 'start_line', 'end_line'])
|
['offset', 'signature', 'start_line', 'end_line'])
|
||||||
|
|
||||||
# To match a reasonable variance of formatting for the offset comment
|
# To match a reasonable variance of formatting for the offset comment
|
||||||
offsetCommentRegex = re.compile(r'//\s?OFFSET:\s?LEGO1 (?:0x)?([a-f0-9]+)',
|
offsetCommentRegex = re.compile(r'//\s?OFFSET:\s?\w+ (?:0x)?([a-f0-9]+)',
|
||||||
flags=re.I)
|
flags=re.I)
|
||||||
|
|
||||||
# To match the exact syntax (text upper case, hex lower case, with spaces)
|
# To match the exact syntax (text upper case, hex lower case, with spaces)
|
||||||
# that is used in most places
|
# that is used in most places
|
||||||
offsetCommentExactRegex = re.compile(r'// OFFSET: LEGO1 (0x[a-f][0-9]+)')
|
offsetCommentExactRegex = re.compile(r'// OFFSET: [A-Z0-9]+ (0x[a-f][0-9]+)')
|
||||||
|
|
||||||
|
|
||||||
def is_blank_or_comment(line: str) -> bool:
|
def is_blank_or_comment(line: str) -> bool:
|
||||||
@ -31,9 +31,9 @@ def is_blank_or_comment(line: str) -> bool:
|
|||||||
function signature, and we want to skip those."""
|
function signature, and we want to skip those."""
|
||||||
line_strip = line.strip()
|
line_strip = line.strip()
|
||||||
return (len(line_strip) == 0
|
return (len(line_strip) == 0
|
||||||
or line.startswith('//')
|
or line_strip.startswith('//')
|
||||||
or line.startswith('/*')
|
or line_strip.startswith('/*')
|
||||||
or line.startswith('*/'))
|
or line_strip.endswith('*/'))
|
||||||
|
|
||||||
|
|
||||||
def is_exact_offset_comment(line: str) -> bool:
|
def is_exact_offset_comment(line: str) -> bool:
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user