| 4596 | } |
| 4597 | |
| 4598 | bool String::is_valid_ascii_identifier() const { |
| 4599 | int len = length(); |
| 4600 | |
| 4601 | if (len == 0) { |
| 4602 | return false; |
| 4603 | } |
| 4604 | |
| 4605 | if (is_digit(operator[](0))) { |
| 4606 | return false; |
| 4607 | } |
| 4608 | |
| 4609 | const char32_t *str = &operator[](0); |
| 4610 | |
| 4611 | for (int i = 0; i < len; i++) { |
| 4612 | if (!is_ascii_identifier_char(str[i])) { |
| 4613 | return false; |
| 4614 | } |
| 4615 | } |
| 4616 | |
| 4617 | return true; |
| 4618 | } |
| 4619 | |
| 4620 | bool String::is_valid_unicode_identifier() const { |
| 4621 | const char32_t *str = ptr(); |