Skip to content

Commit

Permalink
[Ruby] Fix potential bug for heredoc highlighting.
Browse files Browse the repository at this point in the history
  • Loading branch information
zufuliu committed Jan 1, 2025
1 parent a03703c commit 68c7b56
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions scintilla/lexers/LexRuby.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,7 @@ bool sureThisIsHeredoc(Sci_Position iPrev, LexAccessor &styler, char *prevWord)
switch (prevStyle) {
case SCE_RB_WORD:
case SCE_RB_WORD_DEMOTED:
//case SCE_RB_IDENTIFIER:
break;
default:
return true;
Expand Down Expand Up @@ -472,11 +473,9 @@ bool sureThisIsNotHeredoc(Sci_Position lt2StartPos, LexAccessor &styler) {
}
int prevStyle = styler.StyleAt(firstWordPosn);
// If we have '<<' following a keyword, it's not a heredoc
if (prevStyle != SCE_RB_IDENTIFIER
if (!IsIdentifierStyle(prevStyle)
&& prevStyle != SCE_RB_GLOBAL // $stdout and $stderr
&& prevStyle != SCE_RB_BUILTIN_FUNCTION
&& prevStyle != SCE_RB_LIKE_MODULE // module::method
&& prevStyle != SCE_RB_LIKE_CLASS // class::method
//&& prevStyle != SCE_RB_SYMBOL
&& prevStyle != SCE_RB_INSTANCE_VAR
&& prevStyle != SCE_RB_CLASS_VAR) {
return definitely_not_a_here_doc;
Expand Down

0 comments on commit 68c7b56

Please sign in to comment.