aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/LexCPP.cxx20
-rw-r--r--src/LexHTML.cxx7
-rw-r--r--src/LexVB.cxx43
3 files changed, 70 insertions, 0 deletions
diff --git a/src/LexCPP.cxx b/src/LexCPP.cxx
index 4f042bd61..d62375e9c 100644
--- a/src/LexCPP.cxx
+++ b/src/LexCPP.cxx
@@ -118,6 +118,15 @@ static void ColouriseCppDoc(unsigned int startPos, int length, int initStyle, Wo
} else if (ch == '#') {
styler.ColourTo(i-1, state);
state = SCE_C_PREPROCESSOR;
+#ifdef COLORIZE_ALL_PREPROC /* PL 2000/05/18 */
+#else /* OLD PL 2000/05/18 */
+ // Skip whitespace between # and preprocessor word
+ do {
+ i++;
+ ch = chNext;
+ chNext = styler.SafeGetCharAt(i + 1);
+ } while (isspace(ch));
+#endif /* OLD PL 2000/05/18 */
} else if (isoperator(ch)) {
styler.ColourTo(i-1, state);
styler.ColourTo(i, SCE_C_OPERATOR);
@@ -140,8 +149,10 @@ static void ColouriseCppDoc(unsigned int startPos, int length, int initStyle, Wo
state = SCE_C_STRING;
} else if (ch == '\'') {
state = SCE_C_CHARACTER;
+#ifdef OLD /* PL 2000/05/18 -- A preprocessor symbol shouldn't start in the middle of a word! */
} else if (ch == '#') {
state = SCE_C_PREPROCESSOR;
+#endif /* OLD PL 2000/05/18 */
} else if (isoperator(ch)) {
styler.ColourTo(i, SCE_C_OPERATOR);
if ((ch == '{') || (ch == '}')) {
@@ -151,10 +162,17 @@ static void ColouriseCppDoc(unsigned int startPos, int length, int initStyle, Wo
}
} else {
if (state == SCE_C_PREPROCESSOR) {
+#ifdef COLORIZE_ALL_PREPROC /* PL 2000/05/18 -- Stop after the preprocessor word */
if ((ch == '\r' || ch == '\n') && !(chPrev == '\\' || chPrev == '\r')) {
styler.ColourTo(i-1, state);
state = SCE_C_DEFAULT;
}
+#else /* OLD PL 2000/05/18 */
+ if (isspace(ch)) {
+ styler.ColourTo(i-1, state);
+ state = SCE_C_DEFAULT;
+ }
+#endif /* OLD PL 2000/05/18 */
} else if (state == SCE_C_COMMENT) {
if (ch == '/' && chPrev == '*') {
if (((i > styler.GetStartSegment() + 2) || (
@@ -230,8 +248,10 @@ static void ColouriseCppDoc(unsigned int startPos, int length, int initStyle, Wo
state = SCE_C_STRING;
} else if (ch == '\'') {
state = SCE_C_CHARACTER;
+#ifdef OLD /* PL 2000/05/18 -- A preprocessor symbol SHOULD be the first non-white char. of the line! */
} else if (ch == '#') {
state = SCE_C_PREPROCESSOR;
+#endif /* OLD PL 2000/05/18 */
} else if (iswordstart(ch)) {
state = SCE_C_WORD;
} else if (isoperator(ch)) {
diff --git a/src/LexHTML.cxx b/src/LexHTML.cxx
index 653aa4653..0b31cba39 100644
--- a/src/LexHTML.cxx
+++ b/src/LexHTML.cxx
@@ -353,6 +353,13 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
styler.ColourTo(i, state);
state = SCE_H_DEFAULT;
}
+#ifdef OLD /* PL 2000/05/18 -- An bad entity may stop on a non-alphabetic character */
+#else /* OLD PL 2000/05/18 */
+ if (ch != '#' && !isalnum(ch)) { // Should check that '#' follows '&', but it is unlikely anyway...
+ styler.ColourTo(i, SCE_H_TAGUNKNOWN);
+ state = SCE_H_DEFAULT;
+ }
+#endif /* OLD PL 2000/05/18 */
} else if (state == SCE_H_TAGUNKNOWN) {
if (!ishtmlwordchar(ch) && ch != '/' && ch != '-') {
int eClass = classifyTagHTML(styler.GetStartSegment(), i - 1, keywords, styler);
diff --git a/src/LexVB.cxx b/src/LexVB.cxx
index acc3b0d54..cdda470b5 100644
--- a/src/LexVB.cxx
+++ b/src/LexVB.cxx
@@ -20,20 +20,37 @@
static int classifyWordVB(unsigned int start, unsigned int end, WordList &keywords, Accessor &styler) {
char s[100];
+#ifdef OLD /* PL 2000/05/18 -- Include hexadecimal number */
bool wordIsNumber = isdigit(styler[start]) || (styler[start] == '.');
+#else /* OLD PL 2000/05/18 */
+ bool wordIsNumber = isdigit(styler[start]) || (styler[start] == '.') ||
+ (styler[start] == '&' && tolower(styler[start+1]) == 'h');
+#endif /* OLD PL 2000/05/18 */
for (unsigned int i = 0; i < end - start + 1 && i < 30; i++) {
s[i] = static_cast<char>(tolower(styler[start + i]));
+#ifdef OLD /* PL 2000/05/18 -- Little optimization */
s[i + 1] = '\0';
}
+#else /* OLD PL 2000/05/18 */
+ }
+ s[i] = '\0';
+#endif /* OLD PL 2000/05/18 */
char chAttr = SCE_C_DEFAULT;
if (wordIsNumber)
chAttr = SCE_C_NUMBER;
else {
+#ifdef OLD /* PL 2000/05/18 */
if (keywords.InList(s)) {
chAttr = SCE_C_WORD;
if (strcmp(s, "rem") == 0)
chAttr = SCE_C_COMMENTLINE;
}
+#else /* OLD PL 2000/05/18 */
+ if (strcmp(s, "rem") == 0)
+ chAttr = SCE_C_COMMENTLINE;
+ else if (keywords.InList(s))
+ chAttr = SCE_C_WORD;
+#endif /* OLD PL 2000/05/18 */
}
styler.ColourTo(end, chAttr);
if (chAttr == SCE_C_COMMENTLINE)
@@ -73,6 +90,18 @@ static void ColouriseVBDoc(unsigned int startPos, int length, int initStyle,
} else if (ch == '\"') {
styler.ColourTo(i - 1, state);
state = SCE_C_STRING;
+#ifdef OLD /* PL 2000/05/18 */
+#else /* OLD PL 2000/05/18 */
+ } else if (ch == '#') {
+ styler.ColourTo(i - 1, state);
+ state = SCE_C_PREPROCESSOR;
+ } else if (ch == '&' && tolower(chNext) == 'h') {
+ styler.ColourTo(i - 1, state);
+ state = SCE_C_WORD;
+ } else if (isoperator(ch)) {
+ styler.ColourTo(i - 1, state);
+ styler.ColourTo(i, SCE_C_OPERATOR);
+#endif /* OLD PL 2000/05/18 */
}
} else if (state == SCE_C_WORD) {
if (!iswordchar(ch)) {
@@ -82,6 +111,12 @@ static void ColouriseVBDoc(unsigned int startPos, int length, int initStyle,
state = SCE_C_COMMENTLINE;
} else if (ch == '\"') {
state = SCE_C_STRING;
+#ifdef OLD /* PL 2000/05/18 */
+#else /* OLD PL 2000/05/18 */
+ } else if (isoperator(ch)) {
+ styler.ColourTo(i - 1, state);
+ styler.ColourTo(i, SCE_C_OPERATOR);
+#endif /* OLD PL 2000/05/18 */
}
}
}
@@ -100,6 +135,14 @@ static void ColouriseVBDoc(unsigned int startPos, int length, int initStyle,
ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
}
+#ifdef OLD /* PL 2000/05/18 */
+#else /* OLD PL 2000/05/18 */
+ } else if (state == SCE_C_PREPROCESSOR) {
+ if (ch == '\r' || ch == '\n') {
+ styler.ColourTo(i - 1, state);
+ state = SCE_C_DEFAULT;
+ }
+#endif /* OLD PL 2000/05/18 */
}
if (state == SCE_C_DEFAULT) { // One of the above succeeded
if (ch == '\'') {