diff options
Diffstat (limited to 'modules/regex')
| -rw-r--r-- | modules/regex/SCsub | 16 | ||||
| -rw-r--r-- | modules/regex/config.py | 3 | ||||
| -rw-r--r-- | modules/regex/regex.cpp | 26 | ||||
| -rw-r--r-- | modules/regex/register_types.h | 5 | 
4 files changed, 29 insertions, 21 deletions
| diff --git a/modules/regex/SCsub b/modules/regex/SCsub index 6238cd3d9f..753650adcb 100644 --- a/modules/regex/SCsub +++ b/modules/regex/SCsub @@ -1,16 +1,16 @@  #!/usr/bin/env python -Import('env') -Import('env_modules') +Import("env") +Import("env_modules")  env_regex = env_modules.Clone() -if env['builtin_pcre2']: -    thirdparty_dir = '#thirdparty/pcre2/src/' -    thirdparty_flags = ['PCRE2_STATIC', 'HAVE_CONFIG_H'] +if env["builtin_pcre2"]: +    thirdparty_dir = "#thirdparty/pcre2/src/" +    thirdparty_flags = ["PCRE2_STATIC", "HAVE_CONFIG_H"] -    if env['builtin_pcre2_with_jit']: -        thirdparty_flags.append('SUPPORT_JIT') +    if env["builtin_pcre2_with_jit"]: +        thirdparty_flags.append("SUPPORT_JIT")      thirdparty_sources = [          "pcre2_auto_possess.c", @@ -24,7 +24,7 @@ if env['builtin_pcre2']:          "pcre2_extuni.c",          "pcre2_find_bracket.c",          "pcre2_jit_compile.c", -        #"pcre2_jit_match.c", "pcre2_jit_misc.c", # these files are included in pcre2_jit_compile.c. +        # "pcre2_jit_match.c", "pcre2_jit_misc.c", # these files are included in pcre2_jit_compile.c.          "pcre2_maketables.c",          "pcre2_match.c",          "pcre2_match_data.c", diff --git a/modules/regex/config.py b/modules/regex/config.py index 42cfe3b43c..df9f44cb95 100644 --- a/modules/regex/config.py +++ b/modules/regex/config.py @@ -1,14 +1,17 @@  def can_build(env, platform):      return True +  def configure(env):      pass +  def get_doc_classes():      return [          "RegEx",          "RegExMatch",      ] +  def get_doc_path():      return "doc_classes" diff --git a/modules/regex/regex.cpp b/modules/regex/regex.cpp index 53d1a1dd65..25cc580591 100644 --- a/modules/regex/regex.cpp +++ b/modules/regex/regex.cpp @@ -80,7 +80,7 @@ Dictionary RegExMatch::get_names() const {  	Dictionary result; -	for (const Map<String, int>::Element *i = names.front(); i != NULL; i = i->next()) { +	for (const Map<String, int>::Element *i = names.front(); i != nullptr; i = i->next()) {  		result[i->key()] = i->value();  	} @@ -180,14 +180,14 @@ void RegEx::clear() {  		if (code) {  			pcre2_code_free_16((pcre2_code_16 *)code); -			code = NULL; +			code = nullptr;  		}  	} else {  		if (code) {  			pcre2_code_free_32((pcre2_code_32 *)code); -			code = NULL; +			code = nullptr;  		}  	}  } @@ -242,7 +242,7 @@ Error RegEx::compile(const String &p_pattern) {  Ref<RegExMatch> RegEx::search(const String &p_subject, int p_offset, int p_end) const { -	ERR_FAIL_COND_V(!is_valid(), NULL); +	ERR_FAIL_COND_V(!is_valid(), nullptr);  	Ref<RegExMatch> result = memnew(RegExMatch); @@ -263,7 +263,7 @@ Ref<RegExMatch> RegEx::search(const String &p_subject, int p_offset, int p_end)  		if (res < 0) {  			pcre2_match_data_free_16(match); -			return NULL; +			return nullptr;  		}  		uint32_t size = pcre2_get_ovector_count_16(match); @@ -295,7 +295,7 @@ Ref<RegExMatch> RegEx::search(const String &p_subject, int p_offset, int p_end)  			pcre2_match_data_free_32(match);  			pcre2_match_context_free_32(mctx); -			return NULL; +			return nullptr;  		}  		uint32_t size = pcre2_get_ovector_count_32(match); @@ -431,7 +431,7 @@ String RegEx::sub(const String &p_subject, const String &p_replacement, bool p_a  bool RegEx::is_valid() const { -	return (code != NULL); +	return (code != nullptr);  }  String RegEx::get_pattern() const { @@ -479,26 +479,26 @@ RegEx::RegEx() {  	if (sizeof(CharType) == 2) { -		general_ctx = pcre2_general_context_create_16(&_regex_malloc, &_regex_free, NULL); +		general_ctx = pcre2_general_context_create_16(&_regex_malloc, &_regex_free, nullptr);  	} else { -		general_ctx = pcre2_general_context_create_32(&_regex_malloc, &_regex_free, NULL); +		general_ctx = pcre2_general_context_create_32(&_regex_malloc, &_regex_free, nullptr);  	} -	code = NULL; +	code = nullptr;  }  RegEx::RegEx(const String &p_pattern) {  	if (sizeof(CharType) == 2) { -		general_ctx = pcre2_general_context_create_16(&_regex_malloc, &_regex_free, NULL); +		general_ctx = pcre2_general_context_create_16(&_regex_malloc, &_regex_free, nullptr);  	} else { -		general_ctx = pcre2_general_context_create_32(&_regex_malloc, &_regex_free, NULL); +		general_ctx = pcre2_general_context_create_32(&_regex_malloc, &_regex_free, nullptr);  	} -	code = NULL; +	code = nullptr;  	compile(p_pattern);  } diff --git a/modules/regex/register_types.h b/modules/regex/register_types.h index 99a6bbeb2c..cf377cdf5f 100644 --- a/modules/regex/register_types.h +++ b/modules/regex/register_types.h @@ -28,5 +28,10 @@  /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.                */  /*************************************************************************/ +#ifndef REGEX_REGISTER_TYPES_H +#define REGEX_REGISTER_TYPES_H +  void register_regex_types();  void unregister_regex_types(); + +#endif // REGEX_REGISTER_TYPES_H |