diff options
author | nyamatongwe <unknown> | 2013-06-26 23:40:28 +1000 |
---|---|---|
committer | nyamatongwe <unknown> | 2013-06-26 23:40:28 +1000 |
commit | 3bdd57848b1722d7c09c2f2ed4b970fc4b050328 (patch) | |
tree | 1833572435bb5aedffd6b1bc8cd518f8c45d3223 /lexers/LexLua.cxx | |
parent | e8455b88b163bce8cf739aeb7533cf1c518dd900 (diff) | |
download | scintilla-mirror-3bdd57848b1722d7c09c2f2ed4b970fc4b050328.tar.gz |
Simplify label handling code and avoid checking to end of line.
From Kein-Hong Man.
Diffstat (limited to 'lexers/LexLua.cxx')
-rw-r--r-- | lexers/LexLua.cxx | 27 |
1 files changed, 5 insertions, 22 deletions
diff --git a/lexers/LexLua.cxx b/lexers/LexLua.cxx index f0c3a5e57..62bb44dd1 100644 --- a/lexers/LexLua.cxx +++ b/lexers/LexLua.cxx @@ -132,39 +132,22 @@ static void ColouriseLuaDoc( if (sc.state == SCE_LUA_OPERATOR) { if (sc.ch == ':' && sc.chPrev == ':') { // :: <label> :: forward scan sc.Forward(); - int ln = 0, maxln = startPos + length - sc.currentPos; - int c; - while (ln < maxln) { // determine line extent - c = sc.GetRelative(ln); - if (c == '\r' || c == '\n') - break; - ln++; - } - maxln = ln; ln = 0; - while (ln < maxln) { // skip over spaces/tabs - if (!IsASpaceOrTab(sc.GetRelative(ln))) - break; + int ln = 0; + while (IsASpaceOrTab(sc.GetRelative(ln))) // skip over spaces/tabs ln++; - } int ws1 = ln; if (setWordStart.Contains(sc.GetRelative(ln))) { - int i = 0; + int c, i = 0; char s[100]; - while (ln < maxln) { // get potential label - c = sc.GetRelative(ln); - if (!setWord.Contains(c)) - break; + while (setWord.Contains(c = sc.GetRelative(ln))) { // get potential label if (i < 90) s[i++] = c; ln++; } s[i] = '\0'; int lbl = ln; if (!keywords.InList(s)) { - while (ln < maxln) { // skip over spaces/tabs - if (!IsASpaceOrTab(sc.GetRelative(ln))) - break; + while (IsASpaceOrTab(sc.GetRelative(ln))) // skip over spaces/tabs ln++; - } int ws2 = ln - lbl; if (sc.GetRelative(ln) == ':' && sc.GetRelative(ln + 1) == ':') { // final :: found, complete valid label construct |