Commit 30e142b3 authored by Robin Mueller's avatar Robin Mueller
Browse files

repared event parser for moving window mode

parent 7d1c474c
......@@ -8,6 +8,7 @@ EVENT_ENTRY_INFO_IDX = 2
EVENT_SOURCE_FILE_IDX = 3
FSFW_EVENT_HEADER_INCLUDE = "#include <fsfw/events/Event.h>"
DEFAULT_MOVING_WINDOWS_SIZE = 7
SUBSYSTEM_ID_NAMESPACE = "SUBSYSTEM_ID"
class SubsystemDefinitionParser(FileParser):
......@@ -41,6 +42,7 @@ class EventParser(FileParser):
self.my_id = 0
self.current_id = 0
self.last_lines = ["", "", ""]
self.moving_window_center_idx = 3
def _handle_file_parsing(self, file_name: str, *args: any, **kwargs):
try:
......@@ -60,7 +62,14 @@ class EventParser(FileParser):
def _handle_file_parsing_moving_window(
self, file_name: str, current_line: int, moving_window_size: int, moving_window: list,
*args, **kwargs):
pass
match1 = re.search(
r"SUBSYSTEM_ID[\s]*=[\s]*SUBSYSTEM_ID::([A-Z_0-9]*);", moving_window[self.moving_window_center_idx]
)
if match1:
self.current_id = self.interfaces[match1.group(1)][0]
# print( "Current ID: " + str(currentId) )
self.my_id = self.return_number_from_string(self.current_id)
# Now try to look for event definitions. Moving windows allows multi line event definitions
def _post_parsing_operation(self):
pass
......@@ -77,7 +86,8 @@ class EventParser(FileParser):
self.my_id = self.return_number_from_string(self.current_id)
match = re.search(
r"(//)?[\t ]*static const(?:expr)? Event[\s]*([A-Z_0-9]*)[\s]*=[\s]*"
r"MAKE_EVENT\(([0-9]{1,2}),[\s]*severity::([A-Z]*)\);[\t ]*(//!<)?([^\n]*)", twolines)
r"MAKE_EVENT\(([0-9]{1,2}),[\s]*severity::([A-Z]*)\);[\t ]*(//!<)?([^\n]*)", twolines
)
if match:
if match.group(1):
self.last_lines[0] = line
......
......@@ -117,7 +117,6 @@ class ReturnValueParser(FileParser):
all_lines = self._open_file(file_name=file_name)
for line in all_lines:
self.__handle_line_reading(line, file_name, print_truncated_entries)
pass
def _handle_file_parsing_moving_window(self, file_name: str, current_line: int,
moving_window_size: int, moving_window: list, *args,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment