From c1ff1bfafb005dc58c17b16f872c900cbdcde8a7 Mon Sep 17 00:00:00 2001 From: Don Ho Date: Sun, 22 Aug 2010 02:20:44 +0000 Subject: [PATCH] [UPDATE] Adapt LexObjC LexSearchResult and LexUser to a new configuration. git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@654 f5eea248-9336-0410-98b8-ebc06183d4e3 --- scintilla/lexers/LexObjC.cxx | 16 +++++++++-- scintilla/lexers/LexSearchResult.cxx | 8 ++++-- scintilla/lexers/LexUser.cxx | 43 +++++++++++----------------- 3 files changed, 36 insertions(+), 31 deletions(-) diff --git a/scintilla/lexers/LexObjC.cxx b/scintilla/lexers/LexObjC.cxx index c3e84753e..eb36db7df 100644 --- a/scintilla/lexers/LexObjC.cxx +++ b/scintilla/lexers/LexObjC.cxx @@ -11,13 +11,17 @@ #include #include #include +#include #include "Platform.h" -#include "PropSet.h" +#include "ILexer.h" +#include "LexAccessor.h" #include "Accessor.h" #include "StyleContext.h" -#include "KeyWords.h" +#include "WordList.h" +#include "CharacterSet.h" +#include "LexerModule.h" #define INCLUDE_DEPRECATED_FEATURES #include "Scintilla.h" @@ -38,6 +42,14 @@ static inline bool IsAWordStart(const int ch) { return (ch < 0x80) && (isalnum(ch) || ch == '_'); } +inline bool IsASpace(unsigned int ch) { + return (ch == ' ') || ((ch >= 0x09) && (ch <= 0x0d)); +} + +static inline bool IsADigit(char ch) { + return isascii(ch) && isdigit(ch); +} + static inline bool IsADoxygenChar(const int ch) { return (islower(ch) || ch == '$' || ch == '@' || ch == '\\' || ch == '&' || ch == '<' || diff --git a/scintilla/lexers/LexSearchResult.cxx b/scintilla/lexers/LexSearchResult.cxx index 7244c1580..595702be5 100644 --- a/scintilla/lexers/LexSearchResult.cxx +++ b/scintilla/lexers/LexSearchResult.cxx @@ -25,14 +25,18 @@ #include #include #include +#include #include "Platform.h" -#include "PropSet.h" +#include "ILexer.h" +#include "LexAccessor.h" #include "Accessor.h" -#include "KeyWords.h" +#include "WordList.h" #include "Scintilla.h" #include "SciLexer.h" +#include "CharacterSet.h" +#include "LexerModule.h" // The following definitions are a copy of the ones in FindReplaceDlg.h static enum { searchHeaderLevel = SC_FOLDLEVELBASE + 1, fileHeaderLevel, resultLevel }; diff --git a/scintilla/lexers/LexUser.cxx b/scintilla/lexers/LexUser.cxx index 9ec6b2cdf..b16f9d75d 100644 --- a/scintilla/lexers/LexUser.cxx +++ b/scintilla/lexers/LexUser.cxx @@ -21,25 +21,33 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. #include #include #include +#include #include #include "Platform.h" -#include "PropSet.h" +#include "ILexer.h" +#include "LexAccessor.h" #include "Accessor.h" #include "StyleContext.h" -#include "KeyWords.h" +#include "WordList.h" #include "Scintilla.h" #include "SciLexer.h" #include "CharClassify.h" +#include "LexerModule.h" #define KEYWORD_BOXHEADER 1 #define KEYWORD_FOLDCONTRACTED 2 -/* -const char EOString = '\0'; -const char EOLine = '\n'; -const char EOWord = ' '; -*/ + + +static inline bool IsADigit(char ch) { + return isascii(ch) && isdigit(ch); +} + +static inline bool isspacechar(unsigned char ch) { + return (ch == ' ') || ((ch >= 0x09) && (ch <= 0x0d)); +} + static bool isInOpList(WordList & opList, char op) { for (int i = 0 ; i < opList.len ; i++) @@ -53,31 +61,12 @@ static int cmpString(const void *a1, const void *a2) { return strcmp(*(char**)(a1), *(char**)(a2)); } -/* -static int cmpStringNoCase(const void *a1, const void *a2) { - // Can't work out the correct incantation to use modern casts here - return CompareCaseInsensitive(*(char**)(a1), *(char**)(a2)); - -} -*/ static bool isInList(WordList & list, const char *s, bool specialMode, bool ignoreCase) { if (!list.words) return false; - if (!list.sorted) - { - list.sorted = true; - qsort(reinterpret_cast(list.words), list.len, sizeof(*list.words), cmpString); - - for (unsigned int k = 0; k < (sizeof(list.starts) / sizeof(list.starts[0])); k++) - list.starts[k] = -1; - for (int l = list.len - 1; l >= 0; l--) { - unsigned char indexChar = list.words[l][0]; - list.starts[indexChar] = l; - } - } unsigned char firstChar = s[0]; int j = list.starts[firstChar]; @@ -483,7 +472,7 @@ static void ColouriseUserDoc(unsigned int startPos, int length, int initStyle, W chPrevNonWhite = ' '; visibleChars = 0; } - if (!IsASpace(sc.ch)) { + if (!isspacechar(sc.ch)) { chPrevNonWhite = sc.ch; visibleChars++; }