From 2e2187174234a58995065eeb81a0cc34dd88831b Mon Sep 17 00:00:00 2001 From: Rob <5183487+Rexeh@users.noreply.github.com> Date: Wed, 6 Mar 2024 10:09:33 +0000 Subject: [PATCH] DCS World - String token change to handle all scenarios for string chars, fixed for C101. F-5E and Moskito (should fix all future variants) --- joystick_diagrams/plugins/dcs_world_plugin/dcs_world.py | 4 ++-- joystick_diagrams/plugins/dcs_world_plugin/lextab.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/joystick_diagrams/plugins/dcs_world_plugin/dcs_world.py b/joystick_diagrams/plugins/dcs_world_plugin/dcs_world.py index 03e27c1..6e49c9e 100644 --- a/joystick_diagrams/plugins/dcs_world_plugin/dcs_world.py +++ b/joystick_diagrams/plugins/dcs_world_plugin/dcs_world.py @@ -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", @@ -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]+" @@ -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 diff --git a/joystick_diagrams/plugins/dcs_world_plugin/lextab.py b/joystick_diagrams/plugins/dcs_world_plugin/lextab.py index beca27d..13ca9fc 100644 --- a/joystick_diagrams/plugins/dcs_world_plugin/lextab.py +++ b/joystick_diagrams/plugins/dcs_world_plugin/lextab.py @@ -21,18 +21,18 @@ _lexstatere = { "INITIAL": [ ( - '(?P(\\+|\\-)?[0-9]+\\.[0-9]+)|(?P[0-9]+)|(?P\\"[\\w|\\/|\\(|\\)|\\-|\\:|\\+|\\,|\\&|\\.|\\\'|\\<|\\\\\\%|\\>|\\\\\\"|\\s]+\\" )|(?P(true))|(?P(false))|(?P\\\\\\")|(?P\\{)|(?P\\})|(?P\\[)|(?P\\])|(?P\\,)|(?P\\=)', + '(?P(\\+|\\-)?[0-9]+\\.[0-9]+)|(?P[0-9]+)|(?P\\"([^\\"\\\\]|\\\\.)*\\" )|(?P(true))|(?P(false))|(?P\\{)|(?P\\})|(?P\\[)|(?P\\])|(?P\\,)|(?P\\=)', [ 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"),