diff options
-rw-r--r-- | include/SciLexer.h | 2 | ||||
-rw-r--r-- | include/Scintilla.iface | 2 | ||||
-rw-r--r-- | src/LexPython.cxx | 14 |
3 files changed, 15 insertions, 3 deletions
diff --git a/include/SciLexer.h b/include/SciLexer.h index 3d8bd277e..5d52de6c4 100644 --- a/include/SciLexer.h +++ b/include/SciLexer.h @@ -103,6 +103,8 @@ #define SCE_P_IDENTIFIER 11 #define SCE_P_COMMENTBLOCK 12 #define SCE_P_STRINGEOL 13 +#define SCE_P_WORD2 14 +#define SCE_P_DECORATOR 15 #define SCE_C_DEFAULT 0 #define SCE_C_COMMENT 1 #define SCE_C_COMMENTLINE 2 diff --git a/include/Scintilla.iface b/include/Scintilla.iface index 652d45858..d1e63b07e 100644 --- a/include/Scintilla.iface +++ b/include/Scintilla.iface @@ -1826,6 +1826,8 @@ val SCE_P_OPERATOR=10 val SCE_P_IDENTIFIER=11 val SCE_P_COMMENTBLOCK=12 val SCE_P_STRINGEOL=13 +val SCE_P_WORD2=14 +val SCE_P_DECORATOR=15 # Lexical states for SCLEX_CPP lex Cpp=SCLEX_CPP SCE_C_ lex Pascal=SCLEX_PASCAL SCE_C_ diff --git a/src/LexPython.cxx b/src/LexPython.cxx index e13c6220d..c1397b791 100644 --- a/src/LexPython.cxx +++ b/src/LexPython.cxx @@ -109,6 +109,7 @@ static void ColourisePyDoc(unsigned int startPos, int length, int initStyle, } WordList &keywords = *keywordlists[0]; + WordList &keywords2 = *keywordlists[1]; const int whingeLevel = styler.GetPropertyInt("tab.timmy.whinge.level"); @@ -186,6 +187,8 @@ static void ColourisePyDoc(unsigned int startPos, int length, int initStyle, style = SCE_P_CLASSNAME; } else if (kwLast == kwDef) { style = SCE_P_DEFNAME; + } else if (keywords2.InList(s)) { + style = SCE_P_WORD2; } sc.ChangeState(style); sc.SetState(SCE_P_DEFAULT); @@ -198,9 +201,7 @@ static void ColourisePyDoc(unsigned int startPos, int length, int initStyle, kwLast = kwImport; else kwLast = kwOther; - } else if (style == SCE_P_CLASSNAME) { - kwLast = kwOther; - } else if (style == SCE_P_DEFNAME) { + } else { kwLast = kwOther; } } @@ -208,6 +209,10 @@ static void ColourisePyDoc(unsigned int startPos, int length, int initStyle, if (sc.ch == '\r' || sc.ch == '\n') { sc.SetState(SCE_P_DEFAULT); } + } else if (sc.state == SCE_P_DECORATOR) { + if (sc.ch == '\r' || sc.ch == '\n') { + sc.SetState(SCE_P_DEFAULT); + } } else if ((sc.state == SCE_P_STRING) || (sc.state == SCE_P_CHARACTER)) { if (sc.ch == '\\') { if ((sc.chNext == '\r') && (sc.GetRelative(2) == '\n')) { @@ -262,6 +267,8 @@ static void ColourisePyDoc(unsigned int startPos, int length, int initStyle, sc.SetState(SCE_P_OPERATOR); } else if (sc.ch == '#') { sc.SetState(sc.chNext == '#' ? SCE_P_COMMENTBLOCK : SCE_P_COMMENTLINE); + } else if (sc.ch == '@') { + sc.SetState(SCE_P_DECORATOR); } else if (IsPyStringStart(sc.ch, sc.chNext, sc.GetRelative(2))) { unsigned int nextIndex = 0; sc.SetState(GetPyStringState(styler, sc.currentPos, &nextIndex)); @@ -432,6 +439,7 @@ static void FoldPyDoc(unsigned int startPos, int length, int /*initStyle - unuse static const char * const pythonWordListDesc[] = { "Keywords", + "Highlighted identifiers", 0 }; |