From c3fade12a9a86eaeff150252bf19789ac9102fe7 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 20 Jul 2021 18:21:26 +0200 Subject: [PATCH] important bugfix --- events/event_parser.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/events/event_parser.py b/events/event_parser.py index b9b8460..d3d5555 100644 --- a/events/event_parser.py +++ b/events/event_parser.py @@ -102,13 +102,17 @@ class EventParser(FileParser): self, event_match, macro_api_match: bool, moving_window: list, file_name: str ): if ";" in event_match.group(0): - event_full_match = self.__handle_one_line_event_match( - macro_api_match=macro_api_match, moving_window=moving_window + event_full_match = self.__generate_regex_event_match( + macro_api_match=macro_api_match, + full_string=moving_window[self.moving_window_center_idx] ) else: - event_full_match = self.__build_multi_line_event_string( + multi_line_string = self.__build_multi_line_event_string( first_line=event_match.group(0), moving_window=moving_window ) + event_full_match = self.__generate_regex_event_match( + macro_api_match=macro_api_match, full_string=multi_line_string + ) description = self._search_for_descrip_string_generic( moving_window=moving_window, break_pattern=r'[\s]*static const(?:expr)?[\s]*Event[\s]*' ) @@ -125,7 +129,8 @@ class EventParser(FileParser): self.mib_table.update({full_id: (name, severity, description, file_name)}) self.count = self.count + 1 - def __handle_one_line_event_match(self, macro_api_match: bool, moving_window: list): + @staticmethod + def __generate_regex_event_match(macro_api_match: bool, full_string: str): if macro_api_match: # One line event definition. regex_string = \ @@ -135,7 +140,7 @@ class EventParser(FileParser): regex_string = \ r"static const(?:expr)? Event[\s]*([\w]*)[\s]*=[\s]*" \ r"event::makeEvent\(([\w]*),[\s]*([0-9]{1,3})[\s]*,[\s]*severity::([A-Z]*)\)[\s]*;" - event_full_match = re.search(regex_string, moving_window[self.moving_window_center_idx]) + event_full_match = re.search(regex_string, full_string) return event_full_match def __build_multi_line_event_string(