From 2191f7f1ccfefe310b766dcf19b660b266f1841d Mon Sep 17 00:00:00 2001 From: disinvite Date: Sun, 22 Oct 2023 12:13:53 -0400 Subject: [PATCH] More flexible match on module name. Bugfix on blank_or_comment --- tools/checkorder/checkorder.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tools/checkorder/checkorder.py b/tools/checkorder/checkorder.py index a9b738d8..9d346bd2 100644 --- a/tools/checkorder/checkorder.py +++ b/tools/checkorder/checkorder.py @@ -17,12 +17,12 @@ class ReaderState(Enum): ['offset', 'signature', 'start_line', 'end_line']) # 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) # To match the exact syntax (text upper case, hex lower case, with spaces) # 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: @@ -31,9 +31,9 @@ def is_blank_or_comment(line: str) -> bool: function signature, and we want to skip those.""" line_strip = line.strip() return (len(line_strip) == 0 - or line.startswith('//') - or line.startswith('/*') - or line.startswith('*/')) + or line_strip.startswith('//') + or line_strip.startswith('/*') + or line_strip.endswith('*/')) def is_exact_offset_comment(line: str) -> bool: