diff options
| author | nyamatongwe <unknown> | 2007-07-31 04:07:02 +0000 | 
|---|---|---|
| committer | nyamatongwe <unknown> | 2007-07-31 04:07:02 +0000 | 
| commit | ad78f49baf803944285c6acacf19a72846c44c04 (patch) | |
| tree | c64a96b6a7e40aba7010b3e402efc5f93d96daa1 /src | |
| parent | 6cb0be3014ecbab91f2bfa92ca7ae4058e70192b (diff) | |
| download | scintilla-mirror-ad78f49baf803944285c6acacf19a72846c44c04.tar.gz | |
Eric Promislow added an operator state for YAML and recognise comments
after code.
Diffstat (limited to 'src')
| -rw-r--r-- | src/LexYAML.cxx | 21 | 
1 files changed, 13 insertions, 8 deletions
| diff --git a/src/LexYAML.cxx b/src/LexYAML.cxx index 0edd78691..ef5315f24 100644 --- a/src/LexYAML.cxx +++ b/src/LexYAML.cxx @@ -37,12 +37,12 @@ static inline bool AtEOL(Accessor &styler, unsigned int i) {  static unsigned int SpaceCount(char* lineBuffer) {  	if (lineBuffer == NULL)  		return 0; -	 +  	char* headBuffer = lineBuffer; -	 +  	while (*headBuffer == ' ')  		headBuffer++; -	 +  	return headBuffer - lineBuffer;  } @@ -62,14 +62,14 @@ static void ColouriseYAMLLine(  	unsigned int endPos,  	WordList &keywords,  	Accessor &styler) { -	     +  	unsigned int i = 0;  	bool bInQuotes = false;  	unsigned int indentAmount = SpaceCount(lineBuffer); -		 +  	if (currentLine > 0) {  		int parentLineState = styler.GetLineState(currentLine - 1); -	 +  		if ((parentLineState&YAML_STATE_MASK) == YAML_STATE_TEXT || (parentLineState&YAML_STATE_MASK) == YAML_STATE_TEXT_PARENT) {  			unsigned int parentIndentAmount = parentLineState&(~YAML_STATE_MASK);  			if (indentAmount > parentIndentAmount) { @@ -102,7 +102,8 @@ static void ColouriseYAMLLine(  		if (lineBuffer[i] == '\'' || lineBuffer[i] == '\"') {  			bInQuotes = !bInQuotes;  		} else if (lineBuffer[i] == ':' && !bInQuotes) { -			styler.ColourTo(startLine + i, SCE_YAML_IDENTIFIER); +			styler.ColourTo(startLine + i - 1, SCE_YAML_IDENTIFIER); +			styler.ColourTo(startLine + i, SCE_YAML_OPERATOR);  			// Non-folding scalar  			i++;  			while ((i < lengthLine) && isspacechar(lineBuffer[i])) @@ -130,6 +131,10 @@ static void ColouriseYAMLLine(  					styler.ColourTo(endPos, SCE_YAML_ERROR);  					return;  				} +			} else if (lineBuffer[i] == '#') { +				styler.ColourTo(startLine + i - 1, SCE_YAML_DEFAULT); +				styler.ColourTo(endPos, SCE_YAML_COMMENT); +				return;  			}  			styler.SetLineState(currentLine, YAML_STATE_VALUE);  			if (lineBuffer[i] == '&' || lineBuffer[i] == '*') { @@ -169,7 +174,7 @@ static void ColouriseYAMLDoc(unsigned int startPos, int length, int, WordList *k  	unsigned int endPos = startPos + length;  	unsigned int maxPos = styler.Length();  	unsigned int lineCurrent = styler.GetLine(startPos); -	 +  	for (unsigned int i = startPos; i < maxPos && i < endPos; i++) {  		lineBuffer[linePos++] = styler[i];  		if (AtEOL(styler, i) || (linePos >= sizeof(lineBuffer) - 1)) { | 
