aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorKein-Hong Man <devnull@localhost>2015-12-28 10:50:34 +1100
committerKein-Hong Man <devnull@localhost>2015-12-28 10:50:34 +1100
commitbd9dd03e8e5227d12c0a2b396e089b9063752d44 (patch)
treee2feb59046087a2096d02f937f3124854995db7f
parenta25aed5764217e2b2834ad776413b4db3778ffa4 (diff)
downloadscintilla-mirror-bd9dd03e8e5227d12c0a2b396e089b9063752d44.tar.gz
Bug [#1778]. Recognize more characters as here-doc delimiters.
-rw-r--r--doc/ScintillaHistory.html4
-rw-r--r--lexers/LexBash.cxx15
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 {