aboutsummaryrefslogtreecommitdiffhomepage
path: root/lexers/LexPython.cxx
diff options
context:
space:
mode:
authornyamatongwe <devnull@localhost>2011-04-16 15:04:59 +1000
committernyamatongwe <devnull@localhost>2011-04-16 15:04:59 +1000
commit0dd97ffe2248775107d3c031fa6c3920aa105b91 (patch)
tree4909808071927afd30c37de362b4e44146ad7c94 /lexers/LexPython.cxx
parent59766c7c201c45b3a6c6111e8e0ed4c40625e637 (diff)
downloadscintilla-mirror-0dd97ffe2248775107d3c031fa6c3920aa105b91.tar.gz
Support cython cpdef keyword. Bug #3279728.
From Stephan R.A. Deibel.
Diffstat (limited to 'lexers/LexPython.cxx')
-rw-r--r--lexers/LexPython.cxx14
1 files changed, 8 insertions, 6 deletions
diff --git a/lexers/LexPython.cxx b/lexers/LexPython.cxx
index 5020d71df..70db1ecd8 100644
--- a/lexers/LexPython.cxx
+++ b/lexers/LexPython.cxx
@@ -28,7 +28,7 @@ using namespace Scintilla;
#endif
/* kwCDef, kwCTypeName only used for Cython */
-enum kwType { kwOther, kwClass, kwDef, kwImport, kwCDef, kwCTypeName };
+enum kwType { kwOther, kwClass, kwDef, kwImport, kwCDef, kwCTypeName, kwCPDef };
static const int indicatorWhitespace = 1;
@@ -246,7 +246,7 @@ static void ColourisePyDoc(unsigned int startPos, int length, int initStyle,
style = SCE_P_CLASSNAME;
} else if (kwLast == kwDef) {
style = SCE_P_DEFNAME;
- } else if (kwLast == kwCDef) {
+ } else if (kwLast == kwCDef || kwLast == kwCPDef) {
int pos = sc.currentPos;
unsigned char ch = styler.SafeGetCharAt(pos, '\0');
while (ch != '\0') {
@@ -277,11 +277,13 @@ static void ColourisePyDoc(unsigned int startPos, int length, int initStyle,
kwLast = kwImport;
else if (0 == strcmp(s, "cdef"))
kwLast = kwCDef;
+ else if (0 == strcmp(s, "cpdef"))
+ kwLast = kwCPDef;
else if (0 == strcmp(s, "cimport"))
kwLast = kwImport;
- else if (kwLast != kwCDef)
+ else if (kwLast != kwCDef && kwLast != kwCPDef)
kwLast = kwOther;
- } else if (kwLast != kwCDef) {
+ } else if (kwLast != kwCDef && kwLast != kwCPDef) {
kwLast = kwOther;
}
}
@@ -337,8 +339,8 @@ static void ColourisePyDoc(unsigned int startPos, int length, int initStyle,
indentGood = true;
}
- // One cdef line, clear kwLast only at end of line
- if (kwLast == kwCDef && sc.atLineEnd) {
+ // One cdef or cpdef line, clear kwLast only at end of line
+ if ((kwLast == kwCDef || kwLast == kwCPDef) && sc.atLineEnd) {
kwLast = kwOther;
}