From c4a85cf68142ad8605d617beb0488428b6814153 Mon Sep 17 00:00:00 2001 From: Zufu Liu Date: Thu, 21 Nov 2019 15:22:19 +1100 Subject: Feature [feature-requests:#1326] Recognize squiggly heredocs. --- doc/ScintillaHistory.html | 4 ++++ lexers/LexRuby.cxx | 6 +++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/doc/ScintillaHistory.html b/doc/ScintillaHistory.html index a5c815628..8109018c1 100644 --- a/doc/ScintillaHistory.html +++ b/doc/ScintillaHistory.html @@ -593,6 +593,10 @@ Bug #1933.
  • + Ruby lexer recognizes squiggly heredocs. + Feature #1326. +
  • +
  • Avoid unnecessary IME caret movement on Win32. Feature #1304.
  • diff --git a/lexers/LexRuby.cxx b/lexers/LexRuby.cxx index 2affffe65..6f7c34404 100644 --- a/lexers/LexRuby.cxx +++ b/lexers/LexRuby.cxx @@ -562,7 +562,7 @@ static bool sureThisIsNotHeredoc(Sci_Position lt2StartPos, bool allow_indent; Sci_Position target_start, target_end; // From this point on no more styling, since we're looking ahead - if (styler[j] == '-') { + if (styler[j] == '-' || styler[j] == '~') { allow_indent = true; j++; } else { @@ -888,7 +888,7 @@ static void ColouriseRbDoc(Sci_PositionU startPos, Sci_Position length, int init chNext = chNext2; styler.ColourTo(i, SCE_RB_OPERATOR); - if (!(strchr("\"\'`_-", chNext2) || isSafeAlpha(chNext2))) { + if (!(strchr("\"\'`_-~", chNext2) || isSafeAlpha(chNext2))) { // It's definitely not a here-doc, // based on Ruby's lexer/parser in the // heredoc_identifier routine. @@ -1234,7 +1234,7 @@ static void ColouriseRbDoc(Sci_PositionU startPos, Sci_Position length, int init if (HereDoc.State == 0) { // '<<' encountered HereDoc.State = 1; HereDoc.DelimiterLength = 0; - if (ch == '-') { + if (ch == '-' || ch == '~') { HereDoc.CanBeIndented = true; advance_char(i, ch, chNext, chNext2); // pass by ref } else { -- cgit v1.2.3