aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/LexCPP.cxx
diff options
context:
space:
mode:
authornyamatongwe <unknown>2000-05-27 02:16:49 +0000
committernyamatongwe <unknown>2000-05-27 02:16:49 +0000
commit2f0d3718f7d4af752b10fc586507c2b1c25f6ffe (patch)
tree45ee1f8c8d83133fdce122b35674bb86bf507ecb /src/LexCPP.cxx
parentd78209cfaac6af11a56e460aa264ec38e4607c99 (diff)
downloadscintilla-mirror-2f0d3718f7d4af752b10fc586507c2b1c25f6ffe.tar.gz
Changed operator bool in WordList to return false if WordList is empty.
Many lexer changes from Philippe Lhoste. VB handles preprocessor and hex constants. C++ optionally leaves preprocessor state after the preprocessor command. HTML terminates incomplete entities earlier and marks them as bad attributes.
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)) {