From 8b99f2cfdd7ed2274afa7bf003850ce4213cbfd3 Mon Sep 17 00:00:00 2001 From: Jad Altahan Date: Tue, 29 Jan 2019 09:18:07 +1100 Subject: Feature [feature-requests:#1260]. Fix inconsistency with dot styling in Nim. --- lexers/LexNim.cxx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'lexers') diff --git a/lexers/LexNim.cxx b/lexers/LexNim.cxx index 109b3547b..228666b32 100644 --- a/lexers/LexNim.cxx +++ b/lexers/LexNim.cxx @@ -424,13 +424,17 @@ void SCI_METHOD LexerNim::Lex(Sci_PositionU startPos, Sci_Position length, sc.SetState(SCE_NIM_DEFAULT); break; case SCE_NIM_IDENTIFIER: - if (!IsAWordChar(sc.ch)) { + if (sc.ch == '.' || !IsAWordChar(sc.ch)) { char s[100]; sc.GetCurrent(s, sizeof(s)); int style = SCE_NIM_IDENTIFIER; if (keywords.InList(s) && !funcNameExists) { - style = SCE_NIM_WORD; + // Prevent styling keywords if they are sub-identifiers + Sci_Position segStart = styler.GetStartSegment() - 1; + if (segStart < 0 || styler.SafeGetCharAt(segStart, '\0') != '.') { + style = SCE_NIM_WORD; + } } else if (funcNameExists) { style = SCE_NIM_FUNCNAME; } -- cgit v1.2.3