diff options
Diffstat (limited to 'modules')
-rw-r--r-- | modules/gdnative/gdnative.cpp | 2 | ||||
-rw-r--r-- | modules/regex/regex.cpp | 28 | ||||
-rw-r--r-- | modules/visual_script/visual_script_func_nodes.cpp | 2 | ||||
-rw-r--r-- | modules/visual_script/visual_script_nodes.cpp | 2 | ||||
-rw-r--r-- | modules/visual_script/visual_script_yield_nodes.cpp | 2 |
5 files changed, 22 insertions, 14 deletions
diff --git a/modules/gdnative/gdnative.cpp b/modules/gdnative/gdnative.cpp index 706b81f7a3..dad9a54df6 100644 --- a/modules/gdnative/gdnative.cpp +++ b/modules/gdnative/gdnative.cpp @@ -35,7 +35,7 @@ #include "os/file_access.h" #include "os/os.h" -#include "scene/main/scene_main_loop.h" +#include "scene/main/scene_tree.h" #include "scene/resources/scene_format_text.h" #if defined(TOOLS_ENABLED) && defined(DEBUG_METHODS_ENABLED) diff --git a/modules/regex/regex.cpp b/modules/regex/regex.cpp index eb9f1d2ab1..c3e97e357d 100644 --- a/modules/regex/regex.cpp +++ b/modules/regex/regex.cpp @@ -590,6 +590,11 @@ struct RegExNodeGroup : public RegExNode { memdelete(childset[i]); } + virtual void test_success(RegExSearch &s, int pos) const { + + return; + } + virtual int test(RegExSearch &s, int pos) const { for (int i = 0; i < childset.size(); ++i) { @@ -598,10 +603,8 @@ struct RegExNodeGroup : public RegExNode { int res = childset[i]->test(s, pos); - if (s.complete) - return res; - if (inverse) { + s.complete = false; if (res < 0) res = pos + 1; else @@ -611,9 +614,13 @@ struct RegExNodeGroup : public RegExNode { continue; } + if (s.complete) + return res; + if (res >= 0) { if (reset_pos) res = pos; + this->test_success(s, res); return next ? next->test(s, res) : res; } } @@ -668,6 +675,12 @@ struct RegExNodeCapturing : public RegExNodeGroup { id = p_id; } + virtual void test_success(RegExSearch &s, int pos) const { + + RegExMatch::Group &ref = s.match->captures[id]; + ref.length = pos - ref.start; + } + virtual int test(RegExSearch &s, int pos) const { RegExMatch::Group &ref = s.match->captures[id]; @@ -676,13 +689,8 @@ struct RegExNodeCapturing : public RegExNodeGroup { int res = RegExNodeGroup::test(s, pos); - if (res >= 0) { - if (!s.complete) - ref.length = res - pos; - } else { + if (res < 0) ref.start = old_start; - } - return res; } @@ -1488,7 +1496,7 @@ void RegEx::_bind_methods() { ClassDB::bind_method(D_METHOD("clear"), &RegEx::clear); ClassDB::bind_method(D_METHOD("compile", "pattern"), &RegEx::compile); - ClassDB::bind_method(D_METHOD("search", "text", "start", "end"), &RegEx::search, DEFVAL(0), DEFVAL(-1)); + ClassDB::bind_method(D_METHOD("search:RegExMatch", "text", "start", "end"), &RegEx::search, DEFVAL(0), DEFVAL(-1)); ClassDB::bind_method(D_METHOD("sub", "text", "replacement", "all", "start", "end"), &RegEx::sub, DEFVAL(false), DEFVAL(0), DEFVAL(-1)); ClassDB::bind_method(D_METHOD("is_valid"), &RegEx::is_valid); ClassDB::bind_method(D_METHOD("get_pattern"), &RegEx::get_pattern); diff --git a/modules/visual_script/visual_script_func_nodes.cpp b/modules/visual_script/visual_script_func_nodes.cpp index b466e64aec..e0e1a217b3 100644 --- a/modules/visual_script/visual_script_func_nodes.cpp +++ b/modules/visual_script/visual_script_func_nodes.cpp @@ -33,7 +33,7 @@ #include "io/resource_loader.h" #include "os/os.h" #include "scene/main/node.h" -#include "scene/main/scene_main_loop.h" +#include "scene/main/scene_tree.h" #include "visual_script_nodes.h" ////////////////////////////////////////// diff --git a/modules/visual_script/visual_script_nodes.cpp b/modules/visual_script/visual_script_nodes.cpp index 8ea3b8098d..86c98d076e 100644 --- a/modules/visual_script/visual_script_nodes.cpp +++ b/modules/visual_script/visual_script_nodes.cpp @@ -34,7 +34,7 @@ #include "os/input.h" #include "os/os.h" #include "scene/main/node.h" -#include "scene/main/scene_main_loop.h" +#include "scene/main/scene_tree.h" ////////////////////////////////////////// ////////////////FUNCTION////////////////// diff --git a/modules/visual_script/visual_script_yield_nodes.cpp b/modules/visual_script/visual_script_yield_nodes.cpp index 8f96eb6800..be5b218d0a 100644 --- a/modules/visual_script/visual_script_yield_nodes.cpp +++ b/modules/visual_script/visual_script_yield_nodes.cpp @@ -31,7 +31,7 @@ #include "os/os.h" #include "scene/main/node.h" -#include "scene/main/scene_main_loop.h" +#include "scene/main/scene_tree.h" #include "visual_script_nodes.h" ////////////////////////////////////////// |