Skip to content

Commit

Permalink
Merge pull request #90931 from aaronfranke/is-ascii-alphabet-char
Browse files Browse the repository at this point in the history
Rename internal `is_ascii_char` to `is_ascii_alphabet_char`
  • Loading branch information
akien-mga committed Apr 22, 2024
2 parents 8931a3e + b1f5e9f commit 659cf33
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions core/io/json.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -344,10 +344,10 @@ Error JSON::_get_token(const char32_t *p_str, int &index, int p_len, Token &r_to
r_token.value = number;
return OK;

} else if (is_ascii_char(p_str[index])) {
} else if (is_ascii_alphabet_char(p_str[index])) {
String id;

while (is_ascii_char(p_str[index])) {
while (is_ascii_alphabet_char(p_str[index])) {
id += p_str[index];
index++;
}
Expand Down
2 changes: 1 addition & 1 deletion core/string/char_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ static _FORCE_INLINE_ bool is_binary_digit(char32_t c) {
return (c == '0' || c == '1');
}

static _FORCE_INLINE_ bool is_ascii_char(char32_t c) {
static _FORCE_INLINE_ bool is_ascii_alphabet_char(char32_t c) {
return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z');
}

Expand Down
2 changes: 1 addition & 1 deletion core/string/translation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -993,7 +993,7 @@ String TranslationServer::add_padding(const String &p_message, int p_length) con
}

const char32_t *TranslationServer::get_accented_version(char32_t p_character) const {
if (!is_ascii_char(p_character)) {
if (!is_ascii_alphabet_char(p_character)) {
return nullptr;
}

Expand Down
4 changes: 2 additions & 2 deletions core/variant/variant_parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -489,11 +489,11 @@ Error VariantParser::get_token(Stream *p_stream, Token &r_token, int &line, Stri
r_token.value = num.as_int();
}
return OK;
} else if (is_ascii_char(cchar) || is_underscore(cchar)) {
} else if (is_ascii_alphabet_char(cchar) || is_underscore(cchar)) {
StringBuffer<> id;
bool first = true;

while (is_ascii_char(cchar) || is_underscore(cchar) || (!first && is_digit(cchar))) {
while (is_ascii_alphabet_char(cchar) || is_underscore(cchar) || (!first && is_digit(cchar))) {
id += cchar;
cchar = p_stream->get_char();
first = false;
Expand Down
2 changes: 1 addition & 1 deletion scene/gui/text_edit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1187,7 +1187,7 @@ void TextEdit::_notification(int p_what) {
}

if (!clipped && lookup_symbol_word.length() != 0) { // Highlight word
if (is_ascii_char(lookup_symbol_word[0]) || lookup_symbol_word[0] == '_' || lookup_symbol_word[0] == '.') {
if (is_ascii_alphabet_char(lookup_symbol_word[0]) || lookup_symbol_word[0] == '_' || lookup_symbol_word[0] == '.') {
int lookup_symbol_word_col = _get_column_pos_of_word(lookup_symbol_word, str, SEARCH_MATCH_CASE | SEARCH_WHOLE_WORDS, 0);
int lookup_symbol_word_len = lookup_symbol_word.length();
while (lookup_symbol_word_col != -1) {
Expand Down
2 changes: 1 addition & 1 deletion scene/resources/syntax_highlighter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ Dictionary CodeHighlighter::_get_line_syntax_highlighting_impl(int p_line) {
}
}

if (!in_word && (is_ascii_char(str[j]) || is_underscore(str[j])) && !is_number) {
if (!in_word && (is_ascii_alphabet_char(str[j]) || is_underscore(str[j])) && !is_number) {
in_word = true;
}

Expand Down
4 changes: 2 additions & 2 deletions scene/resources/visual_shader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1463,7 +1463,7 @@ String VisualShader::validate_port_name(const String &p_port_name, VisualShaderN
return String();
}

while (port_name.length() && !is_ascii_char(port_name[0])) {
while (port_name.length() && !is_ascii_alphabet_char(port_name[0])) {
port_name = port_name.substr(1, port_name.length() - 1);
}

Expand Down Expand Up @@ -1508,7 +1508,7 @@ String VisualShader::validate_port_name(const String &p_port_name, VisualShaderN

String VisualShader::validate_parameter_name(const String &p_name, const Ref<VisualShaderNodeParameter> &p_parameter) const {
String param_name = p_name; //validate name first
while (param_name.length() && !is_ascii_char(param_name[0])) {
while (param_name.length() && !is_ascii_alphabet_char(param_name[0])) {
param_name = param_name.substr(1, param_name.length() - 1);
}
if (!param_name.is_empty()) {
Expand Down

0 comments on commit 659cf33

Please sign in to comment.