aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/LexCPP.cxx
diff options
context:
space:
mode:
authornyamatongwe <unknown>2000-05-20 13:14:41 +0000
committernyamatongwe <unknown>2000-05-20 13:14:41 +0000
commit45674820f1033b465e8c40c7ba3e0988b438c339 (patch)
treeb09e812aee4aef0bd71b9c49b0b9016c07498026 /src/LexCPP.cxx
parent02e0afd5a9d78f997df5e498550e5b2832ca5aa0 (diff)
downloadscintilla-mirror-45674820f1033b465e8c40c7ba3e0988b438c339.tar.gz
Lexer changes from Philippe.
Diffstat (limited to 'src/LexCPP.cxx')
-rw-r--r--src/LexCPP.cxx20
1 files changed, 20 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)) {