diff options
-rw-r--r-- | doc/ScintillaHistory.html | 4 | ||||
-rw-r--r-- | lexers/LexBash.cxx | 15 |
2 files changed, 11 insertions, 8 deletions
diff --git a/doc/ScintillaHistory.html b/doc/ScintillaHistory.html index e03a8b344..ee6e719a4 100644 --- a/doc/ScintillaHistory.html +++ b/doc/ScintillaHistory.html @@ -515,7 +515,9 @@ Bash lexer flags incomplete here doc delimiters as syntax errors. <a href="http://sourceforge.net/p/scintilla/bugs/1789/">Bug #1789</a>.<br /> Support added for using '#' in non-comment ways as is possible with zsh. - <a href="http://sourceforge.net/p/scintilla/bugs/1794/">Bug #1794</a>. + <a href="http://sourceforge.net/p/scintilla/bugs/1794/">Bug #1794</a>.<br /> + Recognize more characters as here-doc delimiters. + <a href="http://sourceforge.net/p/scintilla/bugs/1778/">Bug #1778</a>. </li> <li> Errorlist lexer highlights warning messages from the Microsoft linker. diff --git a/lexers/LexBash.cxx b/lexers/LexBash.cxx index 21a756120..af8507d7d 100644 --- a/lexers/LexBash.cxx +++ b/lexers/LexBash.cxx @@ -126,9 +126,9 @@ static void ColouriseBashDoc(Sci_PositionU startPos, Sci_Position length, int in CharacterSet setBashOperator(CharacterSet::setNone, "^&%()-+=|{}[]:;>,*/<?!.~@"); CharacterSet setSingleCharOp(CharacterSet::setNone, "rwxoRWXOezsfdlpSbctugkTBMACahGLNn"); CharacterSet setParam(CharacterSet::setAlphaNum, "$_"); - CharacterSet setHereDoc(CharacterSet::setAlpha, "_\\-+!"); - CharacterSet setHereDoc2(CharacterSet::setAlphaNum, "_-+!"); - CharacterSet setLeftShift(CharacterSet::setDigits, "=$"); + CharacterSet setHereDoc(CharacterSet::setAlpha, "_\\-+!%*,./:?@[]^`{}~"); + CharacterSet setHereDoc2(CharacterSet::setAlphaNum, "_-+!%*,./:=?@[]^`{}~"); + CharacterSet setLeftShift(CharacterSet::setDigits, "$"); class HereDocCls { // Class to manage HERE document elements public: @@ -426,17 +426,18 @@ static void ColouriseBashDoc(Sci_PositionU startPos, Sci_Position length, int in sc.Forward(); HereDoc.Quoted = true; HereDoc.State = 1; - } else if (setHereDoc.Contains(sc.chNext)) { + } else if (setHereDoc.Contains(sc.chNext) || + (sc.chNext == '=' && cmdState != BASH_CMD_ARITH)) { // an unquoted here-doc delimiter, no special handling - // TODO check what exactly bash considers part of the delim HereDoc.State = 1; } else if (sc.chNext == '<') { // HERE string <<< sc.Forward(); sc.ForwardSetState(SCE_SH_DEFAULT); } else if (IsASpace(sc.chNext)) { // eat whitespace - } else if (setLeftShift.Contains(sc.chNext)) { - // left shift << or <<= operator cases + } else if (setLeftShift.Contains(sc.chNext) || + (sc.chNext == '=' && cmdState == BASH_CMD_ARITH)) { + // left shift <<$var or <<= cases sc.ChangeState(SCE_SH_OPERATOR); sc.ForwardSetState(SCE_SH_DEFAULT); } else { |