aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/LexPython.cxx
diff options
context:
space:
mode:
authornyamatongwe <devnull@localhost>2005-09-06 22:16:37 +0000
committernyamatongwe <devnull@localhost>2005-09-06 22:16:37 +0000
commit8ddb6f303ba3729ab4a4723072e4c668c616c3c5 (patch)
treeb8e316110916666d4bfca6e77ebc324c6810ff6d /src/LexPython.cxx
parentc6a181a310a3193fed4969d178bc662cc483470e (diff)
downloadscintilla-mirror-8ddb6f303ba3729ab4a4723072e4c668c616c3c5.tar.gz
Added highlighting for decorators and a set of identifiers.
Diffstat (limited to 'src/LexPython.cxx')
-rw-r--r--src/LexPython.cxx14
1 files changed, 11 insertions, 3 deletions
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
};