Skip to content

Commit 2e21871

Browse files
committed
DCS World - String token change to handle all scenarios for string chars, fixed for C101. F-5E and Moskito (should fix all future variants)
1 parent a01f30e commit 2e21871

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

joystick_diagrams/plugins/dcs_world_plugin/dcs_world.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,7 @@ def parse_config(self, file: str) -> dict | None:
258258

259259
def parse_file(self, file: str) -> dict: # noqa
260260
# Linter disabled for this function, this is the format required by PLY
261+
261262
tokens = ( # noqa
262263
"LCURLY",
263264
"RCURLY",
@@ -278,7 +279,6 @@ def parse_file(self, file: str) -> dict: # noqa
278279
t_RBRACE = r"\]" # noqa
279280
t_COMMA = r"\," # noqa
280281
t_EQUALS = r"\=" # noqa
281-
t_ESCAPED_QUOTE = r"\\\"" # noqa
282282

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

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

joystick_diagrams/plugins/dcs_world_plugin/lextab.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,18 @@
2121
_lexstatere = {
2222
"INITIAL": [
2323
(
24-
'(?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>\\=)',
24+
'(?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>\\=)',
2525
[
2626
None,
2727
("t_DOUBLE_VAL", "DOUBLE_VAL"),
2828
None,
2929
("t_NUMBER", "NUMBER"),
3030
("t_STRING", "STRING"),
31+
None,
3132
("t_TRUE", "TRUE"),
3233
None,
3334
("t_FALSE", "FALSE"),
3435
None,
35-
(None, "ESCAPED_QUOTE"),
3636
(None, "LCURLY"),
3737
(None, "RCURLY"),
3838
(None, "LBRACE"),

0 commit comments

Comments
 (0)