From 598cd7db5cc053459624fecd8adfbc0d6f0b1958 Mon Sep 17 00:00:00 2001 From: Jon Date: Tue, 1 Jul 2025 20:52:35 +0930 Subject: [PATCH] refactor(parser): store matcher name seperatly ref: #3 #1 --- includes/usr/bin/annotations.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/includes/usr/bin/annotations.py b/includes/usr/bin/annotations.py index 6af5aa0..3d35f00 100755 --- a/includes/usr/bin/annotations.py +++ b/includes/usr/bin/annotations.py @@ -173,7 +173,7 @@ matcher_type = re.compile(r'NFC_PROBLEM_MATCHER_TYPE=(?P[a-z_-]+)') regex_type = 'default' pattern = re.compile( regex[regex_type] ) - +matcher_name = 'Default Matcher' for line in sys.stdin: @@ -181,12 +181,15 @@ for line in sys.stdin: if match_matcher_type: regex_type = match_matcher_type['type'] - + matcher_name = match_matcher_type['type'] if regex_type in regex: pattern = re.compile( regex[regex_type] ) + else: + + pattern = re.compile( regex['default'] ) match = pattern.finditer(line) @@ -201,13 +204,13 @@ for line in sys.stdin: if match: - if regex_type not in results: - results[regex_type] = [] + if matcher_name not in results: + results[matcher_name] = [] for obj in match: - results[regex_type].append(obj.groupdict()) + results[matcher_name].append(obj.groupdict())