diff options
author | XhmikosR <xhmikosr@users.sourceforge.net> | 2013-10-16 20:22:02 +0300 |
---|---|---|
committer | XhmikosR <xhmikosr@users.sourceforge.net> | 2013-10-16 20:22:02 +0300 |
commit | f7b100cc0440d628c742f18ca1052144cf330366 (patch) | |
tree | 825aed17228e9cc0511f78129fe422252a5dd066 /scintilla/lexlib | |
parent | 89d33e9accdf452ddb421b2967db26e3ebb52e06 (diff) | |
download | notepad2-mod-f7b100cc0440d628c742f18ca1052144cf330366.zip notepad2-mod-f7b100cc0440d628c742f18ca1052144cf330366.tar.gz notepad2-mod-f7b100cc0440d628c742f18ca1052144cf330366.tar.bz2 |
Update Scintilla to v3.3.6 [da3cbb]
Diffstat (limited to 'scintilla/lexlib')
-rw-r--r-- | scintilla/lexlib/StyleContext.h | 4 | ||||
-rw-r--r-- | scintilla/lexlib/SubStyles.h | 25 | ||||
-rw-r--r-- | scintilla/lexlib/WordList.cxx | 40 |
3 files changed, 43 insertions, 26 deletions
diff --git a/scintilla/lexlib/StyleContext.h b/scintilla/lexlib/StyleContext.h index abd69e9..7c4dbaf 100644 --- a/scintilla/lexlib/StyleContext.h +++ b/scintilla/lexlib/StyleContext.h @@ -172,11 +172,11 @@ public: }
int diffRelative = n - offsetRelative;
int posNew = multiByteAccess->GetRelativePosition(posRelative, diffRelative);
- int ch = multiByteAccess->GetCharacterAndWidth(posNew, 0);
+ int chReturn = multiByteAccess->GetCharacterAndWidth(posNew, 0);
posRelative = posNew;
currentPosLastRelative = currentPos;
offsetRelative = n;
- return ch;
+ return chReturn;
} else {
// fast version for single byte encodings
return static_cast<unsigned char>(styler.SafeGetCharAt(currentPos + n, 0));
diff --git a/scintilla/lexlib/SubStyles.h b/scintilla/lexlib/SubStyles.h index e6c34e0..961715c 100644 --- a/scintilla/lexlib/SubStyles.h +++ b/scintilla/lexlib/SubStyles.h @@ -13,13 +13,14 @@ namespace Scintilla { #endif class WordClassifier { + int baseStyle; int firstStyle; int lenStyles; std::map<std::string, int> wordToStyle; public: - WordClassifier() : firstStyle(0), lenStyles(0) { + WordClassifier(int baseStyle_) : baseStyle(baseStyle_), firstStyle(0), lenStyles(0) { } void Allocate(int firstStyle_, int lenStyles_) { @@ -28,6 +29,10 @@ public: wordToStyle.clear(); } + int Base() const { + return baseStyle; + } + int Start() const { return firstStyle; } @@ -57,10 +62,12 @@ public: void SetIdentifiers(int style, const char *identifiers) { while (*identifiers) { const char *cpSpace = identifiers; - while (*cpSpace && *cpSpace != ' ') + while (*cpSpace && !(*cpSpace == ' ' || *cpSpace == '\t' || *cpSpace == '\r' || *cpSpace == '\n')) cpSpace++; - std::string word(identifiers, cpSpace - identifiers); - wordToStyle[word] = style; + if (cpSpace > identifiers) { + std::string word(identifiers, cpSpace - identifiers); + wordToStyle[word] = style; + } identifiers = cpSpace; if (*identifiers) identifiers++; @@ -105,8 +112,8 @@ public: secondaryDistance(secondaryDistance_), allocated(0) { while (baseStyles[classifications]) { + classifiers.push_back(WordClassifier(baseStyles[classifications])); classifications++; - classifiers.push_back(WordClassifier()); } } @@ -134,6 +141,14 @@ public: return (block >= 0) ? classifiers[block].Length() : 0; } + int BaseStyle(int subStyle) const { + int block = BlockFromStyle(subStyle); + if (block >= 0) + return classifiers[block].Base(); + else + return subStyle; + } + int DistanceToSecondaryStyles() const { return secondaryDistance; } diff --git a/scintilla/lexlib/WordList.cxx b/scintilla/lexlib/WordList.cxx index 6dbc710..d3a3274 100644 --- a/scintilla/lexlib/WordList.cxx +++ b/scintilla/lexlib/WordList.cxx @@ -32,11 +32,11 @@ static char **ArrayFromWordList(char *wordlist, int *len, bool onlyLineEnds = fa for (int i=0; i<256; i++) {
wordSeparator[i] = false;
}
- wordSeparator['\r'] = true;
- wordSeparator['\n'] = true;
+ wordSeparator[static_cast<unsigned int>('\r')] = true;
+ wordSeparator[static_cast<unsigned int>('\n')] = true;
if (!onlyLineEnds) {
- wordSeparator[' '] = true;
- wordSeparator['\t'] = true;
+ wordSeparator[static_cast<unsigned int>(' ')] = true;
+ wordSeparator[static_cast<unsigned int>('\t')] = true;
}
for (int j = 0; wordlist[j]; j++) {
int curr = static_cast<unsigned char>(wordlist[j]);
@@ -45,22 +45,24 @@ static char **ArrayFromWordList(char *wordlist, int *len, bool onlyLineEnds = fa prev = curr;
}
char **keywords = new char *[words + 1];
- words = 0;
- prev = '\0';
- size_t slen = strlen(wordlist);
- for (size_t k = 0; k < slen; k++) {
- if (!wordSeparator[static_cast<unsigned char>(wordlist[k])]) {
- if (!prev) {
- keywords[words] = &wordlist[k];
- words++;
+ int wordsStore = 0;
+ const size_t slen = strlen(wordlist);
+ if (words) {
+ prev = '\0';
+ for (size_t k = 0; k < slen; k++) {
+ if (!wordSeparator[static_cast<unsigned char>(wordlist[k])]) {
+ if (!prev) {
+ keywords[wordsStore] = &wordlist[k];
+ wordsStore++;
+ }
+ } else {
+ wordlist[k] = '\0';
}
- } else {
- wordlist[k] = '\0';
+ prev = wordlist[k];
}
- prev = wordlist[k];
}
- keywords[words] = &wordlist[slen];
- *len = words;
+ keywords[wordsStore] = &wordlist[slen];
+ *len = wordsStore;
return keywords;
}
@@ -161,7 +163,7 @@ bool WordList::InList(const char *s) const { j++;
}
}
- j = starts['^'];
+ j = starts[static_cast<unsigned int>('^')];
if (j >= 0) {
while (words[j][0] == '^') {
const char *a = words[j] + 1;
@@ -213,7 +215,7 @@ bool WordList::InListAbbreviated(const char *s, const char marker) const { j++;
}
}
- j = starts['^'];
+ j = starts[static_cast<unsigned int>('^')];
if (j >= 0) {
while (words[j][0] == '^') {
const char *a = words[j] + 1;
|