diff options
author | kudah <kudahkukarek@gmail.com> | 2013-07-01 14:05:04 +0300 |
---|---|---|
committer | kudah <kudahkukarek@gmail.com> | 2013-07-01 14:05:04 +0300 |
commit | 57aa2535f4e1bebfdfe70b598584e06fb19c4559 (patch) | |
tree | 19d7b510be1ae94b2683493ff5f060961c255e00 /lexers/LexHaskell.cxx | |
parent | 4a08fd279fe42115008009938aac616e2663b208 (diff) | |
download | scintilla-mirror-57aa2535f4e1bebfdfe70b598584e06fb19c4559.tar.gz |
Use CharacterCategory
Diffstat (limited to 'lexers/LexHaskell.cxx')
-rw-r--r-- | lexers/LexHaskell.cxx | 37 |
1 files changed, 17 insertions, 20 deletions
diff --git a/lexers/LexHaskell.cxx b/lexers/LexHaskell.cxx index 9b4ad14e9..e10cb8c81 100644 --- a/lexers/LexHaskell.cxx +++ b/lexers/LexHaskell.cxx @@ -40,40 +40,37 @@ #include "CharacterSet.h" #include "LexerModule.h" #include "OptionSet.h" +#include "CharacterCategory.h" #ifdef SCI_NAMESPACE using namespace Scintilla; #endif -static int u_iswalpha(int); -static int u_iswalnum(int); -static int u_iswupper(int); -static int u_IsHaskellSymbol(int); +// See https://github.com/ghc/ghc/blob/master/compiler/parser/Lexer.x#L1682 +// Note, letter modifiers are prohibited. -// #define HASKELL_UNICODE - -#ifndef HASKELL_UNICODE - -// Stubs - -static int u_iswalpha(int) { - return 0; +static int u_iswupper (int ch) { + CharacterCategory c = CategoriseCharacter(ch); + return c == ccLu || c == ccLt; } -static int u_iswalnum(int) { - return 0; +static int u_iswalpha (int ch) { + CharacterCategory c = CategoriseCharacter(ch); + return c == ccLl || c == ccLu || c == ccLt || c == ccLo; } -static int u_iswupper(int) { - return 0; +static int u_iswalnum (int ch) { + CharacterCategory c = CategoriseCharacter(ch); + return c == ccLl || c == ccLu || c == ccLt || c == ccLo + || c == ccNd || c == ccNo; } -static int u_IsHaskellSymbol(int) { - return 0; +static int u_IsHaskellSymbol(int ch) { + CharacterCategory c = CategoriseCharacter(ch); + return c == ccPc || c == ccPd || c == ccPo + || c == ccSm || c == ccSc || c == ccSk || c == ccSo; } -#endif - static inline bool IsHaskellLetter(const int ch) { if (IsASCII(ch)) { return (ch >= 'a' && ch <= 'z') |