diff options
author | Colomban Wendling <ban@herbesfolles.org> | 2014-12-12 18:47:31 +0100 |
---|---|---|
committer | Colomban Wendling <ban@herbesfolles.org> | 2014-12-12 18:47:31 +0100 |
commit | 429d79de7fd686261eee74290bc20ed5ca813f19 (patch) | |
tree | b42ab7370fe7332c48c3fe6d7fdc65b825db5f0a | |
parent | 3f7e896fd12da8087f928fca963a13be510000b3 (diff) | |
download | scintilla-mirror-429d79de7fd686261eee74290bc20ed5ca813f19.tar.gz |
LexBash: Don't allow spaces between `<<` and `-` in a heredoc operator
`<<-` is an operator of itself, not two separate tokens `<<` and `-`.
This fixes handling of delimiters starting with `-`, like this:
cat<< -EOF
...
-EOF
-rw-r--r-- | lexers/LexBash.cxx | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/lexers/LexBash.cxx b/lexers/LexBash.cxx index 3ebba8911..0df343cd2 100644 --- a/lexers/LexBash.cxx +++ b/lexers/LexBash.cxx @@ -419,8 +419,6 @@ static void ColouriseBashDoc(unsigned int startPos, int length, int initStyle, sc.Forward(); HereDoc.Quoted = true; HereDoc.State = 1; - } else if (!HereDoc.Indent && sc.chNext == '-') { // <<- indent case - HereDoc.Indent = true; } else if (setHereDoc.Contains(sc.chNext)) { // an unquoted here-doc delimiter, no special handling // TODO check what exactly bash considers part of the delim @@ -672,7 +670,12 @@ static void ColouriseBashDoc(unsigned int startPos, int length, int initStyle, } else if (sc.Match('<', '<')) { sc.SetState(SCE_SH_HERE_DELIM); HereDoc.State = 0; - HereDoc.Indent = false; + if (sc.GetRelative(2) == '-') { // <<- indent case + HereDoc.Indent = true; + sc.Forward(); + } else { + HereDoc.Indent = false; + } } else if (sc.ch == '-' && // one-char file test operators setSingleCharOp.Contains(sc.chNext) && !setWord.Contains(sc.GetRelative(2)) && |