From fede631dfa75dd8518bbde5b845a9da7d133ce24 Mon Sep 17 00:00:00 2001 From: Kein-Hong Man Date: Thu, 8 Mar 2018 07:54:20 +1100 Subject: Backport: Bug [#1952]. Match identifier chains with dots and colons. Backport of changeset 6475:8fb85a29591f. --- lexers/LexLua.cxx | 150 ++++++++++++++++++++++++++++++++++-------------------- 1 file changed, 94 insertions(+), 56 deletions(-) (limited to 'lexers') diff --git a/lexers/LexLua.cxx b/lexers/LexLua.cxx index b4a18b3ee..9e6e8a70c 100644 --- a/lexers/LexLua.cxx +++ b/lexers/LexLua.cxx @@ -14,6 +14,8 @@ #include #include +#include + #include "ILexer.h" #include "Scintilla.h" #include "SciLexer.h" @@ -82,6 +84,12 @@ static void ColouriseLuaDoc( stringWs = lineState & 0x100; } + // results of identifier/keyword matching + Sci_Position idenPos = 0; + Sci_Position idenWordPos = 0; + int idenStyle = SCE_LUA_IDENTIFIER; + bool foundGoto = false; + // Do not leak onto next line if (initStyle == SCE_LUA_STRINGEOL || initStyle == SCE_LUA_COMMENTLINE || initStyle == SCE_LUA_PREPROCESSOR) { initStyle = SCE_LUA_DEFAULT; @@ -177,40 +185,32 @@ static void ColouriseLuaDoc( sc.SetState(SCE_LUA_DEFAULT); } } else if (sc.state == SCE_LUA_IDENTIFIER) { - if (!(setWord.Contains(sc.ch) || sc.ch == '.') || sc.Match('.', '.')) { - char s[100]; - sc.GetCurrent(s, sizeof(s)); - if (keywords.InList(s)) { - sc.ChangeState(SCE_LUA_WORD); - if (strcmp(s, "goto") == 0) { // goto