Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
source
OBSW MOD GENERATOR CORE
Commits
8d86d771
Commit
8d86d771
authored
Apr 30, 2021
by
Robin Mueller
Browse files
continued multi line event parser
parent
3259a6ec
Changes
1
Hide whitespace changes
Inline
Side-by-side
events/event_parser.py
View file @
8d86d771
...
...
@@ -71,8 +71,30 @@ class EventParser(FileParser):
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
# These two variants need to be checked
# static const(?:expr)? Event[\s]*([A-Z_0-9]*)[\s]*=[\s]*event::makeEvent
# static const(?:expr)? Event[\s]*([A-Z_0-9]*)[\s]*=[\s]*MAKE_EVENT
event_match
=
re
.
match
(
r
"static const(?:expr)? Event[\s]*([A-Z_0-9]*)[\s]*=[\s]*event::makeEvent"
,
moving_window
[
self
.
moving_window_center_idx
]
)
regex_string
=
r
""
if
not
event_match
:
event_match
=
re
.
match
(
r
"static const(?:expr)? Event[\s]*([A-Z_0-9]*)[\s]*=[\s]*MAKE_EVENT"
,
moving_window
[
self
.
moving_window_center_idx
]
)
if
event_match
:
regex_string
=
\
r
"static const(?:expr)? Event[\s]*([A-Z_0-9]*)[\s]*=[\s]*"
\
r
"event::makeEvent\(([0-9]{1,2}),[\s]*severity::([A-Z]*)\);[\t ]*(//!<)?([^\n]*)"
else
:
regex_string
=
\
r
"static const(?:expr)? Event[\s]*([A-Z_0-9]*)[\s]*=[\s]*"
\
r
"MAKE_EVENT\(([0-9]{1,2}),[\s]*severity::([A-Z]*)\);[\t ]*(//!<)?([^\n]*)"
if
event_match
:
if
";"
in
event_match
.
group
(
0
):
# One line event definition.
event_full_match
=
re
.
search
(
regex_string
,
moving_window
[
self
.
moving_window_center_idx
])
# Description will be parsed separately
description
=
" "
def
_post_parsing_operation
(
self
):
pass
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment