diff options
| author | Neil <nyamatongwe@gmail.com> | 2018-12-04 08:29:58 +1100 | 
|---|---|---|
| committer | Neil <nyamatongwe@gmail.com> | 2018-12-04 08:29:58 +1100 | 
| commit | ffc99771b95a0b01371779d9d30f9d0400054691 (patch) | |
| tree | b92279ab3839b0a27fd5a9bcedb64efd10f8bb98 /lexers/LexCPP.cxx | |
| parent | 1887ae76f92913b12e2b94f0b047e3b63d491656 (diff) | |
| download | scintilla-mirror-ffc99771b95a0b01371779d9d30f9d0400054691.tar.gz | |
Backport: Bug [#2062]. Interpret continued preprocessor lines correctly by reading all of
the logical line.
Backport of changeset 7182:a40b6aac5b1f.
Diffstat (limited to 'lexers/LexCPP.cxx')
| -rw-r--r-- | lexers/LexCPP.cxx | 30 | 
1 files changed, 20 insertions, 10 deletions
| diff --git a/lexers/LexCPP.cxx b/lexers/LexCPP.cxx index 3dac142ab..e8cb75e43 100644 --- a/lexers/LexCPP.cxx +++ b/lexers/LexCPP.cxx @@ -201,17 +201,27 @@ struct EscapeSequence {  std::string GetRestOfLine(LexAccessor &styler, Sci_Position start, bool allowSpace) {  	std::string restOfLine; -	Sci_Position i =0; +	Sci_Position line = styler.GetLine(start); +	Sci_Position pos = start; +	Sci_Position endLine = styler.LineEnd(line);  	char ch = styler.SafeGetCharAt(start, '\n'); -	const Sci_Position endLine = styler.LineEnd(styler.GetLine(start)); -	while (((start+i) < endLine) && (ch != '\r')) { -		const char chNext = styler.SafeGetCharAt(start + i + 1, '\n'); -		if (ch == '/' && (chNext == '/' || chNext == '*')) -			break; -		if (allowSpace || (ch != ' ')) -			restOfLine += ch; -		i++; -		ch = chNext; +	while (pos < endLine) { +		if (ch == '\\' && ((pos + 1) == endLine)) { +			// Continuation line +			line++; +			pos = styler.LineStart(line); +			endLine = styler.LineEnd(line); +			ch = styler.SafeGetCharAt(pos, '\n'); +		} else { +			const char chNext = styler.SafeGetCharAt(pos + 1, '\n'); +			if (ch == '/' && (chNext == '/' || chNext == '*')) +				break; +			if (allowSpace || (ch != ' ')) { +				restOfLine += ch; +			} +			pos++; +			ch = chNext; +		}  	}  	return restOfLine;  } | 
