diff options
Diffstat (limited to 'modules/regex')
-rw-r--r-- | modules/regex/config.py | 3 | ||||
-rw-r--r-- | modules/regex/regex.cpp | 15 | ||||
-rw-r--r-- | modules/regex/regex.h | 2 | ||||
-rw-r--r-- | modules/regex/register_types.cpp | 2 | ||||
-rw-r--r-- | modules/regex/register_types.h | 2 |
5 files changed, 15 insertions, 9 deletions
diff --git a/modules/regex/config.py b/modules/regex/config.py index 667b5d8ba6..5347cfd243 100644 --- a/modules/regex/config.py +++ b/modules/regex/config.py @@ -1,8 +1,9 @@ #!/usr/bin/env python + def can_build(platform): return True + def configure(env): pass - diff --git a/modules/regex/regex.cpp b/modules/regex/regex.cpp index a0f4b4934c..c7ce2884a1 100644 --- a/modules/regex/regex.cpp +++ b/modules/regex/regex.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -97,6 +97,9 @@ struct RegExNode { memdelete(next); } + // For avoiding RTTI + virtual bool is_look_behind() { return false; } + virtual int test(RegExSearch& s, int pos) const { return next ? next->test(s, pos) : -1; @@ -750,6 +753,8 @@ struct RegExNodeLookBehind : public RegExNodeGroup { reset_pos = true; } + virtual bool is_look_behind() { return true; } + virtual int test(RegExSearch& s, int pos) const { if (pos < length) @@ -1089,7 +1094,7 @@ Error RegEx::compile(const String& p_pattern) { REGEX_COMPILE_FAIL("backreference not found"); for (int i = 0; i < stack.size(); ++i) - if (dynamic_cast<RegExNodeLookBehind*>(stack[i])) + if (stack[i]->is_look_behind()) REGEX_COMPILE_FAIL("backreferences inside lookbehind not supported"); for (int i = 0; i < group_names.size(); ++i) { @@ -1112,7 +1117,7 @@ Error RegEx::compile(const String& p_pattern) { c = d; for (int i = 0; i < stack.size(); ++i) - if (dynamic_cast<RegExNodeLookBehind*>(stack[i])) + if (stack[i]->is_look_behind()) REGEX_COMPILE_FAIL("backreferences inside lookbehind not supported"); int ref = -1; @@ -1238,7 +1243,7 @@ Error RegEx::compile(const String& p_pattern) { break; case '|': for (int i = 0; i < stack.size(); ++i) - if (dynamic_cast<RegExNodeLookBehind*>(stack[i])) + if (stack[i]->is_look_behind()) REGEX_COMPILE_FAIL("alternations inside lookbehind not supported"); stack[0]->add_childset(); break; @@ -1312,7 +1317,7 @@ Error RegEx::compile(const String& p_pattern) { if (min_val != max_val) for (int i = 0; i < stack.size(); ++i) - if (dynamic_cast<RegExNodeLookBehind*>(stack[i])) + if (stack[i]->is_look_behind()) REGEX_COMPILE_FAIL("variable length quantifiers inside lookbehind not supported"); RegExNodeQuantifier* quant = memnew(RegExNodeQuantifier(min_val, max_val)); diff --git a/modules/regex/regex.h b/modules/regex/regex.h index 803aa72b3f..08b0bebdcd 100644 --- a/modules/regex/regex.h +++ b/modules/regex/regex.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/modules/regex/register_types.cpp b/modules/regex/register_types.cpp index 050cf3efff..b3f56cd924 100644 --- a/modules/regex/register_types.cpp +++ b/modules/regex/register_types.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/modules/regex/register_types.h b/modules/regex/register_types.h index df3b508e14..5d676b6daa 100644 --- a/modules/regex/register_types.h +++ b/modules/regex/register_types.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ |