diff --git a/samples/ruby.rb b/samples/ruby.rb index bbeefe8..ba42f46 100644 --- a/samples/ruby.rb +++ b/samples/ruby.rb @@ -43,7 +43,7 @@ UNINITCORE = %{ # Unicode identifiers (valid in Ruby) 变量 = 0x5_4eddaee -π = 3.14_159e+2, ?\u0234, ?\,, ?\x0A, ?s +π = 3.14_159e+2, ?\u0234, ?\,, ?\x0A, ?s, trued, falsess 挨拶 = -> { "こんに \n ちは" } # Method using unicode variable names diff --git a/src/syntax/bash.cc b/src/syntax/bash.cc index e7ce9e3..c36f504 100644 --- a/src/syntax/bash.cc +++ b/src/syntax/bash.cc @@ -65,7 +65,6 @@ std::shared_ptr bash_parse(std::vector *tokens, len--; if (len == 0) return state; - bool heredoc_first = false; while (i < len) { i += utf8_codepoint_width(text[i]); } diff --git a/src/syntax/ruby.cc b/src/syntax/ruby.cc index a67672e..ca7359c 100644 --- a/src/syntax/ruby.cc +++ b/src/syntax/ruby.cc @@ -800,14 +800,16 @@ std::shared_ptr ruby_parse(std::vector *tokens, continue; } else { uint32_t start = i; - if (i + 4 < len && text[i] == 't' && text[i + 1] == 'r' && - text[i + 2] == 'u' && text[i + 3] == 'e') { + 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])) { i += 4; tokens->push_back({start, i, TokenKind::True}); continue; } - if (i + 5 < len && text[i] == 'f' && text[i + 1] == 'a' && - text[i + 2] == 'l' && text[i + 3] == 's' && text[i + 4] == 'e') { + 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; tokens->push_back({start, i, TokenKind::False}); continue; diff --git a/themes/default.json b/themes/default.json index 36e6b83..09a49c2 100644 --- a/themes/default.json +++ b/themes/default.json @@ -22,10 +22,10 @@ "fg": "#E6C08A" }, "True": { - "fg": "#0FFF0F" + "fg": "#7AE93C" }, "False": { - "fg": "#FF0F0F" + "fg": "#F03138" }, "Char": { "fg": "#FFAF70"