diff --git a/fsfwgen/events/event_parser.py b/fsfwgen/events/event_parser.py index 0581548..7e161a3 100644 --- a/fsfwgen/events/event_parser.py +++ b/fsfwgen/events/event_parser.py @@ -186,9 +186,20 @@ class EventParser(FileParser): r"static const(?:expr)? Event[\s]*([\w]*)[\s]*=[\s]*" r"MAKE_EVENT\((0x[0-9a-fA-F]+|[0-9]{1,3}),[\s]*severity::([A-Z]*)\)[\s]*;" ) - else: - regex_string = r"static const(?:expr)? Event\s*([\w]+)\s*=\s*event::makeEvent\(([\w:]+),\s*(0x[0-9a-fA-F]+|[0-9]{1,3})\s*,\s*severity::([A-Z]+)\)\s*;" + return re.search(regex_string, full_string) + + # Non compiletime const version kept for backwards compatibility + regex_string = r"static const(?:expr)? Event\s*([\w]+)\s*=\s*event::makeEvent\(([\w:]+),\s*(0x[0-9a-fA-F]+|[0-9]{1,3})\s*,\s*severity::([A-Z]+)\)\s*;" event_full_match = re.search(regex_string, full_string) + + # Using old, non compiletime const version + if event_full_match: + return event_full_match + + # Using compiletime const version + regex_string = r"static const(?:expr)? Event\s*([\w]+)\s*=\s*event::makeEvent<([\w:]+),\s*(0x[0-9a-fA-F]+|[0-9]{1,3})\s*,\s*severity::([A-Z]+)>\(\)\s*;" + event_full_match = re.search(regex_string, full_string) + return event_full_match def __build_multi_line_event_string(self, first_line: str, moving_window: List[str]) -> str: