diff options
author | Neil <nyamatongwe@gmail.com> | 2017-03-23 17:49:50 +1100 |
---|---|---|
committer | Neil <nyamatongwe@gmail.com> | 2017-03-23 17:49:50 +1100 |
commit | 40468d40088ea0657d8046747a69c9e99821a403 (patch) | |
tree | 90461250a824f81b38a19aac3176b8911b422d9a /lexers/LexPython.cxx | |
parent | 54012e88adcb0fa83afdd1626aab55066c2e8247 (diff) | |
download | scintilla-mirror-40468d40088ea0657d8046747a69c9e99821a403.tar.gz |
The Python lexer recognizes identifiers more accurately when they include
non-ASCII characters.
Calls provided for determining whether characters are in the sets defined for
identifiers by the Unicode standard in UAX #31.
Diffstat (limited to 'lexers/LexPython.cxx')
-rw-r--r-- | lexers/LexPython.cxx | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/lexers/LexPython.cxx b/lexers/LexPython.cxx index f667cb32c..62ed83c95 100644 --- a/lexers/LexPython.cxx +++ b/lexers/LexPython.cxx @@ -192,11 +192,8 @@ inline bool IsAWordChar(int ch, bool unicodeIdentifiers) { if (!unicodeIdentifiers) return false; - // Approximation, Python uses the XID_Continue set from unicode data - // see http://unicode.org/reports/tr31/ - CharacterCategory c = CategoriseCharacter(ch); - return (c == ccLl || c == ccLu || c == ccLt || c == ccLm || c == ccLo - || c == ccNl || c == ccMn || c == ccMc || c == ccNd || c == ccPc); + // Python uses the XID_Continue set from unicode data + return IsXidContinue(ch); } inline bool IsAWordStart(int ch, bool unicodeIdentifiers) { @@ -206,11 +203,8 @@ inline bool IsAWordStart(int ch, bool unicodeIdentifiers) { if (!unicodeIdentifiers) return false; - // Approximation, Python uses the XID_Start set from unicode data - // see http://unicode.org/reports/tr31/ - CharacterCategory c = CategoriseCharacter(ch); - return (c == ccLl || c == ccLu || c == ccLt || c == ccLm || c == ccLo - || c == ccNl); + // Python uses the XID_Start set from unicode data + return IsXidStart(ch); } static bool IsFirstNonWhitespace(Sci_Position pos, Accessor &styler) { |