diff options
| author | nyamatongwe <devnull@localhost> | 2001-06-13 23:15:41 +0000 | 
|---|---|---|
| committer | nyamatongwe <devnull@localhost> | 2001-06-13 23:15:41 +0000 | 
| commit | fc1cab7c8845201d42cbb6e97cdc16b356319705 (patch) | |
| tree | 5ea8e31b34051f5a80ba0a0edd445a22d2188723 /src/LexOthers.cxx | |
| parent | 80b8f9bc2f3c53c0751a375ac737e64dfa0809e8 (diff) | |
| download | scintilla-mirror-fc1cab7c8845201d42cbb6e97cdc16b356319705.tar.gz | |
Addition of target style for makefile lexer.
Diffstat (limited to 'src/LexOthers.cxx')
| -rw-r--r-- | src/LexOthers.cxx | 31 | 
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);  	}  } | 
