aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--doc/ScintillaHistory.html4
-rw-r--r--lexers/LexBash.cxx17
2 files changed, 19 insertions, 2 deletions
diff --git a/doc/ScintillaHistory.html b/doc/ScintillaHistory.html
index 925f7f5dc..d2a1073e0 100644
--- a/doc/ScintillaHistory.html
+++ b/doc/ScintillaHistory.html
@@ -541,6 +541,10 @@
Updated case conversion and character categories to Unicode 9.
</li>
<li>
+ The Bash lexer recognizes strings in lists in more cases.
+ <a href="http://sourceforge.net/p/scintilla/bugs/1944/">Bug #1944</a>.
+ </li>
+ <li>
The Fortran lexer recognizes a preprocessor line after a line continuation &amp;.
<a href="http://sourceforge.net/p/scintilla/bugs/1935/">Bug #1935</a>.
</li>
diff --git a/lexers/LexBash.cxx b/lexers/LexBash.cxx
index af8507d7d..9c02c2897 100644
--- a/lexers/LexBash.cxx
+++ b/lexers/LexBash.cxx
@@ -97,13 +97,26 @@ static int opposite(int ch) {
}
static int GlobScan(StyleContext &sc) {
- // forward scan for a glob-like (...), no whitespace allowed
+ // forward scan for zsh globs, disambiguate versus bash arrays
+ // complex expressions may still fail, e.g. unbalanced () '' "" etc
int c, sLen = 0;
+ int pCount = 0;
+ int hash = 0;
while ((c = sc.GetRelativeCharacter(++sLen)) != 0) {
if (IsASpace(c)) {
return 0;
+ } else if (c == '\'' || c == '\"') {
+ if (hash != 2) return 0;
+ } else if (c == '#' && hash == 0) {
+ hash = (sLen == 1) ? 2:1;
+ } else if (c == '(') {
+ pCount++;
} else if (c == ')') {
- return sLen;
+ if (pCount == 0) {
+ if (hash) return sLen;
+ return 0;
+ }
+ pCount--;
}
}
return 0;