diff options
| author | nyamatongwe <unknown> | 2012-09-04 17:49:31 +1000 | 
|---|---|---|
| committer | nyamatongwe <unknown> | 2012-09-04 17:49:31 +1000 | 
| commit | 64e8c5fe5f09220d138539e70291f8dd4cbf1e18 (patch) | |
| tree | 44285dc3731dd8f42d071d732664e4d16b1447a4 | |
| parent | 5499955a0b37f34696b4a58d498f0a85037eb9d4 (diff) | |
| download | scintilla-mirror-64e8c5fe5f09220d138539e70291f8dd4cbf1e18.tar.gz | |
Don't treat '//' in include path as comment start. Bug #3519260.
From Sakshi Verma.
| -rw-r--r-- | lexers/LexCPP.cxx | 11 | 
1 files changed, 8 insertions, 3 deletions
| diff --git a/lexers/LexCPP.cxx b/lexers/LexCPP.cxx index d6efa7ee0..f7ccfd04c 100644 --- a/lexers/LexCPP.cxx +++ b/lexers/LexCPP.cxx @@ -467,6 +467,7 @@ void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle,  	int styleBeforeDCKeyword = SCE_C_DEFAULT;  	bool continuationLine = false;  	bool isIncludePreprocessor = false; +	bool isStringInPreprocessor = false;  	int lineCurrent = styler.GetLine(startPos);  	if ((MaskActive(initStyle) == SCE_C_PREPROCESSOR) || @@ -618,13 +619,17 @@ void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle,  					sc.SetState(SCE_C_DEFAULT|activitySet);  				}  				break; -			case SCE_C_PREPROCESSOR: +			case SCE_C_PREPROCESSOR: 	  				if (options.stylingWithinPreprocessor) {  					if (IsASpace(sc.ch)) {  						sc.SetState(SCE_C_DEFAULT|activitySet);  					} -				} else { -					if (sc.Match('/', '*')) { +				} else if (isStringInPreprocessor && (sc.Match('>') || sc.Match('\"'))) { +					isStringInPreprocessor = false; +				} else if (!isStringInPreprocessor) { +					if ((isIncludePreprocessor && sc.Match('<')) || sc.Match('\"')) { +						isStringInPreprocessor = true; +					} else if (sc.Match('/', '*')) {  						sc.SetState(SCE_C_PREPROCESSORCOMMENT|activitySet);  						sc.Forward();	// Eat the *  					} else if (sc.Match('/', '/')) { | 
