From def9f08b4b3aeb38290c2fd6b293bda2900cd469 Mon Sep 17 00:00:00 2001 From: esainane Date: Wed, 17 Nov 2021 09:38:32 +1300 Subject: [PATCH] UpdatePaths: Handle lists containing strings (#62595) * UpdatePaths: Handle lists containing strings The split_re regex considers two alternatives when splitting out property values. The first alternative, "(?:.+?)" looks for a value that starts and ends with a double quote, containing any characters between, but using the smallest length possible. The second alternative, [^";]* looks for a value that does not contain any double quotes or semicolons. Neither of these cases will handle a value such as network = list("fsc"); To handle this case without a major rewrite, the second alternative is updated to [^"][^;]+ which looks for a value that does not start with a double quote and does not contain a semicolon. * UpdatePaths Support @OLD;... too This strips the trailing semicolon, if present, which it will be if you're overriding an old value after specifying @OLD. * UpdatePaths: Handle single char case Whoops --- tools/UpdatePaths/__main__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/UpdatePaths/__main__.py b/tools/UpdatePaths/__main__.py index 6ccaa6bfd9b..8e1141580ce 100644 --- a/tools/UpdatePaths/__main__.py +++ b/tools/UpdatePaths/__main__.py @@ -27,7 +27,7 @@ default_map_directory = "../../_maps" replacement_re = re.compile(r'\s*(?P[^{]*)\s*(\{(?P.*)\})?') #urgent todo: replace with actual parser, this is slow as janitor in crit -split_re = re.compile(r'((?:[A-Za-z0-9_\-$]+)\s*=\s*(?:"(?:.+?)"|[^";]*)|@OLD)') +split_re = re.compile(r'((?:[A-Za-z0-9_\-$]+)\s*=\s*(?:"(?:.+?)"|[^";][^;]*)|@OLD);?') def props_to_string(props):