diff options
author | Kein-Hong Man <unknown> | 2017-05-08 08:30:18 +1000 |
---|---|---|
committer | Kein-Hong Man <unknown> | 2017-05-08 08:30:18 +1000 |
commit | e42c4cfeda5fe1a71f8402cf8f64704c976ee8ba (patch) | |
tree | 1db1d8d84bb6266d0f1836316303f34142baeecd /lexers/LexBash.cxx | |
parent | 0d54ce0341ead232ec9c924bb6cee9bebf56c1f9 (diff) | |
download | scintilla-mirror-e42c4cfeda5fe1a71f8402cf8f64704c976ee8ba.tar.gz |
Bug [#1944]. Recognize strings in lists in more cases.
Diffstat (limited to 'lexers/LexBash.cxx')
-rw-r--r-- | lexers/LexBash.cxx | 17 |
1 files changed, 15 insertions, 2 deletions
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; |