From 6afe08736455650e07a6bc234c20d34a1ca3ffcf Mon Sep 17 00:00:00 2001 From: nyamatongwe Date: Tue, 6 Sep 2005 22:16:37 +0000 Subject: Added highlighting for decorators and a set of identifiers. --- src/LexPython.cxx | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'src/LexPython.cxx') 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 }; -- cgit v1.2.3