aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authornyamatongwe <unknown>2001-06-13 23:15:41 +0000
committernyamatongwe <unknown>2001-06-13 23:15:41 +0000
commite61ba193e48d583f7509645dc5c09eecacf4156d (patch)
tree5ea8e31b34051f5a80ba0a0edd445a22d2188723 /src
parent513f94f20b9e09ceaa0db2d3be9839d2b5608095 (diff)
downloadscintilla-mirror-e61ba193e48d583f7509645dc5c09eecacf4156d.tar.gz
Addition of target style for makefile lexer.
Diffstat (limited to 'src')
-rw-r--r--src/LexOthers.cxx31
1 files changed, 21 insertions, 10 deletions
diff --git a/src/LexOthers.cxx b/src/LexOthers.cxx
index 7ca6f5dfb..bb84d9084 100644
--- a/src/LexOthers.cxx
+++ b/src/LexOthers.cxx
@@ -252,6 +252,7 @@ static void ColouriseMakeLine(
Accessor &styler) {
unsigned int i = 0;
+ unsigned int lastNonSpace = 0;
unsigned int state = SCE_MAKE_DEFAULT;
bool bSpecial = false;
// Skip initial spaces
@@ -260,11 +261,11 @@ static void ColouriseMakeLine(
}
if (lineBuffer[i] == '#') { // Comment
styler.ColourTo(endPos, SCE_MAKE_COMMENT);
- return ;
+ return;
}
if (lineBuffer[i] == '!') { // Special directive
styler.ColourTo(endPos, SCE_MAKE_PREPROCESSOR);
- return ;
+ return;
}
while (i < lengthLine) {
if (lineBuffer[i] == '$' && lineBuffer[i + 1] == '(') {
@@ -274,19 +275,29 @@ static void ColouriseMakeLine(
styler.ColourTo(startLine + i, state);
state = SCE_MAKE_DEFAULT;
}
- if (!bSpecial && state == SCE_MAKE_DEFAULT &&
- (lineBuffer[i] == ':' || lineBuffer[i] == '=')) {
- styler.ColourTo(startLine + i - 1, state);
- styler.ColourTo(startLine + i, SCE_MAKE_OPERATOR);
- bSpecial = true; // Only react to the first '=' or ':' of the line
+ if (!bSpecial) {
+ if (lineBuffer[i] == ':') {
+ styler.ColourTo(startLine + lastNonSpace, SCE_MAKE_TARGET);
+ styler.ColourTo(startLine + i - 1, SCE_MAKE_DEFAULT);
+ styler.ColourTo(startLine + i, SCE_MAKE_OPERATOR);
+ bSpecial = true; // Only react to the first ':' of the line
+ state = SCE_MAKE_DEFAULT;
+ } else if (lineBuffer[i] == '=') {
+ styler.ColourTo(startLine + lastNonSpace, SCE_MAKE_IDENTIFIER);
+ styler.ColourTo(startLine + i - 1, SCE_MAKE_DEFAULT);
+ styler.ColourTo(startLine + i, SCE_MAKE_OPERATOR);
+ bSpecial = true; // Only react to the first '=' of the line
+ state = SCE_MAKE_DEFAULT;
+ }
+ }
+ if (!isspacechar(lineBuffer[i])) {
+ lastNonSpace = i;
}
-
i++;
}
if (state == SCE_MAKE_IDENTIFIER) {
styler.ColourTo(endPos, SCE_MAKE_IDEOL); // Error, variable reference not ended
- }
- else {
+ } else {
styler.ColourTo(endPos, SCE_MAKE_DEFAULT);
}
}