diff options
author | nyamatongwe <unknown> | 2001-06-13 23:15:41 +0000 |
---|---|---|
committer | nyamatongwe <unknown> | 2001-06-13 23:15:41 +0000 |
commit | e61ba193e48d583f7509645dc5c09eecacf4156d (patch) | |
tree | 5ea8e31b34051f5a80ba0a0edd445a22d2188723 | |
parent | 513f94f20b9e09ceaa0db2d3be9839d2b5608095 (diff) | |
download | scintilla-mirror-e61ba193e48d583f7509645dc5c09eecacf4156d.tar.gz |
Addition of target style for makefile lexer.
-rw-r--r-- | include/SciLexer.h | 1 | ||||
-rw-r--r-- | include/Scintilla.iface | 1 | ||||
-rw-r--r-- | src/LexOthers.cxx | 31 |
3 files changed, 23 insertions, 10 deletions
diff --git a/include/SciLexer.h b/include/SciLexer.h index 9af9abeb0..8d07b8480 100644 --- a/include/SciLexer.h +++ b/include/SciLexer.h @@ -241,6 +241,7 @@ #define SCE_MAKE_PREPROCESSOR 2 #define SCE_MAKE_IDENTIFIER 3 #define SCE_MAKE_OPERATOR 4 +#define SCE_MAKE_TARGET 5 #define SCE_MAKE_IDEOL 9 #define SCE_CONF_DEFAULT 0 #define SCE_CONF_COMMENT 1 diff --git a/include/Scintilla.iface b/include/Scintilla.iface index c810c3d9d..54d88f701 100644 --- a/include/Scintilla.iface +++ b/include/Scintilla.iface @@ -1449,6 +1449,7 @@ val SCE_MAKE_COMMENT=1 val SCE_MAKE_PREPROCESSOR=2 val SCE_MAKE_IDENTIFIER=3 val SCE_MAKE_OPERATOR=4 +val SCE_MAKE_TARGET=5 val SCE_MAKE_IDEOL=9 # Lexical states for the SCLEX_CONF (Apache Configuration Files Lexer) val SCE_CONF_DEFAULT=0 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); } } |