important bugfix

This commit is contained in:
Robin Müller 2021-07-20 18:21:26 +02:00
parent 593f866bfe
commit c3fade12a9
No known key found for this signature in database
GPG Key ID: 11D4952C8CCEF814

View File

@ -102,13 +102,17 @@ class EventParser(FileParser):
self, event_match, macro_api_match: bool, moving_window: list, file_name: str self, event_match, macro_api_match: bool, moving_window: list, file_name: str
): ):
if ";" in event_match.group(0): if ";" in event_match.group(0):
event_full_match = self.__handle_one_line_event_match( event_full_match = self.__generate_regex_event_match(
macro_api_match=macro_api_match, moving_window=moving_window macro_api_match=macro_api_match,
full_string=moving_window[self.moving_window_center_idx]
) )
else: 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 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( description = self._search_for_descrip_string_generic(
moving_window=moving_window, break_pattern=r'[\s]*static const(?:expr)?[\s]*Event[\s]*' 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.mib_table.update({full_id: (name, severity, description, file_name)})
self.count = self.count + 1 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: if macro_api_match:
# One line event definition. # One line event definition.
regex_string = \ regex_string = \
@ -135,7 +140,7 @@ class EventParser(FileParser):
regex_string = \ regex_string = \
r"static const(?:expr)? Event[\s]*([\w]*)[\s]*=[\s]*" \ r"static const(?:expr)? Event[\s]*([\w]*)[\s]*=[\s]*" \
r"event::makeEvent\(([\w]*),[\s]*([0-9]{1,3})[\s]*,[\s]*severity::([A-Z]*)\)[\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 return event_full_match
def __build_multi_line_event_string( def __build_multi_line_event_string(