Fix ruby true/false detection bug

This commit is contained in:
2026-01-18 13:23:54 +00:00
parent c8db7b14a3
commit c9324c13aa
3 changed files with 5 additions and 5 deletions

View File

@@ -801,15 +801,15 @@ std::shared_ptr<void> ruby_parse(std::vector<Token> *tokens,
} else {
uint32_t start = i;
if (i + 3 < len && text[i] == 't' && text[i + 1] == 'r' &&
text[i + 2] == 'u' && text[i + 3] == 'e' && i + 4 < len &&
!identifier_char(text[i + 4])) {
text[i + 2] == 'u' && text[i + 3] == 'e' &&
((i + 4 < len && !identifier_char(text[i + 4])) || i + 4 == len)) {
i += 4;
tokens->push_back({start, i, TokenKind::True});
continue;
}
if (i + 4 < len && text[i] == 'f' && text[i + 1] == 'a' &&
text[i + 2] == 'l' && text[i + 3] == 's' && text[i + 4] == 'e' &&
i + 5 < len && !identifier_char(text[i + 5])) {
((i + 5 < len && !identifier_char(text[i + 5])) || i + 5 == len)) {
i += 5;
tokens->push_back({start, i, TokenKind::False});
continue;