aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/LexCPP.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'src/LexCPP.cxx')
-rw-r--r--src/LexCPP.cxx32
1 files changed, 11 insertions, 21 deletions
diff --git a/src/LexCPP.cxx b/src/LexCPP.cxx
index d62375e9c..cad24a773 100644
--- a/src/LexCPP.cxx
+++ b/src/LexCPP.cxx
@@ -46,6 +46,7 @@ static void ColouriseCppDoc(unsigned int startPos, int length, int initStyle, Wo
styler.StartAt(startPos);
bool fold = styler.GetPropertyInt("fold");
+ bool stylingWithinPreprocessor = styler.GetPropertyInt("styling.within.preprocessor");
int lineCurrent = styler.GetLine(startPos);
int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK;
int levelCurrent = levelPrev;
@@ -118,15 +119,12 @@ 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);
@@ -149,10 +147,6 @@ 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 == '}')) {
@@ -162,17 +156,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;
+ if (stylingWithinPreprocessor) {
+ if (isspace(ch)) {
+ styler.ColourTo(i-1, state);
+ state = SCE_C_DEFAULT;
+ }
+ } else {
+ if ((ch == '\r' || ch == '\n') && !(chPrev == '\\' || chPrev == '\r')) {
+ 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) || (
@@ -248,10 +242,6 @@ 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)) {