aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/LexVB.cxx
diff options
context:
space:
mode:
authornyamatongwe <unknown>2000-08-03 12:22:34 +0000
committernyamatongwe <unknown>2000-08-03 12:22:34 +0000
commit01ee5832076b4be7fcbbb0bf5bdcc4f1f534698b (patch)
tree3ac72616c4d057f33da63afff3fdea4de1daafef /src/LexVB.cxx
parent6051be089460dfaff3f18c32cf9ee849c2f0c02b (diff)
downloadscintilla-mirror-01ee5832076b4be7fcbbb0bf5bdcc4f1f534698b.tar.gz
Fixes from Philippe for preprocessor and HTML comments and one from Steve
for HTML comments.
Diffstat (limited to 'src/LexVB.cxx')
-rw-r--r--src/LexVB.cxx27
1 files changed, 15 insertions, 12 deletions
diff --git a/src/LexVB.cxx b/src/LexVB.cxx
index feb9fe24a..67dfa7842 100644
--- a/src/LexVB.cxx
+++ b/src/LexVB.cxx
@@ -50,6 +50,7 @@ static void ColouriseVBDoc(unsigned int startPos, int length, int initStyle,
styler.StartAt(startPos);
+ int visibleChars = 0;
int state = initStyle;
char chNext = styler[startPos];
styler.StartSegment(startPos);
@@ -64,6 +65,17 @@ static void ColouriseVBDoc(unsigned int startPos, int length, int initStyle,
continue;
}
+ if (ch == '\r' || ch == '\n') {
+ // End of line
+ if (state == SCE_C_COMMENTLINE || state == SCE_C_PREPROCESSOR) {
+ styler.ColourTo(i - 1, state);
+ state = SCE_C_DEFAULT;
+ }
+ visibleChars = 0;
+ }
+ if (!isspace(ch))
+ visibleChars++;
+
if (state == SCE_C_DEFAULT) {
if (iswordstart(ch)) {
styler.ColourTo(i - 1, state);
@@ -74,7 +86,8 @@ static void ColouriseVBDoc(unsigned int startPos, int length, int initStyle,
} else if (ch == '\"') {
styler.ColourTo(i - 1, state);
state = SCE_C_STRING;
- } else if (ch == '#') {
+ } else if (ch == '#' && visibleChars == 1) {
+ // Preprocessor commands are alone on their line
styler.ColourTo(i - 1, state);
state = SCE_C_PREPROCESSOR;
} else if (ch == '&' && tolower(chNext) == 'h') {
@@ -99,12 +112,7 @@ static void ColouriseVBDoc(unsigned int startPos, int length, int initStyle,
}
}
} else {
- if (state == SCE_C_COMMENTLINE) {
- if (ch == '\r' || ch == '\n') {
- styler.ColourTo(i - 1, state);
- state = SCE_C_DEFAULT;
- }
- } else if (state == SCE_C_STRING) {
+ if (state == SCE_C_STRING) {
// VB doubles quotes to preserve them
if (ch == '\"') {
styler.ColourTo(i, state);
@@ -113,11 +121,6 @@ static void ColouriseVBDoc(unsigned int startPos, int length, int initStyle,
ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
}
- } else if (state == SCE_C_PREPROCESSOR) {
- if (ch == '\r' || ch == '\n') {
- styler.ColourTo(i - 1, state);
- state = SCE_C_DEFAULT;
- }
}
if (state == SCE_C_DEFAULT) { // One of the above succeeded
if (ch == '\'') {