From 0d1d94400b292cc1bf1938fa1b4faf05db219ce0 Mon Sep 17 00:00:00 2001 From: Kein-Hong Man Date: Thu, 8 Mar 2018 07:54:20 +1100 Subject: Bug [#1952]. Match identifier chains with dots and colons. --- doc/ScintillaHistory.html | 4 ++ lexers/LexLua.cxx | 150 +++++++++++++++++++++++++++++----------------- 2 files changed, 98 insertions(+), 56 deletions(-) diff --git a/doc/ScintillaHistory.html b/doc/ScintillaHistory.html index 4605c993b..7379ab7b7 100644 --- a/doc/ScintillaHistory.html +++ b/doc/ScintillaHistory.html @@ -550,6 +550,10 @@ Bug #1999.
  • + Lua lexer matches identifier chains with dots and colons. + Bug #1952. +
  • +
  • For rectangular selections, pressing Home or End now moves the caret to the Home or End position instead of the limit of the rectangular selection.
  • 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