diff options
author | Andrew Dunai <a@dun.ai> | 2022-08-15 20:48:04 +0300 |
---|---|---|
committer | Andrew Dunai <a@dun.ai> | 2022-08-20 13:57:49 +0300 |
commit | f00cf3ff11ec3462d4513371fb65fae9ed884fe5 (patch) | |
tree | 3c84395199c47be75463406031f57299c435dca9 /editor/project_converter_3_to_4.cpp | |
parent | 4dbb6ecc214375e107427976c19206563a810a43 (diff) |
3to4: Fix handling of arrays in connect() and JSON alignment
Diffstat (limited to 'editor/project_converter_3_to_4.cpp')
-rw-r--r-- | editor/project_converter_3_to_4.cpp | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/editor/project_converter_3_to_4.cpp b/editor/project_converter_3_to_4.cpp index 5ce837f862..8417994cb5 100644 --- a/editor/project_converter_3_to_4.cpp +++ b/editor/project_converter_3_to_4.cpp @@ -1607,8 +1607,8 @@ public: RegEx reg_is_empty = RegEx("\\bempty\\("); RegEx reg_super = RegEx("([\t ])\\.([a-zA-Z_])"); RegEx reg_json_to = RegEx("\\bto_json\\b"); - RegEx reg_json_parse = RegEx("([\t]{0,})([^\n]+)parse_json\\(([^\n]+)"); - RegEx reg_json_non_new = RegEx("([\t]{0,})([^\n]+)JSON\\.parse\\(([^\n]+)"); + RegEx reg_json_parse = RegEx("([\t ]{0,})([^\n]+)parse_json\\(([^\n]+)"); + RegEx reg_json_non_new = RegEx("([\t ]{0,})([^\n]+)JSON\\.parse\\(([^\n]+)"); RegEx reg_export = RegEx("export\\(([a-zA-Z0-9_]+)\\)[ ]+var[ ]+([a-zA-Z0-9_]+)"); RegEx reg_export_advanced = RegEx("export\\(([^)^\n]+)\\)[ ]+var[ ]+([a-zA-Z0-9_]+)([^\n]+)"); RegEx reg_setget_setget = RegEx("var[ ]+([a-zA-Z0-9_]+)([^\n]+)setget[ \t]+([a-zA-Z0-9_]+)[ \t]*,[ \t]*([a-zA-Z0-9_]+)"); @@ -2103,6 +2103,8 @@ bool ProjectConverter3To4::test_conversion(const RegExContainer ®_container) valid = valid & test_conversion_single_additional_builtin("(connect(A,B,C) != OK):", "(connect(A,Callable(B,C)) != OK):", &ProjectConverter3To4::rename_gdscript_functions, "custom rename", reg_container, false); valid = valid & test_conversion_single_additional_builtin("(connect(A,B,C,D) != OK):", "(connect(A,Callable(B,C).bind(D)) != OK):", &ProjectConverter3To4::rename_gdscript_functions, "custom rename", reg_container, false); valid = valid & test_conversion_single_additional_builtin("(connect(A,B,C,[D]) != OK):", "(connect(A,Callable(B,C).bind(D)) != OK):", &ProjectConverter3To4::rename_gdscript_functions, "custom rename", reg_container, false); + valid = valid & test_conversion_single_additional_builtin("(connect(A,B,C,[D,E]) != OK):", "(connect(A,Callable(B,C).bind(D,E)) != OK):", &ProjectConverter3To4::rename_gdscript_functions, "custom rename", reg_container, false); + valid = valid & test_conversion_single_additional_builtin("(connect(A,B,C,[D,E],F) != OK):", "(connect(A,Callable(B,C).bind(D,E),F) != OK):", &ProjectConverter3To4::rename_gdscript_functions, "custom rename", reg_container, false); valid = valid & test_conversion_single_additional_builtin("(connect(A,B,C,D,E) != OK):", "(connect(A,Callable(B,C).bind(D),E) != OK):", &ProjectConverter3To4::rename_gdscript_functions, "custom rename", reg_container, false); valid = valid & test_conversion_single_additional_builtin("(start(A,B) != OK):", "(start(Callable(A,B)) != OK):", &ProjectConverter3To4::rename_gdscript_functions, "custom rename", reg_container, false); @@ -2442,6 +2444,21 @@ Vector<String> ProjectConverter3To4::parse_arguments(const String &line) { } break; }; + case '[': { + parts_counter++; + if (parts_counter == 1 && !is_inside_string) { + start_part = current_index; + } + break; + }; + case ']': { + parts_counter--; + if (parts_counter == 0 && !is_inside_string) { + parts.append(line.substr(start_part, current_index - start_part)); + start_part = current_index; + } + break; + }; case ',': { if (parts_counter == 1 && !is_inside_string) { parts.append(line.substr(start_part + 1, current_index - start_part - 1)); |