Skip to content

Commit

Permalink
DCS World - String token change to handle all scenarios for string ch…
Browse files Browse the repository at this point in the history
…ars, fixed for C101. F-5E and Moskito (should fix all future variants)
  • Loading branch information
Rexeh committed Mar 6, 2024
1 parent a01f30e commit 2e21871
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions joystick_diagrams/plugins/dcs_world_plugin/dcs_world.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,7 @@ def parse_config(self, file: str) -> dict | None:

def parse_file(self, file: str) -> dict: # noqa
# Linter disabled for this function, this is the format required by PLY

tokens = ( # noqa
"LCURLY",
"RCURLY",
Expand All @@ -278,7 +279,6 @@ def parse_file(self, file: str) -> dict: # noqa
t_RBRACE = r"\]" # noqa
t_COMMA = r"\," # noqa
t_EQUALS = r"\=" # noqa
t_ESCAPED_QUOTE = r"\\\"" # noqa

def t_DOUBLE_VAL(t): # noqa
r"(\+|\-)?[0-9]+\.[0-9]+"
Expand All @@ -291,7 +291,7 @@ def t_NUMBER(t): # noqa
return t

def t_STRING(t): # noqa
r"\"[\w|\/|\(|\)|\-|\:|\+|\,|\&|\.|\'|\<|\\\%|\>|\\\"|\s]+\" "
r"\"([^\"\\]|\\.)*\" "
t.value = t.value[1:-1]
return t

Expand Down
4 changes: 2 additions & 2 deletions joystick_diagrams/plugins/dcs_world_plugin/lextab.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,18 @@
_lexstatere = {
"INITIAL": [
(
'(?P<t_DOUBLE_VAL>(\\+|\\-)?[0-9]+\\.[0-9]+)|(?P<t_NUMBER>[0-9]+)|(?P<t_STRING>\\"[\\w|\\/|\\(|\\)|\\-|\\:|\\+|\\,|\\&|\\.|\\\'|\\<|\\\\\\%|\\>|\\\\\\"|\\s]+\\" )|(?P<t_TRUE>(true))|(?P<t_FALSE>(false))|(?P<t_ESCAPED_QUOTE>\\\\\\")|(?P<t_LCURLY>\\{)|(?P<t_RCURLY>\\})|(?P<t_LBRACE>\\[)|(?P<t_RBRACE>\\])|(?P<t_COMMA>\\,)|(?P<t_EQUALS>\\=)',
'(?P<t_DOUBLE_VAL>(\\+|\\-)?[0-9]+\\.[0-9]+)|(?P<t_NUMBER>[0-9]+)|(?P<t_STRING>\\"([^\\"\\\\]|\\\\.)*\\" )|(?P<t_TRUE>(true))|(?P<t_FALSE>(false))|(?P<t_LCURLY>\\{)|(?P<t_RCURLY>\\})|(?P<t_LBRACE>\\[)|(?P<t_RBRACE>\\])|(?P<t_COMMA>\\,)|(?P<t_EQUALS>\\=)',
[
None,
("t_DOUBLE_VAL", "DOUBLE_VAL"),
None,
("t_NUMBER", "NUMBER"),
("t_STRING", "STRING"),
None,
("t_TRUE", "TRUE"),
None,
("t_FALSE", "FALSE"),
None,
(None, "ESCAPED_QUOTE"),
(None, "LCURLY"),
(None, "RCURLY"),
(None, "LBRACE"),
Expand Down

0 comments on commit 2e21871

Please sign in to comment.