diff options
| author | nyamatongwe <unknown> | 2011-04-16 15:04:59 +1000 | 
|---|---|---|
| committer | nyamatongwe <unknown> | 2011-04-16 15:04:59 +1000 | 
| commit | 2dcc31216c9b6a3bc8660829e6f589875527ed8f (patch) | |
| tree | d93a8bfd6711c8688b045b35d8c70d62e11f3559 /lexers/LexPython.cxx | |
| parent | d6f98958d5c32e19a7924883a4bf8cc4fad4282e (diff) | |
| download | scintilla-mirror-2dcc31216c9b6a3bc8660829e6f589875527ed8f.tar.gz | |
Support cython cpdef keyword. Bug #3279728.
From Stephan R.A. Deibel.
Diffstat (limited to 'lexers/LexPython.cxx')
| -rw-r--r-- | lexers/LexPython.cxx | 14 | 
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;  		} | 
