diff options
| author | Joe Mueller <unknown> | 2015-07-30 14:35:17 +1000 | 
|---|---|---|
| committer | Joe Mueller <unknown> | 2015-07-30 14:35:17 +1000 | 
| commit | 58471e908a3b74b27379bb19a13d62cd8d4476b0 (patch) | |
| tree | 8f61293f34d008fea20584c631d23e58b3fe53aa /lexers/LexCPP.cxx | |
| parent | 2270ab97445c6f12bd0fddb273ab617fdb421594 (diff) | |
| download | scintilla-mirror-58471e908a3b74b27379bb19a13d62cd8d4476b0.tar.gz | |
Use Sci_Position / Sci_PositionU for variables in lexers that represent
positions and line numbers and may be widened to 64-bits in a future release.
Diffstat (limited to 'lexers/LexCPP.cxx')
| -rw-r--r-- | lexers/LexCPP.cxx | 56 | 
1 files changed, 28 insertions, 28 deletions
| diff --git a/lexers/LexCPP.cxx b/lexers/LexCPP.cxx index da558b357..628672b9e 100644 --- a/lexers/LexCPP.cxx +++ b/lexers/LexCPP.cxx @@ -54,7 +54,7 @@ bool IsSpaceEquiv(int state) {  // Putting a space between the '++' post-inc operator and the '+' binary op  // fixes this, and is highly recommended for readability anyway.  bool FollowsPostfixOperator(StyleContext &sc, LexAccessor &styler) { -	int pos = (int) sc.currentPos; +	Sci_Position pos = (Sci_Position) sc.currentPos;  	while (--pos > 0) {  		char ch = styler[pos];  		if (ch == '+' || ch == '-') { @@ -66,9 +66,9 @@ bool FollowsPostfixOperator(StyleContext &sc, LexAccessor &styler) {  bool followsReturnKeyword(StyleContext &sc, LexAccessor &styler) {  	// Don't look at styles, so no need to flush. -	int pos = (int) sc.currentPos; -	int currentLine = styler.GetLine(pos); -	int lineStartPos = styler.LineStart(currentLine); +	Sci_Position pos = (Sci_Position) sc.currentPos; +	Sci_Position currentLine = styler.GetLine(pos); +	Sci_Position lineStartPos = styler.LineStart(currentLine);  	while (--pos > lineStartPos) {  		char ch = styler.SafeGetCharAt(pos);  		if (ch != ' ' && ch != '\t') { @@ -145,7 +145,7 @@ void highlightTaskMarker(StyleContext &sc, LexAccessor &styler,  	if ((isoperator(sc.chPrev) || IsASpace(sc.chPrev)) && markerList.Length()) {  		const int lengthMarker = 50;  		char marker[lengthMarker+1]; -		int currPos = (int) sc.currentPos; +		Sci_Position currPos = (Sci_Position) sc.currentPos;  		int i = 0;  		while (i < lengthMarker) {  			char ch = styler.SafeGetCharAt(currPos + i); @@ -199,11 +199,11 @@ struct EscapeSequence {  	}  }; -std::string GetRestOfLine(LexAccessor &styler, int start, bool allowSpace) { +std::string GetRestOfLine(LexAccessor &styler, Sci_Position start, bool allowSpace) {  	std::string restOfLine; -	int i =0; +	Sci_Position i =0;  	char ch = styler.SafeGetCharAt(start, '\n'); -	int endLine = styler.LineEnd(styler.GetLine(start)); +	Sci_Position endLine = styler.LineEnd(styler.GetLine(start));  	while (((start+i) < endLine) && (ch != '\r')) {  		char chNext = styler.SafeGetCharAt(start + i + 1, '\n');  		if (ch == '/' && (chNext == '/' || chNext == '*')) @@ -224,12 +224,12 @@ bool IsStreamCommentStyle(int style) {  }  struct PPDefinition { -	int line; +	Sci_Position line;  	std::string key;  	std::string value;  	bool isUndef;  	std::string arguments; -	PPDefinition(int line_, const std::string &key_, const std::string &value_, bool isUndef_ = false, std::string arguments_="") : +	PPDefinition(Sci_Position line_, const std::string &key_, const std::string &value_, bool isUndef_ = false, std::string arguments_="") :  		line(line_), key(key_), value(value_), isUndef(isUndef_), arguments(arguments_) {  	}  }; @@ -285,14 +285,14 @@ public:  class PPStates {  	std::vector<LinePPState> vlls;  public: -	LinePPState ForLine(int line) const { +	LinePPState ForLine(Sci_Position line) const {  		if ((line > 0) && (vlls.size() > static_cast<size_t>(line))) {  			return vlls[line];  		} else {  			return LinePPState();  		}  	} -	void Add(int line, LinePPState lls) { +	void Add(Sci_Position line, LinePPState lls) {  		vlls.resize(line+1);  		vlls[line] = lls;  	} @@ -590,7 +590,7 @@ Sci_Position SCI_METHOD LexerCPP::WordListSet(int n, const char *wl) {  		wordListN = &markerList;  		break;  	} -	int firstModification = -1; +	Sci_Position firstModification = -1;  	if (wordListN) {  		WordList wlNew;  		wlNew.Set(wl); @@ -630,8 +630,8 @@ Sci_Position SCI_METHOD LexerCPP::WordListSet(int n, const char *wl) {  // Functor used to truncate history  struct After { -	int line; -	explicit After(int line_) : line(line_) {} +	Sci_Position line; +	explicit After(Sci_Position line_) : line(line_) {}  	bool operator()(PPDefinition &p) const {  		return p.line > line;  	} @@ -664,13 +664,13 @@ void SCI_METHOD LexerCPP::Lex(Sci_PositionU startPos, Sci_Position length, int i  	bool inRERange = false;  	bool seenDocKeyBrace = false; -	int lineCurrent = styler.GetLine(startPos); +	Sci_Position lineCurrent = styler.GetLine(startPos);  	if ((MaskActive(initStyle) == SCE_C_PREPROCESSOR) ||        (MaskActive(initStyle) == SCE_C_COMMENTLINE) ||        (MaskActive(initStyle) == SCE_C_COMMENTLINEDOC)) {  		// Set continuationLine if last character of previous line is '\'  		if (lineCurrent > 0) { -			int endLinePrevious = styler.LineEnd(lineCurrent - 1); +			Sci_Position endLinePrevious = styler.LineEnd(lineCurrent - 1);  			if (endLinePrevious > 0) {  				continuationLine = styler.SafeGetCharAt(endLinePrevious-1) == '\\';  			} @@ -679,7 +679,7 @@ void SCI_METHOD LexerCPP::Lex(Sci_PositionU startPos, Sci_Position length, int i  	// look back to set chPrevNonWhite properly for better regex colouring  	if (startPos > 0) { -		int back = startPos; +		Sci_Position back = startPos;  		while (--back && IsSpaceEquiv(MaskActive(styler.StyleAt(back))))  			;  		if (MaskActive(styler.StyleAt(back)) == SCE_C_OPERATOR) { @@ -719,7 +719,7 @@ void SCI_METHOD LexerCPP::Lex(Sci_PositionU startPos, Sci_Position length, int i  	const WordClassifier &classifierIdentifiers = subStyles.Classifier(SCE_C_IDENTIFIER);  	const WordClassifier &classifierDocKeyWords = subStyles.Classifier(SCE_C_COMMENTDOCKEYWORD); -	int lineEndNext = styler.LineEnd(lineCurrent); +	Sci_Position lineEndNext = styler.LineEnd(lineCurrent);  	for (; sc.More();) { @@ -757,7 +757,7 @@ void SCI_METHOD LexerCPP::Lex(Sci_PositionU startPos, Sci_Position length, int i  		// Handle line continuation generically.  		if (sc.ch == '\\') { -			if (static_cast<int>((sc.currentPos+1)) >= lineEndNext) { +			if (static_cast<Sci_Position>((sc.currentPos+1)) >= lineEndNext) {  				lineCurrent++;  				lineEndNext = styler.LineEnd(lineCurrent);  				vlls.Add(lineCurrent, preproc); @@ -1026,7 +1026,7 @@ void SCI_METHOD LexerCPP::Lex(Sci_PositionU startPos, Sci_Position length, int i  					while ((sc.ch < 0x80) && islower(sc.ch))  						sc.Forward();    // gobble regex flags  					sc.SetState(SCE_C_DEFAULT|activitySet); -				} else if (sc.ch == '\\' && (static_cast<int>(sc.currentPos+1) < lineEndNext)) { +				} else if (sc.ch == '\\' && (static_cast<Sci_Position>(sc.currentPos+1) < lineEndNext)) {  					// Gobble up the escaped character  					sc.Forward();  				} else if (sc.ch == '[') { @@ -1132,7 +1132,7 @@ void SCI_METHOD LexerCPP::Lex(Sci_PositionU startPos, Sci_Position length, int i  					if (MaskActive(styler.StyleAt(sc.currentPos - 1)) == SCE_C_STRINGRAW) {  						sc.SetState(SCE_C_STRINGRAW|activitySet);  						rawStringTerminator = ")"; -						for (int termPos = sc.currentPos + 1;; termPos++) { +						for (Sci_Position termPos = sc.currentPos + 1;; termPos++) {  							char chTerminator = styler.SafeGetCharAt(termPos, '(');  							if (chTerminator == '(')  								break; @@ -1286,21 +1286,21 @@ void SCI_METHOD LexerCPP::Fold(Sci_PositionU startPos, Sci_Position length, int  	LexAccessor styler(pAccess); -	unsigned int endPos = startPos + length; +	Sci_PositionU endPos = startPos + length;  	int visibleChars = 0;  	bool inLineComment = false; -	int lineCurrent = styler.GetLine(startPos); +	Sci_Position lineCurrent = styler.GetLine(startPos);  	int levelCurrent = SC_FOLDLEVELBASE;  	if (lineCurrent > 0)  		levelCurrent = styler.LevelAt(lineCurrent-1) >> 16; -	unsigned int lineStartNext = styler.LineStart(lineCurrent+1); +	Sci_PositionU lineStartNext = styler.LineStart(lineCurrent+1);  	int levelMinCurrent = levelCurrent;  	int levelNext = levelCurrent;  	char chNext = styler[startPos];  	int styleNext = MaskActive(styler.StyleAt(startPos));  	int style = MaskActive(initStyle);  	const bool userDefinedFoldMarkers = !options.foldExplicitStart.empty() && !options.foldExplicitEnd.empty(); -	for (unsigned int i = startPos; i < endPos; i++) { +	for (Sci_PositionU i = startPos; i < endPos; i++) {  		char ch = chNext;  		chNext = styler.SafeGetCharAt(i + 1);  		int stylePrev = style; @@ -1337,7 +1337,7 @@ void SCI_METHOD LexerCPP::Fold(Sci_PositionU startPos, Sci_Position length, int  		}  		if (options.foldPreprocessor && (style == SCE_C_PREPROCESSOR)) {  			if (ch == '#') { -				unsigned int j = i + 1; +				Sci_PositionU j = i + 1;  				while ((j < endPos) && IsASpaceOrTab(styler.SafeGetCharAt(j))) {  					j++;  				} @@ -1379,7 +1379,7 @@ void SCI_METHOD LexerCPP::Fold(Sci_PositionU startPos, Sci_Position length, int  			lineStartNext = styler.LineStart(lineCurrent+1);  			levelCurrent = levelNext;  			levelMinCurrent = levelCurrent; -			if (atEOL && (i == static_cast<unsigned int>(styler.Length()-1))) { +			if (atEOL && (i == static_cast<Sci_PositionU>(styler.Length()-1))) {  				// There is an empty line at end of file so give it same level and empty  				styler.SetLevel(lineCurrent, (levelCurrent | levelCurrent << 16) | SC_FOLDLEVELWHITEFLAG);  			} | 
