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 | 64afc0151aa4af657635f8d04ff4ba988a95e4be (patch) | |
tree | 9580bf5383a083f151435cd2fb9b80815721e18a /lexers/LexRuby.cxx | |
parent | 2a32bdcc5e67b568516e9016b9f787510483a500 (diff) | |
download | scintilla-mirror-64afc0151aa4af657635f8d04ff4ba988a95e4be.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); |