diff options
author | Colomban Wendling <ban@herbesfolles.org> | 2012-09-14 20:06:50 +0200 |
---|---|---|
committer | Colomban Wendling <ban@herbesfolles.org> | 2012-09-14 20:06:50 +0200 |
commit | e131a540ead0500de45695d9793d3cc7edf2ecac (patch) | |
tree | 8ce868e12e7a4e116e0173487e682133a3b4a4cc /lexers/LexRuby.cxx | |
parent | 4d11ddd074a1d6107dfc2617f6bdf1024fa37de6 (diff) | |
download | scintilla-mirror-e131a540ead0500de45695d9793d3cc7edf2ecac.tar.gz |
Recognize Ruby HereDoc after an instance or class variable
This fixes highlighting HereDoc in constructs like this:
@foo.concat <<END
...
END
Diffstat (limited to 'lexers/LexRuby.cxx')
-rw-r--r-- | lexers/LexRuby.cxx | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lexers/LexRuby.cxx b/lexers/LexRuby.cxx index 22364c19c..40424aabd 100644 --- a/lexers/LexRuby.cxx +++ b/lexers/LexRuby.cxx @@ -465,7 +465,9 @@ static bool sureThisIsNotHeredoc(int lt2StartPos, } prevStyle = styler.StyleAt(firstWordPosn); // If we have '<<' following a keyword, it's not a heredoc - if (prevStyle != SCE_RB_IDENTIFIER) { + if (prevStyle != SCE_RB_IDENTIFIER + && prevStyle != SCE_RB_INSTANCE_VAR + && prevStyle != SCE_RB_CLASS_VAR) { return definitely_not_a_here_doc; } int newStyle = prevStyle; @@ -495,6 +497,9 @@ static bool sureThisIsNotHeredoc(int lt2StartPos, } else { break; } + // on second and next passes, only identifiers may appear since + // class and instance variable are private + prevStyle = SCE_RB_IDENTIFIER; } // Skip next batch of white-space firstWordPosn = skipWhitespace(firstWordPosn, lt2StartPos, styler); |