diff options
| -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);  	}  } | 
