aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/LexOthers.cxx
diff options
context:
space:
mode:
authornyamatongwe <unknown>2007-02-25 21:27:47 +0000
committernyamatongwe <unknown>2007-02-25 21:27:47 +0000
commit690778eaee53e9314bd120ebf772014b818ad5bf (patch)
tree9e3380a6fa2d52f1a3d77febc25fccb6a6cfa025 /src/LexOthers.cxx
parent3fca3a236483ffdef8797b662b5a636ed966ceba (diff)
downloadscintilla-mirror-690778eaee53e9314bd120ebf772014b818ad5bf.tar.gz
Fix for bug #1668409, Minor makefile lexer issues.
Supports ":=" operator and avoids processing ":" or "=" on command lines.
Diffstat (limited to 'src/LexOthers.cxx')
-rw-r--r--src/LexOthers.cxx30
1 files changed, 23 insertions, 7 deletions
diff --git a/src/LexOthers.cxx b/src/LexOthers.cxx
index 0731572c4..1f544497a 100644
--- a/src/LexOthers.cxx
+++ b/src/LexOthers.cxx
@@ -722,6 +722,12 @@ static void ColouriseMakeLine(
int lastNonSpace = -1;
unsigned int state = SCE_MAKE_DEFAULT;
bool bSpecial = false;
+
+ // check for a tab character in column 0 indicating a command
+ bool bCommand = false;
+ if ((lengthLine > 0) && (lineBuffer[0] == '\t'))
+ bCommand = true;
+
// Skip initial spaces
while ((i < lengthLine) && isspacechar(lineBuffer[i])) {
i++;
@@ -742,14 +748,24 @@ static void ColouriseMakeLine(
styler.ColourTo(startLine + i, state);
state = SCE_MAKE_DEFAULT;
}
- if (!bSpecial) {
+
+ // skip identifier and target styling if this is a command line
+ if (!bSpecial && !bCommand) {
if (lineBuffer[i] == ':') {
- // We should check that no colouring was made since the beginning of the line,
- // to avoid colouring stuff like /OUT:file
- if (lastNonSpace >= 0)
- styler.ColourTo(startLine + lastNonSpace, SCE_MAKE_TARGET);
- styler.ColourTo(startLine + i - 1, SCE_MAKE_DEFAULT);
- styler.ColourTo(startLine + i, SCE_MAKE_OPERATOR);
+ if (((i + 1) < lengthLine) && (lineBuffer[i + 1] == '=')) {
+ // it's a ':=', so style as an identifier
+ if (lastNonSpace >= 0)
+ styler.ColourTo(startLine + lastNonSpace, SCE_MAKE_IDENTIFIER);
+ styler.ColourTo(startLine + i - 1, SCE_MAKE_DEFAULT);
+ styler.ColourTo(startLine + i + 1, SCE_MAKE_OPERATOR);
+ } else {
+ // We should check that no colouring was made since the beginning of the line,
+ // to avoid colouring stuff like /OUT:file
+ if (lastNonSpace >= 0)
+ 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] == '=') {