Fix ruby true/false detection bug
This commit is contained in:
@@ -43,7 +43,7 @@ UNINITCORE = %{
|
|||||||
|
|
||||||
# Unicode identifiers (valid in Ruby)
|
# Unicode identifiers (valid in Ruby)
|
||||||
变量 = 0x5_4eddaee
|
变量 = 0x5_4eddaee
|
||||||
π = 3.14_159e+2, ?\u0234, ?\,, ?\x0A, ?s, trued, falsess
|
π = 3.14_159e+2, ?\u0234, ?\,, ?\x0A, ?s, true, false
|
||||||
挨拶 = -> { "こんに \n ちは" }
|
挨拶 = -> { "こんに \n ちは" }
|
||||||
|
|
||||||
# Method using unicode variable names
|
# Method using unicode variable names
|
||||||
|
|||||||
@@ -801,15 +801,15 @@ std::shared_ptr<void> ruby_parse(std::vector<Token> *tokens,
|
|||||||
} else {
|
} else {
|
||||||
uint32_t start = i;
|
uint32_t start = i;
|
||||||
if (i + 3 < len && text[i] == 't' && text[i + 1] == 'r' &&
|
if (i + 3 < len && text[i] == 't' && text[i + 1] == 'r' &&
|
||||||
text[i + 2] == 'u' && text[i + 3] == 'e' && i + 4 < len &&
|
text[i + 2] == 'u' && text[i + 3] == 'e' &&
|
||||||
!identifier_char(text[i + 4])) {
|
((i + 4 < len && !identifier_char(text[i + 4])) || i + 4 == len)) {
|
||||||
i += 4;
|
i += 4;
|
||||||
tokens->push_back({start, i, TokenKind::True});
|
tokens->push_back({start, i, TokenKind::True});
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (i + 4 < len && text[i] == 'f' && text[i + 1] == 'a' &&
|
if (i + 4 < len && text[i] == 'f' && text[i + 1] == 'a' &&
|
||||||
text[i + 2] == 'l' && text[i + 3] == 's' && text[i + 4] == 'e' &&
|
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;
|
i += 5;
|
||||||
tokens->push_back({start, i, TokenKind::False});
|
tokens->push_back({start, i, TokenKind::False});
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
@@ -25,7 +25,7 @@
|
|||||||
"fg": "#7AE93C"
|
"fg": "#7AE93C"
|
||||||
},
|
},
|
||||||
"False": {
|
"False": {
|
||||||
"fg": "#F03138"
|
"fg": "#EF5168"
|
||||||
},
|
},
|
||||||
"Char": {
|
"Char": {
|
||||||
"fg": "#FFAF70"
|
"fg": "#FFAF70"
|
||||||
|
|||||||
Reference in New Issue
Block a user