1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-04 12:00:25 +00:00

[TextServer] Implement ICU/UAX 31 based is_valid_identifier function.

This commit is contained in:
bruvzg
2021-10-18 15:07:11 +03:00
parent de53e91b85
commit 5aa48b6ae5
11 changed files with 1747 additions and 2 deletions

View File

@@ -33,6 +33,26 @@
#include "core/typedefs.h"
#include "char_range.inc"
static _FORCE_INLINE_ bool is_unicode_identifier_start(char32_t c) {
for (int i = 0; xid_start[i].start != 0; i++) {
if (c >= xid_start[i].start && c <= xid_start[i].end) {
return true;
}
}
return false;
}
static _FORCE_INLINE_ bool is_unicode_identifier_continue(char32_t c) {
for (int i = 0; xid_continue[i].start != 0; i++) {
if (c >= xid_continue[i].start && c <= xid_continue[i].end) {
return true;
}
}
return false;
}
static _FORCE_INLINE_ bool is_ascii_upper_case(char32_t c) {
return (c >= 'A' && c <= 'Z');
}