Cleanup and move char functions to the char_utils.h header.

This commit is contained in:
bruvzg 2022-02-04 10:32:20 +02:00
parent 2a3c4f00c8
commit 244db37508
No known key found for this signature in database
GPG key ID: 7960FCF39844EC38
41 changed files with 250 additions and 327 deletions

View file

@ -227,7 +227,7 @@ class GetClassAndNamespace {
return TK_SYMBOL;
}
if (code[idx] == '-' || (code[idx] >= '0' && code[idx] <= '9')) {
if (code[idx] == '-' || is_digit(code[idx])) {
//a number
const char32_t *rptr;
double number = String::to_float(&code[idx], &rptr);
@ -235,10 +235,10 @@ class GetClassAndNamespace {
value = number;
return TK_NUMBER;
} else if ((code[idx] >= 'A' && code[idx] <= 'Z') || (code[idx] >= 'a' && code[idx] <= 'z') || code[idx] > 127) {
} else if (is_ascii_char(code[idx]) || code[idx] > 127) {
String id;
while ((code[idx] >= 'A' && code[idx] <= 'Z') || (code[idx] >= 'a' && code[idx] <= 'z') || code[idx] > 127) {
while (is_ascii_char(code[idx]) || code[idx] > 127) {
id += code[idx];
idx++;
}