aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authornyamatongwe <unknown>2005-09-06 22:16:37 +0000
committernyamatongwe <unknown>2005-09-06 22:16:37 +0000
commit6afe08736455650e07a6bc234c20d34a1ca3ffcf (patch)
treeb8e316110916666d4bfca6e77ebc324c6810ff6d /src
parentb27cf12446ea2680181b5f9c3bd9f3e8dffc888c (diff)
downloadscintilla-mirror-6afe08736455650e07a6bc234c20d34a1ca3ffcf.tar.gz
Added highlighting for decorators and a set of identifiers.
Diffstat (limited to 'src')
-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
};