diff options
author | bruvzg <7645683+bruvzg@users.noreply.github.com> | 2021-10-18 15:07:11 +0300 |
---|---|---|
committer | bruvzg <7645683+bruvzg@users.noreply.github.com> | 2022-08-02 08:30:20 +0300 |
commit | 5aa48b6ae5f44f16b3bf62c7c1c3501295132142 (patch) | |
tree | b3c14c8621d4dfd82d8c3df84962ed31a43df9ae /servers/text | |
parent | de53e91b856aba0e0ac100707376c8de9f50b4d1 (diff) |
[TextServer] Implement ICU/UAX 31 based `is_valid_identifier` function.
Diffstat (limited to 'servers/text')
-rw-r--r-- | servers/text/text_server_extension.cpp | 9 | ||||
-rw-r--r-- | servers/text/text_server_extension.h | 3 |
2 files changed, 12 insertions, 0 deletions
diff --git a/servers/text/text_server_extension.cpp b/servers/text/text_server_extension.cpp index 47598abce7..c2387be80d 100644 --- a/servers/text/text_server_extension.cpp +++ b/servers/text/text_server_extension.cpp @@ -297,6 +297,7 @@ void TextServerExtension::_bind_methods() { GDVIRTUAL_BIND(percent_sign, "language"); GDVIRTUAL_BIND(strip_diacritics, "string"); + GDVIRTUAL_BIND(is_valid_identifier, "string"); GDVIRTUAL_BIND(string_get_word_breaks, "string", "language"); @@ -1498,6 +1499,14 @@ String TextServerExtension::percent_sign(const String &p_language) const { return "%"; } +bool TextServerExtension::is_valid_identifier(const String &p_string) const { + bool ret; + if (GDVIRTUAL_CALL(is_valid_identifier, p_string, ret)) { + return ret; + } + return TextServer::is_valid_identifier(p_string); +} + String TextServerExtension::strip_diacritics(const String &p_string) const { String ret; if (GDVIRTUAL_CALL(strip_diacritics, p_string, ret)) { diff --git a/servers/text/text_server_extension.h b/servers/text/text_server_extension.h index 571753ea67..3814e2ad88 100644 --- a/servers/text/text_server_extension.h +++ b/servers/text/text_server_extension.h @@ -496,6 +496,9 @@ public: virtual PackedInt32Array string_get_word_breaks(const String &p_string, const String &p_language = "") const override; GDVIRTUAL2RC(PackedInt32Array, string_get_word_breaks, const String &, const String &); + virtual bool is_valid_identifier(const String &p_string) const override; + GDVIRTUAL1RC(bool, is_valid_identifier, const String &); + virtual String string_to_upper(const String &p_string, const String &p_language = "") const override; virtual String string_to_lower(const String &p_string, const String &p_language = "") const override; GDVIRTUAL2RC(String, string_to_upper, const String &, const String &); |