aboutsummaryrefslogtreecommitdiffhomepage
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
parentb27cf12446ea2680181b5f9c3bd9f3e8dffc888c (diff)
downloadscintilla-mirror-6afe08736455650e07a6bc234c20d34a1ca3ffcf.tar.gz
Added highlighting for decorators and a set of identifiers.
-rw-r--r--include/SciLexer.h2
-rw-r--r--include/Scintilla.iface2
-rw-r--r--src/LexPython.cxx14
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
};