Browse Source

[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
remotes/trunk
Don Ho 14 years ago
parent
commit
c1ff1bfafb
  1. 16
      scintilla/lexers/LexObjC.cxx
  2. 8
      scintilla/lexers/LexSearchResult.cxx
  3. 43
      scintilla/lexers/LexUser.cxx

16
scintilla/lexers/LexObjC.cxx

@ -11,13 +11,17 @@
#include <ctype.h>
#include <stdio.h>
#include <stdarg.h>
#include <assert.h>
#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 == '<' ||

8
scintilla/lexers/LexSearchResult.cxx

@ -25,14 +25,18 @@
#include <stdio.h>
#include <stdarg.h>
#include <vector>
#include <assert.h>
#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 };

43
scintilla/lexers/LexUser.cxx

@ -21,25 +21,33 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#include <ctype.h>
#include <stdio.h>
#include <stdarg.h>
#include <assert.h>
#include <windows.h>
#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<void*>(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++;
}

Loading…
Cancel
Save