diff options
author | Joe Mueller <devnull@localhost> | 2015-07-30 14:35:17 +1000 |
---|---|---|
committer | Joe Mueller <devnull@localhost> | 2015-07-30 14:35:17 +1000 |
commit | 96229bb5f01e86efe382523e1ee79ff23bdcc8e0 (patch) | |
tree | 5aa3c8becad92a397b02445001383e188070f287 | |
parent | 7604a6b2a98fc2250408368eb51f8f6827d888c8 (diff) | |
download | scintilla-mirror-96229bb5f01e86efe382523e1ee79ff23bdcc8e0.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.
96 files changed, 1105 insertions, 1100 deletions
diff --git a/lexers/LexA68k.cxx b/lexers/LexA68k.cxx index c14797238..e74c0b90a 100644 --- a/lexers/LexA68k.cxx +++ b/lexers/LexA68k.cxx @@ -115,7 +115,7 @@ static inline bool IsDoxygenChar (const int ch) * Main function, which colourises a 68k source */ -static void ColouriseA68kDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *keywordlists[], Accessor &styler) +static void ColouriseA68kDoc (Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *keywordlists[], Accessor &styler) { // Used to buffer a string, to be able to compare it using built-in functions char Buffer[100]; diff --git a/lexers/LexAPDL.cxx b/lexers/LexAPDL.cxx index 8289def08..873ec9d13 100644 --- a/lexers/LexAPDL.cxx +++ b/lexers/LexAPDL.cxx @@ -187,13 +187,13 @@ static int CheckAPDLFoldPoint(char const *token, int &level) { static void FoldAPDLDoc(Sci_PositionU startPos, Sci_Position length, int, WordList *[], Accessor &styler) { - int line = styler.GetLine(startPos); + Sci_Position line = styler.GetLine(startPos); int level = styler.LevelAt(line); int go = 0, done = 0; - int endPos = startPos + length; + Sci_Position endPos = startPos + length; char word[256]; int wordlen = 0; - int i; + Sci_Position i; bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0; // Scan for tokens at the start of the line (they may include // whitespace, for tokens like "End Function" diff --git a/lexers/LexASY.cxx b/lexers/LexASY.cxx index 722eb2dfa..b49975e70 100644 --- a/lexers/LexASY.cxx +++ b/lexers/LexASY.cxx @@ -152,7 +152,7 @@ static inline bool isASYidentifier(int ch) { ((ch >= 'a') && (ch <= 'z')) || ((ch >= 'A') && (ch <= 'Z')) ; } -static int ParseASYWord(unsigned int pos, Accessor &styler, char *word) +static int ParseASYWord(Sci_PositionU pos, Accessor &styler, char *word) { int length=0; char ch=styler.SafeGetCharAt(pos); @@ -167,11 +167,11 @@ static int ParseASYWord(unsigned int pos, Accessor &styler, char *word) return length; } -static bool IsASYDrawingLine(int line, Accessor &styler) { - int pos = styler.LineStart(line); - int eol_pos = styler.LineStart(line + 1) - 1; +static bool IsASYDrawingLine(Sci_Position line, Accessor &styler) { + Sci_Position pos = styler.LineStart(line); + Sci_Position eol_pos = styler.LineStart(line + 1) - 1; - int startpos = pos; + Sci_Position startpos = pos; char buffer[100]=""; while (startpos<eol_pos){ @@ -191,9 +191,9 @@ static void FoldAsyDoc(Sci_PositionU startPos, Sci_Position length, int initStyl bool foldComment = styler.GetPropertyInt("fold.comment") != 0; bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0; bool foldAtElse = styler.GetPropertyInt("fold.at.else", 0) != 0; - unsigned int endPos = startPos + length; + Sci_PositionU endPos = startPos + length; int visibleChars = 0; - int lineCurrent = styler.GetLine(startPos); + Sci_Position lineCurrent = styler.GetLine(startPos); int levelCurrent = SC_FOLDLEVELBASE; if (lineCurrent > 0) levelCurrent = styler.LevelAt(lineCurrent-1) >> 16; @@ -202,7 +202,7 @@ static void FoldAsyDoc(Sci_PositionU startPos, Sci_Position length, int initStyl char chNext = styler[startPos]; int styleNext = styler.StyleAt(startPos); int style = initStyle; - 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; diff --git a/lexers/LexAU3.cxx b/lexers/LexAU3.cxx index cb3159797..c8ab9d700 100644 --- a/lexers/LexAU3.cxx +++ b/lexers/LexAU3.cxx @@ -170,10 +170,10 @@ static int GetSendKey(const char *szLine, char *szKey) // // Routine to check the last "none comment" character on a line to see if its a continuation // -static bool IsContinuationLine(unsigned int szLine, Accessor &styler) +static bool IsContinuationLine(Sci_PositionU szLine, Accessor &styler) { - int nsPos = styler.LineStart(szLine); - int nePos = styler.LineStart(szLine+1) - 2; + Sci_Position nsPos = styler.LineStart(szLine); + Sci_Position nePos = styler.LineStart(szLine+1) - 2; //int stylech = styler.StyleAt(nsPos); while (nsPos < nePos) { @@ -209,8 +209,8 @@ static void ColouriseAU3Doc(Sci_PositionU startPos, WordList &keywords7 = *keywordlists[6]; WordList &keywords8 = *keywordlists[7]; // find the first previous line without continuation character at the end - int lineCurrent = styler.GetLine(startPos); - int s_startPos = startPos; + Sci_Position lineCurrent = styler.GetLine(startPos); + Sci_Position s_startPos = startPos; // When not inside a Block comment: find First line without _ if (!(initStyle==SCE_AU3_COMMENTBLOCK)) { while ((lineCurrent > 0 && IsContinuationLine(lineCurrent,styler)) || @@ -447,7 +447,7 @@ static void ColouriseAU3Doc(Sci_PositionU startPos, { si=0; // at line end and not found a continuation char then reset to default - int lineCurrent = styler.GetLine(sc.currentPos); + Sci_Position lineCurrent = styler.GetLine(sc.currentPos); if (!IsContinuationLine(lineCurrent,styler)) { sc.SetState(SCE_AU3_DEFAULT); @@ -492,7 +492,7 @@ static void ColouriseAU3Doc(Sci_PositionU startPos, else { // check if the start is a valid SendKey start - int nPos = 0; + Sci_Position nPos = 0; int nState = 1; char cTemp; while (!(nState == 2) && ((cTemp = s[nPos]) != '\0')) @@ -659,10 +659,10 @@ static bool IsStreamCommentStyle(int style) { // // Routine to find first none space on the current line and return its Style // needed for comment lines not starting on pos 1 -static int GetStyleFirstWord(unsigned int szLine, Accessor &styler) +static int GetStyleFirstWord(Sci_PositionU szLine, Accessor &styler) { - int nsPos = styler.LineStart(szLine); - int nePos = styler.LineStart(szLine+1) - 1; + Sci_Position nsPos = styler.LineStart(szLine); + Sci_Position nePos = styler.LineStart(szLine+1) - 1; while (isspacechar(styler.SafeGetCharAt(nsPos)) && nsPos < nePos) { nsPos++; // skip to next char @@ -676,14 +676,14 @@ static int GetStyleFirstWord(unsigned int szLine, Accessor &styler) // static void FoldAU3Doc(Sci_PositionU startPos, Sci_Position length, int, WordList *[], Accessor &styler) { - int endPos = startPos + length; + Sci_Position endPos = startPos + length; // get settings from the config files for folding comments and preprocessor lines bool foldComment = styler.GetPropertyInt("fold.comment") != 0; bool foldInComment = styler.GetPropertyInt("fold.comment") == 2; bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0; bool foldpreprocessor = styler.GetPropertyInt("fold.preprocessor") != 0; // Backtrack to previous line in case need to fix its fold status - int lineCurrent = styler.GetLine(startPos); + Sci_Position lineCurrent = styler.GetLine(startPos); if (startPos > 0) { if (lineCurrent > 0) { lineCurrent--; @@ -720,7 +720,7 @@ static void FoldAU3Doc(Sci_PositionU startPos, Sci_Position length, int, WordLis char chNext = styler.SafeGetCharAt(startPos); char chPrev = ' '; // - for (int i = startPos; i < endPos; i++) { + for (Sci_Position i = startPos; i < endPos; i++) { char ch = chNext; chNext = styler.SafeGetCharAt(i + 1); if (IsAWordChar(ch)) { diff --git a/lexers/LexAVE.cxx b/lexers/LexAVE.cxx index ee5149318..fd9927379 100644 --- a/lexers/LexAVE.cxx +++ b/lexers/LexAVE.cxx @@ -82,7 +82,7 @@ static void ColouriseAveDoc( for (; sc.More(); sc.Forward()) { if (sc.atLineEnd) { // Update the line state, so it can be seen by next line - int currentLine = styler.GetLine(sc.currentPos); + Sci_Position currentLine = styler.GetLine(sc.currentPos); styler.SetLineState(currentLine, 0); } if (sc.atLineStart && (sc.state == SCE_AVE_STRING)) { @@ -159,9 +159,9 @@ static void ColouriseAveDoc( static void FoldAveDoc(Sci_PositionU startPos, Sci_Position length, int /* initStyle */, WordList *[], Accessor &styler) { - unsigned int lengthDoc = startPos + length; + Sci_PositionU lengthDoc = startPos + length; int visibleChars = 0; - int lineCurrent = styler.GetLine(startPos); + Sci_Position lineCurrent = styler.GetLine(startPos); int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK; int levelCurrent = levelPrev; char chNext = static_cast<char>(tolower(styler[startPos])); @@ -169,7 +169,7 @@ static void FoldAveDoc(Sci_PositionU startPos, Sci_Position length, int /* initS int styleNext = styler.StyleAt(startPos); char s[10] = ""; - for (unsigned int i = startPos; i < lengthDoc; i++) { + for (Sci_PositionU i = startPos; i < lengthDoc; i++) { char ch = static_cast<char>(tolower(chNext)); chNext = static_cast<char>(tolower(styler.SafeGetCharAt(i + 1))); int style = styleNext; diff --git a/lexers/LexAVS.cxx b/lexers/LexAVS.cxx index 8599ce952..6e0980715 100644 --- a/lexers/LexAVS.cxx +++ b/lexers/LexAVS.cxx @@ -57,7 +57,7 @@ static void ColouriseAvsDoc( WordList &clipProperties = *keywordlists[4]; WordList &userDefined = *keywordlists[5]; - int currentLine = styler.GetLine(startPos); + Sci_Position currentLine = styler.GetLine(startPos); // Initialize the block comment nesting level, if we are inside such a comment. int blockCommentLevel = 0; if (initStyle == SCE_AVS_COMMENTBLOCK || initStyle == SCE_AVS_COMMENTBLOCKN) { @@ -216,16 +216,16 @@ static void FoldAvsDoc( bool foldComment = styler.GetPropertyInt("fold.comment") != 0; bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0; - unsigned int endPos = startPos + length; + Sci_PositionU endPos = startPos + length; int visibleChars = 0; - int lineCurrent = styler.GetLine(startPos); + Sci_Position lineCurrent = styler.GetLine(startPos); int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK; int levelCurrent = levelPrev; char chNext = styler[startPos]; int styleNext = styler.StyleAt(startPos); int style = initStyle; - 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; diff --git a/lexers/LexAbaqus.cxx b/lexers/LexAbaqus.cxx index eba3e59d7..509d89a0a 100644 --- a/lexers/LexAbaqus.cxx +++ b/lexers/LexAbaqus.cxx @@ -301,10 +301,10 @@ static int LowerCase(int c) return c; } -static int LineEnd(int line, Accessor &styler) +static Sci_Position LineEnd(Sci_Position line, Accessor &styler) { - const int docLines = styler.GetLine(styler.Length() - 1); // Available last line - int eol_pos ; + const Sci_Position docLines = styler.GetLine(styler.Length() - 1); // Available last line + Sci_Position eol_pos ; // if the line is the last line, the eol_pos is styler.Length() // eol will contain a new line, or a virtual new line if ( docLines == line ) @@ -314,7 +314,7 @@ static int LineEnd(int line, Accessor &styler) return eol_pos ; } -static int LineStart(int line, Accessor &styler) +static Sci_Position LineStart(Sci_Position line, Accessor &styler) { return styler.LineStart(line) ; } @@ -330,14 +330,14 @@ static int LineStart(int line, Accessor &styler) // 6 : block close keyword line // 7 : keyword line in error // 8 : comment line -static int LineType(int line, Accessor &styler) { - int pos = LineStart(line, styler) ; - int eol_pos = LineEnd(line, styler) ; +static int LineType(Sci_Position line, Accessor &styler) { + Sci_Position pos = LineStart(line, styler) ; + Sci_Position eol_pos = LineEnd(line, styler) ; int c ; char ch = ' '; - int i = pos ; + Sci_Position i = pos ; while ( i < eol_pos ) { c = styler.SafeGetCharAt(i); ch = static_cast<char>(LowerCase(c)); @@ -418,7 +418,7 @@ static int LineType(int line, Accessor &styler) { return 4 ; } -static void SafeSetLevel(int line, int level, Accessor &styler) +static void SafeSetLevel(Sci_Position line, int level, Accessor &styler) { if ( line < 0 ) return ; @@ -434,18 +434,18 @@ static void SafeSetLevel(int line, int level, Accessor &styler) static void FoldABAQUSDoc(Sci_PositionU startPos, Sci_Position length, int, WordList *[], Accessor &styler) { - int startLine = styler.GetLine(startPos) ; - int endLine = styler.GetLine(startPos+length-1) ; + Sci_Position startLine = styler.GetLine(startPos) ; + Sci_Position endLine = styler.GetLine(startPos+length-1) ; // bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0; // We want to deal with all the cases // To know the correct indentlevel, we need to look back to the // previous command line indentation level // order of formatting keyline datalines commentlines - int beginData = -1 ; - int beginComment = -1 ; - int prvKeyLine = startLine ; - int prvKeyLineTp = 0 ; + Sci_Position beginData = -1 ; + Sci_Position beginComment = -1 ; + Sci_Position prvKeyLine = startLine ; + Sci_Position prvKeyLineTp = 0 ; // Scan until we find the previous keyword line // this will give us the level reference that we need @@ -467,7 +467,7 @@ WordList *[], Accessor &styler) { prvKeyLine = -1 ; // Now start scanning over the lines. - for ( int line = startLine; line <= endLine; line++ ) { + for ( Sci_Position line = startLine; line <= endLine; line++ ) { int lineType = LineType(line, styler) ; // Check for comment line @@ -516,7 +516,7 @@ WordList *[], Accessor &styler) { datLevel = level ; } - for ( int ll = beginData; ll < beginComment; ll++ ) + for ( Sci_Position ll = beginData; ll < beginComment; ll++ ) SafeSetLevel(ll, datLevel, styler) ; // The keyword we just found is going to be written at another level @@ -532,7 +532,7 @@ WordList *[], Accessor &styler) { } } - for ( int lll = beginComment; lll < line; lll++ ) + for ( Sci_Position lll = beginComment; lll < line; lll++ ) SafeSetLevel(lll, level, styler) ; // wrap and reset @@ -549,10 +549,10 @@ WordList *[], Accessor &styler) { } else { // We need to find out whether this comment block is followed by // a data line or a keyword line - const int docLines = styler.GetLine(styler.Length() - 1); + const Sci_Position docLines = styler.GetLine(styler.Length() - 1); - for ( int line = endLine + 1; line <= docLines; line++ ) { - int lineType = LineType(line, styler) ; + for ( Sci_Position line = endLine + 1; line <= docLines; line++ ) { + Sci_Position lineType = LineType(line, styler) ; if ( lineType != 8 ) { if ( !(lineType & 4) ) { @@ -578,7 +578,7 @@ WordList *[], Accessor &styler) { datLevel = level ; } - for ( int ll = beginData; ll < beginComment; ll++ ) + for ( Sci_Position ll = beginData; ll < beginComment; ll++ ) SafeSetLevel(ll, datLevel, styler) ; if ( prvKeyLineTp == 5 ) { @@ -588,7 +588,7 @@ WordList *[], Accessor &styler) { if ( prvKeyLineTp == 6 ) { level -= 1 ; } - for ( int m = beginComment; m <= endLine; m++ ) + for ( Sci_Position m = beginComment; m <= endLine; m++ ) SafeSetLevel(m, level, styler) ; } diff --git a/lexers/LexAda.cxx b/lexers/LexAda.cxx index e03b75f04..df26d7578 100644 --- a/lexers/LexAda.cxx +++ b/lexers/LexAda.cxx @@ -231,7 +231,7 @@ static void ColouriseDocument( StyleContext sc(startPos, length, initStyle, styler); - int lineCurrent = styler.GetLine(startPos); + Sci_Position lineCurrent = styler.GetLine(startPos); bool apostropheStartsAttribute = (styler.GetLineState(lineCurrent) & 1) != 0; while (sc.More()) { diff --git a/lexers/LexAsm.cxx b/lexers/LexAsm.cxx index ded7a4348..0b8e438a8 100644 --- a/lexers/LexAsm.cxx +++ b/lexers/LexAsm.cxx @@ -228,7 +228,7 @@ Sci_Position SCI_METHOD LexerAsm::WordListSet(int n, const char *wl) { wordListN = &directives4foldend; break; } - int firstModification = -1; + Sci_Position firstModification = -1; if (wordListN) { WordList wlNew; wlNew.Set(wl); @@ -378,9 +378,9 @@ void SCI_METHOD LexerAsm::Fold(Sci_PositionU startPos, Sci_Position length, int LexAccessor styler(pAccess); - unsigned int endPos = startPos + length; + Sci_PositionU endPos = startPos + length; int visibleChars = 0; - int lineCurrent = styler.GetLine(startPos); + Sci_Position lineCurrent = styler.GetLine(startPos); int levelCurrent = SC_FOLDLEVELBASE; if (lineCurrent > 0) levelCurrent = styler.LevelAt(lineCurrent-1) >> 16; @@ -391,7 +391,7 @@ void SCI_METHOD LexerAsm::Fold(Sci_PositionU startPos, Sci_Position length, int char word[100]; int wordlen = 0; 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; @@ -453,7 +453,7 @@ void SCI_METHOD LexerAsm::Fold(Sci_PositionU startPos, Sci_Position length, int } lineCurrent++; levelCurrent = levelNext; - 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); } diff --git a/lexers/LexBaan.cxx b/lexers/LexBaan.cxx index 1421e3797..8da2f3a3e 100644 --- a/lexers/LexBaan.cxx +++ b/lexers/LexBaan.cxx @@ -141,15 +141,15 @@ static void FoldBaanDoc(Sci_PositionU startPos, Sci_Position length, int initSty Accessor &styler) { bool foldComment = styler.GetPropertyInt("fold.comment") != 0; bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0; - unsigned int endPos = startPos + length; + Sci_PositionU endPos = startPos + length; int visibleChars = 0; - int lineCurrent = styler.GetLine(startPos); + Sci_Position lineCurrent = styler.GetLine(startPos); int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK; int levelCurrent = levelPrev; char chNext = styler[startPos]; int styleNext = styler.StyleAt(startPos); int style = initStyle; - 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; diff --git a/lexers/LexBash.cxx b/lexers/LexBash.cxx index 4ce937a80..21c47e577 100644 --- a/lexers/LexBash.cxx +++ b/lexers/LexBash.cxx @@ -223,14 +223,14 @@ static void ColouriseBashDoc(Sci_PositionU startPos, Sci_Position length, int in int numBase = 0; int digit; - unsigned int endPos = startPos + length; + Sci_PositionU endPos = startPos + length; int cmdState = BASH_CMD_START; int testExprType = 0; // Always backtracks to the start of a line that is not a continuation // of the previous line (i.e. start of a bash command segment) - int ln = styler.GetLine(startPos); - if (ln > 0 && startPos == static_cast<unsigned int>(styler.LineStart(ln))) + Sci_Position ln = styler.GetLine(startPos); + if (ln > 0 && startPos == static_cast<Sci_PositionU>(styler.LineStart(ln))) ln--; for (;;) { startPos = styler.LineStart(ln); @@ -752,10 +752,10 @@ static void ColouriseBashDoc(Sci_PositionU startPos, Sci_Position length, int in sc.Complete(); } -static bool IsCommentLine(int line, Accessor &styler) { - int pos = styler.LineStart(line); - int eol_pos = styler.LineStart(line + 1) - 1; - for (int i = pos; i < eol_pos; i++) { +static bool IsCommentLine(Sci_Position line, Accessor &styler) { + Sci_Position pos = styler.LineStart(line); + Sci_Position eol_pos = styler.LineStart(line + 1) - 1; + for (Sci_Position i = pos; i < eol_pos; i++) { char ch = styler[i]; if (ch == '#') return true; @@ -769,15 +769,15 @@ static void FoldBashDoc(Sci_PositionU startPos, Sci_Position length, int, WordLi Accessor &styler) { bool foldComment = styler.GetPropertyInt("fold.comment") != 0; bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0; - unsigned int endPos = startPos + length; + Sci_PositionU endPos = startPos + length; int visibleChars = 0; int skipHereCh = 0; - int lineCurrent = styler.GetLine(startPos); + Sci_Position lineCurrent = styler.GetLine(startPos); int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK; int levelCurrent = levelPrev; char chNext = styler[startPos]; int styleNext = styler.StyleAt(startPos); - 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 style = styleNext; diff --git a/lexers/LexBasic.cxx b/lexers/LexBasic.cxx index 94d350b42..7fa5b5498 100644 --- a/lexers/LexBasic.cxx +++ b/lexers/LexBasic.cxx @@ -300,7 +300,7 @@ Sci_Position SCI_METHOD LexerBasic::WordListSet(int n, const char *wl) { wordListN = &keywordlists[3]; break; } - int firstModification = -1; + Sci_Position firstModification = -1; if (wordListN) { WordList wlNew; wlNew.Set(wl); @@ -478,10 +478,10 @@ void SCI_METHOD LexerBasic::Fold(Sci_PositionU startPos, Sci_Position length, in LexAccessor styler(pAccess); - int line = styler.GetLine(startPos); + Sci_Position line = styler.GetLine(startPos); int level = styler.LevelAt(line); int go = 0, done = 0; - int endPos = startPos + length; + Sci_Position endPos = startPos + length; char word[256]; int wordlen = 0; const bool userDefinedFoldMarkers = !options.foldExplicitStart.empty() && !options.foldExplicitEnd.empty(); @@ -489,7 +489,7 @@ void SCI_METHOD LexerBasic::Fold(Sci_PositionU startPos, Sci_Position length, in // Scan for tokens at the start of the line (they may include // whitespace, for tokens like "End Function" - for (int i = startPos; i < endPos; i++) { + for (Sci_Position i = startPos; i < endPos; i++) { int c = cNext; cNext = styler.SafeGetCharAt(i + 1); bool atEOL = (c == '\r' && cNext != '\n') || (c == '\n'); diff --git a/lexers/LexBatch.cxx b/lexers/LexBatch.cxx index 551a9b58f..377b2cbf1 100644 --- a/lexers/LexBatch.cxx +++ b/lexers/LexBatch.cxx @@ -35,7 +35,7 @@ static bool IsAlphabetic(int ch) { return IsASCII(ch) && isalpha(ch); } -static inline bool AtEOL(Accessor &styler, unsigned int i) { +static inline bool AtEOL(Accessor &styler, Sci_PositionU i) { return (styler[i] == '\n') || ((styler[i] == '\r') && (styler.SafeGetCharAt(i + 1) != '\n')); } @@ -54,17 +54,17 @@ static bool IsBSeparator(char ch) { static void ColouriseBatchLine( char *lineBuffer, - unsigned int lengthLine, - unsigned int startLine, - unsigned int endPos, + Sci_PositionU lengthLine, + Sci_PositionU startLine, + Sci_PositionU endPos, WordList *keywordlists[], Accessor &styler) { - unsigned int offset = 0; // Line Buffer Offset - unsigned int cmdLoc; // External Command / Program Location + Sci_PositionU offset = 0; // Line Buffer Offset + Sci_PositionU cmdLoc; // External Command / Program Location char wordBuffer[81]; // Word Buffer - large to catch long paths - unsigned int wbl; // Word Buffer Length - unsigned int wbo; // Word Buffer Offset - also Special Keyword Buffer Length + Sci_PositionU wbl; // Word Buffer Length + Sci_PositionU wbo; // Word Buffer Offset - also Special Keyword Buffer Length WordList &keywords = *keywordlists[0]; // Internal Commands WordList &keywords2 = *keywordlists[1]; // External Commands (optional) @@ -219,7 +219,7 @@ static void ColouriseBatchLine( // Affected Commands are in Length range 2-6 // Good that ERRORLEVEL, EXIST, CALL, DO, LOADHIGH, and LH are unaffected sKeywordFound = false; - for (unsigned int keywordLength = 2; keywordLength < wbl && keywordLength < 7 && !sKeywordFound; keywordLength++) { + for (Sci_PositionU keywordLength = 2; keywordLength < wbl && keywordLength < 7 && !sKeywordFound; keywordLength++) { wbo = 0; // Copy Keyword Length from Word Buffer into Special Keyword Buffer for (; wbo < keywordLength; wbo++) { @@ -472,9 +472,9 @@ static void ColouriseBatchDoc( styler.StartAt(startPos); styler.StartSegment(startPos); - unsigned int linePos = 0; - unsigned int startLine = startPos; - for (unsigned int i = startPos; i < startPos + length; i++) { + Sci_PositionU linePos = 0; + Sci_PositionU startLine = startPos; + for (Sci_PositionU i = startPos; i < startPos + length; i++) { lineBuffer[linePos++] = styler[i]; if (AtEOL(styler, i) || (linePos >= sizeof(lineBuffer) - 1)) { // End of line (or of line buffer) met, colourise it diff --git a/lexers/LexBibTeX.cxx b/lexers/LexBibTeX.cxx index bab02842a..fef58a9b0 100644 --- a/lexers/LexBibTeX.cxx +++ b/lexers/LexBibTeX.cxx @@ -94,7 +94,7 @@ namespace { styler.StartAt(start_pos); styler.StartSegment(start_pos); - int current_line = styler.GetLine(start_pos); + Sci_Position current_line = styler.GetLine(start_pos); int prev_level = styler.LevelAt(current_line) & SC_FOLDLEVELNUMBERMASK; int current_level = prev_level; int visible_chars = 0; @@ -153,7 +153,7 @@ namespace { sc.SetState(SCE_BIBTEX_DEFAULT); // Don't colorize the = sc.ForwardSetState(SCE_BIBTEX_VALUE); // Parameter value colorization - int start = sc.currentPos; + Sci_Position start = sc.currentPos; // We need to handle multiple situations: // 1. name"one two {three}" @@ -227,12 +227,12 @@ namespace { state = SCE_BIBTEX_DEFAULT; } - int end = sc.currentPos; + Sci_Position end = sc.currentPos; current_line = styler.GetLine(end); // We have possibly skipped some lines, so the folding levels // have to be adjusted separately - for (int i = styler.GetLine(start); i <= styler.GetLine(end); ++i) + for (Sci_Position i = styler.GetLine(start); i <= styler.GetLine(end); ++i) styler.SetLevel(i, prev_level); sc.ForwardSetState(state); diff --git a/lexers/LexBullant.cxx b/lexers/LexBullant.cxx index 8a3dbb46d..404188769 100644 --- a/lexers/LexBullant.cxx +++ b/lexers/LexBullant.cxx @@ -23,10 +23,10 @@ using namespace Scintilla; #endif -static int classifyWordBullant(unsigned int start, unsigned int end, WordList &keywords, Accessor &styler) { +static int classifyWordBullant(Sci_PositionU start, Sci_PositionU end, WordList &keywords, Accessor &styler) { char s[100]; s[0] = '\0'; - for (unsigned int i = 0; i < end - start + 1 && i < 30; i++) { + for (Sci_PositionU i = 0; i < end - start + 1 && i < 30; i++) { s[i] = static_cast<char>(tolower(styler[start + i])); s[i + 1] = '\0'; } @@ -65,7 +65,7 @@ static void ColouriseBullantDoc(Sci_PositionU startPos, Sci_Position length, int styler.StartAt(startPos); bool fold = styler.GetPropertyInt("fold") != 0; - int lineCurrent = styler.GetLine(startPos); + Sci_Position lineCurrent = styler.GetLine(startPos); int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK; int levelCurrent = levelPrev; @@ -74,11 +74,11 @@ static void ColouriseBullantDoc(Sci_PositionU startPos, Sci_Position length, int state = SCE_C_DEFAULT; char chPrev = ' '; char chNext = styler[startPos]; - unsigned int lengthDoc = startPos + length; + Sci_PositionU lengthDoc = startPos + length; int visibleChars = 0; styler.StartSegment(startPos); int endFoundThisLine = 0; - for (unsigned int i = startPos; i < lengthDoc; i++) { + for (Sci_PositionU i = startPos; i < lengthDoc; i++) { char ch = chNext; chNext = styler.SafeGetCharAt(i + 1); diff --git a/lexers/LexCLW.cxx b/lexers/LexCLW.cxx index 0e7242761..af2ca151a 100644 --- a/lexers/LexCLW.cxx +++ b/lexers/LexCLW.cxx @@ -142,12 +142,12 @@ inline bool SetNumericConstantState(StyleContext &scDoc) { } // Get the next word in uppercase from the current position (keyword lookahead) -inline bool GetNextWordUpper(Accessor &styler, unsigned int uiStartPos, int iLength, char *cWord) { +inline bool GetNextWordUpper(Accessor &styler, Sci_PositionU uiStartPos, Sci_Position iLength, char *cWord) { - unsigned int iIndex = 0; // Buffer Index + Sci_PositionU iIndex = 0; // Buffer Index // Loop through the remaining string from the current position - for (int iOffset = uiStartPos; iOffset < iLength; iOffset++) { + for (Sci_Position iOffset = uiStartPos; iOffset < iLength; iOffset++) { // Get the character from the buffer using the offset char cCharacter = styler[iOffset]; if (IsEOL(cCharacter)) { @@ -534,9 +534,9 @@ static void ColouriseClarionDocInsensitive(Sci_PositionU uiStartPos, Sci_Positio // Fill Buffer -static void FillBuffer(unsigned int uiStart, unsigned int uiEnd, Accessor &accStyler, char *szBuffer, unsigned int uiLength) { +static void FillBuffer(Sci_PositionU uiStart, Sci_PositionU uiEnd, Accessor &accStyler, char *szBuffer, Sci_PositionU uiLength) { - unsigned int uiPos = 0; + Sci_PositionU uiPos = 0; while ((uiPos < uiEnd - uiStart + 1) && (uiPos < uiLength-1)) { szBuffer[uiPos] = static_cast<char>(toupper(accStyler[uiStart + uiPos])); @@ -601,17 +601,17 @@ static int ClassifyClarionFoldPoint(int iLevel, const char* szString) { // Clarion Language Folding Procedure static void FoldClarionDoc(Sci_PositionU uiStartPos, Sci_Position iLength, int iInitStyle, WordList *[], Accessor &accStyler) { - unsigned int uiEndPos = uiStartPos + iLength; - int iLineCurrent = accStyler.GetLine(uiStartPos); + Sci_PositionU uiEndPos = uiStartPos + iLength; + Sci_Position iLineCurrent = accStyler.GetLine(uiStartPos); int iLevelPrev = accStyler.LevelAt(iLineCurrent) & SC_FOLDLEVELNUMBERMASK; int iLevelCurrent = iLevelPrev; char chNext = accStyler[uiStartPos]; int iStyle = iInitStyle; int iStyleNext = accStyler.StyleAt(uiStartPos); int iVisibleChars = 0; - int iLastStart = 0; + Sci_Position iLastStart = 0; - for (unsigned int uiPos = uiStartPos; uiPos < uiEndPos; uiPos++) { + for (Sci_PositionU uiPos = uiStartPos; uiPos < uiEndPos; uiPos++) { char chChar = chNext; chNext = accStyler.SafeGetCharAt(uiPos + 1); diff --git a/lexers/LexCOBOL.cxx b/lexers/LexCOBOL.cxx index bce06623a..3150e3338 100644 --- a/lexers/LexCOBOL.cxx +++ b/lexers/LexCOBOL.cxx @@ -64,12 +64,12 @@ static int CountBits(int nBits) return count; } -static void getRange(unsigned int start, - unsigned int end, +static void getRange(Sci_PositionU start, + Sci_PositionU end, Accessor &styler, char *s, - unsigned int len) { - unsigned int i = 0; + Sci_PositionU len) { + Sci_PositionU i = 0; while ((i < end - start + 1) && (i < len-1)) { s[i] = static_cast<char>(tolower(styler[start + i])); i++; @@ -77,12 +77,12 @@ static void getRange(unsigned int start, s[i] = '\0'; } -static void ColourTo(Accessor &styler, unsigned int end, unsigned int attr) { +static void ColourTo(Accessor &styler, Sci_PositionU end, unsigned int attr) { styler.ColourTo(end, attr); } -static int classifyWordCOBOL(unsigned int start, unsigned int end, /*WordList &keywords*/WordList *keywordlists[], Accessor &styler, int nContainment, bool *bAarea) { +static int classifyWordCOBOL(Sci_PositionU start, Sci_PositionU end, /*WordList &keywords*/WordList *keywordlists[], Accessor &styler, int nContainment, bool *bAarea) { int ret = 0; WordList& a_keywords = *keywordlists[0]; @@ -152,11 +152,11 @@ static void ColouriseCOBOLDoc(Sci_PositionU startPos, Sci_Position length, int i state = SCE_C_DEFAULT; char chPrev = ' '; char chNext = styler[startPos]; - unsigned int lengthDoc = startPos + length; + Sci_PositionU lengthDoc = startPos + length; int nContainment; - int currentLine = styler.GetLine(startPos); + Sci_Position currentLine = styler.GetLine(startPos); if (currentLine > 0) { styler.SetLineState(currentLine, styler.GetLineState(currentLine-1)); nContainment = styler.GetLineState(currentLine); @@ -170,7 +170,7 @@ static void ColouriseCOBOLDoc(Sci_PositionU startPos, Sci_Position length, int i bool bNewLine = true; bool bAarea = !isspacechar(chNext); int column = 0; - for (unsigned int i = startPos; i < lengthDoc; i++) { + for (Sci_PositionU i = startPos; i < lengthDoc; i++) { char ch = chNext; chNext = styler.SafeGetCharAt(i + 1); @@ -277,7 +277,7 @@ static void ColouriseCOBOLDoc(Sci_PositionU startPos, Sci_Position length, int i if (ch == '\r' || ch == '\n') { if (((i > styler.GetStartSegment() + 2) || ( (initStyle == SCE_C_COMMENTDOC) && - (styler.GetStartSegment() == static_cast<unsigned int>(startPos))))) { + (styler.GetStartSegment() == static_cast<Sci_PositionU>(startPos))))) { ColourTo(styler, i, state); state = SCE_C_DEFAULT; } @@ -312,9 +312,9 @@ static void ColouriseCOBOLDoc(Sci_PositionU startPos, Sci_Position length, int i static void FoldCOBOLDoc(Sci_PositionU startPos, Sci_Position length, int, WordList *[], Accessor &styler) { bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0; - unsigned int endPos = startPos + length; + Sci_PositionU endPos = startPos + length; int visibleChars = 0; - int lineCurrent = styler.GetLine(startPos); + Sci_Position lineCurrent = styler.GetLine(startPos); int levelPrev = lineCurrent > 0 ? styler.LevelAt(lineCurrent - 1) & SC_FOLDLEVELNUMBERMASK : 0xFFF; char chNext = styler[startPos]; @@ -322,7 +322,7 @@ static void FoldCOBOLDoc(Sci_PositionU startPos, Sci_Position length, int, WordL bool bAarea = !isspacechar(chNext); int column = 0; bool bComment = false; - for (unsigned int i = startPos; i < endPos; i++) { + for (Sci_PositionU i = startPos; i < endPos; i++) { char ch = chNext; chNext = styler.SafeGetCharAt(i + 1); ++column; 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); } diff --git a/lexers/LexCSS.cxx b/lexers/LexCSS.cxx index b56aff31b..19345af54 100644 --- a/lexers/LexCSS.cxx +++ b/lexers/LexCSS.cxx @@ -58,11 +58,11 @@ inline bool IsCssOperator(const int ch) { } // look behind (from start of document to our start position) to determine current nesting level -inline int NestingLevelLookBehind(unsigned int startPos, Accessor &styler) { +inline int NestingLevelLookBehind(Sci_PositionU startPos, Accessor &styler) { int ch; int nestingLevel = 0; - for (unsigned int i = 0; i < startPos; i++) { + for (Sci_PositionU i = 0; i < startPos; i++) { ch = styler.SafeGetCharAt(i); if (ch == '{') nestingLevel++; @@ -131,7 +131,7 @@ static void ColouriseCssDoc(Sci_PositionU startPos, Sci_Position length, int ini if (lastStateC == -1) { // backtrack to get last state: // comments are like whitespace, so we must return to the previous state - unsigned int i = startPos; + Sci_PositionU i = startPos; for (; i > 0; i--) { if ((lastStateC = styler.StyleAt(i-1)) != SCE_CSS_COMMENT) { if (lastStateC == SCE_CSS_OPERATOR) { @@ -165,7 +165,7 @@ static void ColouriseCssDoc(Sci_PositionU startPos, Sci_Position length, int ini if (sc.state == SCE_CSS_DOUBLESTRING || sc.state == SCE_CSS_SINGLESTRING) { if (sc.ch != (sc.state == SCE_CSS_DOUBLESTRING ? '\"' : '\'')) continue; - unsigned int i = sc.currentPos; + Sci_PositionU i = sc.currentPos; while (i && styler[i-1] == '\\') i--; if ((sc.currentPos - i) % 2 == 1) @@ -175,7 +175,7 @@ static void ColouriseCssDoc(Sci_PositionU startPos, Sci_Position length, int ini if (sc.state == SCE_CSS_OPERATOR) { if (op == ' ') { - unsigned int i = startPos; + Sci_PositionU i = startPos; op = styler.SafeGetCharAt(i-1); opPrev = styler.SafeGetCharAt(i-2); while (--i) { @@ -380,10 +380,10 @@ static void ColouriseCssDoc(Sci_PositionU startPos, Sci_Position length, int ini // check for nested rule selector if (sc.state == SCE_CSS_IDENTIFIER && (IsAWordChar(sc.ch) || sc.ch == ':' || sc.ch == '.' || sc.ch == '#')) { // look ahead to see whether { comes before next ; and } - unsigned int endPos = startPos + length; + Sci_PositionU endPos = startPos + length; int ch; - for (unsigned int i = sc.currentPos; i < endPos; i++) { + for (Sci_PositionU i = sc.currentPos; i < endPos; i++) { ch = styler.SafeGetCharAt(i); if (ch == ';' || ch == '}') break; @@ -505,14 +505,14 @@ static void ColouriseCssDoc(Sci_PositionU startPos, Sci_Position length, int ini static void FoldCSSDoc(Sci_PositionU startPos, Sci_Position length, int, WordList *[], Accessor &styler) { bool foldComment = styler.GetPropertyInt("fold.comment") != 0; bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0; - unsigned int endPos = startPos + length; + Sci_PositionU endPos = startPos + length; int visibleChars = 0; - int lineCurrent = styler.GetLine(startPos); + Sci_Position lineCurrent = styler.GetLine(startPos); int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK; int levelCurrent = levelPrev; char chNext = styler[startPos]; bool inComment = (styler.StyleAt(startPos-1) == SCE_CSS_COMMENT); - 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 style = styler.StyleAt(i); diff --git a/lexers/LexCaml.cxx b/lexers/LexCaml.cxx index 4cc0bd7df..df8781541 100644 --- a/lexers/LexCaml.cxx +++ b/lexers/LexCaml.cxx @@ -188,7 +188,8 @@ void ColouriseCamlDoc( // initialize styler StyleContext sc(startPos, length, initStyle, styler); - int chBase = 0, chToken = 0, chLit = 0; + Sci_PositionU chToken = 0; + int chBase = 0, chLit = 0; WordList& keywords = *keywordlists[0]; WordList& keywords2 = *keywordlists[1]; WordList& keywords3 = *keywordlists[2]; @@ -206,7 +207,7 @@ void ColouriseCamlDoc( while (sc.More()) { // set up [per-char] state info int state2 = -1; // (ASSUME no state change) - int chColor = sc.currentPos - 1;// (ASSUME standard coloring range) + Sci_Position chColor = sc.currentPos - 1;// (ASSUME standard coloring range) bool advance = true; // (ASSUME scanner "eats" 1 char) // step state machine @@ -254,11 +255,11 @@ void ColouriseCamlDoc( case SCE_CAML_IDENTIFIER: // [try to] interpret as [additional] identifier char if (!(iscaml(sc.ch) || sc.Match('\''))) { - const int n = sc.currentPos - chToken; + const Sci_Position n = sc.currentPos - chToken; if (n < 24) { // length is believable as keyword, [re-]construct token char t[24]; - for (int i = -n; i < 0; i++) + for (Sci_Position i = -n; i < 0; i++) t[n + i] = static_cast<char>(sc.GetRelative(i)); t[n] = '\0'; // special-case "_" token as KEYWORD @@ -390,7 +391,7 @@ void ColouriseCamlDoc( state2 = SCE_CAML_STRING, sc.ch = ' ' /* (...\") */, chColor++, styler.ColourTo(chColor, SCE_CAML_WHITE), styler.Flush(); // ... then backtrack to determine original SML literal type - int p = chColor - 2; + Sci_Position p = chColor - 2; for (; p >= 0 && styler.StyleAt(p) == SCE_CAML_WHITE; p--) ; if (p >= 0) state2 = static_cast<int>(styler.StyleAt(p)); @@ -437,7 +438,7 @@ void ColouriseCamlDoc( static #endif /* BUILD_AS_EXTERNAL_LEXER */ void FoldCamlDoc( - unsigned int, int, + Sci_PositionU, Sci_Position, int, WordList *[], Accessor &) diff --git a/lexers/LexCmake.cxx b/lexers/LexCmake.cxx index 4bfc5adb0..1cbca3611 100644 --- a/lexers/LexCmake.cxx +++ b/lexers/LexCmake.cxx @@ -43,10 +43,10 @@ static bool isCmakeLetter(char ch) return(ch >= 'A' && ch <= 'Z') || (ch >= 'a' && ch <= 'z'); } -static bool CmakeNextLineHasElse(unsigned int start, unsigned int end, Accessor &styler) +static bool CmakeNextLineHasElse(Sci_PositionU start, Sci_PositionU end, Accessor &styler) { - int nNextLine = -1; - for ( unsigned int i = start; i < end; i++ ) { + Sci_Position nNextLine = -1; + for ( Sci_PositionU i = start; i < end; i++ ) { char cNext = styler.SafeGetCharAt( i ); if ( cNext == '\n' ) { nNextLine = i+1; @@ -57,7 +57,7 @@ static bool CmakeNextLineHasElse(unsigned int start, unsigned int end, Accessor if ( nNextLine == -1 ) // We never foudn the next line... return false; - for ( unsigned int firstChar = nNextLine; firstChar < end; firstChar++ ) { + for ( Sci_PositionU firstChar = nNextLine; firstChar < end; firstChar++ ) { char cNext = styler.SafeGetCharAt( firstChar ); if ( cNext == ' ' ) continue; @@ -71,7 +71,7 @@ static bool CmakeNextLineHasElse(unsigned int start, unsigned int end, Accessor return false; } -static int calculateFoldCmake(unsigned int start, unsigned int end, int foldlevel, Accessor &styler, bool bElse) +static int calculateFoldCmake(Sci_PositionU start, Sci_PositionU end, int foldlevel, Accessor &styler, bool bElse) { // If the word is too long, it is not what we are looking for if ( end - start > 20 ) @@ -100,7 +100,7 @@ static int calculateFoldCmake(unsigned int start, unsigned int end, int foldleve return newFoldlevel; } -static int classifyWordCmake(unsigned int start, unsigned int end, WordList *keywordLists[], Accessor &styler ) +static int classifyWordCmake(Sci_PositionU start, Sci_PositionU end, WordList *keywordLists[], Accessor &styler ) { char word[100] = {0}; char lowercaseWord[100] = {0}; @@ -109,7 +109,7 @@ static int classifyWordCmake(unsigned int start, unsigned int end, WordList *key WordList &Parameters = *keywordLists[1]; WordList &UserDefined = *keywordLists[2]; - for (unsigned int i = 0; i < end - start + 1 && i < 99; i++) { + for (Sci_PositionU i = 0; i < end - start + 1 && i < 99; i++) { word[i] = static_cast<char>( styler[ start + i ] ); lowercaseWord[i] = static_cast<char>(tolower(word[i])); } @@ -171,14 +171,14 @@ static void ColouriseCmakeDoc(Sci_PositionU startPos, Sci_Position length, int, styler.StartAt( startPos ); styler.GetLine( startPos ); - unsigned int nLengthDoc = startPos + length; + Sci_PositionU nLengthDoc = startPos + length; styler.StartSegment( startPos ); char cCurrChar; bool bVarInString = false; bool bClassicVarInString = false; - unsigned int i; + Sci_PositionU i; for ( i = startPos; i < nLengthDoc; i++ ) { cCurrChar = styler.SafeGetCharAt( i ); char cNextChar = styler.SafeGetCharAt(i+1); @@ -263,8 +263,8 @@ static void ColouriseCmakeDoc(Sci_PositionU startPos, Sci_Position length, int, } if ( cNextChar == '\r' || cNextChar == '\n' ) { - int nCurLine = styler.GetLine(i+1); - int nBack = i; + Sci_Position nCurLine = styler.GetLine(i+1); + Sci_Position nBack = i; // We need to check if the previous line has a \ in it... bool bNextLine = false; @@ -385,18 +385,18 @@ static void FoldCmakeDoc(Sci_PositionU startPos, Sci_Position length, int, WordL bool foldAtElse = styler.GetPropertyInt("fold.at.else", 0) == 1; - int lineCurrent = styler.GetLine(startPos); - unsigned int safeStartPos = styler.LineStart( lineCurrent ); + Sci_Position lineCurrent = styler.GetLine(startPos); + Sci_PositionU safeStartPos = styler.LineStart( lineCurrent ); bool bArg1 = true; - int nWordStart = -1; + Sci_Position nWordStart = -1; int levelCurrent = SC_FOLDLEVELBASE; if (lineCurrent > 0) levelCurrent = styler.LevelAt(lineCurrent-1) >> 16; int levelNext = levelCurrent; - for (unsigned int i = safeStartPos; i < startPos + length; i++) { + for (Sci_PositionU i = safeStartPos; i < startPos + length; i++) { char chCurr = styler.SafeGetCharAt(i); if ( bArg1 ) { diff --git a/lexers/LexCoffeeScript.cxx b/lexers/LexCoffeeScript.cxx index 0cd86e838..34ad716e9 100644 --- a/lexers/LexCoffeeScript.cxx +++ b/lexers/LexCoffeeScript.cxx @@ -48,7 +48,7 @@ static 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. static bool FollowsPostfixOperator(StyleContext &sc, Accessor &styler) { - int pos = (int) sc.currentPos; + Sci_Position pos = (Sci_Position) sc.currentPos; while (--pos > 0) { char ch = styler[pos]; if (ch == '+' || ch == '-') { @@ -60,9 +60,9 @@ static bool FollowsPostfixOperator(StyleContext &sc, Accessor &styler) { static bool followsReturnKeyword(StyleContext &sc, Accessor &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') { @@ -97,9 +97,9 @@ static void ColouriseCoffeeScriptDoc(Sci_PositionU startPos, Sci_Position length int visibleChars = 0; // look back to set chPrevNonWhite properly for better regex colouring - int endPos = startPos + length; + Sci_Position endPos = startPos + length; if (startPos > 0 && IsSpaceEquiv(initStyle)) { - unsigned int back = startPos; + Sci_PositionU back = startPos; styler.Flush(); while (back > 0 && IsSpaceEquiv(styler.StyleAt(--back))) ; @@ -268,10 +268,10 @@ static void ColouriseCoffeeScriptDoc(Sci_PositionU startPos, Sci_Position length sc.Complete(); } -static bool IsCommentLine(int line, Accessor &styler) { - int pos = styler.LineStart(line); - int eol_pos = styler.LineStart(line + 1) - 1; - for (int i = pos; i < eol_pos; i++) { +static bool IsCommentLine(Sci_Position line, Accessor &styler) { + Sci_Position pos = styler.LineStart(line); + Sci_Position eol_pos = styler.LineStart(line + 1) - 1; + for (Sci_Position i = pos; i < eol_pos; i++) { char ch = styler[i]; if (ch == '#') return true; @@ -284,9 +284,9 @@ static bool IsCommentLine(int line, Accessor &styler) { static void FoldCoffeeScriptDoc(Sci_PositionU startPos, Sci_Position length, int, WordList *[], Accessor &styler) { // A simplified version of FoldPyDoc - const int maxPos = startPos + length; - const int maxLines = styler.GetLine(maxPos - 1); // Requested last line - const int docLines = styler.GetLine(styler.Length() - 1); // Available last line + const Sci_Position maxPos = startPos + length; + const Sci_Position maxLines = styler.GetLine(maxPos - 1); // Requested last line + const Sci_Position docLines = styler.GetLine(styler.Length() - 1); // Available last line // property fold.coffeescript.comment const bool foldComment = styler.GetPropertyInt("fold.coffeescript.comment") != 0; @@ -298,7 +298,7 @@ static void FoldCoffeeScriptDoc(Sci_PositionU startPos, Sci_Position length, int // and so we can fix any preceding fold level (which is why we go back // at least one line in all cases) int spaceFlags = 0; - int lineCurrent = styler.GetLine(startPos); + Sci_Position lineCurrent = styler.GetLine(startPos); int indentCurrent = styler.IndentAmount(lineCurrent, &spaceFlags, NULL); while (lineCurrent > 0) { lineCurrent--; @@ -321,7 +321,7 @@ static void FoldCoffeeScriptDoc(Sci_PositionU startPos, Sci_Position length, int // Gather info int lev = indentCurrent; - int lineNext = lineCurrent + 1; + Sci_Position lineNext = lineCurrent + 1; int indentNext = indentCurrent; if (lineNext <= docLines) { // Information about next line is only available if not at end of document @@ -365,7 +365,7 @@ static void FoldCoffeeScriptDoc(Sci_PositionU startPos, Sci_Position length, int // which is indented more than the line after the end of // the comment-block, use the level of the block before - int skipLine = lineNext; + Sci_Position skipLine = lineNext; int skipLevel = levelAfterComments; while (--skipLine > lineCurrent) { diff --git a/lexers/LexConf.cxx b/lexers/LexConf.cxx index f41e623cc..2eed51b71 100644 --- a/lexers/LexConf.cxx +++ b/lexers/LexConf.cxx @@ -35,10 +35,10 @@ static void ColouriseConfDoc(Sci_PositionU startPos, Sci_Position length, int, W { int state = SCE_CONF_DEFAULT; char chNext = styler[startPos]; - int lengthDoc = startPos + length; + Sci_Position lengthDoc = startPos + length; // create a buffer large enough to take the largest chunk... char *buffer = new char[length+1]; - int bufferCount = 0; + Sci_Position bufferCount = 0; // this assumes that we have 2 keyword list in conf.properties WordList &directives = *keywordLists[0]; @@ -48,7 +48,7 @@ static void ColouriseConfDoc(Sci_PositionU startPos, Sci_Position length, int, W // using the hand-written state machine shown below styler.StartAt(startPos); styler.StartSegment(startPos); - for (int i = startPos; i < lengthDoc; i++) { + for (Sci_Position i = startPos; i < lengthDoc; i++) { char ch = chNext; chNext = styler.SafeGetCharAt(i + 1); diff --git a/lexers/LexCrontab.cxx b/lexers/LexCrontab.cxx index 3bc20f11f..b500d2d28 100644 --- a/lexers/LexCrontab.cxx +++ b/lexers/LexCrontab.cxx @@ -34,10 +34,10 @@ static void ColouriseNncrontabDoc(Sci_PositionU startPos, Sci_Position length, i { int state = SCE_NNCRONTAB_DEFAULT; char chNext = styler[startPos]; - int lengthDoc = startPos + length; + Sci_Position lengthDoc = startPos + length; // create a buffer large enough to take the largest chunk... char *buffer = new char[length+1]; - int bufferCount = 0; + Sci_Position bufferCount = 0; // used when highliting environment variables inside quoted string: bool insideString = false; @@ -50,7 +50,7 @@ static void ColouriseNncrontabDoc(Sci_PositionU startPos, Sci_Position length, i // using the hand-written state machine shown below styler.StartAt(startPos); styler.StartSegment(startPos); - for (int i = startPos; i < lengthDoc; i++) { + for (Sci_Position i = startPos; i < lengthDoc; i++) { char ch = chNext; chNext = styler.SafeGetCharAt(i + 1); diff --git a/lexers/LexCsound.cxx b/lexers/LexCsound.cxx index 292eb15c7..6d065c8d1 100644 --- a/lexers/LexCsound.cxx +++ b/lexers/LexCsound.cxx @@ -152,15 +152,15 @@ static void ColouriseCsoundDoc(Sci_PositionU startPos, Sci_Position length, int static void FoldCsoundInstruments(Sci_PositionU startPos, Sci_Position length, int /* initStyle */, WordList *[], Accessor &styler) { - unsigned int lengthDoc = startPos + length; + Sci_PositionU lengthDoc = startPos + length; int visibleChars = 0; - int lineCurrent = styler.GetLine(startPos); + Sci_Position lineCurrent = styler.GetLine(startPos); int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK; int levelCurrent = levelPrev; char chNext = styler[startPos]; int stylePrev = 0; int styleNext = styler.StyleAt(startPos); - for (unsigned int i = startPos; i < lengthDoc; i++) { + for (Sci_PositionU i = startPos; i < lengthDoc; i++) { char ch = chNext; chNext = styler.SafeGetCharAt(i + 1); int style = styleNext; diff --git a/lexers/LexD.cxx b/lexers/LexD.cxx index 4d699da61..7c0177e99 100644 --- a/lexers/LexD.cxx +++ b/lexers/LexD.cxx @@ -229,7 +229,7 @@ Sci_Position SCI_METHOD LexerD::WordListSet(int n, const char *wl) { wordListN = &keywords7; break; } - int firstModification = -1; + Sci_Position firstModification = -1; if (wordListN) { WordList wlNew; wlNew.Set(wl); @@ -248,7 +248,7 @@ void SCI_METHOD LexerD::Lex(Sci_PositionU startPos, Sci_Position length, int ini StyleContext sc(startPos, length, initStyle, styler); - int curLine = styler.GetLine(startPos); + Sci_Position curLine = styler.GetLine(startPos); int curNcLevel = curLine > 0? styler.GetLineState(curLine-1): 0; bool numFloat = false; // Float literals have '+' and '-' signs bool numHex = false; @@ -478,9 +478,9 @@ void SCI_METHOD LexerD::Fold(Sci_PositionU startPos, Sci_Position length, int in LexAccessor styler(pAccess); - unsigned int endPos = startPos + length; + Sci_PositionU endPos = startPos + length; int visibleChars = 0; - int lineCurrent = styler.GetLine(startPos); + Sci_Position lineCurrent = styler.GetLine(startPos); int levelCurrent = SC_FOLDLEVELBASE; if (lineCurrent > 0) levelCurrent = styler.LevelAt(lineCurrent-1) >> 16; @@ -491,7 +491,7 @@ void SCI_METHOD LexerD::Fold(Sci_PositionU startPos, Sci_Position length, int in int style = initStyle; bool foldAtElse = options.foldAtElseInt >= 0 ? options.foldAtElseInt != 0 : options.foldAtElse; 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; diff --git a/lexers/LexDMAP.cxx b/lexers/LexDMAP.cxx index 8f3706b77..eb43cde6d 100644 --- a/lexers/LexDMAP.cxx +++ b/lexers/LexDMAP.cxx @@ -44,8 +44,8 @@ static void ColouriseDMAPDoc(Sci_PositionU startPos, Sci_Position length, int in WordList &keywords2 = *keywordlists[1]; WordList &keywords3 = *keywordlists[2]; /***************************************/ - int posLineStart = 0, numNonBlank = 0; - int endPos = startPos + length; + Sci_Position posLineStart = 0, numNonBlank = 0; + Sci_Position endPos = startPos + length; /***************************************/ // backtrack to the nearest keyword while ((startPos > 1) && (styler.StyleAt(startPos) != SCE_DMAP_WORD)) { @@ -65,7 +65,7 @@ static void ColouriseDMAPDoc(Sci_PositionU startPos, Sci_Position length, int in if (!IsASpaceOrTab(sc.ch)) numNonBlank ++; /***********************************************/ // Handle data appearing after column 72; it is ignored - int toLineStart = sc.currentPos - posLineStart; + Sci_Position toLineStart = sc.currentPos - posLineStart; if (toLineStart >= 72 || sc.ch == '$') { sc.SetState(SCE_DMAP_COMMENT); while (!sc.atLineEnd && sc.More()) sc.Forward(); // Until line end @@ -158,19 +158,19 @@ static void FoldDMAPDoc(Sci_PositionU startPos, Sci_Position length, int initSty // Do not know how to fold the comment at the moment. // bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0; - unsigned int endPos = startPos + length; + Sci_PositionU endPos = startPos + length; int visibleChars = 0; - int lineCurrent = styler.GetLine(startPos); + Sci_Position lineCurrent = styler.GetLine(startPos); int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK; int levelCurrent = levelPrev; char chNext = styler[startPos]; int styleNext = styler.StyleAt(startPos); int style = initStyle; /***************************************/ - int lastStart = 0; + Sci_Position lastStart = 0; char prevWord[32] = ""; /***************************************/ - 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; @@ -186,7 +186,7 @@ static void FoldDMAPDoc(Sci_PositionU startPos, Sci_Position length, int initSty if (style == SCE_DMAP_WORD) { if(iswordchar(ch) && !iswordchar(chNext)) { char s[32]; - unsigned int k; + Sci_PositionU k; for(k=0; (k<31 ) && (k<i-lastStart+1 ); k++) { s[k] = static_cast<char>(tolower(styler[lastStart+k])); } diff --git a/lexers/LexDMIS.cxx b/lexers/LexDMIS.cxx index 39d40b6cc..7eeecca0e 100644 --- a/lexers/LexDMIS.cxx +++ b/lexers/LexDMIS.cxx @@ -187,7 +187,7 @@ const char * SCI_METHOD LexerDMIS::DescribeWordListSets() void SCI_METHOD LexerDMIS::Lex(Sci_PositionU startPos, Sci_Position lengthDoc, int initStyle, IDocument *pAccess) { - const unsigned int MAX_STR_LEN = 100; + const Sci_PositionU MAX_STR_LEN = 100; LexAccessor styler(pAccess); StyleContext scCTX(startPos, lengthDoc, initStyle, styler); @@ -286,9 +286,9 @@ void SCI_METHOD LexerDMIS::Fold(Sci_PositionU startPos, Sci_Position lengthDoc, const int MAX_STR_LEN = 100; LexAccessor styler(pAccess); - unsigned int endPos = startPos + lengthDoc; + Sci_PositionU endPos = startPos + lengthDoc; char chNext = styler[startPos]; - int lineCurrent = styler.GetLine(startPos); + Sci_Position lineCurrent = styler.GetLine(startPos); int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK; int levelCurrent = levelPrev; int strPos = 0; @@ -300,7 +300,7 @@ void SCI_METHOD LexerDMIS::Fold(Sci_PositionU startPos, Sci_Position lengthDoc, tmpStr = new char[MAX_STR_LEN]; memset(tmpStr, 0, MAX_STR_LEN*sizeof(char)); - for (unsigned int i=startPos; i<endPos; i++) { + for (Sci_PositionU i=startPos; i<endPos; i++) { char ch = chNext; chNext = styler.SafeGetCharAt(i+1); diff --git a/lexers/LexDiff.cxx b/lexers/LexDiff.cxx index 79062396f..baa8368f6 100644 --- a/lexers/LexDiff.cxx +++ b/lexers/LexDiff.cxx @@ -27,7 +27,7 @@ using namespace Scintilla; #endif -static inline bool AtEOL(Accessor &styler, unsigned int i) { +static inline bool AtEOL(Accessor &styler, Sci_PositionU i) { return (styler[i] == '\n') || ((styler[i] == '\r') && (styler.SafeGetCharAt(i + 1) != '\n')); } @@ -36,7 +36,7 @@ static inline bool AtEOL(Accessor &styler, unsigned int i) { // Note that ColouriseDiffLine analyzes only the first DIFF_BUFFER_START_SIZE // characters of each line to classify the line. -static void ColouriseDiffLine(char *lineBuffer, int endLine, Accessor &styler) { +static void ColouriseDiffLine(char *lineBuffer, Sci_Position endLine, Accessor &styler) { // It is needed to remember the current state to recognize starting // comment lines before the first "diff " or "--- ". If a real // difference starts then each line starting with ' ' is a whitespace @@ -95,8 +95,8 @@ static void ColouriseDiffDoc(Sci_PositionU startPos, Sci_Position length, int, W char lineBuffer[DIFF_BUFFER_START_SIZE] = ""; styler.StartAt(startPos); styler.StartSegment(startPos); - unsigned int linePos = 0; - for (unsigned int i = startPos; i < startPos + length; i++) { + Sci_PositionU linePos = 0; + for (Sci_PositionU i = startPos; i < startPos + length; i++) { if (AtEOL(styler, i)) { if (linePos < DIFF_BUFFER_START_SIZE) { lineBuffer[linePos] = 0; @@ -118,8 +118,8 @@ static void ColouriseDiffDoc(Sci_PositionU startPos, Sci_Position length, int, W } static void FoldDiffDoc(Sci_PositionU startPos, Sci_Position length, int, WordList *[], Accessor &styler) { - int curLine = styler.GetLine(startPos); - int curLineStart = styler.LineStart(curLine); + Sci_Position curLine = styler.GetLine(startPos); + Sci_Position curLineStart = styler.LineStart(curLine); int prevLevel = curLine > 0 ? styler.LevelAt(curLine - 1) : SC_FOLDLEVELBASE; int nextLevel; @@ -143,7 +143,7 @@ static void FoldDiffDoc(Sci_PositionU startPos, Sci_Position length, int, WordLi prevLevel = nextLevel; curLineStart = styler.LineStart(++curLine); - } while (static_cast<int>(startPos) + length > curLineStart); + } while (static_cast<Sci_Position>(startPos)+length > curLineStart); } static const char *const emptyWordListDesc[] = { diff --git a/lexers/LexECL.cxx b/lexers/LexECL.cxx index 9f47b01a0..32dc09b43 100644 --- a/lexers/LexECL.cxx +++ b/lexers/LexECL.cxx @@ -90,7 +90,7 @@ static void ColouriseEclDoc(Sci_PositionU startPos, Sci_Position length, int ini if (initStyle == SCE_ECL_PREPROCESSOR) { // Set continuationLine if last character of previous line is '\' - int lineCurrent = styler.GetLine(startPos); + Sci_Position lineCurrent = styler.GetLine(startPos); if (lineCurrent > 0) { int chBack = styler.SafeGetCharAt(startPos-1, 0); int chBack2 = styler.SafeGetCharAt(startPos-2, 0); @@ -106,7 +106,7 @@ static void ColouriseEclDoc(Sci_PositionU startPos, Sci_Position length, int ini // look back to set chPrevNonWhite properly for better regex colouring if (startPos > 0) { - int back = startPos; + Sci_Position back = startPos; while (--back && IsSpaceEquiv(styler.StyleAt(back))) ; if (styler.StyleAt(back) == SCE_ECL_OPERATOR) { @@ -311,7 +311,7 @@ static void ColouriseEclDoc(Sci_PositionU startPos, Sci_Position length, int ini } // Determine if a new state should be entered. - int lineCurrent = styler.GetLine(sc.currentPos); + Sci_Position lineCurrent = styler.GetLine(sc.currentPos); int lineState = styler.GetLineState(lineCurrent); if (sc.state == SCE_ECL_DEFAULT) { if (lineState) { @@ -388,8 +388,8 @@ static bool IsStreamCommentStyle(int style) { style == SCE_ECL_COMMENTDOCKEYWORDERROR; } -bool MatchNoCase(Accessor & styler, unsigned int & pos, const char *s) { - int i=0; +bool MatchNoCase(Accessor & styler, Sci_PositionU & pos, const char *s) { + Sci_Position i=0; for (; *s; i++) { char compare_char = tolower(*s); char styler_char = tolower(styler.SafeGetCharAt(pos+i)); @@ -405,15 +405,15 @@ bool MatchNoCase(Accessor & styler, unsigned int & pos, const char *s) { // Store both the current line's fold level and the next lines in the // level store to make it easy to pick up with each increment // and to make it possible to fiddle the current level for "} else {". -static void FoldEclDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, +static void FoldEclDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *[], Accessor &styler) { bool foldComment = true; bool foldPreprocessor = true; bool foldCompact = true; bool foldAtElse = true; - unsigned int endPos = startPos + length; + Sci_PositionU endPos = startPos + length; int visibleChars = 0; - int lineCurrent = styler.GetLine(startPos); + Sci_Position lineCurrent = styler.GetLine(startPos); int levelCurrent = SC_FOLDLEVELBASE; if (lineCurrent > 0) levelCurrent = styler.LevelAt(lineCurrent-1) >> 16; @@ -422,7 +422,7 @@ static void FoldEclDoc(Sci_PositionU startPos, Sci_Position length, int initStyl char chNext = styler[startPos]; int styleNext = styler.StyleAt(startPos); int style = initStyle; - 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; @@ -449,7 +449,7 @@ static void FoldEclDoc(Sci_PositionU startPos, Sci_Position length, int initStyl } if (foldPreprocessor && (style == SCE_ECL_PREPROCESSOR)) { if (ch == '#') { - unsigned int j = i + 1; + Sci_PositionU j = i + 1; while ((j < endPos) && IsASpaceOrTab(styler.SafeGetCharAt(j))) { j++; } @@ -497,7 +497,7 @@ static void FoldEclDoc(Sci_PositionU startPos, Sci_Position length, int initStyl lineCurrent++; 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); } diff --git a/lexers/LexEScript.cxx b/lexers/LexEScript.cxx index 60fd31da9..bc1fb3201 100644 --- a/lexers/LexEScript.cxx +++ b/lexers/LexEScript.cxx @@ -181,19 +181,19 @@ static void FoldESCRIPTDoc(Sci_PositionU startPos, Sci_Position length, int init // Do not know how to fold the comment at the moment. bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0; bool foldComment = true; - unsigned int endPos = startPos + length; + Sci_PositionU endPos = startPos + length; int visibleChars = 0; - int lineCurrent = styler.GetLine(startPos); + Sci_Position lineCurrent = styler.GetLine(startPos); int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK; int levelCurrent = levelPrev; char chNext = styler[startPos]; int styleNext = styler.StyleAt(startPos); int style = initStyle; - int lastStart = 0; + Sci_Position lastStart = 0; char prevWord[32] = ""; - 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; @@ -231,7 +231,7 @@ static void FoldESCRIPTDoc(Sci_PositionU startPos, Sci_Position length, int init if (style == SCE_ESCRIPT_WORD3) { if(iswordchar(ch) && !iswordchar(chNext)) { char s[32]; - unsigned int j; + Sci_PositionU j; for(j = 0; ( j < 31 ) && ( j < i-lastStart+1 ); j++) { s[j] = static_cast<char>(tolower(styler[lastStart + j])); } diff --git a/lexers/LexEiffel.cxx b/lexers/LexEiffel.cxx index 94ebab35b..2e2813ef6 100644 --- a/lexers/LexEiffel.cxx +++ b/lexers/LexEiffel.cxx @@ -124,10 +124,10 @@ static bool IsEiffelComment(Accessor &styler, Sci_Position pos, Sci_Position len static void FoldEiffelDocIndent(Sci_PositionU startPos, Sci_Position length, int, WordList *[], Accessor &styler) { - int lengthDoc = startPos + length; + Sci_Position lengthDoc = startPos + length; // Backtrack to previous line in case need to fix its fold status - int lineCurrent = styler.GetLine(startPos); + Sci_Position lineCurrent = styler.GetLine(startPos); if (startPos > 0) { if (lineCurrent > 0) { lineCurrent--; @@ -137,7 +137,7 @@ static void FoldEiffelDocIndent(Sci_PositionU startPos, Sci_Position length, int int spaceFlags = 0; int indentCurrent = styler.IndentAmount(lineCurrent, &spaceFlags, IsEiffelComment); char chNext = styler[startPos]; - for (int i = startPos; i < lengthDoc; i++) { + for (Sci_Position i = startPos; i < lengthDoc; i++) { char ch = chNext; chNext = styler.SafeGetCharAt(i + 1); @@ -166,9 +166,9 @@ static void FoldEiffelDocIndent(Sci_PositionU startPos, Sci_Position length, int static void FoldEiffelDocKeyWords(Sci_PositionU startPos, Sci_Position length, int /* initStyle */, WordList *[], Accessor &styler) { - unsigned int lengthDoc = startPos + length; + Sci_PositionU lengthDoc = startPos + length; int visibleChars = 0; - int lineCurrent = styler.GetLine(startPos); + Sci_Position lineCurrent = styler.GetLine(startPos); int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK; int levelCurrent = levelPrev; char chNext = styler[startPos]; @@ -177,7 +177,7 @@ static void FoldEiffelDocKeyWords(Sci_PositionU startPos, Sci_Position length, i // lastDeferred should be determined by looking back to last keyword in case // the "deferred" is on a line before "class" bool lastDeferred = false; - for (unsigned int i = startPos; i < lengthDoc; i++) { + for (Sci_PositionU i = startPos; i < lengthDoc; i++) { char ch = chNext; chNext = styler.SafeGetCharAt(i + 1); int style = styleNext; @@ -185,7 +185,7 @@ static void FoldEiffelDocKeyWords(Sci_PositionU startPos, Sci_Position length, i bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n'); if ((stylePrev != SCE_EIFFEL_WORD) && (style == SCE_EIFFEL_WORD)) { char s[20]; - unsigned int j = 0; + Sci_PositionU j = 0; while ((j < (sizeof(s) - 1)) && (iswordchar(styler[i + j]))) { s[j] = styler[i + j]; j++; diff --git a/lexers/LexErlang.cxx b/lexers/LexErlang.cxx index b4dd6e484..3d3c1e89f 100644 --- a/lexers/LexErlang.cxx +++ b/lexers/LexErlang.cxx @@ -500,7 +500,7 @@ static void ColouriseErlangDoc(Sci_PositionU startPos, Sci_Position length, int static int ClassifyErlangFoldPoint( Accessor &styler, int styleNext, - int keyword_start + Sci_Position keyword_start ) { int lev = 0; if (styler.Match(keyword_start,"case") @@ -524,20 +524,20 @@ static void FoldErlangDoc( Sci_PositionU startPos, Sci_Position length, int initStyle, WordList** /*keywordlists*/, Accessor &styler ) { - unsigned int endPos = startPos + length; - int currentLine = styler.GetLine(startPos); + Sci_PositionU endPos = startPos + length; + Sci_Position currentLine = styler.GetLine(startPos); int lev; int previousLevel = styler.LevelAt(currentLine) & SC_FOLDLEVELNUMBERMASK; int currentLevel = previousLevel; int styleNext = styler.StyleAt(startPos); int style = initStyle; int stylePrev; - int keyword_start = 0; + Sci_Position keyword_start = 0; char ch; char chNext = styler.SafeGetCharAt(startPos); bool atEOL; - for (unsigned int i = startPos; i < endPos; i++) { + for (Sci_PositionU i = startPos; i < endPos; i++) { ch = chNext; chNext = styler.SafeGetCharAt(i + 1); diff --git a/lexers/LexErrorList.cxx b/lexers/LexErrorList.cxx index 50fbfdc6e..be85cdc8f 100644 --- a/lexers/LexErrorList.cxx +++ b/lexers/LexErrorList.cxx @@ -43,12 +43,12 @@ static bool IsAlphabetic(int ch) { return IsASCII(ch) && isalpha(ch); } -static inline bool AtEOL(Accessor &styler, unsigned int i) { +static inline bool AtEOL(Accessor &styler, Sci_PositionU i) { return (styler[i] == '\n') || ((styler[i] == '\r') && (styler.SafeGetCharAt(i + 1) != '\n')); } -static int RecogniseErrorListLine(const char *lineBuffer, unsigned int lengthLine, int &startValue) { +static int RecogniseErrorListLine(const char *lineBuffer, Sci_PositionU lengthLine, Sci_Position &startValue) { if (lineBuffer[0] == '>') { // Command or return status return SCE_ERR_CMD; @@ -146,7 +146,7 @@ static int RecogniseErrorListLine(const char *lineBuffer, unsigned int lengthLin stCtagsStart, stCtagsFile, stCtagsStartString, stCtagsStringDollar, stCtags, stUnrecognized } state = stInitial; - for (unsigned int i = 0; i < lengthLine; i++) { + for (Sci_PositionU i = 0; i < lengthLine; i++) { char ch = lineBuffer[i]; char chNext = ' '; if ((i + 1) < lengthLine) @@ -203,7 +203,7 @@ static int RecogniseErrorListLine(const char *lineBuffer, unsigned int lengthLin } else if ((ch == ':' && chNext == ' ') || (ch == ' ')) { // Possibly Delphi.. don't test against chNext as it's one of the strings below. char word[512]; - unsigned int j, chPos; + Sci_PositionU j, chPos; unsigned numstep; chPos = 0; if (ch == ' ') @@ -261,11 +261,11 @@ static int RecogniseErrorListLine(const char *lineBuffer, unsigned int lengthLin static void ColouriseErrorListLine( char *lineBuffer, - unsigned int lengthLine, - unsigned int endPos, + Sci_PositionU lengthLine, + Sci_PositionU endPos, Accessor &styler, bool valueSeparate) { - int startValue = -1; + Sci_Position startValue = -1; int style = RecogniseErrorListLine(lineBuffer, lengthLine, startValue); if (valueSeparate && (startValue >= 0)) { styler.ColourTo(endPos - (lengthLine - startValue), style); @@ -279,7 +279,7 @@ static void ColouriseErrorListDoc(Sci_PositionU startPos, Sci_Position length, i char lineBuffer[10000]; styler.StartAt(startPos); styler.StartSegment(startPos); - unsigned int linePos = 0; + Sci_PositionU linePos = 0; // property lexer.errorlist.value.separate // For lines in the output pane that are matches from Find in Files or GCC-style @@ -287,7 +287,7 @@ static void ColouriseErrorListDoc(Sci_PositionU startPos, Sci_Position length, i // line with style 21 used for the rest of the line. // This allows matched text to be more easily distinguished from its location. bool valueSeparate = styler.GetPropertyInt("lexer.errorlist.value.separate", 0) != 0; - for (unsigned int i = startPos; i < startPos + length; i++) { + for (Sci_PositionU i = startPos; i < startPos + length; i++) { lineBuffer[linePos++] = styler[i]; if (AtEOL(styler, i) || (linePos >= sizeof(lineBuffer) - 1)) { // End of line (or of line buffer) met, colourise it diff --git a/lexers/LexFlagship.cxx b/lexers/LexFlagship.cxx index b355423e5..6f6f4c0c7 100644 --- a/lexers/LexFlagship.cxx +++ b/lexers/LexFlagship.cxx @@ -271,9 +271,9 @@ static void ColouriseFlagShipDoc(Sci_PositionU startPos, Sci_Position length, in } } } else if (bEnableCode && sc.ch == '{') { - int p = 0; + Sci_Position p = 0; int chSeek; - unsigned int endPos(startPos + length); + Sci_PositionU endPos(startPos + length); do { // Skip whitespace chSeek = sc.GetRelative(++p); } while (IsASpaceOrTab(chSeek) && (sc.currentPos + p < endPos)); @@ -306,10 +306,10 @@ static void FoldFlagShipDoc(Sci_PositionU startPos, Sci_Position length, int, WordList *[], Accessor &styler) { - int endPos = startPos + length; + Sci_Position endPos = startPos + length; // Backtrack to previous line in case need to fix its fold status - int lineCurrent = styler.GetLine(startPos); + Sci_Position lineCurrent = styler.GetLine(startPos); if (startPos > 0 && lineCurrent > 0) { lineCurrent--; startPos = styler.LineStart(lineCurrent); @@ -317,7 +317,7 @@ static void FoldFlagShipDoc(Sci_PositionU startPos, Sci_Position length, int, int spaceFlags = 0; int indentCurrent = styler.IndentAmount(lineCurrent, &spaceFlags); char chNext = styler[startPos]; - for (int i = startPos; i < endPos; i++) { + for (Sci_Position i = startPos; i < endPos; i++) { char ch = chNext; chNext = styler.SafeGetCharAt(i + 1); diff --git a/lexers/LexForth.cxx b/lexers/LexForth.cxx index 9e9c3b540..63d3f4f6d 100644 --- a/lexers/LexForth.cxx +++ b/lexers/LexForth.cxx @@ -151,7 +151,7 @@ static void ColouriseForthDoc(Sci_PositionU startPos, Sci_Position length, int i sc.Complete(); } -static void FoldForthDoc(unsigned int, int, int, WordList *[], +static void FoldForthDoc(Sci_PositionU, Sci_Position, int, WordList *[], Accessor &) { } diff --git a/lexers/LexFortran.cxx b/lexers/LexFortran.cxx index 4acf2d7f3..37e0b45c5 100644 --- a/lexers/LexFortran.cxx +++ b/lexers/LexFortran.cxx @@ -46,7 +46,7 @@ static inline bool IsALineEnd(char ch) { return ((ch == '\n') || (ch == '\r')) ; } /***************************************/ -static unsigned int GetContinuedPos(unsigned int pos, Accessor &styler) { +static Sci_PositionU GetContinuedPos(Sci_PositionU pos, Accessor &styler) { while (!IsALineEnd(styler.SafeGetCharAt(pos++))) continue; if (styler.SafeGetCharAt(pos) == '\n') pos++; while (IsABlank(styler.SafeGetCharAt(pos++))) continue; @@ -65,8 +65,9 @@ static void ColouriseFortranDoc(Sci_PositionU startPos, Sci_Position length, int WordList &keywords2 = *keywordlists[1]; WordList &keywords3 = *keywordlists[2]; /***************************************/ - int posLineStart = 0, numNonBlank = 0, prevState = 0; - int endPos = startPos + length; + Sci_Position posLineStart = 0; + int numNonBlank = 0, prevState = 0; + Sci_Position endPos = startPos + length; /***************************************/ // backtrack to the nearest keyword while ((startPos > 1) && (styler.StyleAt(startPos) != SCE_F_WORD)) { @@ -86,7 +87,7 @@ static void ColouriseFortranDoc(Sci_PositionU startPos, Sci_Position length, int if (!IsASpaceOrTab(sc.ch)) numNonBlank ++; /***********************************************/ // Handle the fix format generically - int toLineStart = sc.currentPos - posLineStart; + Sci_Position toLineStart = sc.currentPos - posLineStart; if (isFixFormat && (toLineStart < 6 || toLineStart >= 72)) { if ((toLineStart == 0 && (tolower(sc.ch) == 'c' || sc.ch == '*')) || sc.ch == '!') { if (sc.MatchIgnoreCase("cdec$") || sc.MatchIgnoreCase("*dec$") || sc.MatchIgnoreCase("!dec$") || @@ -130,7 +131,7 @@ static void ColouriseFortranDoc(Sci_PositionU startPos, Sci_Position length, int // Handle line continuation generically. if (!isFixFormat && sc.ch == '&' && sc.state != SCE_F_COMMENT) { char chTemp = ' '; - int j = 1; + Sci_Position j = 1; while (IsABlank(chTemp) && j<132) { chTemp = static_cast<char>(sc.GetRelative(j)); j++; @@ -302,9 +303,9 @@ static void FoldFortranDoc(Sci_PositionU startPos, Sci_Position length, int init // Do not know how to fold the comment at the moment. // bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0; - unsigned int endPos = startPos + length; + Sci_PositionU endPos = startPos + length; int visibleChars = 0; - int lineCurrent = styler.GetLine(startPos); + Sci_Position lineCurrent = styler.GetLine(startPos); int levelCurrent; bool isPrevLine; if (lineCurrent > 0) { @@ -321,10 +322,10 @@ static void FoldFortranDoc(Sci_PositionU startPos, Sci_Position length, int init int style = initStyle; int levelDeltaNext = 0; /***************************************/ - int lastStart = 0; + Sci_Position lastStart = 0; char prevWord[32] = ""; /***************************************/ - for (unsigned int i = startPos; i < endPos; i++) { + for (Sci_PositionU i = startPos; i < endPos; i++) { char ch = chNext; chNext = styler.SafeGetCharAt(i + 1); char chNextNonBlank = chNext; @@ -332,7 +333,7 @@ static void FoldFortranDoc(Sci_PositionU startPos, Sci_Position length, int init if (IsALineEnd(chNextNonBlank)) { nextEOL = true; } - unsigned int j=i+1; + Sci_PositionU j=i+1; while(IsABlank(chNextNonBlank) && j<endPos) { j ++ ; chNextNonBlank = styler.SafeGetCharAt(j); @@ -357,7 +358,7 @@ static void FoldFortranDoc(Sci_PositionU startPos, Sci_Position length, int init if (style == SCE_F_WORD) { if(iswordchar(ch) && !iswordchar(chNext)) { char s[32]; - unsigned int k; + Sci_PositionU k; for(k=0; (k<31 ) && (k<i-lastStart+1 ); k++) { s[k] = static_cast<char>(tolower(styler[lastStart+k])); } @@ -386,7 +387,7 @@ static void FoldFortranDoc(Sci_PositionU startPos, Sci_Position length, int init if (depth == 0) break; } } - int tmpLineCurrent = lineCurrent; + Sci_Position tmpLineCurrent = lineCurrent; while (j<endPos) { j++; chAtPos = styler.SafeGetCharAt(j); diff --git a/lexers/LexGAP.cxx b/lexers/LexGAP.cxx index 413839c45..ee0a7ad69 100644 --- a/lexers/LexGAP.cxx +++ b/lexers/LexGAP.cxx @@ -39,8 +39,8 @@ static inline bool IsGAPOperator(char ch) { return false; } -static void GetRange(unsigned int start, unsigned int end, Accessor &styler, char *s, unsigned int len) { - unsigned int i = 0; +static void GetRange(Sci_PositionU start, Sci_PositionU end, Accessor &styler, char *s, Sci_PositionU len) { + Sci_PositionU i = 0; while ((i < end - start + 1) && (i < len-1)) { s[i] = static_cast<char>(styler[start + i]); i++; @@ -197,19 +197,19 @@ static int ClassifyFoldPointGAP(const char* s) { return level; } -static void FoldGAPDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList**, Accessor &styler) { - unsigned int endPos = startPos + length; +static void FoldGAPDoc( Sci_PositionU startPos, Sci_Position length, int initStyle, WordList** , Accessor &styler) { + Sci_PositionU endPos = startPos + length; int visibleChars = 0; - int lineCurrent = styler.GetLine(startPos); + Sci_Position lineCurrent = styler.GetLine(startPos); int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK; int levelCurrent = levelPrev; char chNext = styler[startPos]; int styleNext = styler.StyleAt(startPos); int style = initStyle; - int lastStart = 0; + Sci_Position lastStart = 0; - 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; diff --git a/lexers/LexGui4Cli.cxx b/lexers/LexGui4Cli.cxx index 4cba4ceff..c1625160a 100644 --- a/lexers/LexGui4Cli.cxx +++ b/lexers/LexGui4Cli.cxx @@ -68,9 +68,9 @@ inline bool isGCOperator(int ch) #define isFoldPoint(x) ((styler.LevelAt(x) & SC_FOLDLEVELNUMBERMASK) == 1024) static void colorFirstWord(WordList *keywordlists[], Accessor &styler, - StyleContext *sc, char *buff, int length, int) + StyleContext *sc, char *buff, Sci_Position length, int) { - int c = 0; + Sci_Position c = 0; while (sc->More() && isSpaceOrNL(sc->ch)) { sc->Forward(); } @@ -124,7 +124,8 @@ ColouriseGui4CliDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, { styler.StartAt(startPos); - int quotestart = 0, oldstate, currentline = styler.GetLine(startPos); + Sci_Position currentline = styler.GetLine(startPos); + int quotestart = 0, oldstate; styler.StartSegment(startPos); bool noforward; char buff[BUFFSIZE+1]; // buffer for command name @@ -248,15 +249,15 @@ static void FoldGui4Cli(Sci_PositionU startPos, Sci_Position length, int, { bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0; - unsigned int endPos = startPos + length; + Sci_PositionU endPos = startPos + length; int visibleChars = 0; - int lineCurrent = styler.GetLine(startPos); + Sci_Position lineCurrent = styler.GetLine(startPos); char chNext = styler[startPos]; int styleNext = styler.StyleAt(startPos); bool headerPoint = false; - for (unsigned int i = startPos; i < endPos; i++) + for (Sci_PositionU i = startPos; i < endPos; i++) { char ch = chNext; chNext = styler[i+1]; diff --git a/lexers/LexHTML.cxx b/lexers/LexHTML.cxx index ba536c46d..59c9e8ee4 100644 --- a/lexers/LexHTML.cxx +++ b/lexers/LexHTML.cxx @@ -57,17 +57,17 @@ inline bool IsOperator(int ch) { return false; } -static void GetTextSegment(Accessor &styler, unsigned int start, unsigned int end, char *s, size_t len) { - unsigned int i = 0; +static void GetTextSegment(Accessor &styler, Sci_PositionU start, Sci_PositionU end, char *s, size_t len) { + Sci_PositionU i = 0; for (; (i < end - start + 1) && (i < len-1); i++) { s[i] = static_cast<char>(MakeLowerCase(styler[start + i])); } s[i] = '\0'; } -static const char *GetNextWord(Accessor &styler, unsigned int start, char *s, size_t sLen) { +static const char *GetNextWord(Accessor &styler, Sci_PositionU start, char *s, size_t sLen) { - unsigned int i = 0; + Sci_PositionU i = 0; for (; i < sLen-1; i++) { char ch = static_cast<char>(styler.SafeGetCharAt(start + i)); if ((i == 0) && !IsAWordStart(ch)) @@ -81,7 +81,7 @@ static const char *GetNextWord(Accessor &styler, unsigned int start, char *s, si return s; } -static script_type segIsScriptingIndicator(Accessor &styler, unsigned int start, unsigned int end, script_type prevValue) { +static script_type segIsScriptingIndicator(Accessor &styler, Sci_PositionU start, Sci_PositionU end, script_type prevValue) { char s[100]; GetTextSegment(styler, start, end, s, sizeof(s)); //Platform::DebugPrintf("Scripting indicator [%s]\n", s); @@ -110,7 +110,7 @@ static script_type segIsScriptingIndicator(Accessor &styler, unsigned int start, return prevValue; } -static int PrintScriptingIndicatorOffset(Accessor &styler, unsigned int start, unsigned int end) { +static int PrintScriptingIndicatorOffset(Accessor &styler, Sci_PositionU start, Sci_PositionU end) { int iResult = 0; char s[100]; GetTextSegment(styler, start, end, s, sizeof(s)); @@ -171,7 +171,7 @@ static int stateForPrintState(int StateToPrint) { return state; } -static inline bool IsNumber(unsigned int start, Accessor &styler) { +static inline bool IsNumber(Sci_PositionU start, Accessor &styler) { return IsADigit(styler[start]) || (styler[start] == '.') || (styler[start] == '-') || (styler[start] == '#'); } @@ -242,7 +242,7 @@ static inline bool isCommentASPState(int state) { return bResult; } -static void classifyAttribHTML(unsigned int start, unsigned int end, WordList &keywords, Accessor &styler) { +static void classifyAttribHTML(Sci_PositionU start, Sci_PositionU end, WordList &keywords, Accessor &styler) { bool wordIsNumber = IsNumber(start, styler); char chAttr = SCE_H_ATTRIBUTEUNKNOWN; if (wordIsNumber) { @@ -259,14 +259,14 @@ static void classifyAttribHTML(unsigned int start, unsigned int end, WordList &k styler.ColourTo(end, chAttr); } -static int classifyTagHTML(unsigned int start, unsigned int end, +static int classifyTagHTML(Sci_PositionU start, Sci_PositionU end, WordList &keywords, Accessor &styler, bool &tagDontFold, bool caseSensitive, bool isXml, bool allowScripts) { char withSpace[30 + 2] = " "; const char *s = withSpace + 1; // Copy after the '<' - unsigned int i = 1; - for (unsigned int cPos = start; cPos <= end && i < 30; cPos++) { + Sci_PositionU i = 1; + for (Sci_PositionU cPos = start; cPos <= end && i < 30; cPos++) { char ch = styler[cPos]; if ((ch != '<') && (ch != '/')) { withSpace[i++] = caseSensitive ? ch : static_cast<char>(MakeLowerCase(ch)); @@ -298,7 +298,7 @@ static int classifyTagHTML(unsigned int start, unsigned int end, if (allowScripts && 0 == strcmp(s, "script")) { // check to see if this is a self-closing tag by sniffing ahead bool isSelfClose = false; - for (unsigned int cPos = end; cPos <= end + 200; cPos++) { + for (Sci_PositionU cPos = end; cPos <= end + 200; cPos++) { char ch = styler.SafeGetCharAt(cPos, '\0'); if (ch == '\0' || ch == '>') break; @@ -318,10 +318,10 @@ static int classifyTagHTML(unsigned int start, unsigned int end, return chAttr; } -static void classifyWordHTJS(unsigned int start, unsigned int end, +static void classifyWordHTJS(Sci_PositionU start, Sci_PositionU end, WordList &keywords, Accessor &styler, script_mode inScriptType) { char s[30 + 1]; - unsigned int i = 0; + Sci_PositionU i = 0; for (; i < end - start + 1 && i < 30; i++) { s[i] = styler[start + i]; } @@ -337,7 +337,7 @@ static void classifyWordHTJS(unsigned int start, unsigned int end, styler.ColourTo(end, statePrintForState(chAttr, inScriptType)); } -static int classifyWordHTVB(unsigned int start, unsigned int end, WordList &keywords, Accessor &styler, script_mode inScriptType) { +static int classifyWordHTVB(Sci_PositionU start, Sci_PositionU end, WordList &keywords, Accessor &styler, script_mode inScriptType) { char chAttr = SCE_HB_IDENTIFIER; bool wordIsNumber = IsADigit(styler[start]) || (styler[start] == '.'); if (wordIsNumber) { @@ -358,10 +358,10 @@ static int classifyWordHTVB(unsigned int start, unsigned int end, WordList &keyw return SCE_HB_DEFAULT; } -static void classifyWordHTPy(unsigned int start, unsigned int end, WordList &keywords, Accessor &styler, char *prevWord, script_mode inScriptType, bool isMako) { +static void classifyWordHTPy(Sci_PositionU start, Sci_PositionU end, WordList &keywords, Accessor &styler, char *prevWord, script_mode inScriptType, bool isMako) { bool wordIsNumber = IsADigit(styler[start]); char s[30 + 1]; - unsigned int i = 0; + Sci_PositionU i = 0; for (; i < end - start + 1 && i < 30; i++) { s[i] = styler[start + i]; } @@ -383,7 +383,7 @@ static void classifyWordHTPy(unsigned int start, unsigned int end, WordList &key // Update the word colour to default or keyword // Called when in a PHP word -static void classifyWordHTPHP(unsigned int start, unsigned int end, WordList &keywords, Accessor &styler) { +static void classifyWordHTPHP(Sci_PositionU start, Sci_PositionU end, WordList &keywords, Accessor &styler) { char chAttr = SCE_HPHP_DEFAULT; bool wordIsNumber = IsADigit(styler[start]) || (styler[start] == '.' && start+1 <= end && IsADigit(styler[start+1])); if (wordIsNumber) { @@ -397,9 +397,9 @@ static void classifyWordHTPHP(unsigned int start, unsigned int end, WordList &ke styler.ColourTo(end, chAttr); } -static bool isWordHSGML(unsigned int start, unsigned int end, WordList &keywords, Accessor &styler) { +static bool isWordHSGML(Sci_PositionU start, Sci_PositionU end, WordList &keywords, Accessor &styler) { char s[30 + 1]; - unsigned int i = 0; + Sci_PositionU i = 0; for (; i < end - start + 1 && i < 30; i++) { s[i] = styler[start + i]; } @@ -407,9 +407,9 @@ static bool isWordHSGML(unsigned int start, unsigned int end, WordList &keywords return keywords.InList(s); } -static bool isWordCdata(unsigned int start, unsigned int end, Accessor &styler) { +static bool isWordCdata(Sci_PositionU start, Sci_PositionU end, Accessor &styler) { char s[30 + 1]; - unsigned int i = 0; + Sci_PositionU i = 0; for (; i < end - start + 1 && i < 30; i++) { s[i] = styler[start + i]; } @@ -520,9 +520,9 @@ static bool isPHPStringState(int state) { (state == SCE_HPHP_COMPLEX_VARIABLE); } -static int FindPhpStringDelimiter(char *phpStringDelimiter, const int phpStringDelimiterSize, int i, const int lengthDoc, Accessor &styler, bool &isSimpleString) { - int j; - const int beginning = i - 1; +static Sci_Position FindPhpStringDelimiter(char *phpStringDelimiter, const int phpStringDelimiterSize, Sci_Position i, const Sci_Position lengthDoc, Accessor &styler, bool &isSimpleString) { + Sci_Position j; + const Sci_Position beginning = i - 1; bool isValidSimpleString = false; while (i < lengthDoc && (styler[i] == ' ' || styler[i] == '\t')) @@ -592,7 +592,7 @@ static void ColouriseHyperTextDoc(Sci_PositionU startPos, Sci_Position length, i // If inside a tag, it may be a script tag, so reread from the start of line starting tag to ensure any language tags are seen if (InTagState(state)) { while ((startPos > 0) && (InTagState(styler.StyleAt(startPos - 1)))) { - int backLineStart = styler.LineStart(styler.GetLine(startPos-1)); + Sci_Position backLineStart = styler.LineStart(styler.GetLine(startPos-1)); length += startPos - backLineStart; startPos = backLineStart; } @@ -610,7 +610,7 @@ static void ColouriseHyperTextDoc(Sci_PositionU startPos, Sci_Position length, i } styler.StartAt(startPos); - int lineCurrent = styler.GetLine(startPos); + Sci_Position lineCurrent = styler.GetLine(startPos); int lineState; if (lineCurrent > 0) { lineState = styler.GetLineState(lineCurrent-1); @@ -695,7 +695,7 @@ static void ColouriseHyperTextDoc(Sci_PositionU startPos, Sci_Position length, i int chPrevNonWhite = ' '; // look back to set chPrevNonWhite properly for better regex colouring if (scriptLanguage == eScriptJS && startPos > 0) { - int back = startPos; + Sci_Position back = startPos; int style = 0; while (--back) { style = styler.StyleAt(back); @@ -709,8 +709,8 @@ static void ColouriseHyperTextDoc(Sci_PositionU startPos, Sci_Position length, i } styler.StartSegment(startPos); - const int lengthDoc = startPos + length; - for (int i = startPos; i < lengthDoc; i++) { + const Sci_Position lengthDoc = startPos + length; + for (Sci_Position i = startPos; i < lengthDoc; i++) { const int chPrev2 = chPrev; chPrev = ch; if (!IsASpace(ch) && state != SCE_HJ_COMMENT && @@ -746,7 +746,7 @@ static void ColouriseHyperTextDoc(Sci_PositionU startPos, Sci_Position length, i //Platform::DebugPrintf("state=%d, StateToPrint=%d, initStyle=%d\n", state, StateToPrint, initStyle); //if ((state == SCE_HPHP_OPERATOR) || (state == SCE_HPHP_DEFAULT) || (state == SCE_HJ_SYMBOLS) || (state == SCE_HJ_START) || (state == SCE_HJ_DEFAULT)) { if (ch == '#') { - int j = i + 1; + Sci_Position j = i + 1; while ((j < lengthDoc) && IsASpaceOrTab(styler.SafeGetCharAt(j))) { j++; } @@ -769,7 +769,7 @@ static void ColouriseHyperTextDoc(Sci_PositionU startPos, Sci_Position length, i } else if ((ch == '\n') && !((chNext == '\r') && (chNext2 == '\n')) && (chNext != '\n')) { // check if the number of tabs is lower than the level int Findlevel = (levelCurrent & ~SC_FOLDLEVELBASE) * 8; - for (int j = 0; Findlevel > 0; j++) { + for (Sci_Position j = 0; Findlevel > 0; j++) { char chTmp = styler.SafeGetCharAt(i + j + 1); if (chTmp == '\t') { Findlevel -= 8; @@ -875,7 +875,7 @@ static void ColouriseHyperTextDoc(Sci_PositionU startPos, Sci_Position length, i if (const char *tag = state == SCE_HJ_COMMENTLINE || isXml ? "script" : state == SCE_H_COMMENT ? "comment" : 0) { - int j = i + 2; + Sci_Position j = i + 2; int chr; do { chr = static_cast<int>(*tag++); @@ -1237,7 +1237,7 @@ static void ColouriseHyperTextDoc(Sci_PositionU startPos, Sci_Position length, i styler.ColourTo(i - 1, StateToPrint); state = SCE_H_SGML_SIMPLESTRING; } else if ((ch == '-') && (chPrev == '-')) { - if (static_cast<int>(styler.GetStartSegment()) <= (i - 2)) { + if (static_cast<Sci_Position>(styler.GetStartSegment()) <= (i - 2)) { styler.ColourTo(i - 2, StateToPrint); } state = SCE_H_SGML_COMMENT; @@ -2080,7 +2080,7 @@ static void ColouriseHyperTextDoc(Sci_PositionU startPos, Sci_Position length, i // Some of the above terminated their lexeme but since the same character starts // the same class again, only reenter if non empty segment. - bool nonEmptySegment = i >= static_cast<int>(styler.GetStartSegment()); + bool nonEmptySegment = i >= static_cast<Sci_Position>(styler.GetStartSegment()); if (state == SCE_HB_DEFAULT) { // One of the above succeeded if ((ch == '\"') && (nonEmptySegment)) { state = SCE_HB_STRING; @@ -2136,7 +2136,7 @@ static void ColouriseHyperTextDoc(Sci_PositionU startPos, Sci_Position length, i break; default: StateToPrint = statePrintForState(state, inScriptType); - if (static_cast<int>(styler.GetStartSegment()) < lengthDoc) + if (static_cast<Sci_Position>(styler.GetStartSegment()) < lengthDoc) styler.ColourTo(lengthDoc - 1, StateToPrint); break; } diff --git a/lexers/LexHaskell.cxx b/lexers/LexHaskell.cxx index 18ac15db9..0dd67d0ae 100644 --- a/lexers/LexHaskell.cxx +++ b/lexers/LexHaskell.cxx @@ -143,13 +143,13 @@ static inline int CommentBlockStyleFromNestLevel(const unsigned int nestLevel) { // Mangled version of lexlib/Accessor.cxx IndentAmount. // Modified to treat comment blocks as whitespace // plus special case for commentline/preprocessor. -static int HaskellIndentAmount(Accessor &styler, const int line) { +static int HaskellIndentAmount(Accessor &styler, const Sci_Position line) { // Determines the indentation level of the current line // Comment blocks are treated as whitespace - int pos = styler.LineStart(line); - int eol_pos = styler.LineStart(line + 1) - 1; + Sci_Position pos = styler.LineStart(line); + Sci_Position eol_pos = styler.LineStart(line + 1) - 1; char ch = styler[pos]; int style = styler.StyleAt(pos); @@ -157,7 +157,7 @@ static int HaskellIndentAmount(Accessor &styler, const int line) { int indent = 0; bool inPrevPrefix = line > 0; - int posPrev = inPrevPrefix ? styler.LineStart(line-1) : 0; + Sci_Position posPrev = inPrevPrefix ? styler.LineStart(line-1) : 0; while (( ch == ' ' || ch == '\t' || IsCommentBlockStyle(style) @@ -271,7 +271,7 @@ struct OptionSetHaskell : public OptionSet<OptionsHaskell> { class LexerHaskell : public ILexer { bool literate; - int firstImportLine; + Sci_Position firstImportLine; int firstImportIndent; WordList keywords; WordList ffi; @@ -347,12 +347,12 @@ class LexerHaskell : public ILexer { } } - bool LineContainsImport(const int line, Accessor &styler) const { + bool LineContainsImport(const Sci_Position line, Accessor &styler) const { if (options.foldImports) { - int currentPos = styler.LineStart(line); + Sci_Position currentPos = styler.LineStart(line); int style = styler.StyleAt(currentPos); - int eol_pos = styler.LineStart(line + 1) - 1; + Sci_Position eol_pos = styler.LineStart(line + 1) - 1; while (currentPos < eol_pos) { int ch = styler[currentPos]; @@ -374,7 +374,7 @@ class LexerHaskell : public ILexer { } } - inline int IndentAmountWithOffset(Accessor &styler, const int line) const { + inline int IndentAmountWithOffset(Accessor &styler, const Sci_Position line) const { const int indent = HaskellIndentAmount(styler, line); const int indentLevel = indent & SC_FOLDLEVELNUMBERMASK; return indentLevel <= ((firstImportIndent - 1) + SC_FOLDLEVELBASE) @@ -461,7 +461,7 @@ Sci_Position SCI_METHOD LexerHaskell::WordListSet(int n, const char *wl) { wordListN = &reserved_operators; break; } - int firstModification = -1; + Sci_Position firstModification = -1; if (wordListN) { WordList wlNew; wlNew.Set(wl); @@ -477,7 +477,7 @@ void SCI_METHOD LexerHaskell::Lex(Sci_PositionU startPos, Sci_Position length, i ,IDocument *pAccess) { LexAccessor styler(pAccess); - int lineCurrent = styler.GetLine(startPos); + Sci_Position lineCurrent = styler.GetLine(startPos); HaskellLineInfo hs = HaskellLineInfo(lineCurrent ? styler.GetLineState(lineCurrent-1) : 0); @@ -968,19 +968,19 @@ void SCI_METHOD LexerHaskell::Fold(Sci_PositionU startPos, Sci_Position length, Accessor styler(pAccess, NULL); - int lineCurrent = styler.GetLine(startPos); + Sci_Position lineCurrent = styler.GetLine(startPos); if (lineCurrent <= firstImportLine) { firstImportLine = -1; // readjust first import position firstImportIndent = 0; } - const int maxPos = startPos + length; - const int maxLines = + const Sci_Position maxPos = startPos + length; + const Sci_Position maxLines = maxPos == styler.Length() ? styler.GetLine(maxPos) : styler.GetLine(maxPos - 1); // Requested last line - const int docLines = styler.GetLine(styler.Length()); // Available last line + const Sci_Position docLines = styler.GetLine(styler.Length()); // Available last line // Backtrack to previous non-blank line so we can determine indent level // for any white space lines @@ -1018,7 +1018,7 @@ void SCI_METHOD LexerHaskell::Fold(Sci_PositionU startPos, Sci_Position length, while (lineCurrent <= docLines && lineCurrent <= maxLines) { // Gather info - int lineNext = lineCurrent + 1; + Sci_Position lineNext = lineCurrent + 1; importHere = false; int indentNext = indentCurrent; @@ -1063,7 +1063,7 @@ void SCI_METHOD LexerHaskell::Fold(Sci_PositionU startPos, Sci_Position length, // which is indented more than the line after the end of // the comment-block, use the level of the block before - int skipLine = lineNext; + Sci_Position skipLine = lineNext; int skipLevel = indentNextLevel; while (--skipLine > lineCurrent) { diff --git a/lexers/LexHex.cxx b/lexers/LexHex.cxx index 1799624fa..d549881cb 100644 --- a/lexers/LexHex.cxx +++ b/lexers/LexHex.cxx @@ -126,37 +126,37 @@ using namespace Scintilla; static inline bool IsNewline(const int ch); static int GetHexaNibble(char hd); static int GetHexaChar(char hd1, char hd2); -static int GetHexaChar(unsigned int pos, Accessor &styler); -static bool ForwardWithinLine(StyleContext &sc, int nb = 1); -static bool PosInSameRecord(unsigned int pos1, unsigned int pos2, Accessor &styler); -static int CountByteCount(unsigned int startPos, int uncountedDigits, Accessor &styler); -static int CalcChecksum(unsigned int startPos, int cnt, bool twosCompl, Accessor &styler); +static int GetHexaChar(Sci_PositionU pos, Accessor &styler); +static bool ForwardWithinLine(StyleContext &sc, Sci_Position nb = 1); +static bool PosInSameRecord(Sci_PositionU pos1, Sci_PositionU pos2, Accessor &styler); +static Sci_Position CountByteCount(Sci_PositionU startPos, Sci_Position uncountedDigits, Accessor &styler); +static int CalcChecksum(Sci_PositionU startPos, Sci_Position cnt, bool twosCompl, Accessor &styler); // prototypes for file format specific helper functions -static unsigned int GetSrecRecStartPosition(unsigned int pos, Accessor &styler); -static int GetSrecByteCount(unsigned int recStartPos, Accessor &styler); -static int CountSrecByteCount(unsigned int recStartPos, Accessor &styler); -static int GetSrecAddressFieldSize(unsigned int recStartPos, Accessor &styler); -static int GetSrecAddressFieldType(unsigned int recStartPos, Accessor &styler); -static int GetSrecDataFieldType(unsigned int recStartPos, Accessor &styler); -static int GetSrecRequiredDataFieldSize(unsigned int recStartPos, Accessor &styler); -static int GetSrecChecksum(unsigned int recStartPos, Accessor &styler); -static int CalcSrecChecksum(unsigned int recStartPos, Accessor &styler); - -static unsigned int GetIHexRecStartPosition(unsigned int pos, Accessor &styler); -static int GetIHexByteCount(unsigned int recStartPos, Accessor &styler); -static int CountIHexByteCount(unsigned int recStartPos, Accessor &styler); -static int GetIHexAddressFieldType(unsigned int recStartPos, Accessor &styler); -static int GetIHexDataFieldType(unsigned int recStartPos, Accessor &styler); -static int GetIHexRequiredDataFieldSize(unsigned int recStartPos, Accessor &styler); -static int GetIHexChecksum(unsigned int recStartPos, Accessor &styler); -static int CalcIHexChecksum(unsigned int recStartPos, Accessor &styler); - -static int GetTEHexDigitCount(unsigned int recStartPos, Accessor &styler); -static int CountTEHexDigitCount(unsigned int recStartPos, Accessor &styler); -static int GetTEHexAddressFieldType(unsigned int recStartPos, Accessor &styler); -static int GetTEHexChecksum(unsigned int recStartPos, Accessor &styler); -static int CalcTEHexChecksum(unsigned int recStartPos, Accessor &styler); +static Sci_PositionU GetSrecRecStartPosition(Sci_PositionU pos, Accessor &styler); +static int GetSrecByteCount(Sci_PositionU recStartPos, Accessor &styler); +static Sci_Position CountSrecByteCount(Sci_PositionU recStartPos, Accessor &styler); +static int GetSrecAddressFieldSize(Sci_PositionU recStartPos, Accessor &styler); +static int GetSrecAddressFieldType(Sci_PositionU recStartPos, Accessor &styler); +static int GetSrecDataFieldType(Sci_PositionU recStartPos, Accessor &styler); +static Sci_Position GetSrecRequiredDataFieldSize(Sci_PositionU recStartPos, Accessor &styler); +static int GetSrecChecksum(Sci_PositionU recStartPos, Accessor &styler); +static int CalcSrecChecksum(Sci_PositionU recStartPos, Accessor &styler); + +static Sci_PositionU GetIHexRecStartPosition(Sci_PositionU pos, Accessor &styler); +static int GetIHexByteCount(Sci_PositionU recStartPos, Accessor &styler); +static Sci_Position CountIHexByteCount(Sci_PositionU recStartPos, Accessor &styler); +static int GetIHexAddressFieldType(Sci_PositionU recStartPos, Accessor &styler); +static int GetIHexDataFieldType(Sci_PositionU recStartPos, Accessor &styler); +static int GetIHexRequiredDataFieldSize(Sci_PositionU recStartPos, Accessor &styler); +static int GetIHexChecksum(Sci_PositionU recStartPos, Accessor &styler); +static int CalcIHexChecksum(Sci_PositionU recStartPos, Accessor &styler); + +static int GetTEHexDigitCount(Sci_PositionU recStartPos, Accessor &styler); +static Sci_Position CountTEHexDigitCount(Sci_PositionU recStartPos, Accessor &styler); +static int GetTEHexAddressFieldType(Sci_PositionU recStartPos, Accessor &styler); +static int GetTEHexChecksum(Sci_PositionU recStartPos, Accessor &styler); +static int CalcTEHexChecksum(Sci_PositionU recStartPos, Accessor &styler); static inline bool IsNewline(const int ch) { @@ -207,7 +207,7 @@ static int GetHexaChar(char hd1, char hd2) return hexValue; } -static int GetHexaChar(unsigned int pos, Accessor &styler) +static int GetHexaChar(Sci_PositionU pos, Accessor &styler) { char highNibble, lowNibble; @@ -221,9 +221,9 @@ static int GetHexaChar(unsigned int pos, Accessor &styler) // end. Return true if forwarding within the line was possible. // Avoids influence on highlighting of the subsequent line if the current line // is malformed (too short). -static bool ForwardWithinLine(StyleContext &sc, int nb) +static bool ForwardWithinLine(StyleContext &sc, Sci_Position nb) { - for (int i = 0; i < nb; i++) { + for (Sci_Position i = 0; i < nb; i++) { if (sc.atLineEnd) { // line is too short sc.SetState(SCE_HEX_DEFAULT); @@ -238,7 +238,7 @@ static bool ForwardWithinLine(StyleContext &sc, int nb) } // Checks whether the given positions are in the same record. -static bool PosInSameRecord(unsigned int pos1, unsigned int pos2, Accessor &styler) +static bool PosInSameRecord(Sci_PositionU pos1, Sci_PositionU pos2, Accessor &styler) { return styler.GetLine(pos1) == styler.GetLine(pos2); } @@ -246,10 +246,10 @@ static bool PosInSameRecord(unsigned int pos1, unsigned int pos2, Accessor &styl // Count the number of digit pairs from <startPos> till end of record, ignoring // <uncountedDigits> digits. // If the record is too short, a negative count may be returned. -static int CountByteCount(unsigned int startPos, int uncountedDigits, Accessor &styler) +static Sci_Position CountByteCount(Sci_PositionU startPos, Sci_Position uncountedDigits, Accessor &styler) { - int cnt; - unsigned int pos; + Sci_Position cnt; + Sci_PositionU pos; pos = startPos; @@ -258,7 +258,7 @@ static int CountByteCount(unsigned int startPos, int uncountedDigits, Accessor & } // number of digits in this line minus number of digits of uncounted fields - cnt = static_cast<int>(pos - startPos) - uncountedDigits; + cnt = static_cast<Sci_Position>(pos - startPos) - uncountedDigits; // Prepare round up if odd (digit pair incomplete), this way the byte // count is considered to be valid if the checksum is incomplete. @@ -275,11 +275,11 @@ static int CountByteCount(unsigned int startPos, int uncountedDigits, Accessor & // Calculate the checksum of the record. // <startPos> is the position of the first character of the starting digit // pair, <cnt> is the number of digit pairs. -static int CalcChecksum(unsigned int startPos, int cnt, bool twosCompl, Accessor &styler) +static int CalcChecksum(Sci_PositionU startPos, Sci_Position cnt, bool twosCompl, Accessor &styler) { int cs = 0; - for (unsigned int pos = startPos; pos < startPos + cnt; pos += 2) { + for (Sci_PositionU pos = startPos; pos < startPos + cnt; pos += 2) { int val = GetHexaChar(pos, styler); if (val < 0) { @@ -301,7 +301,7 @@ static int CalcChecksum(unsigned int startPos, int cnt, bool twosCompl, Accessor // Get the position of the record "start" field (first character in line) in // the record around position <pos>. -static unsigned int GetSrecRecStartPosition(unsigned int pos, Accessor &styler) +static Sci_PositionU GetSrecRecStartPosition(Sci_PositionU pos, Accessor &styler) { while (styler.SafeGetCharAt(pos) != 'S') { pos--; @@ -312,7 +312,7 @@ static unsigned int GetSrecRecStartPosition(unsigned int pos, Accessor &styler) // Get the value of the "byte count" field, it counts the number of bytes in // the subsequent fields ("address", "data" and "checksum" fields). -static int GetSrecByteCount(unsigned int recStartPos, Accessor &styler) +static int GetSrecByteCount(Sci_PositionU recStartPos, Accessor &styler) { int val; @@ -327,13 +327,13 @@ static int GetSrecByteCount(unsigned int recStartPos, Accessor &styler) // Count the number of digit pairs for the "address", "data" and "checksum" // fields in this record. Has to be equal to the "byte count" field value. // If the record is too short, a negative count may be returned. -static int CountSrecByteCount(unsigned int recStartPos, Accessor &styler) +static Sci_Position CountSrecByteCount(Sci_PositionU recStartPos, Accessor &styler) { return CountByteCount(recStartPos, 4, styler); } // Get the size of the "address" field. -static int GetSrecAddressFieldSize(unsigned int recStartPos, Accessor &styler) +static int GetSrecAddressFieldSize(Sci_PositionU recStartPos, Accessor &styler) { switch (styler.SafeGetCharAt(recStartPos + 1)) { case '0': @@ -357,7 +357,7 @@ static int GetSrecAddressFieldSize(unsigned int recStartPos, Accessor &styler) } // Get the type of the "address" field content. -static int GetSrecAddressFieldType(unsigned int recStartPos, Accessor &styler) +static int GetSrecAddressFieldType(Sci_PositionU recStartPos, Accessor &styler) { switch (styler.SafeGetCharAt(recStartPos + 1)) { case '0': @@ -383,7 +383,7 @@ static int GetSrecAddressFieldType(unsigned int recStartPos, Accessor &styler) } // Get the type of the "data" field content. -static int GetSrecDataFieldType(unsigned int recStartPos, Accessor &styler) +static int GetSrecDataFieldType(Sci_PositionU recStartPos, Accessor &styler) { switch (styler.SafeGetCharAt(recStartPos + 1)) { case '0': @@ -407,7 +407,7 @@ static int GetSrecDataFieldType(unsigned int recStartPos, Accessor &styler) // Get the required size of the "data" field. Useless for block header and // ordinary data records (type S0, S1, S2, S3), return the value calculated // from the "byte count" and "address field" size in this case. -static int GetSrecRequiredDataFieldSize(unsigned int recStartPos, Accessor &styler) +static Sci_Position GetSrecRequiredDataFieldSize(Sci_PositionU recStartPos, Accessor &styler) { switch (styler.SafeGetCharAt(recStartPos + 1)) { case '5': @@ -425,7 +425,7 @@ static int GetSrecRequiredDataFieldSize(unsigned int recStartPos, Accessor &styl } // Get the value of the "checksum" field. -static int GetSrecChecksum(unsigned int recStartPos, Accessor &styler) +static int GetSrecChecksum(Sci_PositionU recStartPos, Accessor &styler) { int byteCount; @@ -435,9 +435,9 @@ static int GetSrecChecksum(unsigned int recStartPos, Accessor &styler) } // Calculate the checksum of the record. -static int CalcSrecChecksum(unsigned int recStartPos, Accessor &styler) +static int CalcSrecChecksum(Sci_PositionU recStartPos, Accessor &styler) { - int byteCount; + Sci_Position byteCount; byteCount = GetSrecByteCount(recStartPos, styler); @@ -447,7 +447,7 @@ static int CalcSrecChecksum(unsigned int recStartPos, Accessor &styler) // Get the position of the record "start" field (first character in line) in // the record around position <pos>. -static unsigned int GetIHexRecStartPosition(unsigned int pos, Accessor &styler) +static Sci_PositionU GetIHexRecStartPosition(Sci_PositionU pos, Accessor &styler) { while (styler.SafeGetCharAt(pos) != ':') { pos--; @@ -458,7 +458,7 @@ static unsigned int GetIHexRecStartPosition(unsigned int pos, Accessor &styler) // Get the value of the "byte count" field, it counts the number of bytes in // the "data" field. -static int GetIHexByteCount(unsigned int recStartPos, Accessor &styler) +static int GetIHexByteCount(Sci_PositionU recStartPos, Accessor &styler) { int val; @@ -473,13 +473,13 @@ static int GetIHexByteCount(unsigned int recStartPos, Accessor &styler) // Count the number of digit pairs for the "data" field in this record. Has to // be equal to the "byte count" field value. // If the record is too short, a negative count may be returned. -static int CountIHexByteCount(unsigned int recStartPos, Accessor &styler) +static Sci_Position CountIHexByteCount(Sci_PositionU recStartPos, Accessor &styler) { return CountByteCount(recStartPos, 11, styler); } // Get the type of the "address" field content. -static int GetIHexAddressFieldType(unsigned int recStartPos, Accessor &styler) +static int GetIHexAddressFieldType(Sci_PositionU recStartPos, Accessor &styler) { if (!PosInSameRecord(recStartPos, recStartPos + 7, styler)) { // malformed (record too short) @@ -504,7 +504,7 @@ static int GetIHexAddressFieldType(unsigned int recStartPos, Accessor &styler) } // Get the type of the "data" field content. -static int GetIHexDataFieldType(unsigned int recStartPos, Accessor &styler) +static int GetIHexDataFieldType(Sci_PositionU recStartPos, Accessor &styler) { switch (GetHexaChar(recStartPos + 7, styler)) { case 0x00: @@ -528,7 +528,7 @@ static int GetIHexDataFieldType(unsigned int recStartPos, Accessor &styler) // Get the required size of the "data" field. Useless for an ordinary data // record (type 00), return the "byte count" in this case. -static int GetIHexRequiredDataFieldSize(unsigned int recStartPos, Accessor &styler) +static int GetIHexRequiredDataFieldSize(Sci_PositionU recStartPos, Accessor &styler) { switch (GetHexaChar(recStartPos + 7, styler)) { case 0x01: @@ -548,7 +548,7 @@ static int GetIHexRequiredDataFieldSize(unsigned int recStartPos, Accessor &styl } // Get the value of the "checksum" field. -static int GetIHexChecksum(unsigned int recStartPos, Accessor &styler) +static int GetIHexChecksum(Sci_PositionU recStartPos, Accessor &styler) { int byteCount; @@ -558,7 +558,7 @@ static int GetIHexChecksum(unsigned int recStartPos, Accessor &styler) } // Calculate the checksum of the record. -static int CalcIHexChecksum(unsigned int recStartPos, Accessor &styler) +static int CalcIHexChecksum(Sci_PositionU recStartPos, Accessor &styler) { int byteCount; @@ -571,7 +571,7 @@ static int CalcIHexChecksum(unsigned int recStartPos, Accessor &styler) // Get the value of the "record length" field, it counts the number of digits in // the record excluding the percent. -static int GetTEHexDigitCount(unsigned int recStartPos, Accessor &styler) +static int GetTEHexDigitCount(Sci_PositionU recStartPos, Accessor &styler) { int val = GetHexaChar(recStartPos + 1, styler); if (val < 0) @@ -582,9 +582,9 @@ static int GetTEHexDigitCount(unsigned int recStartPos, Accessor &styler) // Count the number of digits in this record. Has to // be equal to the "record length" field value. -static int CountTEHexDigitCount(unsigned int recStartPos, Accessor &styler) +static Sci_Position CountTEHexDigitCount(Sci_PositionU recStartPos, Accessor &styler) { - unsigned int pos; + Sci_PositionU pos; pos = recStartPos+1; @@ -592,11 +592,11 @@ static int CountTEHexDigitCount(unsigned int recStartPos, Accessor &styler) pos++; } - return static_cast<int>(pos - (recStartPos+1)); + return static_cast<Sci_Position>(pos - (recStartPos+1)); } // Get the type of the "address" field content. -static int GetTEHexAddressFieldType(unsigned int recStartPos, Accessor &styler) +static int GetTEHexAddressFieldType(Sci_PositionU recStartPos, Accessor &styler) { switch (styler.SafeGetCharAt(recStartPos + 3)) { case '6': @@ -611,16 +611,16 @@ static int GetTEHexAddressFieldType(unsigned int recStartPos, Accessor &styler) } // Get the value of the "checksum" field. -static int GetTEHexChecksum(unsigned int recStartPos, Accessor &styler) +static int GetTEHexChecksum(Sci_PositionU recStartPos, Accessor &styler) { return GetHexaChar(recStartPos+4, styler); } // Calculate the checksum of the record (excluding the checksum field). -static int CalcTEHexChecksum(unsigned int recStartPos, Accessor &styler) +static int CalcTEHexChecksum(Sci_PositionU recStartPos, Accessor &styler) { - unsigned int pos = recStartPos +1; - unsigned int length = GetTEHexDigitCount(recStartPos, styler); + Sci_PositionU pos = recStartPos +1; + Sci_PositionU length = GetTEHexDigitCount(recStartPos, styler); int cs = GetHexaNibble(styler.SafeGetCharAt(pos++));//length cs += GetHexaNibble(styler.SafeGetCharAt(pos++));//length @@ -650,7 +650,7 @@ static void ColouriseSrecDoc(Sci_PositionU startPos, Sci_Position length, int in StyleContext sc(startPos, length, initStyle, styler); while (sc.More()) { - unsigned int recStartPos; + Sci_PositionU recStartPos; int byteCount, reqByteCount, addrFieldSize, addrFieldType, dataFieldSize, dataFieldType; int cs1, cs2; @@ -774,7 +774,7 @@ static void ColouriseIHexDoc(Sci_PositionU startPos, Sci_Position length, int in StyleContext sc(startPos, length, initStyle, styler); while (sc.More()) { - unsigned int recStartPos; + Sci_PositionU recStartPos; int byteCount, addrFieldType, dataFieldSize, dataFieldType; int cs1, cs2; @@ -892,17 +892,17 @@ static void ColouriseIHexDoc(Sci_PositionU startPos, Sci_Position length, int in static void FoldIHexDoc(Sci_PositionU startPos, Sci_Position length, int, WordList *[], Accessor &styler) { - unsigned int endPos = startPos + length; + Sci_PositionU endPos = startPos + length; - int lineCurrent = styler.GetLine(startPos); + Sci_Position lineCurrent = styler.GetLine(startPos); int levelCurrent = SC_FOLDLEVELBASE; if (lineCurrent > 0) levelCurrent = styler.LevelAt(lineCurrent - 1); - unsigned int lineStartNext = styler.LineStart(lineCurrent + 1); + Sci_PositionU lineStartNext = styler.LineStart(lineCurrent + 1); int levelNext = SC_FOLDLEVELBASE; // default if no specific line found - for (unsigned int i = startPos; i < endPos; i++) { + for (Sci_PositionU i = startPos; i < endPos; i++) { bool atEOL = i == (lineStartNext - 1); int style = styler.StyleAt(i); @@ -912,7 +912,7 @@ static void FoldIHexDoc(Sci_PositionU startPos, Sci_Position length, int, WordLi levelNext = SC_FOLDLEVELBASE | SC_FOLDLEVELHEADERFLAG; } else if (style == SCE_HEX_DATAADDRESS || (style == SCE_HEX_DEFAULT - && i == (unsigned int)styler.LineStart(lineCurrent))) { + && i == (Sci_PositionU)styler.LineStart(lineCurrent))) { // data record or no record start code at all if (levelCurrent & SC_FOLDLEVELHEADERFLAG) { levelNext = SC_FOLDLEVELBASE + 1; @@ -938,7 +938,7 @@ static void ColouriseTEHexDoc(Sci_PositionU startPos, Sci_Position length, int i StyleContext sc(startPos, length, initStyle, styler); while (sc.More()) { - unsigned int recStartPos; + Sci_PositionU recStartPos; int digitCount, addrFieldType; int cs1, cs2; diff --git a/lexers/LexInno.cxx b/lexers/LexInno.cxx index d9b481f2a..d60377eda 100644 --- a/lexers/LexInno.cxx +++ b/lexers/LexInno.cxx @@ -32,9 +32,9 @@ static void ColouriseInnoDoc(Sci_PositionU startPos, Sci_Position length, int, W char chPrev; char ch = 0; char chNext = styler[startPos]; - int lengthDoc = startPos + length; + Sci_Position lengthDoc = startPos + length; char *buffer = new char[length]; - int bufferCount = 0; + Sci_Position bufferCount = 0; bool isBOL, isEOL, isWS, isBOLWS = 0; bool isCStyleComment = false; @@ -45,7 +45,7 @@ static void ColouriseInnoDoc(Sci_PositionU startPos, Sci_Position length, int, W WordList &pascalKeywords = *keywordLists[4]; WordList &userKeywords = *keywordLists[5]; - int curLine = styler.GetLine(startPos); + Sci_Position curLine = styler.GetLine(startPos); int curLineState = curLine > 0 ? styler.GetLineState(curLine - 1) : 0; bool isCode = (curLineState == 1); @@ -53,7 +53,7 @@ static void ColouriseInnoDoc(Sci_PositionU startPos, Sci_Position length, int, W // using the hand-written state machine shown below styler.StartAt(startPos); styler.StartSegment(startPos); - for (int i = startPos; i < lengthDoc; i++) { + for (Sci_Position i = startPos; i < lengthDoc; i++) { chPrev = ch; ch = chNext; chNext = styler.SafeGetCharAt(i + 1); @@ -249,16 +249,16 @@ static const char * const innoWordListDesc[] = { }; static void FoldInnoDoc(Sci_PositionU startPos, Sci_Position length, int, WordList *[], Accessor &styler) { - unsigned int endPos = startPos + length; + Sci_PositionU endPos = startPos + length; char chNext = styler[startPos]; - int lineCurrent = styler.GetLine(startPos); + Sci_Position lineCurrent = styler.GetLine(startPos); bool sectionFlag = false; int levelPrev = lineCurrent > 0 ? styler.LevelAt(lineCurrent - 1) : SC_FOLDLEVELBASE; int level; - for (unsigned int i = startPos; i < endPos; i++) { + for (Sci_PositionU i = startPos; i < endPos; i++) { char ch = chNext; chNext = styler[i+1]; bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n'); diff --git a/lexers/LexKVIrc.cxx b/lexers/LexKVIrc.cxx index 5aa35cf99..76259db7e 100644 --- a/lexers/LexKVIrc.cxx +++ b/lexers/LexKVIrc.cxx @@ -313,10 +313,10 @@ static void ColouriseKVIrcDoc(Sci_PositionU startPos, Sci_Position length, * fetching the current word, NULL-terminated like * the keyword list */ char s[100]; - int wordLen = sc.currentPos - styler.GetStartSegment(); + Sci_Position wordLen = sc.currentPos - styler.GetStartSegment(); if (wordLen > 99) wordLen = 99; /* Include '\0' in buffer */ - int i; + Sci_Position i; for( i = 0; i < wordLen; ++i ) { s[i] = styler.SafeGetCharAt( styler.GetStartSegment() + i ); @@ -365,11 +365,11 @@ static void FoldKVIrcDoc(Sci_PositionU startPos, Sci_Position length, int /*init return; /* Obtaining current line number*/ - int currentLine = styler.GetLine(startPos); + Sci_Position currentLine = styler.GetLine(startPos); /* Obtaining starting character - indentation is done on a line basis, * not character */ - unsigned int safeStartPos = styler.LineStart( currentLine ); + Sci_PositionU safeStartPos = styler.LineStart( currentLine ); /* Initialising current level - this is defined as indentation level * in the low 12 bits, with flag bits in the upper four bits. @@ -386,7 +386,7 @@ static void FoldKVIrcDoc(Sci_PositionU startPos, Sci_Position length, int /*init int nextLevel = currentLevel; // Looping for characters in range - for (unsigned int i = safeStartPos; i < startPos + length; ++i) + for (Sci_PositionU i = safeStartPos; i < startPos + length; ++i) { /* Folding occurs after syntax highlighting, meaning Scintilla * already knows where the comments are diff --git a/lexers/LexLaTeX.cxx b/lexers/LexLaTeX.cxx index d2ab191fa..7e03a9c4c 100644 --- a/lexers/LexLaTeX.cxx +++ b/lexers/LexLaTeX.cxx @@ -48,33 +48,33 @@ struct latexFoldSave { class LexerLaTeX : public LexerBase { private: vector<int> modes; - void setMode(int line, int mode) { - if (line >= static_cast<int>(modes.size())) modes.resize(line + 1, 0); + void setMode(Sci_Position line, int mode) { + if (line >= static_cast<Sci_Position>(modes.size())) modes.resize(line + 1, 0); modes[line] = mode; } - int getMode(int line) { - if (line >= 0 && line < static_cast<int>(modes.size())) return modes[line]; + int getMode(Sci_Position line) { + if (line >= 0 && line < static_cast<Sci_Position>(modes.size())) return modes[line]; return 0; } - void truncModes(int numLines) { - if (static_cast<int>(modes.size()) > numLines * 2 + 256) + void truncModes(Sci_Position numLines) { + if (static_cast<Sci_Position>(modes.size()) > numLines * 2 + 256) modes.resize(numLines + 128); } vector<latexFoldSave> saves; - void setSave(int line, const latexFoldSave &save) { - if (line >= static_cast<int>(saves.size())) saves.resize(line + 1); + void setSave(Sci_Position line, const latexFoldSave &save) { + if (line >= static_cast<Sci_Position>(saves.size())) saves.resize(line + 1); saves[line] = save; } - void getSave(int line, latexFoldSave &save) { - if (line >= 0 && line < static_cast<int>(saves.size())) save = saves[line]; + void getSave(Sci_Position line, latexFoldSave &save) { + if (line >= 0 && line < static_cast<Sci_Position>(saves.size())) save = saves[line]; else { save.structLev = 0; for (int i = 0; i < 8; ++i) save.openBegins[i] = 0; } } - void truncSaves(int numLines) { - if (static_cast<int>(saves.size()) > numLines * 2 + 256) + void truncSaves(Sci_Position numLines) { + if (static_cast<Sci_Position>(saves.size()) > numLines * 2 + 256) saves.resize(numLines + 128); } public: @@ -102,7 +102,7 @@ static bool latexIsLetter(int ch) { return IsASCII(ch) && isalpha(ch); } -static bool latexIsTagValid(int &i, int l, Accessor &styler) { +static bool latexIsTagValid(Sci_Position &i, Sci_Position l, Accessor &styler) { while (i < l) { if (styler.SafeGetCharAt(i) == '{') { while (i < l) { @@ -122,7 +122,7 @@ static bool latexIsTagValid(int &i, int l, Accessor &styler) { return false; } -static bool latexNextNotBlankIs(int i, Accessor &styler, char needle) { +static bool latexNextNotBlankIs(Sci_Position i, Accessor &styler, char needle) { char ch; while (i < styler.Length()) { ch = styler.SafeGetCharAt(i); @@ -137,10 +137,10 @@ static bool latexNextNotBlankIs(int i, Accessor &styler, char needle) { return false; } -static bool latexLastWordIs(int start, Accessor &styler, const char *needle) { - unsigned int i = 0; - unsigned int l = static_cast<unsigned int>(strlen(needle)); - int ini = start-l+1; +static bool latexLastWordIs(Sci_Position start, Accessor &styler, const char *needle) { + Sci_PositionU i = 0; + Sci_PositionU l = static_cast<Sci_PositionU>(strlen(needle)); + Sci_Position ini = start-l+1; char s[32]; while (i < l && i < 31) { @@ -152,8 +152,8 @@ static bool latexLastWordIs(int start, Accessor &styler, const char *needle) { return (strcmp(s, needle) == 0); } -static bool latexLastWordIsMathEnv(int pos, Accessor &styler) { - int i, j; +static bool latexLastWordIsMathEnv(Sci_Position pos, Accessor &styler) { + Sci_Position i, j; char s[32]; const char *mathEnvs[] = { "align", "alignat", "flalign", "gather", "multiline", "displaymath", "eqnarray", "equation" }; @@ -196,9 +196,9 @@ void SCI_METHOD LexerLaTeX::Lex(Sci_PositionU startPos, Sci_Position length, int char chNext = styler.SafeGetCharAt(startPos); char chVerbatimDelim = '\0'; styler.StartSegment(startPos); - int lengthDoc = startPos + length; + Sci_Position lengthDoc = startPos + length; - for (int i = startPos; i < lengthDoc; i++) { + for (Sci_Position i = startPos; i < lengthDoc; i++) { char ch = chNext; chNext = styler.SafeGetCharAt(i + 1); @@ -325,7 +325,7 @@ void SCI_METHOD LexerLaTeX::Lex(Sci_PositionU startPos, Sci_Position length, int case '\\' : styler.ColourTo(i - 1, state); if (latexIsLetter(chNext)) { - int match = i + 3; + Sci_Position match = i + 3; if (latexLastWordIs(match, styler, "\\end")) { match++; if (latexIsTagValid(match, lengthDoc, styler)) { @@ -367,7 +367,7 @@ void SCI_METHOD LexerLaTeX::Lex(Sci_PositionU startPos, Sci_Position length, int case '\\' : styler.ColourTo(i - 1, state); if (latexIsLetter(chNext)) { - int match = i + 3; + Sci_Position match = i + 3; if (latexLastWordIs(match, styler, "\\end")) { match++; if (latexIsTagValid(match, lengthDoc, styler)) { @@ -418,7 +418,7 @@ void SCI_METHOD LexerLaTeX::Lex(Sci_PositionU startPos, Sci_Position length, int break; case SCE_L_COMMENT2 : if (ch == '\\') { - int match = i + 3; + Sci_Position match = i + 3; if (latexLastWordIs(match, styler, "\\end")) { match++; if (latexIsTagValid(match, lengthDoc, styler)) { @@ -432,7 +432,7 @@ void SCI_METHOD LexerLaTeX::Lex(Sci_PositionU startPos, Sci_Position length, int break; case SCE_L_VERBATIM : if (ch == '\\') { - int match = i + 3; + Sci_Position match = i + 3; if (latexLastWordIs(match, styler, "\\end")) { match++; if (latexIsTagValid(match, lengthDoc, styler)) { @@ -474,19 +474,20 @@ void SCI_METHOD LexerLaTeX::Fold(Sci_PositionU startPos, Sci_Position length, in const char *structWords[7] = {"part", "chapter", "section", "subsection", "subsubsection", "paragraph", "subparagraph"}; Accessor styler(pAccess, &props); - unsigned int endPos = startPos + length; - int curLine = styler.GetLine(startPos); + Sci_PositionU endPos = startPos + length; + Sci_Position curLine = styler.GetLine(startPos); latexFoldSave save; getSave(curLine - 1, save); do { char ch, buf[16]; - int i, j, lev = -1; + Sci_Position i, j; + int lev = -1; bool needFold = false; - for (i = static_cast<int>(startPos); i < static_cast<int>(endPos); ++i) { + for (i = static_cast<Sci_Position>(startPos); i < static_cast<Sci_Position>(endPos); ++i) { ch = styler.SafeGetCharAt(i); if (ch == '\r' || ch == '\n') break; if (ch != '\\' || styler.StyleAt(i) != SCE_L_COMMAND) continue; - for (j = 0; j < 15 && i + 1 < static_cast<int>(endPos); ++j, ++i) { + for (j = 0; j < 15 && i + 1 < static_cast<Sci_Position>(endPos); ++j, ++i) { buf[j] = styler.SafeGetCharAt(i + 1); if (!latexIsLetter(buf[j])) break; } @@ -522,7 +523,7 @@ void SCI_METHOD LexerLaTeX::Fold(Sci_PositionU startPos, Sci_Position length, in setSave(curLine, save); ++curLine; startPos = styler.LineStart(curLine); - if (static_cast<int>(startPos) == styler.Length()) { + if (static_cast<Sci_Position>(startPos) == styler.Length()) { lev = latexFoldSaveToInt(save); styler.SetLevel(curLine, lev); setSave(curLine, save); diff --git a/lexers/LexLisp.cxx b/lexers/LexLisp.cxx index aba094cfa..8d81eae2e 100644 --- a/lexers/LexLisp.cxx +++ b/lexers/LexLisp.cxx @@ -46,10 +46,10 @@ static inline bool isLispwordstart(char ch) { } -static void classifyWordLisp(unsigned int start, unsigned int end, WordList &keywords, WordList &keywords_kw, Accessor &styler) { +static void classifyWordLisp(Sci_PositionU start, Sci_PositionU end, WordList &keywords, WordList &keywords_kw, Accessor &styler) { assert(end >= start); char s[100]; - unsigned int i; + Sci_PositionU i; bool digit_flag = true; for (i = 0; (i < end - start + 1) && (i < 99); i++) { s[i] = styler[start + i]; @@ -84,9 +84,9 @@ static void ColouriseLispDoc(Sci_PositionU startPos, Sci_Position length, int in int state = initStyle, radix = -1; char chNext = styler[startPos]; - unsigned int lengthDoc = startPos + length; + Sci_PositionU lengthDoc = startPos + length; styler.StartSegment(startPos); - for (unsigned int i = startPos; i < lengthDoc; i++) { + for (Sci_PositionU i = startPos; i < lengthDoc; i++) { char ch = chNext; chNext = styler.SafeGetCharAt(i + 1); @@ -235,14 +235,14 @@ static void ColouriseLispDoc(Sci_PositionU startPos, Sci_Position length, int in static void FoldLispDoc(Sci_PositionU startPos, Sci_Position length, int /* initStyle */, WordList *[], Accessor &styler) { - unsigned int lengthDoc = startPos + length; + Sci_PositionU lengthDoc = startPos + length; int visibleChars = 0; - int lineCurrent = styler.GetLine(startPos); + Sci_Position lineCurrent = styler.GetLine(startPos); int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK; int levelCurrent = levelPrev; char chNext = styler[startPos]; int styleNext = styler.StyleAt(startPos); - for (unsigned int i = startPos; i < lengthDoc; i++) { + for (Sci_PositionU i = startPos; i < lengthDoc; i++) { char ch = chNext; chNext = styler.SafeGetCharAt(i + 1); int style = styleNext; diff --git a/lexers/LexLout.cxx b/lexers/LexLout.cxx index e0458218d..39709827d 100644 --- a/lexers/LexLout.cxx +++ b/lexers/LexLout.cxx @@ -143,9 +143,9 @@ static void ColouriseLoutDoc(Sci_PositionU startPos, Sci_Position length, int in static void FoldLoutDoc(Sci_PositionU startPos, Sci_Position length, int, WordList *[], Accessor &styler) { - unsigned int endPos = startPos + length; + Sci_PositionU endPos = startPos + length; int visibleChars = 0; - int lineCurrent = styler.GetLine(startPos); + Sci_Position lineCurrent = styler.GetLine(startPos); int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK; int levelCurrent = levelPrev; char chNext = styler[startPos]; @@ -153,7 +153,7 @@ static void FoldLoutDoc(Sci_PositionU startPos, Sci_Position length, int, WordLi int styleNext = styler.StyleAt(startPos); char s[10] = ""; - 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 style = styleNext; @@ -162,7 +162,7 @@ static void FoldLoutDoc(Sci_PositionU startPos, Sci_Position length, int, WordLi if (style == SCE_LOUT_WORD) { if (ch == '@') { - for (unsigned int j = 0; j < 8; j++) { + for (Sci_PositionU j = 0; j < 8; j++) { if (!IsAWordChar(styler[i + j])) { break; } diff --git a/lexers/LexLua.cxx b/lexers/LexLua.cxx index 7ef4a9080..b62e69a35 100644 --- a/lexers/LexLua.cxx +++ b/lexers/LexLua.cxx @@ -67,7 +67,7 @@ static void ColouriseLuaDoc( CharacterSet setLuaOperator(CharacterSet::setNone, "*/-+()={}~[];<>,.^%:#"); CharacterSet setEscapeSkip(CharacterSet::setNone, "\"'\\"); - int currentLine = styler.GetLine(startPos); + Sci_Position currentLine = styler.GetLine(startPos); // Initialize long string [[ ... ]] or block comment --[[ ... ]] nesting level, // if we are inside such a string. Block comment was introduced in Lua 5.0, // blocks with separators [=[ ... ]=] in Lua 5.1. @@ -132,10 +132,10 @@ static void ColouriseLuaDoc( if (sc.state == SCE_LUA_OPERATOR) { if (sc.ch == ':' && sc.chPrev == ':') { // :: <label> :: forward scan sc.Forward(); - int ln = 0; + Sci_Position ln = 0; while (IsASpaceOrTab(sc.GetRelative(ln))) // skip over spaces/tabs ln++; - int ws1 = ln; + Sci_Position ws1 = ln; if (setWordStart.Contains(sc.GetRelative(ln))) { int c, i = 0; char s[100]; @@ -144,11 +144,11 @@ static void ColouriseLuaDoc( s[i++] = static_cast<char>(c); ln++; } - s[i] = '\0'; int lbl = ln; + s[i] = '\0'; Sci_Position lbl = ln; if (!keywords.InList(s)) { while (IsASpaceOrTab(sc.GetRelative(ln))) // skip over spaces/tabs ln++; - int ws2 = ln - lbl; + Sci_Position ws2 = ln - lbl; if (sc.GetRelative(ln) == ':' && sc.GetRelative(ln + 1) == ':') { // final :: found, complete valid label construct sc.ChangeState(SCE_LUA_LABEL); @@ -349,16 +349,16 @@ static void ColouriseLuaDoc( static void FoldLuaDoc(Sci_PositionU startPos, Sci_Position length, int /* initStyle */, WordList *[], Accessor &styler) { - unsigned int lengthDoc = startPos + length; + Sci_PositionU lengthDoc = startPos + length; int visibleChars = 0; - int lineCurrent = styler.GetLine(startPos); + Sci_Position lineCurrent = styler.GetLine(startPos); int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK; int levelCurrent = levelPrev; char chNext = styler[startPos]; bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0; int styleNext = styler.StyleAt(startPos); - for (unsigned int i = startPos; i < lengthDoc; i++) { + for (Sci_PositionU i = startPos; i < lengthDoc; i++) { char ch = chNext; chNext = styler.SafeGetCharAt(i + 1); int style = styleNext; @@ -367,7 +367,7 @@ static void FoldLuaDoc(Sci_PositionU startPos, Sci_Position length, int /* initS if (style == SCE_LUA_WORD) { if (ch == 'i' || ch == 'd' || ch == 'f' || ch == 'e' || ch == 'r' || ch == 'u') { char s[10] = ""; - for (unsigned int j = 0; j < 8; j++) { + for (Sci_PositionU j = 0; j < 8; j++) { if (!iswordchar(styler[i + j])) { break; } diff --git a/lexers/LexMPT.cxx b/lexers/LexMPT.cxx index cbb45e3c4..2732fb4d5 100644 --- a/lexers/LexMPT.cxx +++ b/lexers/LexMPT.cxx @@ -89,7 +89,7 @@ static void ColourizeLotDoc(Sci_PositionU startPos, Sci_Position length, int, Wo line.reserve(256); // Lot lines are less than 256 chars long most of the time. This should avoid reallocations // Styles LOT document - unsigned int i; // Declared here because it's used after the for loop + Sci_PositionU i; // Declared here because it's used after the for loop for (i = startPos; i < startPos + length; ++i) { char ch = chNext; chNext = styler.SafeGetCharAt(i + 1); @@ -120,9 +120,9 @@ static void ColourizeLotDoc(Sci_PositionU startPos, Sci_Position length, int, Wo // fails (contiguous fail results within a section) static void FoldLotDoc(Sci_PositionU startPos, Sci_Position length, int, WordList *[], Accessor &styler) { bool foldCompact = styler.GetPropertyInt("fold.compact", 0) != 0; - unsigned int endPos = startPos + length; + Sci_PositionU endPos = startPos + length; int visibleChars = 0; - int lineCurrent = styler.GetLine(startPos); + Sci_Position lineCurrent = styler.GetLine(startPos); char chNext = styler.SafeGetCharAt(startPos); int style = SCE_LOT_DEFAULT; @@ -133,7 +133,7 @@ static void FoldLotDoc(Sci_PositionU startPos, Sci_Position length, int, WordLis if (startPos > 1) style = styler.StyleAt(startPos - 2); - for (unsigned int i = startPos; i < endPos; i++) { + for (Sci_PositionU i = startPos; i < endPos; i++) { char ch = chNext; chNext = styler.SafeGetCharAt(i + 1); diff --git a/lexers/LexMSSQL.cxx b/lexers/LexMSSQL.cxx index 71a9e62e4..fa86db694 100644 --- a/lexers/LexMSSQL.cxx +++ b/lexers/LexMSSQL.cxx @@ -35,8 +35,8 @@ using namespace Scintilla; #define KW_MSSQL_STORED_PROCEDURES 5 #define KW_MSSQL_OPERATORS 6 -static char classifyWordSQL(unsigned int start, - unsigned int end, +static char classifyWordSQL(Sci_PositionU start, + Sci_PositionU end, WordList *keywordlists[], Accessor &styler, unsigned int actualState, @@ -52,7 +52,7 @@ static char classifyWordSQL(unsigned int start, WordList &kwStoredProcedures = *keywordlists[KW_MSSQL_STORED_PROCEDURES]; WordList &kwOperators = *keywordlists[KW_MSSQL_OPERATORS]; - for (unsigned int i = 0; i < end - start + 1 && i < 128; i++) { + for (Sci_PositionU i = 0; i < end - start + 1 && i < 128; i++) { s[i] = static_cast<char>(tolower(styler[start + i])); s[i + 1] = '\0'; } @@ -108,7 +108,7 @@ static void ColouriseMSSQLDoc(Sci_PositionU startPos, Sci_Position length, styler.StartAt(startPos); bool fold = styler.GetPropertyInt("fold") != 0; - int lineCurrent = styler.GetLine(startPos); + Sci_Position lineCurrent = styler.GetLine(startPos); int spaceFlags = 0; int state = initStyle; @@ -116,8 +116,8 @@ static void ColouriseMSSQLDoc(Sci_PositionU startPos, Sci_Position length, char chPrev = ' '; char chNext = styler[startPos]; styler.StartSegment(startPos); - unsigned int lengthDoc = startPos + length; - for (unsigned int i = startPos; i < lengthDoc; i++) { + Sci_PositionU lengthDoc = startPos + length; + for (Sci_PositionU i = startPos; i < lengthDoc; i++) { char ch = chNext; chNext = styler.SafeGetCharAt(i + 1); @@ -280,15 +280,15 @@ static void ColouriseMSSQLDoc(Sci_PositionU startPos, Sci_Position length, static void FoldMSSQLDoc(Sci_PositionU startPos, Sci_Position length, int, WordList *[], Accessor &styler) { bool foldComment = styler.GetPropertyInt("fold.comment") != 0; bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0; - unsigned int endPos = startPos + length; + Sci_PositionU endPos = startPos + length; int visibleChars = 0; - int lineCurrent = styler.GetLine(startPos); + Sci_Position lineCurrent = styler.GetLine(startPos); int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK; int levelCurrent = levelPrev; char chNext = styler[startPos]; bool inComment = (styler.StyleAt(startPos-1) == SCE_MSSQL_COMMENT); char s[10] = ""; - 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 style = styler.StyleAt(i); @@ -304,7 +304,7 @@ static void FoldMSSQLDoc(Sci_PositionU startPos, Sci_Position length, int, WordL if (style == SCE_MSSQL_STATEMENT) { // Folding between begin or case and end if (ch == 'b' || ch == 'B' || ch == 'c' || ch == 'C' || ch == 'e' || ch == 'E') { - for (unsigned int j = 0; j < 5; j++) { + for (Sci_PositionU j = 0; j < 5; j++) { if (!iswordchar(styler[i + j])) { break; } diff --git a/lexers/LexMagik.cxx b/lexers/LexMagik.cxx index 02d457d55..4a2a7b9fb 100644 --- a/lexers/LexMagik.cxx +++ b/lexers/LexMagik.cxx @@ -141,7 +141,7 @@ static void ColouriseMagikDoc(Sci_PositionU startPos, Sci_Position length, int i char keywordChar = static_cast<char>( tolower(styler.SafeGetCharAt( scanPosition + - static_cast<int>(sc.currentPos+1), ' '))); + static_cast<Sci_Position>(sc.currentPos+1), ' '))); if(IsAlpha(keywordChar)) { keyword[scanPosition] = keywordChar; } else { @@ -365,18 +365,18 @@ static void FoldMagikDoc(Sci_PositionU startPos, Sci_Position length, int, bool compact = styler.GetPropertyInt("fold.compact") != 0; WordList &foldingElements = *keywordslists[5]; - int endPos = startPos + length; - int line = styler.GetLine(startPos); + Sci_Position endPos = startPos + length; + Sci_Position line = styler.GetLine(startPos); int level = styler.LevelAt(line) & SC_FOLDLEVELNUMBERMASK; int flags = styler.LevelAt(line) & ~SC_FOLDLEVELNUMBERMASK; for( - int currentPos = startPos; + Sci_Position currentPos = startPos; currentPos < endPos; currentPos++) { char currentState = styler.StyleAt(currentPos); char c = styler.SafeGetCharAt(currentPos, ' '); - int prevLine = styler.GetLine(currentPos - 1); + Sci_Position prevLine = styler.GetLine(currentPos - 1); line = styler.GetLine(currentPos); // Default situation diff --git a/lexers/LexMake.cxx b/lexers/LexMake.cxx index 7af782acf..9e8dadf1b 100644 --- a/lexers/LexMake.cxx +++ b/lexers/LexMake.cxx @@ -27,20 +27,20 @@ using namespace Scintilla; #endif -static inline bool AtEOL(Accessor &styler, unsigned int i) { +static inline bool AtEOL(Accessor &styler, Sci_PositionU i) { return (styler[i] == '\n') || ((styler[i] == '\r') && (styler.SafeGetCharAt(i + 1) != '\n')); } static void ColouriseMakeLine( char *lineBuffer, - unsigned int lengthLine, - unsigned int startLine, - unsigned int endPos, + Sci_PositionU lengthLine, + Sci_PositionU startLine, + Sci_PositionU endPos, Accessor &styler) { - unsigned int i = 0; - int lastNonSpace = -1; + Sci_PositionU i = 0; + Sci_Position lastNonSpace = -1; unsigned int state = SCE_MAKE_DEFAULT; bool bSpecial = false; @@ -120,9 +120,9 @@ static void ColouriseMakeDoc(Sci_PositionU startPos, Sci_Position length, int, W char lineBuffer[1024]; styler.StartAt(startPos); styler.StartSegment(startPos); - unsigned int linePos = 0; - unsigned int startLine = startPos; - for (unsigned int i = startPos; i < startPos + length; i++) { + Sci_PositionU linePos = 0; + Sci_PositionU startLine = startPos; + for (Sci_PositionU i = startPos; i < startPos + length; i++) { lineBuffer[linePos++] = styler[i]; if (AtEOL(styler, i) || (linePos >= sizeof(lineBuffer) - 1)) { // End of line (or of line buffer) met, colourise it diff --git a/lexers/LexMarkdown.cxx b/lexers/LexMarkdown.cxx index a587ca845..781f85deb 100644 --- a/lexers/LexMarkdown.cxx +++ b/lexers/LexMarkdown.cxx @@ -60,8 +60,8 @@ static inline bool IsNewline(const int ch) { } // True if can follow ch down to the end with possibly trailing whitespace -static bool FollowToLineEnd(const int ch, const int state, const unsigned int endPos, StyleContext &sc) { - unsigned int i = 0; +static bool FollowToLineEnd(const int ch, const int state, const Sci_PositionU endPos, StyleContext &sc) { + Sci_PositionU i = 0; while (sc.GetRelative(++i) == ch) ; // Skip over whitespace @@ -78,7 +78,7 @@ static bool FollowToLineEnd(const int ch, const int state, const unsigned int en // Set the state on text section from current to length characters, // then set the rest until the newline to default, except for any characters matching token -static void SetStateAndZoom(const int state, const int length, const int token, StyleContext &sc) { +static void SetStateAndZoom(const int state, const Sci_Position length, const int token, StyleContext &sc) { sc.SetState(state); sc.Forward(length); sc.SetState(SCE_MARKDOWN_DEFAULT); @@ -100,11 +100,11 @@ static void SetStateAndZoom(const int state, const int length, const int token, // Does the previous line have more than spaces and tabs? static bool HasPrevLineContent(StyleContext &sc) { - int i = 0; + Sci_Position i = 0; // Go back to the previous newline - while ((--i + (int)sc.currentPos) >= 0 && !IsNewline(sc.GetRelative(i))) + while ((--i + (Sci_Position)sc.currentPos) >= 0 && !IsNewline(sc.GetRelative(i))) ; - while ((--i + (int)sc.currentPos) >= 0) { + while ((--i + (Sci_Position)sc.currentPos) >= 0) { if (IsNewline(sc.GetRelative(i))) break; if (!IsASpaceOrTab(sc.GetRelative(i))) @@ -117,9 +117,9 @@ static bool AtTermStart(StyleContext &sc) { return sc.currentPos == 0 || isspacechar(sc.chPrev); } -static bool IsValidHrule(const unsigned int endPos, StyleContext &sc) { +static bool IsValidHrule(const Sci_PositionU endPos, StyleContext &sc) { int count = 1; - unsigned int i = 0; + Sci_PositionU i = 0; for (;;) { ++i; int c = sc.GetRelative(i); @@ -145,7 +145,7 @@ static bool IsValidHrule(const unsigned int endPos, StyleContext &sc) { static void ColorizeMarkdownDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList **, Accessor &styler) { - unsigned int endPos = startPos + length; + Sci_PositionU endPos = startPos + length; int precharCount = 0; // Don't advance on a new loop iteration and retry at the same position. // Useful in the corner case of having to start at the beginning file position @@ -225,7 +225,7 @@ static void ColorizeMarkdownDoc(Sci_PositionU startPos, Sci_Position length, int } else if (sc.state == SCE_MARKDOWN_CODEBK) { if (sc.atLineStart && sc.Match("~~~")) { - int i = 1; + Sci_Position i = 1; while (!IsNewline(sc.GetRelative(i)) && sc.currentPos + i < endPos) i++; sc.Forward(i); @@ -347,8 +347,8 @@ static void ColorizeMarkdownDoc(Sci_PositionU startPos, Sci_Position length, int } // Links and Images if (sc.Match("![") || sc.ch == '[') { - int i = 0, j = 0, k = 0; - int len = endPos - sc.currentPos; + Sci_Position i = 0, j = 0, k = 0; + Sci_Position len = endPos - sc.currentPos; while (i < len && (sc.GetRelative(++i) != ']' || sc.GetRelative(i - 1) == '\\')) ; if (sc.GetRelative(i) == ']') { diff --git a/lexers/LexMatlab.cxx b/lexers/LexMatlab.cxx index 8bf94fe29..563b31b46 100644 --- a/lexers/LexMatlab.cxx +++ b/lexers/LexMatlab.cxx @@ -58,7 +58,7 @@ static bool IsOctaveComment(Accessor &styler, Sci_Position pos, Sci_Position len } static void ColouriseMatlabOctaveDoc( - Sci_PositionU startPos, Sci_Position length, int initStyle, + Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *keywordlists[], Accessor &styler, bool (*IsCommentChar)(int), bool ismatlab) { @@ -77,7 +77,7 @@ static void ColouriseMatlabOctaveDoc( int column = 0; // use the line state of each line to store the block comment depth - int curLine = styler.GetLine(startPos); + Sci_Position curLine = styler.GetLine(startPos); int commentDepth = curLine > 0 ? styler.GetLineState(curLine-1) : 0; @@ -247,12 +247,12 @@ static void ColouriseOctaveDoc(Sci_PositionU startPos, Sci_Position length, int static void FoldMatlabOctaveDoc(Sci_PositionU startPos, Sci_Position length, int, WordList *[], Accessor &styler, - bool(*IsComment)(Accessor&, Sci_Position, Sci_Position)) { + bool (*IsComment)(Accessor&, Sci_Position, Sci_Position)) { - int endPos = startPos + length; + Sci_Position endPos = startPos + length; // Backtrack to previous line in case need to fix its fold status - int lineCurrent = styler.GetLine(startPos); + Sci_Position lineCurrent = styler.GetLine(startPos); if (startPos > 0) { if (lineCurrent > 0) { lineCurrent--; @@ -262,7 +262,7 @@ static void FoldMatlabOctaveDoc(Sci_PositionU startPos, Sci_Position length, int int spaceFlags = 0; int indentCurrent = styler.IndentAmount(lineCurrent, &spaceFlags, IsComment); char chNext = styler[startPos]; - for (int i = startPos; i < endPos; i++) { + for (Sci_Position i = startPos; i < endPos; i++) { char ch = chNext; chNext = styler.SafeGetCharAt(i + 1); diff --git a/lexers/LexMetapost.cxx b/lexers/LexMetapost.cxx index 8f8da1344..cbfe10fa7 100644 --- a/lexers/LexMetapost.cxx +++ b/lexers/LexMetapost.cxx @@ -62,7 +62,7 @@ using namespace Scintilla; // Auxiliary functions: -static inline bool endOfLine(Accessor &styler, unsigned int i) { +static inline bool endOfLine(Accessor &styler, Sci_PositionU i) { return (styler[i] == '\n') || ((styler[i] == '\r') && (styler.SafeGetCharAt(i + 1) != '\n')) ; } @@ -125,12 +125,12 @@ static int CheckMETAPOSTInterface( int defaultInterface) { char lineBuffer[1024] ; - unsigned int linePos = 0 ; + Sci_PositionU linePos = 0 ; // some day we can make something lexer.metapost.mapping=(none,0)(metapost,1)(mp,1)(metafun,2)... if (styler.SafeGetCharAt(0) == '%') { - for (unsigned int i = 0; i < startPos + length; i++) { + for (Sci_PositionU i = 0; i < startPos + length; i++) { lineBuffer[linePos++] = styler.SafeGetCharAt(i) ; if (endOfLine(styler, i) || (linePos >= sizeof(lineBuffer) - 1)) { lineBuffer[linePos] = '\0'; @@ -336,7 +336,7 @@ static int classifyFoldPointMetapost(const char* s,WordList *keywordlists[]) { } -static int ParseMetapostWord(unsigned int pos, Accessor &styler, char *word) +static int ParseMetapostWord(Sci_PositionU pos, Accessor &styler, char *word) { int length=0; char ch=styler.SafeGetCharAt(pos); @@ -354,16 +354,16 @@ static int ParseMetapostWord(unsigned int pos, Accessor &styler, char *word) static void FoldMetapostDoc(Sci_PositionU startPos, Sci_Position length, int, WordList *keywordlists[], Accessor &styler) { bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0; - unsigned int endPos = startPos+length; + Sci_PositionU endPos = startPos+length; int visibleChars=0; - int lineCurrent=styler.GetLine(startPos); + Sci_Position lineCurrent=styler.GetLine(startPos); int levelPrev=styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK; int levelCurrent=levelPrev; char chNext=styler[startPos]; char buffer[100]=""; - for (unsigned int i=startPos; i < endPos; i++) { + for (Sci_PositionU i=startPos; i < endPos; i++) { char ch=chNext; chNext=styler.SafeGetCharAt(i+1); char chPrev=styler.SafeGetCharAt(i-1); diff --git a/lexers/LexModula.cxx b/lexers/LexModula.cxx index f2014d0fe..c71cdd0ce 100644 --- a/lexers/LexModula.cxx +++ b/lexers/LexModula.cxx @@ -79,7 +79,7 @@ static inline unsigned IsOperator( StyleContext & sc, WordList & op ) { return 0; } -static inline bool IsEOL( Accessor &styler, unsigned curPos ) { +static inline bool IsEOL( Accessor &styler, Sci_PositionU curPos ) { unsigned ch = styler.SafeGetCharAt( curPos ); if( ( ch == '\r' && styler.SafeGetCharAt( curPos + 1 ) == '\n' ) || ( ch == '\n' ) ) { @@ -90,7 +90,7 @@ static inline bool IsEOL( Accessor &styler, unsigned curPos ) { static inline bool checkStatement( Accessor &styler, - int &curPos, + Sci_Position &curPos, const char *stt, bool spaceAfter = true ) { int len = static_cast<int>(strlen( stt )); int i; @@ -110,7 +110,7 @@ static inline bool checkStatement( static inline bool checkEndSemicolon( Accessor &styler, - int &curPos, int endPos ) + Sci_Position &curPos, Sci_Position endPos ) { const char *stt = "END"; int len = static_cast<int>(strlen( stt )); @@ -134,9 +134,9 @@ static inline bool checkEndSemicolon( static inline bool checkKeyIdentOper( Accessor &styler, - int &curPos, int endPos, + Sci_Position &curPos, Sci_Position endPos, const char *stt, const char etk ) { - int newPos = curPos; + Sci_Position newPos = curPos; if( ! checkStatement( styler, newPos, stt ) ) return false; newPos++; @@ -179,12 +179,12 @@ static void FoldModulaDoc( Sci_PositionU startPos, int , WordList *[], Accessor &styler) { - int curLine = styler.GetLine(startPos); + Sci_Position curLine = styler.GetLine(startPos); int curLevel = SC_FOLDLEVELBASE; - int endPos = startPos + length; + Sci_Position endPos = startPos + length; if( curLine > 0 ) curLevel = styler.LevelAt( curLine - 1 ) >> 16; - int curPos = startPos; + Sci_Position curPos = startPos; int style = styler.StyleAt( curPos ); int visChars = 0; int nextLevel = curLevel; @@ -250,9 +250,9 @@ static void FoldModulaDoc( Sci_PositionU startPos, nextLevel++; else if( checkKeyIdentOper( styler, curPos, endPos, "END", ';' ) ) { - int cln = curLine; + Sci_Position cln = curLine; int clv_old = curLevel; - int pos; + Sci_Position pos; char ch; int clv_new; while( cln > 0 ) { @@ -342,7 +342,7 @@ static void ColouriseModulaDoc( Sci_PositionU startPos, char buf[BUFLEN]; int i, kl; - int charPos = 0; + Sci_Position charPos = 0; StyleContext sc( startPos, length, initStyle, styler ); diff --git a/lexers/LexMySQL.cxx b/lexers/LexMySQL.cxx index 8d7dc802e..dceec4734 100644 --- a/lexers/LexMySQL.cxx +++ b/lexers/LexMySQL.cxx @@ -150,7 +150,7 @@ static void ColouriseMySQLDoc(Sci_PositionU startPos, Sci_Position length, int i case SCE_MYSQL_SYSTEMVARIABLE: if (!IsAWordChar(sc.ch)) { - int length = sc.LengthCurrent() + 1; + Sci_Position length = sc.LengthCurrent() + 1; char* s = new char[length]; sc.GetCurrentLowered(s, length); @@ -328,9 +328,9 @@ static bool IsStreamCommentStyle(int style) * Code copied from StyleContext and modified to work here. Should go into Accessor as a * companion to Match()... */ -bool MatchIgnoreCase(Accessor &styler, int currentPos, const char *s) +bool MatchIgnoreCase(Accessor &styler, Sci_Position currentPos, const char *s) { - for (int n = 0; *s; n++) + for (Sci_Position n = 0; *s; n++) { if (*s != tolower(styler.SafeGetCharAt(currentPos + n))) return false; @@ -350,7 +350,7 @@ static void FoldMySQLDoc(Sci_PositionU startPos, Sci_Position length, int initSt bool foldOnlyBegin = styler.GetPropertyInt("fold.sql.only.begin", 0) != 0; int visibleChars = 0; - int lineCurrent = styler.GetLine(startPos); + Sci_Position lineCurrent = styler.GetLine(startPos); int levelCurrent = SC_FOLDLEVELBASE; if (lineCurrent > 0) levelCurrent = styler.LevelAt(lineCurrent - 1) >> 16; @@ -365,7 +365,7 @@ static void FoldMySQLDoc(Sci_PositionU startPos, Sci_Position length, int initSt bool elseIfPending = false; char nextChar = styler.SafeGetCharAt(startPos); - for (unsigned int i = startPos; length > 0; i++, length--) + for (Sci_PositionU i = startPos; length > 0; i++, length--) { int stylePrev = style; int lastActiveState = activeState; diff --git a/lexers/LexNimrod.cxx b/lexers/LexNimrod.cxx index e02203e24..d232f9f14 100644 --- a/lexers/LexNimrod.cxx +++ b/lexers/LexNimrod.cxx @@ -33,7 +33,7 @@ static inline bool IsAWordChar(int ch) { return (ch >= 0x80) || isalnum(ch) || ch == '_'; } -static int tillEndOfTripleQuote(Accessor &styler, int pos, int max) { +static Sci_Position tillEndOfTripleQuote(Accessor &styler, Sci_Position pos, Sci_Position max) { /* search for """ */ for (;;) { if (styler.SafeGetCharAt(pos, '\0') == '\0') return pos; @@ -52,7 +52,7 @@ static bool inline isNewLine(int ch) { return ch == CR || ch == LF; } -static int scanString(Accessor &styler, int pos, int max, bool rawMode) { +static Sci_Position scanString(Accessor &styler, Sci_Position pos, Sci_Position max, bool rawMode) { for (;;) { if (pos >= max) return pos; char ch = styler.SafeGetCharAt(pos, '\0'); @@ -66,7 +66,7 @@ static int scanString(Accessor &styler, int pos, int max, bool rawMode) { } } -static int scanChar(Accessor &styler, int pos, int max) { +static Sci_Position scanChar(Accessor &styler, Sci_Position pos, Sci_Position max) { for (;;) { if (pos >= max) return pos; char ch = styler.SafeGetCharAt(pos, '\0'); @@ -81,9 +81,9 @@ static int scanChar(Accessor &styler, int pos, int max) { } } -static int scanIdent(Accessor &styler, int pos, WordList &keywords) { +static Sci_Position scanIdent(Accessor &styler, Sci_Position pos, WordList &keywords) { char buf[100]; /* copy to lowercase and ignore underscores */ - int i = 0; + Sci_Position i = 0; for (;;) { char ch = styler.SafeGetCharAt(pos, '\0'); @@ -104,7 +104,7 @@ static int scanIdent(Accessor &styler, int pos, WordList &keywords) { return pos; } -static int scanNumber(Accessor &styler, int pos) { +static Sci_Position scanNumber(Accessor &styler, Sci_Position pos) { char ch, ch2; ch = styler.SafeGetCharAt(pos, '\0'); ch2 = styler.SafeGetCharAt(pos+1, '\0'); @@ -181,8 +181,8 @@ static int scanNumber(Accessor &styler, int pos) { */ static void ColouriseNimrodDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *keywordlists[], Accessor &styler) { - int pos = startPos; - int max = startPos + length; + Sci_Position pos = startPos; + Sci_Position max = startPos + length; char ch; WordList &keywords = *keywordlists[0]; @@ -264,10 +264,10 @@ static void ColouriseNimrodDoc(Sci_PositionU startPos, Sci_Position length, int } } -static bool IsCommentLine(int line, Accessor &styler) { - int pos = styler.LineStart(line); - int eol_pos = styler.LineStart(line + 1) - 1; - for (int i = pos; i < eol_pos; i++) { +static bool IsCommentLine(Sci_Position line, Accessor &styler) { + Sci_Position pos = styler.LineStart(line); + Sci_Position eol_pos = styler.LineStart(line + 1) - 1; + for (Sci_Position i = pos; i < eol_pos; i++) { char ch = styler[i]; if (ch == '#') return true; @@ -277,7 +277,7 @@ static bool IsCommentLine(int line, Accessor &styler) { return false; } -static bool IsQuoteLine(int line, Accessor &styler) { +static bool IsQuoteLine(Sci_Position line, Accessor &styler) { int style = styler.StyleAt(styler.LineStart(line)) & 31; return ((style == SCE_P_TRIPLE) || (style == SCE_P_TRIPLEDOUBLE)); } @@ -286,9 +286,9 @@ static bool IsQuoteLine(int line, Accessor &styler) { static void FoldNimrodDoc(Sci_PositionU startPos, Sci_Position length, int /*initStyle - unused*/, WordList *[], Accessor &styler) { - const int maxPos = startPos + length; - const int maxLines = styler.GetLine(maxPos - 1); // Requested last line - const int docLines = styler.GetLine(styler.Length() - 1); // Available last line + const Sci_Position maxPos = startPos + length; + const Sci_Position maxLines = styler.GetLine(maxPos - 1); // Requested last line + const Sci_Position docLines = styler.GetLine(styler.Length() - 1); // Available last line const bool foldComment = styler.GetPropertyInt("fold.comment.nimrod") != 0; const bool foldQuotes = styler.GetPropertyInt("fold.quotes.nimrod") != 0; @@ -297,7 +297,7 @@ static void FoldNimrodDoc(Sci_PositionU startPos, Sci_Position length, // and so we can fix any preceding fold level (which is why we go back // at least one line in all cases) int spaceFlags = 0; - int lineCurrent = styler.GetLine(startPos); + Sci_Position lineCurrent = styler.GetLine(startPos); int indentCurrent = styler.IndentAmount(lineCurrent, &spaceFlags, NULL); while (lineCurrent > 0) { lineCurrent--; @@ -328,7 +328,7 @@ static void FoldNimrodDoc(Sci_PositionU startPos, Sci_Position length, // Gather info int lev = indentCurrent; - int lineNext = lineCurrent + 1; + Sci_Position lineNext = lineCurrent + 1; int indentNext = indentCurrent; int quote = false; if (lineNext <= docLines) { @@ -388,7 +388,7 @@ static void FoldNimrodDoc(Sci_PositionU startPos, Sci_Position length, // which is indented more than the line after the end of // the comment-block, use the level of the block before - int skipLine = lineNext; + Sci_Position skipLine = lineNext; int skipLevel = levelAfterComments; while (--skipLine > lineCurrent) { diff --git a/lexers/LexNsis.cxx b/lexers/LexNsis.cxx index 390342c7f..260834912 100644 --- a/lexers/LexNsis.cxx +++ b/lexers/LexNsis.cxx @@ -69,10 +69,10 @@ static bool isNsisLetter(char ch) return (ch >= 'A' && ch <= 'Z') || (ch >= 'a' && ch <= 'z'); } -static bool NsisNextLineHasElse(unsigned int start, unsigned int end, Accessor &styler) +static bool NsisNextLineHasElse(Sci_PositionU start, Sci_PositionU end, Accessor &styler) { - int nNextLine = -1; - for( unsigned int i = start; i < end; i++ ) + Sci_Position nNextLine = -1; + for( Sci_PositionU i = start; i < end; i++ ) { char cNext = styler.SafeGetCharAt( i ); if( cNext == '\n' ) @@ -85,7 +85,7 @@ static bool NsisNextLineHasElse(unsigned int start, unsigned int end, Accessor & if( nNextLine == -1 ) // We never found the next line... return false; - for( unsigned int firstChar = nNextLine; firstChar < end; firstChar++ ) + for( Sci_PositionU firstChar = nNextLine; firstChar < end; firstChar++ ) { char cNext = styler.SafeGetCharAt( firstChar ); if( cNext == ' ' ) @@ -111,7 +111,7 @@ static int NsisCmp( const char *s1, const char *s2, bool bIgnoreCase ) return strcmp( s1, s2 ); } -static int calculateFoldNsis(unsigned int start, unsigned int end, int foldlevel, Accessor &styler, bool bElse, bool foldUtilityCmd ) +static int calculateFoldNsis(Sci_PositionU start, Sci_PositionU end, int foldlevel, Accessor &styler, bool bElse, bool foldUtilityCmd ) { int style = styler.StyleAt(end); @@ -143,7 +143,7 @@ static int calculateFoldNsis(unsigned int start, unsigned int end, int foldlevel char s[20]; // The key word we are looking for has atmost 13 characters s[0] = '\0'; - for (unsigned int i = 0; i < end - start + 1 && i < 19; i++) + for (Sci_PositionU i = 0; i < end - start + 1 && i < 19; i++) { s[i] = static_cast<char>( styler[ start + i ] ); s[i + 1] = '\0'; @@ -169,7 +169,7 @@ static int calculateFoldNsis(unsigned int start, unsigned int end, int foldlevel return newFoldlevel; } -static int classifyWordNsis(unsigned int start, unsigned int end, WordList *keywordLists[], Accessor &styler ) +static int classifyWordNsis(Sci_PositionU start, Sci_PositionU end, WordList *keywordLists[], Accessor &styler ) { bool bIgnoreCase = false; if( styler.GetPropertyInt("nsis.ignorecase") == 1 ) @@ -188,7 +188,7 @@ static int classifyWordNsis(unsigned int start, unsigned int end, WordList *keyw WordList &Lables = *keywordLists[2]; WordList &UserDefined = *keywordLists[3]; - for (unsigned int i = 0; i < end - start + 1 && i < 99; i++) + for (Sci_PositionU i = 0; i < end - start + 1 && i < 99; i++) { if( bIgnoreCase ) s[i] = static_cast<char>( tolower(styler[ start + i ] ) ); @@ -247,7 +247,7 @@ static int classifyWordNsis(unsigned int start, unsigned int end, WordList *keyw if( s[0] == '$' && bUserVars ) { bool bHasSimpleNsisChars = true; - for (unsigned int j = 1; j < end - start + 1 && j < 99; j++) + for (Sci_PositionU j = 1; j < end - start + 1 && j < 99; j++) { if( !isNsisChar( s[j] ) ) { @@ -264,7 +264,7 @@ static int classifyWordNsis(unsigned int start, unsigned int end, WordList *keyw if( isNsisNumber( s[0] ) ) { bool bHasSimpleNsisNumber = true; - for (unsigned int j = 1; j < end - start + 1 && j < 99; j++) + for (Sci_PositionU j = 1; j < end - start + 1 && j < 99; j++) { if( !isNsisNumber( s[j] ) ) { @@ -289,14 +289,14 @@ static void ColouriseNsisDoc(Sci_PositionU startPos, Sci_Position length, int, W styler.StartAt( startPos ); styler.GetLine( startPos ); - unsigned int nLengthDoc = startPos + length; + Sci_PositionU nLengthDoc = startPos + length; styler.StartSegment( startPos ); char cCurrChar; bool bVarInString = false; bool bClassicVarInString = false; - unsigned int i; + Sci_PositionU i; for( i = startPos; i < nLengthDoc; i++ ) { cCurrChar = styler.SafeGetCharAt( i ); @@ -403,8 +403,8 @@ static void ColouriseNsisDoc(Sci_PositionU startPos, Sci_Position length, int, W if( cNextChar == '\r' || cNextChar == '\n' ) { - int nCurLine = styler.GetLine(i+1); - int nBack = i; + Sci_Position nCurLine = styler.GetLine(i+1); + Sci_Position nBack = i; // We need to check if the previous line has a \ in it... bool bNextLine = false; @@ -562,11 +562,11 @@ static void FoldNsisDoc(Sci_PositionU startPos, Sci_Position length, int, WordLi bool foldUtilityCmd = styler.GetPropertyInt("nsis.foldutilcmd", 1) == 1; bool blockComment = false; - int lineCurrent = styler.GetLine(startPos); - unsigned int safeStartPos = styler.LineStart( lineCurrent ); + Sci_Position lineCurrent = styler.GetLine(startPos); + Sci_PositionU safeStartPos = styler.LineStart( lineCurrent ); bool bArg1 = true; - int nWordStart = -1; + Sci_Position nWordStart = -1; int levelCurrent = SC_FOLDLEVELBASE; if (lineCurrent > 0) @@ -580,7 +580,7 @@ static void FoldNsisDoc(Sci_PositionU startPos, Sci_Position length, int, WordLi blockComment = true; } - for (unsigned int i = safeStartPos; i < startPos + length; i++) + for (Sci_PositionU i = safeStartPos; i < startPos + length; i++) { char chCurr = styler.SafeGetCharAt(i); style = styler.StyleAt(i); diff --git a/lexers/LexOScript.cxx b/lexers/LexOScript.cxx index d73295292..8d4fe7950 100644 --- a/lexers/LexOScript.cxx +++ b/lexers/LexOScript.cxx @@ -374,10 +374,10 @@ static inline bool IsBlockComment(int style) { return style == SCE_OSCRIPT_BLOCK_COMMENT; } -static bool IsLineComment(int line, Accessor &styler) { - int pos = styler.LineStart(line); - int eolPos = styler.LineStart(line + 1) - 1; - for (int i = pos; i < eolPos; i++) { +static bool IsLineComment(Sci_Position line, Accessor &styler) { + Sci_Position pos = styler.LineStart(line); + Sci_Position eolPos = styler.LineStart(line + 1) - 1; + for (Sci_Position i = pos; i < eolPos; i++) { char ch = styler[i]; char chNext = styler.SafeGetCharAt(i + 1); int style = styler.StyleAt(i); @@ -395,9 +395,9 @@ static inline bool IsPreprocessor(int style) { style == SCE_OSCRIPT_DOC_COMMENT; } -static void GetRangeLowered(unsigned int start, unsigned int end, - Accessor &styler, char *s, unsigned int len) { - unsigned int i = 0; +static void GetRangeLowered(Sci_PositionU start, Sci_PositionU end, + Accessor &styler, char *s, Sci_PositionU len) { + Sci_PositionU i = 0; while (i < end - start + 1 && i < len - 1) { s[i] = static_cast<char>(tolower(styler[start + i])); i++; @@ -405,9 +405,9 @@ static void GetRangeLowered(unsigned int start, unsigned int end, s[i] = '\0'; } -static void GetForwardWordLowered(unsigned int start, Accessor &styler, - char *s, unsigned int len) { - unsigned int i = 0; +static void GetForwardWordLowered(Sci_PositionU start, Accessor &styler, + char *s, Sci_PositionU len) { + Sci_PositionU i = 0; while (i < len - 1 && IsAlpha(styler.SafeGetCharAt(start + i))) { s[i] = static_cast<char>(tolower(styler.SafeGetCharAt(start + i))); i++; @@ -416,7 +416,7 @@ static void GetForwardWordLowered(unsigned int start, Accessor &styler, } static void UpdatePreprocessorFoldLevel(int &levelCurrent, - unsigned int startPos, Accessor &styler) { + Sci_PositionU startPos, Accessor &styler) { char s[7]; // Size of the longest possible keyword + null. GetForwardWordLowered(startPos, styler, s, sizeof(s)); @@ -431,8 +431,8 @@ static void UpdatePreprocessorFoldLevel(int &levelCurrent, } } -static void UpdateKeywordFoldLevel(int &levelCurrent, unsigned int lastStart, - unsigned int currentPos, Accessor &styler) { +static void UpdateKeywordFoldLevel(int &levelCurrent, Sci_PositionU lastStart, + Sci_PositionU currentPos, Accessor &styler) { char s[9]; GetRangeLowered(lastStart, currentPos, styler, s, sizeof(s)); @@ -456,9 +456,9 @@ static void FoldOScriptDoc(Sci_PositionU startPos, Sci_Position length, int init bool foldComment = styler.GetPropertyInt("fold.comment") != 0; bool foldPreprocessor = styler.GetPropertyInt("fold.preprocessor") != 0; bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0; - int endPos = startPos + length; + Sci_Position endPos = startPos + length; int visibleChars = 0; - int lineCurrent = styler.GetLine(startPos); + Sci_Position lineCurrent = styler.GetLine(startPos); int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK; int levelCurrent = levelPrev; char chNext = styler[startPos]; @@ -466,7 +466,7 @@ static void FoldOScriptDoc(Sci_PositionU startPos, Sci_Position length, int init int style = initStyle; int lastStart = 0; - for (int i = startPos; i < endPos; i++) { + for (Sci_Position i = startPos; i < endPos; i++) { char ch = chNext; chNext = styler.SafeGetCharAt(i + 1); int stylePrev = style; diff --git a/lexers/LexOpal.cxx b/lexers/LexOpal.cxx index 9f6b42a0b..955927f63 100644 --- a/lexers/LexOpal.cxx +++ b/lexers/LexOpal.cxx @@ -26,9 +26,9 @@ using namespace Scintilla; #endif -inline static void getRange( unsigned int start, unsigned int end, Accessor & styler, char * s, unsigned int len ) +inline static void getRange( Sci_PositionU start, Sci_PositionU end, Accessor & styler, char * s, Sci_PositionU len ) { - unsigned int i = 0; + Sci_PositionU i = 0; while( ( i < end - start + 1 ) && ( i < len - 1 ) ) { s[i] = static_cast<char>( styler[ start + i ] ); @@ -37,7 +37,7 @@ inline static void getRange( unsigned int start, unsigned int end, Accessor & st s[ i ] = '\0'; } -inline bool HandleString( unsigned int & cur, unsigned int one_too_much, Accessor & styler ) +inline bool HandleString( Sci_PositionU & cur, Sci_PositionU one_too_much, Accessor & styler ) { char ch; @@ -92,7 +92,7 @@ inline bool HandleString( unsigned int & cur, unsigned int one_too_much, Accesso } } -inline bool HandleCommentBlock( unsigned int & cur, unsigned int one_too_much, Accessor & styler, bool could_fail ) +inline bool HandleCommentBlock( Sci_PositionU & cur, Sci_PositionU one_too_much, Accessor & styler, bool could_fail ) { char ch; @@ -155,7 +155,7 @@ inline bool HandleCommentBlock( unsigned int & cur, unsigned int one_too_much, A } } -inline bool HandleCommentLine( unsigned int & cur, unsigned int one_too_much, Accessor & styler, bool could_fail ) +inline bool HandleCommentLine( Sci_PositionU & cur, Sci_PositionU one_too_much, Accessor & styler, bool could_fail ) { char ch; @@ -240,7 +240,7 @@ inline bool HandleCommentLine( unsigned int & cur, unsigned int one_too_much, Ac } } -inline bool HandlePar( unsigned int & cur, Accessor & styler ) +inline bool HandlePar( Sci_PositionU & cur, Accessor & styler ) { styler.ColourTo( cur, SCE_OPAL_PAR ); @@ -250,7 +250,7 @@ inline bool HandlePar( unsigned int & cur, Accessor & styler ) return true; } -inline bool HandleSpace( unsigned int & cur, unsigned int one_too_much, Accessor & styler ) +inline bool HandleSpace( Sci_PositionU & cur, Sci_PositionU one_too_much, Accessor & styler ) { char ch; @@ -281,7 +281,7 @@ inline bool HandleSpace( unsigned int & cur, unsigned int one_too_much, Accessor } } -inline bool HandleInteger( unsigned int & cur, unsigned int one_too_much, Accessor & styler ) +inline bool HandleInteger( Sci_PositionU & cur, Sci_PositionU one_too_much, Accessor & styler ) { char ch; @@ -304,10 +304,10 @@ inline bool HandleInteger( unsigned int & cur, unsigned int one_too_much, Access } } -inline bool HandleWord( unsigned int & cur, unsigned int one_too_much, Accessor & styler, WordList * keywordlists[] ) +inline bool HandleWord( Sci_PositionU & cur, Sci_PositionU one_too_much, Accessor & styler, WordList * keywordlists[] ) { char ch; - const unsigned int beg = cur; + const Sci_PositionU beg = cur; cur++; for( ; ; ) @@ -323,7 +323,7 @@ inline bool HandleWord( unsigned int & cur, unsigned int one_too_much, Accessor } } - const int ide_len = cur - beg + 1; + const Sci_Position ide_len = cur - beg + 1; char * ide = new char[ ide_len ]; getRange( beg, cur, styler, ide, ide_len ); @@ -393,7 +393,7 @@ inline bool HandleWord( unsigned int & cur, unsigned int one_too_much, Accessor } -inline bool HandleSkip( unsigned int & cur, unsigned int one_too_much, Accessor & styler ) +inline bool HandleSkip( Sci_PositionU & cur, Sci_PositionU one_too_much, Accessor & styler ) { cur++; styler.ColourTo( cur - 1, SCE_OPAL_DEFAULT ); @@ -408,13 +408,13 @@ inline bool HandleSkip( unsigned int & cur, unsigned int one_too_much, Accessor } } -static void ColouriseOpalDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *keywordlists[], Accessor & styler) +static void ColouriseOpalDoc( Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *keywordlists[], Accessor & styler ) { styler.StartAt( startPos ); styler.StartSegment( startPos ); - unsigned int & cur = startPos; - const unsigned int one_too_much = startPos + length; + Sci_PositionU & cur = startPos; + const Sci_PositionU one_too_much = startPos + length; int state = initStyle; diff --git a/lexers/LexPB.cxx b/lexers/LexPB.cxx index 217154c27..df9689b3c 100644 --- a/lexers/LexPB.cxx +++ b/lexers/LexPB.cxx @@ -70,10 +70,10 @@ static inline bool IsAWordStart(const int ch) return (ch < 0x80) && (isalnum(ch) || ch == '_'); } -bool MatchUpperCase(Accessor &styler, int pos, const char *s) //Same as styler.Match() but uppercase comparison (a-z,A-Z and space only) +bool MatchUpperCase(Accessor &styler, Sci_Position pos, const char *s) //Same as styler.Match() but uppercase comparison (a-z,A-Z and space only) { char ch; - for (int i=0; *s; i++) + for (Sci_Position i=0; *s; i++) { ch=styler.SafeGetCharAt(pos+i); if (ch > 0x60) ch -= '\x20'; @@ -83,7 +83,7 @@ bool MatchUpperCase(Accessor &styler, int pos, const char *s) //Same as styler return true; } -static void ColourisePBDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *keywordlists[], Accessor &styler) { +static void ColourisePBDoc(Sci_PositionU startPos, Sci_Position length, int initStyle,WordList *keywordlists[],Accessor &styler) { WordList &keywords = *keywordlists[0]; @@ -191,8 +191,8 @@ static void FoldPBDoc(Sci_PositionU startPos, Sci_Position length, int, WordList if( styler.GetPropertyInt("fold") == 0 ) return; - unsigned int endPos = startPos + length; - int lineCurrent = styler.GetLine(startPos); + Sci_PositionU endPos = startPos + length; + Sci_Position lineCurrent = styler.GetLine(startPos); int levelCurrent = SC_FOLDLEVELBASE; if (lineCurrent > 0) levelCurrent = styler.LevelAt(lineCurrent-1) >> 16; @@ -202,7 +202,7 @@ static void FoldPBDoc(Sci_PositionU startPos, Sci_Position length, int, WordList bool fNewLine=true; bool fMightBeMultiLineMacro=false; bool fBeginOfCommentFound=false; - for (unsigned int i = startPos; i < endPos; i++) + for (Sci_PositionU i = startPos; i < endPos; i++) { char ch = chNext; chNext = styler.SafeGetCharAt(i + 1); @@ -354,7 +354,7 @@ static void FoldPBDoc(Sci_PositionU startPos, Sci_Position length, int, WordList break; } } //switch (ch) - } //for (unsigned int i = startPos; i < endPos; i++) + } //for (Sci_PositionU i = startPos; i < endPos; i++) } static const char * const pbWordListDesc[] = { diff --git a/lexers/LexPLM.cxx b/lexers/LexPLM.cxx index 3783508b9..e306685d6 100644 --- a/lexers/LexPLM.cxx +++ b/lexers/LexPLM.cxx @@ -24,12 +24,12 @@ using namespace Scintilla; #endif -static void GetRange(unsigned int start, - unsigned int end, +static void GetRange(Sci_PositionU start, + Sci_PositionU end, Accessor &styler, char *s, - unsigned int len) { - unsigned int i = 0; + Sci_PositionU len) { + Sci_PositionU i = 0; while ((i < end - start + 1) && (i < len-1)) { s[i] = static_cast<char>(tolower(styler[start + i])); i++; @@ -43,13 +43,13 @@ static void ColourisePlmDoc(Sci_PositionU startPos, WordList *keywordlists[], Accessor &styler) { - unsigned int endPos = startPos + length; + Sci_PositionU endPos = startPos + length; int state = initStyle; styler.StartAt(startPos); styler.StartSegment(startPos); - for (unsigned int i = startPos; i < endPos; i++) { + for (Sci_PositionU i = startPos; i < endPos; i++) { char ch = styler.SafeGetCharAt(i); char chNext = styler.SafeGetCharAt(i + 1); @@ -99,7 +99,7 @@ static void ColourisePlmDoc(Sci_PositionU startPos, if (!isdigit(ch) && !isalpha(ch) && ch != '$') { // Get the entire identifier. char word[1024]; - int segmentStart = styler.GetStartSegment(); + Sci_Position segmentStart = styler.GetStartSegment(); GetRange(segmentStart, i - 1, styler, word, sizeof(word)); i--; @@ -133,17 +133,17 @@ static void FoldPlmDoc(Sci_PositionU startPos, { bool foldComment = styler.GetPropertyInt("fold.comment") != 0; bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0; - unsigned int endPos = startPos + length; + Sci_PositionU endPos = startPos + length; int visibleChars = 0; - int lineCurrent = styler.GetLine(startPos); + Sci_Position lineCurrent = styler.GetLine(startPos); int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK; int levelCurrent = levelPrev; char chNext = styler[startPos]; int styleNext = styler.StyleAt(startPos); int style = initStyle; - int startKeyword = 0; + Sci_Position startKeyword = 0; - 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; diff --git a/lexers/LexPO.cxx b/lexers/LexPO.cxx index d2532cb2e..61e601126 100644 --- a/lexers/LexPO.cxx +++ b/lexers/LexPO.cxx @@ -38,7 +38,7 @@ using namespace Scintilla; static void ColourisePODoc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *[], Accessor &styler) { StyleContext sc(startPos, length, initStyle, styler); bool escaped = false; - int curLine = styler.GetLine(startPos); + Sci_Position curLine = styler.GetLine(startPos); // the line state holds the last state on or before the line that isn't the default style int curLineState = curLine > 0 ? styler.GetLineState(curLine - 1) : SCE_PO_DEFAULT; @@ -148,9 +148,9 @@ static void ColourisePODoc(Sci_PositionU startPos, Sci_Position length, int init sc.Complete(); } -static int FindNextNonEmptyLineState(unsigned int startPos, Accessor &styler) { - unsigned int length = styler.Length(); - for (unsigned int i = startPos; i < length; i++) { +static int FindNextNonEmptyLineState(Sci_PositionU startPos, Accessor &styler) { + Sci_PositionU length = styler.Length(); + for (Sci_PositionU i = startPos; i < length; i++) { if (! isspacechar(styler[i])) { return styler.GetLineState(styler.GetLine(i)); } @@ -164,8 +164,8 @@ static void FoldPODoc(Sci_PositionU startPos, Sci_Position length, int, WordList bool foldCompact = styler.GetPropertyInt("fold.compact") != 0; bool foldComment = styler.GetPropertyInt("fold.comment") != 0; - unsigned int endPos = startPos + length; - int curLine = styler.GetLine(startPos); + Sci_PositionU endPos = startPos + length; + Sci_Position curLine = styler.GetLine(startPos); int lineState = styler.GetLineState(curLine); int nextLineState; int level = styler.LevelAt(curLine) & SC_FOLDLEVELNUMBERMASK; @@ -173,7 +173,7 @@ static void FoldPODoc(Sci_PositionU startPos, Sci_Position length, int, WordList int visible = 0; int chNext = styler[startPos]; - for (unsigned int i = startPos; i < endPos; i++) { + for (Sci_PositionU i = startPos; i < endPos; i++) { int ch = chNext; chNext = styler.SafeGetCharAt(i+1); @@ -181,7 +181,7 @@ static void FoldPODoc(Sci_PositionU startPos, Sci_Position length, int, WordList visible++; } else if ((ch == '\r' && chNext != '\n') || ch == '\n' || i+1 >= endPos) { int lvl = level; - int nextLine = curLine + 1; + Sci_Position nextLine = curLine + 1; nextLineState = styler.GetLineState(nextLine); if ((lineState != SCE_PO_COMMENT || foldComment) && diff --git a/lexers/LexPOV.cxx b/lexers/LexPOV.cxx index c837dd03e..c46744769 100644 --- a/lexers/LexPOV.cxx +++ b/lexers/LexPOV.cxx @@ -68,7 +68,7 @@ static void ColourisePovDoc( WordList &keywords7 = *keywordlists[6]; WordList &keywords8 = *keywordlists[7]; - int currentLine = styler.GetLine(startPos); + Sci_Position currentLine = styler.GetLine(startPos); // Initialize the block comment /* */ nesting level, if we are inside such a comment. int blockCommentLevel = 0; if (initStyle == SCE_POV_COMMENT) { @@ -235,15 +235,15 @@ static void FoldPovDoc( bool foldComment = styler.GetPropertyInt("fold.comment") != 0; bool foldDirective = styler.GetPropertyInt("fold.directive") != 0; bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0; - unsigned int endPos = startPos + length; + Sci_PositionU endPos = startPos + length; int visibleChars = 0; - int lineCurrent = styler.GetLine(startPos); + Sci_Position lineCurrent = styler.GetLine(startPos); int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK; int levelCurrent = levelPrev; char chNext = styler[startPos]; int styleNext = styler.StyleAt(startPos); int style = initStyle; - 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; @@ -270,7 +270,7 @@ static void FoldPovDoc( } if (foldDirective && (style == SCE_POV_DIRECTIVE)) { if (ch == '#') { - unsigned int j=i+1; + Sci_PositionU j=i+1; while ((j<endPos) && IsASpaceOrTab(styler.SafeGetCharAt(j))) { j++; } diff --git a/lexers/LexPS.cxx b/lexers/LexPS.cxx index 3df25344b..e4730ca55 100644 --- a/lexers/LexPS.cxx +++ b/lexers/LexPS.cxx @@ -79,7 +79,7 @@ static void ColourisePSDoc( StyleContext sc(startPos, length, initStyle, styler); int pslevel = styler.GetPropertyInt("ps.level", 3); - int lineCurrent = styler.GetLine(startPos); + Sci_Position lineCurrent = styler.GetLine(startPos); int nestTextCurrent = 0; if (lineCurrent > 0 && initStyle == SCE_PS_TEXT) nestTextCurrent = styler.GetLineState(lineCurrent - 1); @@ -270,9 +270,9 @@ static void FoldPSDoc(Sci_PositionU startPos, Sci_Position length, int, WordList Accessor &styler) { bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0; bool foldAtElse = styler.GetPropertyInt("fold.at.else", 0) != 0; - unsigned int endPos = startPos + length; + Sci_PositionU endPos = startPos + length; int visibleChars = 0; - int lineCurrent = styler.GetLine(startPos); + Sci_Position lineCurrent = styler.GetLine(startPos); int levelCurrent = SC_FOLDLEVELBASE; if (lineCurrent > 0) levelCurrent = styler.LevelAt(lineCurrent-1) >> 16; @@ -280,7 +280,7 @@ static void FoldPSDoc(Sci_PositionU startPos, Sci_Position length, int, WordList int levelNext = levelCurrent; char chNext = styler[startPos]; int styleNext = styler.StyleAt(startPos); - 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 style = styleNext; diff --git a/lexers/LexPascal.cxx b/lexers/LexPascal.cxx index 4c24dab96..b7213bb87 100644 --- a/lexers/LexPascal.cxx +++ b/lexers/LexPascal.cxx @@ -132,12 +132,12 @@ contains requires using namespace Scintilla; #endif -static void GetRangeLowered(unsigned int start, - unsigned int end, +static void GetRangeLowered(Sci_PositionU start, + Sci_PositionU end, Accessor &styler, char *s, - unsigned int len) { - unsigned int i = 0; + Sci_PositionU len) { + Sci_PositionU i = 0; while ((i < end - start + 1) && (i < len-1)) { s[i] = static_cast<char>(tolower(styler[start + i])); i++; @@ -145,12 +145,12 @@ static void GetRangeLowered(unsigned int start, s[i] = '\0'; } -static void GetForwardRangeLowered(unsigned int start, +static void GetForwardRangeLowered(Sci_PositionU start, CharacterSet &charSet, Accessor &styler, char *s, - unsigned int len) { - unsigned int i = 0; + Sci_PositionU len) { + Sci_PositionU i = 0; while ((i < len-1) && charSet.Contains(styler.SafeGetCharAt(start + i))) { s[i] = static_cast<char>(tolower(styler.SafeGetCharAt(start + i))); i++; @@ -224,7 +224,7 @@ static void ColourisePascalDoc(Sci_PositionU startPos, Sci_Position length, int CharacterSet setHexNumber(CharacterSet::setDigits, "abcdefABCDEF"); CharacterSet setOperator(CharacterSet::setNone, "#$&'()*+,-./:;<=>@[]^{}"); - int curLine = styler.GetLine(startPos); + Sci_Position curLine = styler.GetLine(startPos); int curLineState = curLine > 0 ? styler.GetLineState(curLine - 1) : 0; StyleContext sc(startPos, length, initStyle, styler); @@ -347,10 +347,10 @@ static bool IsStreamCommentStyle(int style) { return style == SCE_PAS_COMMENT || style == SCE_PAS_COMMENT2; } -static bool IsCommentLine(int line, Accessor &styler) { - int pos = styler.LineStart(line); - int eolPos = styler.LineStart(line + 1) - 1; - for (int i = pos; i < eolPos; i++) { +static bool IsCommentLine(Sci_Position line, Accessor &styler) { + Sci_Position pos = styler.LineStart(line); + Sci_Position eolPos = styler.LineStart(line + 1) - 1; + for (Sci_Position i = pos; i < eolPos; i++) { char ch = styler[i]; char chNext = styler.SafeGetCharAt(i + 1); int style = styler.StyleAt(i); @@ -373,7 +373,7 @@ static void SetFoldInPreprocessorLevelFlag(int &lineFoldStateCurrent, unsigned i } static void ClassifyPascalPreprocessorFoldPoint(int &levelCurrent, int &lineFoldStateCurrent, - unsigned int startPos, Accessor &styler) { + Sci_PositionU startPos, Accessor &styler) { CharacterSet setWord(CharacterSet::setAlpha); char s[11]; // Size of the longest possible keyword + one additional character + null @@ -405,10 +405,10 @@ static void ClassifyPascalPreprocessorFoldPoint(int &levelCurrent, int &lineFold } } -static unsigned int SkipWhiteSpace(unsigned int currentPos, unsigned int endPos, +static Sci_PositionU SkipWhiteSpace(Sci_PositionU currentPos, Sci_PositionU endPos, Accessor &styler, bool includeChars = false) { CharacterSet setWord(CharacterSet::setAlphaNum, "_"); - unsigned int j = currentPos + 1; + Sci_PositionU j = currentPos + 1; char ch = styler.SafeGetCharAt(j); while ((j < endPos) && (IsASpaceOrTab(ch) || ch == '\r' || ch == '\n' || IsStreamCommentStyle(styler.StyleAt(j)) || (includeChars && setWord.Contains(ch)))) { @@ -419,8 +419,8 @@ static unsigned int SkipWhiteSpace(unsigned int currentPos, unsigned int endPos, } static void ClassifyPascalWordFoldPoint(int &levelCurrent, int &lineFoldStateCurrent, - int startPos, unsigned int endPos, - unsigned int lastStart, unsigned int currentPos, Accessor &styler) { + Sci_Position startPos, Sci_PositionU endPos, + Sci_PositionU lastStart, Sci_PositionU currentPos, Accessor &styler) { char s[100]; GetRangeLowered(lastStart, currentPos, styler, s, sizeof(s)); @@ -435,7 +435,7 @@ static void ClassifyPascalWordFoldPoint(int &levelCurrent, int &lineFoldStateCur } else if (strcmp(s, "class") == 0 || strcmp(s, "object") == 0) { // "class" & "object" keywords require special handling... bool ignoreKeyword = false; - unsigned int j = SkipWhiteSpace(currentPos, endPos, styler); + Sci_PositionU j = SkipWhiteSpace(currentPos, endPos, styler); if (j < endPos) { CharacterSet setWordStart(CharacterSet::setAlpha, "_"); CharacterSet setWord(CharacterSet::setAlphaNum, "_"); @@ -476,7 +476,7 @@ static void ClassifyPascalWordFoldPoint(int &levelCurrent, int &lineFoldStateCur } else if (strcmp(s, "interface") == 0) { // "interface" keyword requires special handling... bool ignoreKeyword = true; - int j = lastStart - 1; + Sci_Position j = lastStart - 1; char ch = styler.SafeGetCharAt(j); while ((j >= startPos) && (IsASpaceOrTab(ch) || ch == '\r' || ch == '\n' || IsStreamCommentStyle(styler.StyleAt(j)))) { @@ -487,7 +487,7 @@ static void ClassifyPascalWordFoldPoint(int &levelCurrent, int &lineFoldStateCur ignoreKeyword = false; } if (!ignoreKeyword) { - unsigned int k = SkipWhiteSpace(currentPos, endPos, styler); + Sci_PositionU k = SkipWhiteSpace(currentPos, endPos, styler); if (k < endPos && styler.SafeGetCharAt(k) == ';') { // Handle forward interface declarations ("type IMyInterface = interface;") ignoreKeyword = true; @@ -499,7 +499,7 @@ static void ClassifyPascalWordFoldPoint(int &levelCurrent, int &lineFoldStateCur } else if (strcmp(s, "dispinterface") == 0) { // "dispinterface" keyword requires special handling... bool ignoreKeyword = false; - unsigned int j = SkipWhiteSpace(currentPos, endPos, styler); + Sci_PositionU j = SkipWhiteSpace(currentPos, endPos, styler); if (j < endPos && styler.SafeGetCharAt(j) == ';') { // Handle forward dispinterface declarations ("type IMyInterface = dispinterface;") ignoreKeyword = true; @@ -521,9 +521,9 @@ static void FoldPascalDoc(Sci_PositionU startPos, Sci_Position length, int initS bool foldComment = styler.GetPropertyInt("fold.comment") != 0; bool foldPreprocessor = styler.GetPropertyInt("fold.preprocessor") != 0; bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0; - unsigned int endPos = startPos + length; + Sci_PositionU endPos = startPos + length; int visibleChars = 0; - int lineCurrent = styler.GetLine(startPos); + Sci_Position lineCurrent = styler.GetLine(startPos); int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK; int levelCurrent = levelPrev; int lineFoldStateCurrent = lineCurrent > 0 ? styler.GetLineState(lineCurrent - 1) & stateFoldMaskAll : 0; @@ -531,10 +531,10 @@ static void FoldPascalDoc(Sci_PositionU startPos, Sci_Position length, int initS int styleNext = styler.StyleAt(startPos); int style = initStyle; - int lastStart = 0; + Sci_Position lastStart = 0; CharacterSet setWord(CharacterSet::setAlphaNum, "_", 0x80, true); - 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; diff --git a/lexers/LexPerl.cxx b/lexers/LexPerl.cxx index c81dc2663..df6cc9d3e 100644 --- a/lexers/LexPerl.cxx +++ b/lexers/LexPerl.cxx @@ -69,19 +69,19 @@ using namespace Scintilla; // we also assume SCE_PL_STRING_VAR is the interpolated style with the smallest value #define INTERPOLATE_SHIFT (SCE_PL_STRING_VAR - SCE_PL_STRING) -static bool isPerlKeyword(unsigned int start, unsigned int end, WordList &keywords, LexAccessor &styler) { +static bool isPerlKeyword(Sci_PositionU start, Sci_PositionU end, WordList &keywords, LexAccessor &styler) { // old-style keyword matcher; needed because GetCurrent() needs // current segment to be committed, but we may abandon early... char s[100]; - unsigned int i, len = end - start; + Sci_PositionU i, len = end - start; if (len > 30) { len = 30; } for (i = 0; i < len; i++, start++) s[i] = styler[start]; s[i] = '\0'; return keywords.InList(s); } -static int disambiguateBareword(LexAccessor &styler, unsigned int bk, unsigned int fw, - int backFlag, unsigned int backPos, unsigned int endPos) { +static int disambiguateBareword(LexAccessor &styler, Sci_PositionU bk, Sci_PositionU fw, + int backFlag, Sci_PositionU backPos, Sci_PositionU endPos) { // identifiers are recognized by Perl as barewords under some // conditions, the following attempts to do the disambiguation // by looking backward and forward; result in 2 LSB @@ -93,7 +93,7 @@ static int disambiguateBareword(LexAccessor &styler, unsigned int bk, unsigned i return result; // first look backwards past whitespace/comments to set EOL flag // (some disambiguation patterns must be on a single line) - if (backPos <= static_cast<unsigned int>(styler.LineStart(styler.GetLine(bk)))) + if (backPos <= static_cast<Sci_PositionU>(styler.LineStart(styler.GetLine(bk)))) moreback = true; // look backwards at last significant lexed item for disambiguation bk = backPos - 1; @@ -128,7 +128,7 @@ static int disambiguateBareword(LexAccessor &styler, unsigned int bk, unsigned i return result; } -static void skipWhitespaceComment(LexAccessor &styler, unsigned int &p) { +static void skipWhitespaceComment(LexAccessor &styler, Sci_PositionU &p) { // when backtracking, we need to skip whitespace and comments int style; while ((p > 0) && (style = styler.StyleAt(p), @@ -136,7 +136,7 @@ static void skipWhitespaceComment(LexAccessor &styler, unsigned int &p) { p--; } -static int styleBeforeBracePair(LexAccessor &styler, unsigned int bk) { +static int styleBeforeBracePair(LexAccessor &styler, Sci_PositionU bk) { // backtrack to find open '{' corresponding to a '}', balanced // return significant style to be tested for '/' disambiguation int braceCount = 1; @@ -163,7 +163,7 @@ static int styleBeforeBracePair(LexAccessor &styler, unsigned int bk) { return SCE_PL_DEFAULT; } -static int styleCheckIdentifier(LexAccessor &styler, unsigned int bk) { +static int styleCheckIdentifier(LexAccessor &styler, Sci_PositionU bk) { // backtrack to classify sub-styles of identifier under test // return sub-style to be tested for '/' disambiguation if (styler.SafeGetCharAt(bk) == '>') // inputsymbol, like <foo> @@ -188,7 +188,7 @@ static int styleCheckIdentifier(LexAccessor &styler, unsigned int bk) { return 0; } -static int podLineScan(LexAccessor &styler, unsigned int &pos, unsigned int endPos) { +static int podLineScan(LexAccessor &styler, Sci_PositionU &pos, Sci_PositionU endPos) { // forward scan the current line to classify line for POD style int state = -1; while (pos < endPos) { @@ -212,7 +212,7 @@ static int podLineScan(LexAccessor &styler, unsigned int &pos, unsigned int endP return state; } -static bool styleCheckSubPrototype(LexAccessor &styler, unsigned int bk) { +static bool styleCheckSubPrototype(LexAccessor &styler, Sci_PositionU bk) { // backtrack to identify if we're starting a subroutine prototype // we also need to ignore whitespace/comments: // 'sub' [whitespace|comment] <identifier> [whitespace|comment] @@ -247,10 +247,10 @@ static int opposite(int ch) { return ch; } -static bool IsCommentLine(int line, LexAccessor &styler) { - int pos = styler.LineStart(line); - int eol_pos = styler.LineStart(line + 1) - 1; - for (int i = pos; i < eol_pos; i++) { +static bool IsCommentLine(Sci_Position line, LexAccessor &styler) { + Sci_Position pos = styler.LineStart(line); + Sci_Position eol_pos = styler.LineStart(line + 1) - 1; + for (Sci_Position i = pos; i < eol_pos; i++) { char ch = styler[i]; int style = styler.StyleAt(i); if (ch == '#' && style == SCE_PL_COMMENTLINE) @@ -261,8 +261,8 @@ static bool IsCommentLine(int line, LexAccessor &styler) { return false; } -static bool IsPackageLine(int line, LexAccessor &styler) { - int pos = styler.LineStart(line); +static bool IsPackageLine(Sci_Position line, LexAccessor &styler) { + Sci_Position pos = styler.LineStart(line); int style = styler.StyleAt(pos); if (style == SCE_PL_WORD && styler.Match(pos, "package")) { return true; @@ -270,7 +270,7 @@ static bool IsPackageLine(int line, LexAccessor &styler) { return false; } -static int PodHeadingLevel(int pos, LexAccessor &styler) { +static int PodHeadingLevel(Sci_Position pos, LexAccessor &styler) { int lvl = static_cast<unsigned char>(styler.SafeGetCharAt(pos + 5)); if (lvl >= '1' && lvl <= '4') { return lvl - '0'; @@ -400,7 +400,7 @@ Sci_Position SCI_METHOD LexerPerl::WordListSet(int n, const char *wl) { wordListN = &keywords; break; } - int firstModification = -1; + Sci_Position firstModification = -1; if (wordListN) { WordList wlNew; wlNew.Set(wl); @@ -600,7 +600,7 @@ void SCI_METHOD LexerPerl::Lex(Sci_PositionU startPos, Sci_Position length, int int numState = PERLNUM_DECIMAL; int dotCount = 0; - unsigned int endPos = startPos + length; + Sci_PositionU endPos = startPos + length; // Backtrack to beginning of style if required... // If in a long distance lexical state, backtrack to find quote characters. @@ -663,7 +663,7 @@ void SCI_METHOD LexerPerl::Lex(Sci_PositionU startPos, Sci_Position length, int || initStyle == SCE_PL_POD_VERB ) { // POD backtracking finds preceding blank lines and goes back past them - int ln = styler.GetLine(startPos); + Sci_Position ln = styler.GetLine(startPos); if (ln > 0) { initStyle = styler.StyleAt(styler.LineStart(--ln)); if (initStyle == SCE_PL_POD || initStyle == SCE_PL_POD_VERB) { @@ -682,7 +682,7 @@ void SCI_METHOD LexerPerl::Lex(Sci_PositionU startPos, Sci_Position length, int // Look backwards past whitespace and comments in order to detect either // operator or keyword. Later updated as we go along. int backFlag = BACK_NONE; - unsigned int backPos = startPos; + Sci_PositionU backPos = startPos; if (backPos > 0) { backPos--; skipWhitespaceComment(styler, backPos); @@ -814,7 +814,7 @@ void SCI_METHOD LexerPerl::Lex(Sci_PositionU startPos, Sci_Position length, int case SCE_PL_HERE_DELIM: if (HereDoc.State == 0) { // '<<' encountered int delim_ch = sc.chNext; - int ws_skip = 0; + Sci_Position ws_skip = 0; HereDoc.State = 1; // pre-init HERE doc class HereDoc.Quote = sc.chNext; HereDoc.Quoted = false; @@ -822,7 +822,7 @@ void SCI_METHOD LexerPerl::Lex(Sci_PositionU startPos, Sci_Position length, int HereDoc.Delimiter[HereDoc.DelimiterLength] = '\0'; if (IsASpaceOrTab(delim_ch)) { // skip whitespace; legal only for quoted delimiters - unsigned int i = sc.currentPos + 1; + Sci_PositionU i = sc.currentPos + 1; while ((i < endPos) && IsASpaceOrTab(delim_ch)) { i++; delim_ch = static_cast<unsigned char>(styler.SafeGetCharAt(i)); @@ -929,8 +929,8 @@ void SCI_METHOD LexerPerl::Lex(Sci_PositionU startPos, Sci_Position length, int break; case SCE_PL_POD: case SCE_PL_POD_VERB: { - unsigned int fw = sc.currentPos; - int ln = styler.GetLine(fw); + Sci_PositionU fw = sc.currentPos; + Sci_Position ln = styler.GetLine(fw); if (sc.atLineStart && sc.Match("=cut")) { // end of POD sc.SetState(SCE_PL_POD); sc.Forward(4); @@ -942,7 +942,7 @@ void SCI_METHOD LexerPerl::Lex(Sci_PositionU startPos, Sci_Position length, int styler.SetLineState(ln, pod); if (pod == SCE_PL_DEFAULT) { if (sc.state == SCE_PL_POD_VERB) { - unsigned int fw2 = fw; + Sci_PositionU fw2 = fw; while (fw2 < (endPos - 1) && pod == SCE_PL_DEFAULT) { fw = fw2++; // penultimate line (last blank line) pod = podLineScan(styler, fw2, endPos); @@ -1234,8 +1234,8 @@ void SCI_METHOD LexerPerl::Lex(Sci_PositionU startPos, Sci_Position length, int if (sc.chPrev == ':' && sc.GetRelative(-2) == ':') { sc.ChangeState(SCE_PL_IDENTIFIER); } - unsigned int bk = sc.currentPos; - unsigned int fw = sc.currentPos + 1; + Sci_PositionU bk = sc.currentPos; + Sci_PositionU fw = sc.currentPos + 1; // first check for possible quote-like delimiter if (sc.ch == 's' && !setWord.Contains(sc.chNext)) { sc.ChangeState(SCE_PL_REGSUBST); @@ -1341,7 +1341,7 @@ void SCI_METHOD LexerPerl::Lex(Sci_PositionU startPos, Sci_Position length, int bool preferRE = false; bool isHereDoc = sc.Match('<', '<'); bool hereDocSpace = false; // for: SCALAR [whitespace] '<<' - unsigned int bk = (sc.currentPos > 0) ? sc.currentPos - 1: 0; + Sci_PositionU bk = (sc.currentPos > 0) ? sc.currentPos - 1: 0; sc.Complete(); styler.Flush(); if (styler.StyleAt(bk) == SCE_PL_DEFAULT) @@ -1410,7 +1410,7 @@ void SCI_METHOD LexerPerl::Lex(Sci_PositionU startPos, Sci_Position length, int // keywords always forced as /PATTERN/: split, if, elsif, while // everything else /PATTERN/ unless digit/space immediately after '/' // for '//', defined-or favoured unless special keywords - unsigned int bkend = bk + 1; + Sci_PositionU bkend = bk + 1; while (bk > 0 && styler.StyleAt(bk - 1) == SCE_PL_WORD) { bk--; } @@ -1506,8 +1506,8 @@ void SCI_METHOD LexerPerl::Lex(Sci_PositionU startPos, Sci_Position length, int sc.SetState(SCE_PL_POD); backFlag = BACK_NONE; } else if (sc.ch == '-' && setWordStart.Contains(sc.chNext)) { // extended '-' cases - unsigned int bk = sc.currentPos; - unsigned int fw = 2; + Sci_PositionU bk = sc.currentPos; + Sci_PositionU fw = 2; if (setSingleCharOp.Contains(sc.chNext) && // file test operators !setWord.Contains(sc.GetRelative(2))) { sc.SetState(SCE_PL_WORD); @@ -1564,9 +1564,9 @@ void SCI_METHOD LexerPerl::Fold(Sci_PositionU startPos, Sci_Position length, int LexAccessor styler(pAccess); - unsigned int endPos = startPos + length; + Sci_PositionU endPos = startPos + length; int visibleChars = 0; - int lineCurrent = styler.GetLine(startPos); + Sci_Position lineCurrent = styler.GetLine(startPos); // Backtrack to previous line in case need to fix its fold status if (startPos > 0) { @@ -1586,7 +1586,7 @@ void SCI_METHOD LexerPerl::Fold(Sci_PositionU startPos, Sci_Position length, int // Used at end of line to determine if the line was a package definition bool isPackageLine = false; int podHeading = 0; - 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 style = styleNext; diff --git a/lexers/LexPowerPro.cxx b/lexers/LexPowerPro.cxx index 3e2a1be79..7120c4003 100644 --- a/lexers/LexPowerPro.cxx +++ b/lexers/LexPowerPro.cxx @@ -57,10 +57,10 @@ static inline bool IsLineEndChar(unsigned char ch) { || ch == 0x0d; //CR } -static bool IsContinuationLine(unsigned int szLine, Accessor &styler) +static bool IsContinuationLine(Sci_PositionU szLine, Accessor &styler) { - int startPos = styler.LineStart(szLine); - int endPos = styler.LineStart(szLine + 1) - 2; + Sci_Position startPos = styler.LineStart(szLine); + Sci_Position endPos = styler.LineStart(szLine + 1) - 2; while (startPos < endPos) { char stylech = styler.StyleAt(startPos); @@ -78,10 +78,10 @@ static bool IsContinuationLine(unsigned int szLine, Accessor &styler) // Routine to find first none space on the current line and return its Style // needed for comment lines not starting on pos 1 -static int GetStyleFirstWord(int szLine, Accessor &styler) +static int GetStyleFirstWord(Sci_Position szLine, Accessor &styler) { - int startPos = styler.LineStart(szLine); - int endPos = styler.LineStart(szLine + 1) - 1; + Sci_Position startPos = styler.LineStart(szLine); + Sci_Position endPos = styler.LineStart(szLine + 1) - 1; char ch = styler.SafeGetCharAt(startPos); while (ch > 0 && isspacechar(ch) && startPos < endPos) @@ -97,15 +97,15 @@ static int GetStyleFirstWord(int szLine, Accessor &styler) //note: // sample line (without quotes): "\tfunction asdf() // currentPos will be the position of 'a' -static bool IsFunction(Accessor &styler, unsigned int currentPos) { +static bool IsFunction(Accessor &styler, Sci_PositionU currentPos) { const char function[10] = "function "; //10 includes \0 unsigned int numberOfCharacters = sizeof(function) - 1; - unsigned int position = currentPos - numberOfCharacters; + Sci_PositionU position = currentPos - numberOfCharacters; //compare each character with the letters in the function array //return false if ALL don't match - for (unsigned int i = 0; i < numberOfCharacters; i++) { + for (Sci_PositionU i = 0; i < numberOfCharacters; i++) { char c = styler.SafeGetCharAt(position++); if (c != function[i]) return false; @@ -114,7 +114,7 @@ static bool IsFunction(Accessor &styler, unsigned int currentPos) { //make sure that there are only spaces (or tabs) between the beginning //of the line and the function declaration position = currentPos - numberOfCharacters - 1; //-1 to move to char before 'function' - for (unsigned int j = 0; j < 16; j++) { //check up to 16 preceeding characters + for (Sci_PositionU j = 0; j < 16; j++) { //check up to 16 preceeding characters char c = styler.SafeGetCharAt(position--, '\0'); //if can't read char, return NUL (past beginning of document) if (c <= 0) //reached beginning of document return true; @@ -369,8 +369,8 @@ static void FoldPowerProDoc(Sci_PositionU startPos, Sci_Position length, int, Wo //used to tell if we're recursively folding the whole document, or just a small piece (ie: if statement or 1 function) bool isFoldingAll = true; - int endPos = startPos + length; - int lastLine = styler.GetLine(styler.Length()); //used to help fold the last line correctly + Sci_Position endPos = startPos + length; + Sci_Position lastLine = styler.GetLine(styler.Length()); //used to help fold the last line correctly // get settings from the config files for folding comments and preprocessor lines bool foldComment = styler.GetPropertyInt("fold.comment") != 0; @@ -378,7 +378,7 @@ static void FoldPowerProDoc(Sci_PositionU startPos, Sci_Position length, int, Wo bool foldCompact = true; // Backtrack to previous line in case need to fix its fold status - int lineCurrent = styler.GetLine(startPos); + Sci_Position lineCurrent = styler.GetLine(startPos); if (startPos > 0) { isFoldingAll = false; if (lineCurrent > 0) { @@ -427,7 +427,7 @@ static void FoldPowerProDoc(Sci_PositionU startPos, Sci_Position length, int, Wo char chPrevPrev = '\0'; char chPrevPrevPrev = '\0'; - for (int i = startPos; i < endPos; i++) { + for (Sci_Position i = startPos; i < endPos; i++) { char ch = chNext; chNext = styler.SafeGetCharAt(i + 1); diff --git a/lexers/LexPowerShell.cxx b/lexers/LexPowerShell.cxx index 7e8c8f1af..00d79db83 100644 --- a/lexers/LexPowerShell.cxx +++ b/lexers/LexPowerShell.cxx @@ -163,9 +163,9 @@ static void FoldPowerShellDoc(Sci_PositionU startPos, Sci_Position length, int i bool foldComment = styler.GetPropertyInt("fold.comment") != 0; bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0; bool foldAtElse = styler.GetPropertyInt("fold.at.else", 0) != 0; - unsigned int endPos = startPos + length; + Sci_PositionU endPos = startPos + length; int visibleChars = 0; - int lineCurrent = styler.GetLine(startPos); + Sci_Position lineCurrent = styler.GetLine(startPos); int levelCurrent = SC_FOLDLEVELBASE; if (lineCurrent > 0) levelCurrent = styler.LevelAt(lineCurrent-1) >> 16; @@ -174,7 +174,7 @@ static void FoldPowerShellDoc(Sci_PositionU startPos, Sci_Position length, int i char chNext = styler[startPos]; int styleNext = styler.StyleAt(startPos); int style = initStyle; - 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; @@ -200,7 +200,7 @@ static void FoldPowerShellDoc(Sci_PositionU startPos, Sci_Position length, int i } } else if (foldComment && style == SCE_POWERSHELL_COMMENT) { if (ch == '#') { - unsigned int j = i + 1; + Sci_PositionU j = i + 1; while ((j < endPos) && IsASpaceOrTab(styler.SafeGetCharAt(j))) { j++; } diff --git a/lexers/LexProgress.cxx b/lexers/LexProgress.cxx index acbdaafe3..844b635ae 100644 --- a/lexers/LexProgress.cxx +++ b/lexers/LexProgress.cxx @@ -210,9 +210,9 @@ static void FoldNoBox4glDoc(Sci_PositionU startPos, Sci_Position length, int ini bool foldComment = styler.GetPropertyInt("fold.comment") != 0; bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0; bool foldAtElse = styler.GetPropertyInt("fold.at.else", 0) != 0; - unsigned int endPos = startPos + length; + Sci_PositionU endPos = startPos + length; int visibleChars = 0; - int lineCurrent = styler.GetLine(startPos); + Sci_Position lineCurrent = styler.GetLine(startPos); int levelCurrent = SC_FOLDLEVELBASE; if (lineCurrent > 0) levelCurrent = styler.LevelAt(lineCurrent-1) >> 16; @@ -221,7 +221,7 @@ static void FoldNoBox4glDoc(Sci_PositionU startPos, Sci_Position length, int ini char chNext = static_cast<char>(tolower(styler[startPos])); int styleNext = styler.StyleAt(startPos); int style = initStyle; - for (unsigned int i = startPos; i < endPos; i++) { + for (Sci_PositionU i = startPos; i < endPos; i++) { char ch = chNext; chNext = static_cast<char>(tolower(styler.SafeGetCharAt(i + 1))); int stylePrev = style; diff --git a/lexers/LexProps.cxx b/lexers/LexProps.cxx index c676449c4..45af72928 100644 --- a/lexers/LexProps.cxx +++ b/lexers/LexProps.cxx @@ -27,7 +27,7 @@ using namespace Scintilla; #endif -static inline bool AtEOL(Accessor &styler, unsigned int i) { +static inline bool AtEOL(Accessor &styler, Sci_PositionU i) { return (styler[i] == '\n') || ((styler[i] == '\r') && (styler.SafeGetCharAt(i + 1) != '\n')); } @@ -38,13 +38,13 @@ static inline bool isassignchar(unsigned char ch) { static void ColourisePropsLine( char *lineBuffer, - unsigned int lengthLine, - unsigned int startLine, - unsigned int endPos, + Sci_PositionU lengthLine, + Sci_PositionU startLine, + Sci_PositionU endPos, Accessor &styler, bool allowInitialSpaces) { - unsigned int i = 0; + Sci_PositionU i = 0; if (allowInitialSpaces) { while ((i < lengthLine) && isspacechar(lineBuffer[i])) // Skip initial spaces i++; @@ -84,8 +84,8 @@ static void ColourisePropsDoc(Sci_PositionU startPos, Sci_Position length, int, char lineBuffer[1024]; styler.StartAt(startPos); styler.StartSegment(startPos); - unsigned int linePos = 0; - unsigned int startLine = startPos; + Sci_PositionU linePos = 0; + Sci_PositionU startLine = startPos; // property lexer.props.allow.initial.spaces // For properties files, set to 0 to style all lines that start with whitespace in the default style. @@ -93,7 +93,7 @@ static void ColourisePropsDoc(Sci_PositionU startPos, Sci_Position length, int, // can be used for RFC2822 text where indentation is used for continuation lines. bool allowInitialSpaces = styler.GetPropertyInt("lexer.props.allow.initial.spaces", 1) != 0; - for (unsigned int i = startPos; i < startPos + length; i++) { + for (Sci_PositionU i = startPos; i < startPos + length; i++) { lineBuffer[linePos++] = styler[i]; if (AtEOL(styler, i) || (linePos >= sizeof(lineBuffer) - 1)) { // End of line (or of line buffer) met, colourise it @@ -113,16 +113,16 @@ static void ColourisePropsDoc(Sci_PositionU startPos, Sci_Position length, int, static void FoldPropsDoc(Sci_PositionU startPos, Sci_Position length, int, WordList *[], Accessor &styler) { bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0; - unsigned int endPos = startPos + length; + Sci_PositionU endPos = startPos + length; int visibleChars = 0; - int lineCurrent = styler.GetLine(startPos); + Sci_Position lineCurrent = styler.GetLine(startPos); char chNext = styler[startPos]; int styleNext = styler.StyleAt(startPos); bool headerPoint = false; int lev; - for (unsigned int i = startPos; i < endPos; i++) { + for (Sci_PositionU i = startPos; i < endPos; i++) { char ch = chNext; chNext = styler[i+1]; diff --git a/lexers/LexPython.cxx b/lexers/LexPython.cxx index 7e1604e79..7cd3bc8de 100644 --- a/lexers/LexPython.cxx +++ b/lexers/LexPython.cxx @@ -69,7 +69,7 @@ bool IsPyStringStart(int ch, int chNext, int chNext2, literalsAllowed allowed) { } /* Return the state to use for the string starting at i; *nextIndex will be set to the first index following the quote(s) */ -int GetPyStringState(Accessor &styler, int i, unsigned int *nextIndex, literalsAllowed allowed) { +int GetPyStringState(Accessor &styler, Sci_Position i, Sci_PositionU *nextIndex, literalsAllowed allowed) { char ch = styler.SafeGetCharAt(i); char chNext = styler.SafeGetCharAt(i + 1); @@ -292,7 +292,7 @@ Sci_Position SCI_METHOD LexerPython::WordListSet(int n, const char *wl) { wordListN = &keywords2; break; } - int firstModification = -1; + Sci_Position firstModification = -1; if (wordListN) { WordList wlNew; wlNew.Set(wl); @@ -307,16 +307,16 @@ Sci_Position SCI_METHOD LexerPython::WordListSet(int n, const char *wl) { void SCI_METHOD LexerPython::Lex(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess) { Accessor styler(pAccess, NULL); - const int endPos = startPos + length; + const Sci_Position endPos = startPos + length; // Backtrack to previous line in case need to fix its tab whinging - int lineCurrent = styler.GetLine(startPos); + Sci_Position lineCurrent = styler.GetLine(startPos); if (startPos > 0) { if (lineCurrent > 0) { lineCurrent--; // Look for backslash-continued lines while (lineCurrent > 0) { - int eolPos = styler.LineStart(lineCurrent) - 1; + Sci_Position eolPos = styler.LineStart(lineCurrent) - 1; int eolStyle = styler.StyleAt(eolPos); if (eolStyle == SCE_P_STRING || eolStyle == SCE_P_CHARACTER @@ -348,7 +348,7 @@ void SCI_METHOD LexerPython::Lex(Sci_PositionU startPos, Sci_Position length, in StyleContext sc(startPos, endPos - startPos, initStyle, styler); bool indentGood = true; - int startIndicator = sc.currentPos; + Sci_Position startIndicator = sc.currentPos; bool inContinuedString = false; for (; sc.More(); sc.Forward()) { @@ -417,7 +417,7 @@ void SCI_METHOD LexerPython::Lex(Sci_PositionU startPos, Sci_Position length, in } else if (kwLast == kwDef) { style = SCE_P_DEFNAME; } else if (kwLast == kwCDef || kwLast == kwCPDef) { - int pos = sc.currentPos; + Sci_Position pos = sc.currentPos; unsigned char ch = styler.SafeGetCharAt(pos, '\0'); while (ch != '\0') { if (ch == '(') { @@ -438,7 +438,7 @@ void SCI_METHOD LexerPython::Lex(Sci_PositionU startPos, Sci_Position length, in // We don't want to highlight keywords2 // that are used as a sub-identifier, // i.e. not open in "foo.open". - int pos = styler.GetStartSegment() - 1; + Sci_Position pos = styler.GetStartSegment() - 1; if (pos < 0 || (styler.SafeGetCharAt(pos, '\0') != '.')) style = SCE_P_WORD2; } else { @@ -562,7 +562,7 @@ void SCI_METHOD LexerPython::Lex(Sci_PositionU startPos, Sci_Position length, in } else if (sc.ch == '@') { sc.SetState(SCE_P_DECORATOR); } else if (IsPyStringStart(sc.ch, sc.chNext, sc.GetRelative(2), allowedLiterals)) { - unsigned int nextIndex = 0; + Sci_PositionU nextIndex = 0; sc.SetState(GetPyStringState(styler, sc.currentPos, &nextIndex, allowedLiterals)); while (nextIndex > (sc.currentPos + 1) && sc.More()) { sc.Forward(); @@ -576,10 +576,10 @@ void SCI_METHOD LexerPython::Lex(Sci_PositionU startPos, Sci_Position length, in sc.Complete(); } -static bool IsCommentLine(int line, Accessor &styler) { - int pos = styler.LineStart(line); - int eol_pos = styler.LineStart(line + 1) - 1; - for (int i = pos; i < eol_pos; i++) { +static bool IsCommentLine(Sci_Position line, Accessor &styler) { + Sci_Position pos = styler.LineStart(line); + Sci_Position eol_pos = styler.LineStart(line + 1) - 1; + for (Sci_Position i = pos; i < eol_pos; i++) { char ch = styler[i]; if (ch == '#') return true; @@ -589,7 +589,7 @@ static bool IsCommentLine(int line, Accessor &styler) { return false; } -static bool IsQuoteLine(int line, Accessor &styler) { +static bool IsQuoteLine(Sci_Position line, Accessor &styler) { int style = styler.StyleAt(styler.LineStart(line)) & 31; return ((style == SCE_P_TRIPLE) || (style == SCE_P_TRIPLEDOUBLE)); } @@ -601,16 +601,16 @@ void SCI_METHOD LexerPython::Fold(Sci_PositionU startPos, Sci_Position length, i Accessor styler(pAccess, NULL); - const int maxPos = startPos + length; - const int maxLines = (maxPos == styler.Length()) ? styler.GetLine(maxPos) : styler.GetLine(maxPos - 1); // Requested last line - const int docLines = styler.GetLine(styler.Length()); // Available last line + const Sci_Position maxPos = startPos + length; + const Sci_Position maxLines = (maxPos == styler.Length()) ? styler.GetLine(maxPos) : styler.GetLine(maxPos - 1); // Requested last line + const Sci_Position docLines = styler.GetLine(styler.Length()); // Available last line // Backtrack to previous non-blank line so we can determine indent level // for any white space lines (needed esp. within triple quoted strings) // and so we can fix any preceding fold level (which is why we go back // at least one line in all cases) int spaceFlags = 0; - int lineCurrent = styler.GetLine(startPos); + Sci_Position lineCurrent = styler.GetLine(startPos); int indentCurrent = styler.IndentAmount(lineCurrent, &spaceFlags, NULL); while (lineCurrent > 0) { lineCurrent--; @@ -636,13 +636,13 @@ void SCI_METHOD LexerPython::Fold(Sci_PositionU startPos, Sci_Position length, i // Gather info int lev = indentCurrent; - int lineNext = lineCurrent + 1; + Sci_Position lineNext = lineCurrent + 1; int indentNext = indentCurrent; int quote = false; if (lineNext <= docLines) { // Information about next line is only available if not at end of document indentNext = styler.IndentAmount(lineNext, &spaceFlags, NULL); - int lookAtPos = (styler.LineStart(lineNext) == styler.Length()) ? styler.Length() - 1 : styler.LineStart(lineNext); + Sci_Position lookAtPos = (styler.LineStart(lineNext) == styler.Length()) ? styler.Length() - 1 : styler.LineStart(lineNext); int style = styler.StyleAt(lookAtPos) & 31; quote = options.foldQuotes && ((style == SCE_P_TRIPLE) || (style == SCE_P_TRIPLEDOUBLE)); } @@ -685,7 +685,7 @@ void SCI_METHOD LexerPython::Fold(Sci_PositionU startPos, Sci_Position length, i // which is indented more than the line after the end of // the comment-block, use the level of the block before - int skipLine = lineNext; + Sci_Position skipLine = lineNext; int skipLevel = levelAfterComments; while (--skipLine > lineCurrent) { diff --git a/lexers/LexR.cxx b/lexers/LexR.cxx index 7f0442660..c72937bbb 100644 --- a/lexers/LexR.cxx +++ b/lexers/LexR.cxx @@ -150,9 +150,9 @@ static void FoldRDoc(Sci_PositionU startPos, Sci_Position length, int, WordList Accessor &styler) { bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0; bool foldAtElse = styler.GetPropertyInt("fold.at.else", 0) != 0; - unsigned int endPos = startPos + length; + Sci_PositionU endPos = startPos + length; int visibleChars = 0; - int lineCurrent = styler.GetLine(startPos); + Sci_Position lineCurrent = styler.GetLine(startPos); int levelCurrent = SC_FOLDLEVELBASE; if (lineCurrent > 0) levelCurrent = styler.LevelAt(lineCurrent-1) >> 16; @@ -160,7 +160,7 @@ static void FoldRDoc(Sci_PositionU startPos, Sci_Position length, int, WordList int levelNext = levelCurrent; char chNext = styler[startPos]; int styleNext = styler.StyleAt(startPos); - 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 style = styleNext; diff --git a/lexers/LexRebol.cxx b/lexers/LexRebol.cxx index e048a8304..bce93dfc8 100644 --- a/lexers/LexRebol.cxx +++ b/lexers/LexRebol.cxx @@ -79,7 +79,7 @@ static void ColouriseRebolDoc(Sci_PositionU startPos, Sci_Position length, int i WordList &keywords7 = *keywordlists[6]; WordList &keywords8 = *keywordlists[7]; - int currentLine = styler.GetLine(startPos); + Sci_Position currentLine = styler.GetLine(startPos); // Initialize the braced string {.. { ... } ..} nesting level, if we are inside such a string. int stringLevel = 0; if (initStyle == SCE_REBOL_BRACEDSTRING || initStyle == SCE_REBOL_COMMENTBLOCK) { @@ -275,14 +275,14 @@ static void ColouriseRebolDoc(Sci_PositionU startPos, Sci_Position length, int i static void FoldRebolDoc(Sci_PositionU startPos, Sci_Position length, int /* initStyle */, WordList *[], Accessor &styler) { - unsigned int lengthDoc = startPos + length; + Sci_PositionU lengthDoc = startPos + length; int visibleChars = 0; - int lineCurrent = styler.GetLine(startPos); + Sci_Position lineCurrent = styler.GetLine(startPos); int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK; int levelCurrent = levelPrev; char chNext = styler[startPos]; int styleNext = styler.StyleAt(startPos); - for (unsigned int i = startPos; i < lengthDoc; i++) { + for (Sci_PositionU i = startPos; i < lengthDoc; i++) { char ch = chNext; chNext = styler.SafeGetCharAt(i + 1); int style = styleNext; diff --git a/lexers/LexRegistry.cxx b/lexers/LexRegistry.cxx index 22fdd111e..8fa99434f 100644 --- a/lexers/LexRegistry.cxx +++ b/lexers/LexRegistry.cxx @@ -65,8 +65,8 @@ class LexerRegistry : public ILexer { return (state == SCE_REG_ADDEDKEY || state == SCE_REG_DELETEDKEY); } - static bool AtValueType(LexAccessor &styler, int start) { - int i = 0; + static bool AtValueType(LexAccessor &styler, Sci_Position start) { + Sci_Position i = 0; while (i < 10) { i++; char curr = styler.SafeGetCharAt(start+i, '\0'); @@ -79,8 +79,8 @@ class LexerRegistry : public ILexer { return false; } - static bool IsNextNonWhitespace(LexAccessor &styler, int start, char ch) { - int i = 0; + static bool IsNextNonWhitespace(LexAccessor &styler, Sci_Position start, char ch) { + Sci_Position i = 0; while (i < 100) { i++; char curr = styler.SafeGetCharAt(start+i, '\0'); @@ -96,9 +96,9 @@ class LexerRegistry : public ILexer { } // Looks for the equal sign at the end of the string - static bool AtValueName(LexAccessor &styler, int start) { + static bool AtValueName(LexAccessor &styler, Sci_Position start) { bool atEOL = false; - int i = 0; + Sci_Position i = 0; bool escaped = false; while (!atEOL) { i++; @@ -119,9 +119,9 @@ class LexerRegistry : public ILexer { return false; } - static bool AtKeyPathEnd(LexAccessor &styler, int start) { + static bool AtKeyPathEnd(LexAccessor &styler, Sci_Position start) { bool atEOL = false; - int i = 0; + Sci_Position i = 0; while (!atEOL) { i++; char curr = styler.SafeGetCharAt(start+i, '\0'); @@ -135,7 +135,7 @@ class LexerRegistry : public ILexer { return true; } - static bool AtGUID(LexAccessor &styler, int start) { + static bool AtGUID(LexAccessor &styler, Sci_Position start) { int count = 8; int portion = 0; int offset = 1; @@ -220,7 +220,7 @@ void SCI_METHOD LexerRegistry::Lex(Sci_PositionU startPos, bool afterEqualSign = false; while (context.More()) { if (context.atLineStart) { - int currPos = static_cast<int>(context.currentPos); + Sci_Position currPos = static_cast<Sci_Position>(context.currentPos); bool continued = styler[currPos-3] == '\\'; highlight = continued ? true : false; } @@ -232,7 +232,7 @@ void SCI_METHOD LexerRegistry::Lex(Sci_PositionU startPos, break; case SCE_REG_VALUENAME: case SCE_REG_STRING: { - int currPos = static_cast<int>(context.currentPos); + Sci_Position currPos = static_cast<Sci_Position>(context.currentPos); if (context.ch == '"') { context.ForwardSetState(SCE_REG_DEFAULT); } else if (context.ch == '\\') { @@ -270,7 +270,7 @@ void SCI_METHOD LexerRegistry::Lex(Sci_PositionU startPos, break; case SCE_REG_DELETEDKEY: case SCE_REG_ADDEDKEY: { - int currPos = static_cast<int>(context.currentPos); + Sci_Position currPos = static_cast<Sci_Position>(context.currentPos); if (context.ch == ']' && AtKeyPathEnd(styler, currPos)) { context.ForwardSetState(SCE_REG_DEFAULT); } else if (context.ch == '{') { @@ -298,7 +298,7 @@ void SCI_METHOD LexerRegistry::Lex(Sci_PositionU startPos, context.ForwardSetState(beforeGUID); beforeGUID = SCE_REG_DEFAULT; } - int currPos = static_cast<int>(context.currentPos); + Sci_Position currPos = static_cast<Sci_Position>(context.currentPos); if (context.ch == '"' && IsStringState(context.state)) { context.ForwardSetState(SCE_REG_DEFAULT); } else if (context.ch == ']' && @@ -315,7 +315,7 @@ void SCI_METHOD LexerRegistry::Lex(Sci_PositionU startPos, } // Determine if a new state should be entered. if (context.state == SCE_REG_DEFAULT) { - int currPos = static_cast<int>(context.currentPos); + Sci_Position currPos = static_cast<Sci_Position>(context.currentPos); if (context.ch == ';') { context.SetState(SCE_REG_COMMENT); } else if (context.ch == '"') { @@ -360,11 +360,11 @@ void SCI_METHOD LexerRegistry::Fold(Sci_PositionU startPos, return; } LexAccessor styler(pAccess); - int currLine = styler.GetLine(startPos); + Sci_Position currLine = styler.GetLine(startPos); int visibleChars = 0; - unsigned endPos = startPos + length; + Sci_PositionU endPos = startPos + length; bool atKeyPath = false; - for (unsigned i = startPos; i < endPos; i++) { + for (Sci_PositionU i = startPos; i < endPos; i++) { atKeyPath = IsKeyPathState(styler.StyleAt(i)) ? true : atKeyPath; char curr = styler.SafeGetCharAt(i); char next = styler.SafeGetCharAt(i+1); diff --git a/lexers/LexRuby.cxx b/lexers/LexRuby.cxx index c06915144..be60f8041 100644 --- a/lexers/LexRuby.cxx +++ b/lexers/LexRuby.cxx @@ -68,7 +68,7 @@ static bool inline iswhitespace(char ch) { #define STYLE_MASK 63 #define actual_style(style) (style & STYLE_MASK) -static bool followsDot(unsigned int pos, Accessor &styler) { +static bool followsDot(Sci_PositionU pos, Accessor &styler) { styler.Flush(); for (; pos >= 1; --pos) { int style = actual_style(styler.StyleAt(pos)); @@ -95,16 +95,16 @@ static bool followsDot(unsigned int pos, Accessor &styler) { // Forward declarations static bool keywordIsAmbiguous(const char *prevWord); -static bool keywordDoStartsLoop(int pos, +static bool keywordDoStartsLoop(Sci_Position pos, Accessor &styler); static bool keywordIsModifier(const char *word, - int pos, + Sci_Position pos, Accessor &styler); -static int ClassifyWordRb(unsigned int start, unsigned int end, WordList &keywords, Accessor &styler, char *prevWord) { +static int ClassifyWordRb(Sci_PositionU start, Sci_PositionU end, WordList &keywords, Accessor &styler, char *prevWord) { char s[MAX_KEYWORD_LENGTH]; - unsigned int i, j; - unsigned int lim = end - start + 1; // num chars to copy + Sci_PositionU i, j; + Sci_PositionU lim = end - start + 1; // num chars to copy if (lim >= MAX_KEYWORD_LENGTH) { lim = MAX_KEYWORD_LENGTH - 1; } @@ -149,7 +149,7 @@ static int ClassifyWordRb(unsigned int start, unsigned int end, WordList &keywor //XXX Identical to Perl, put in common area -static bool isMatch(Accessor &styler, int lengthDoc, int pos, const char *val) { +static bool isMatch(Accessor &styler, Sci_Position lengthDoc, Sci_Position pos, const char *val) { if ((pos + static_cast<int>(strlen(val))) >= lengthDoc) { return false; } @@ -167,8 +167,8 @@ static bool isMatch(Accessor &styler, int lengthDoc, int pos, const char *val) { // Precondition: the here-doc target can be indented static bool lookingAtHereDocDelim(Accessor &styler, - int pos, - int lengthDoc, + Sci_Position pos, + Sci_Position lengthDoc, const char *HereDocDelim) { if (!isMatch(styler, lengthDoc, pos, HereDocDelim)) { @@ -201,7 +201,7 @@ static char opposite(char ch) { // Null transitions when we see we've reached the end // and need to relex the curr char. -static void redo_char(int &i, char &ch, char &chNext, char &chNext2, +static void redo_char(Sci_Position &i, char &ch, char &chNext, char &chNext2, int &state) { i--; chNext2 = chNext; @@ -209,19 +209,19 @@ static void redo_char(int &i, char &ch, char &chNext, char &chNext2, state = SCE_RB_DEFAULT; } -static void advance_char(int &i, char &ch, char &chNext, char &chNext2) { +static void advance_char(Sci_Position &i, char &ch, char &chNext, char &chNext2) { i++; ch = chNext; chNext = chNext2; } // precondition: startPos points to one after the EOL char -static bool currLineContainsHereDelims(int &startPos, +static bool currLineContainsHereDelims(Sci_Position &startPos, Accessor &styler) { if (startPos <= 1) return false; - int pos; + Sci_Position pos; for (pos = startPos - 1; pos > 0; pos--) { char ch = styler.SafeGetCharAt(pos); if (isEOLChar(ch)) { @@ -314,10 +314,10 @@ static void exitInnerExpression(int *p_inner_string_types, curr_quote = p_inner_quotes[inner_string_count]; } -static bool isEmptyLine(int pos, +static bool isEmptyLine(Sci_Position pos, Accessor &styler) { int spaceFlags = 0; - int lineCurrent = styler.GetLine(pos); + Sci_Position lineCurrent = styler.GetLine(pos); int indentCurrent = styler.IndentAmount(lineCurrent, &spaceFlags, NULL); return (indentCurrent & SC_FOLDLEVELWHITEFLAG) != 0; } @@ -346,10 +346,10 @@ static bool RE_CanFollowKeyword(const char *keyword) { // Look at chars up to but not including endPos // Don't look at styles in case we're looking forward -static int skipWhitespace(int startPos, - int endPos, +static int skipWhitespace(Sci_Position startPos, + Sci_Position endPos, Accessor &styler) { - for (int i = startPos; i < endPos; i++) { + for (Sci_Position i = startPos; i < endPos; i++) { if (!iswhitespace(styler[i])) { return i; } @@ -363,19 +363,19 @@ static int skipWhitespace(int startPos, // // iPrev points to the start of << -static bool sureThisIsHeredoc(int iPrev, +static bool sureThisIsHeredoc(Sci_Position iPrev, Accessor &styler, char *prevWord) { // Not so fast, since Ruby's so dynamic. Check the context // to make sure we're OK. int prevStyle; - int lineStart = styler.GetLine(iPrev); - int lineStartPosn = styler.LineStart(lineStart); + Sci_Position lineStart = styler.GetLine(iPrev); + Sci_Position lineStartPosn = styler.LineStart(lineStart); styler.Flush(); // Find the first word after some whitespace - int firstWordPosn = skipWhitespace(lineStartPosn, iPrev, styler); + Sci_Position firstWordPosn = skipWhitespace(lineStartPosn, iPrev, styler); if (firstWordPosn >= iPrev) { // Have something like {^ <<} //XXX Look at the first previous non-comment non-white line @@ -391,7 +391,7 @@ static bool sureThisIsHeredoc(int iPrev, return true; } } - int firstWordEndPosn = firstWordPosn; + Sci_Position firstWordEndPosn = firstWordPosn; char *dst = prevWord; for (;;) { if (firstWordEndPosn >= iPrev || @@ -414,15 +414,15 @@ static bool sureThisIsHeredoc(int iPrev, // Routine that saves us from allocating a buffer for the here-doc target // targetEndPos points one past the end of the current target -static bool haveTargetMatch(int currPos, - int lengthDoc, - int targetStartPos, - int targetEndPos, +static bool haveTargetMatch(Sci_Position currPos, + Sci_Position lengthDoc, + Sci_Position targetStartPos, + Sci_Position targetEndPos, Accessor &styler) { if (lengthDoc - currPos < targetEndPos - targetStartPos) { return false; } - int i, j; + Sci_Position i, j; for (i = targetStartPos, j = currPos; i < targetEndPos && j < lengthDoc; i++, j++) { @@ -447,19 +447,19 @@ static bool haveTargetMatch(int currPos, // return true == yes, we have no heredocs -static bool sureThisIsNotHeredoc(int lt2StartPos, +static bool sureThisIsNotHeredoc(Sci_Position lt2StartPos, Accessor &styler) { int prevStyle; // Use full document, not just part we're styling - int lengthDoc = styler.Length(); - int lineStart = styler.GetLine(lt2StartPos); - int lineStartPosn = styler.LineStart(lineStart); + Sci_Position lengthDoc = styler.Length(); + Sci_Position lineStart = styler.GetLine(lt2StartPos); + Sci_Position lineStartPosn = styler.LineStart(lineStart); styler.Flush(); const bool definitely_not_a_here_doc = true; const bool looks_like_a_here_doc = false; // Find the first word after some whitespace - int firstWordPosn = skipWhitespace(lineStartPosn, lt2StartPos, styler); + Sci_Position firstWordPosn = skipWhitespace(lineStartPosn, lt2StartPos, styler); if (firstWordPosn >= lt2StartPos) { return definitely_not_a_here_doc; } @@ -508,12 +508,12 @@ static bool sureThisIsNotHeredoc(int lt2StartPos, return definitely_not_a_here_doc; } // OK, now 'j' will point to the current spot moving ahead - int j = firstWordPosn + 1; + Sci_Position j = firstWordPosn + 1; if (styler.StyleAt(j) != SCE_RB_OPERATOR || styler[j] != '<') { // This shouldn't happen return definitely_not_a_here_doc; } - int nextLineStartPosn = styler.LineStart(lineStart + 1); + Sci_Position nextLineStartPosn = styler.LineStart(lineStart + 1); if (nextLineStartPosn >= lengthDoc) { return definitely_not_a_here_doc; } @@ -522,7 +522,7 @@ static bool sureThisIsNotHeredoc(int lt2StartPos, return definitely_not_a_here_doc; } bool allow_indent; - int target_start, target_end; + Sci_Position target_start, target_end; // From this point on no more styling, since we're looking ahead if (styler[j] == '-') { allow_indent = true; @@ -580,12 +580,12 @@ static bool sureThisIsNotHeredoc(int lt2StartPos, } // Just look at the start of each line - int last_line = styler.GetLine(lengthDoc - 1); + Sci_Position last_line = styler.GetLine(lengthDoc - 1); // But don't go too far if (last_line > lineStart + 50) { last_line = lineStart + 50; } - for (int line_num = lineStart + 1; line_num <= last_line; line_num++) { + for (Sci_Position line_num = lineStart + 1; line_num <= last_line; line_num++) { if (allow_indent) { j = skipWhitespace(styler.LineStart(line_num), lengthDoc, styler); } else { @@ -604,8 +604,8 @@ static bool sureThisIsNotHeredoc(int lt2StartPos, // move to the start of the first line that is not in a // multi-line construct -static void synchronizeDocStart(unsigned int &startPos, - int &length, +static void synchronizeDocStart(Sci_PositionU &startPos, + Sci_Position &length, int &initStyle, Accessor &styler, bool skipWhiteSpace=false) { @@ -620,9 +620,9 @@ static void synchronizeDocStart(unsigned int &startPos, return; } - int pos = startPos; + Sci_Position pos = startPos; // Quick way to characterize each line - int lineStart; + Sci_Position lineStart; for (lineStart = styler.GetLine(pos); lineStart > 0; lineStart--) { // Now look at the style before the previous line's EOL pos = styler.LineStart(lineStart) - 1; @@ -695,7 +695,7 @@ static void ColouriseRbDoc(Sci_PositionU startPos, Sci_Position length, int init bool preferRE = true; int state = initStyle; - int lengthDoc = startPos + length; + Sci_Position lengthDoc = startPos + length; char prevWord[MAX_KEYWORD_LENGTH + 1]; // 1 byte for zero prevWord[0] = '\0'; @@ -743,7 +743,7 @@ static void ColouriseRbDoc(Sci_PositionU startPos, Sci_Position length, int init int inner_string_count = 0; int brace_counts = 0; // Number of #{ ... } things within an expression - int i; + Sci_Position i; for (i = 0; i < INNER_STRINGS_MAX_COUNT; i++) { inner_string_types[i] = 0; inner_expn_brace_counts[i] = 0; @@ -1103,7 +1103,7 @@ static void ColouriseRbDoc(Sci_PositionU startPos, Sci_Position length, int init // No need to handle this state -- we'll just move to the end preferRE = false; } else { - int wordStartPos = styler.GetStartSegment(); + Sci_Position wordStartPos = styler.GetStartSegment(); int word_style = ClassifyWordRb(wordStartPos, i - 1, keywords, styler, prevWord); switch (word_style) { case SCE_RB_WORD: @@ -1445,12 +1445,12 @@ static void ColouriseRbDoc(Sci_PositionU startPos, Sci_Position length, int init // Helper functions for folding, disambiguation keywords // Assert that there are no high-bit chars -static void getPrevWord(int pos, +static void getPrevWord(Sci_Position pos, char *prevWord, Accessor &styler, int word_state) { - int i; + Sci_Position i; styler.Flush(); for (i = pos - 1; i > 0; i--) { if (actual_style(styler.StyleAt(i)) != word_state) { @@ -1488,7 +1488,7 @@ static bool keywordIsAmbiguous(const char *prevWord) // do after a while or until, as a noise word (like then after if) static bool keywordIsModifier(const char *word, - int pos, + Sci_Position pos, Accessor &styler) { if (word[0] == 'd' && word[1] == 'o' && !word[2]) { @@ -1496,8 +1496,8 @@ static bool keywordIsModifier(const char *word, } char ch, chPrev, chPrev2; int style = SCE_RB_DEFAULT; - int lineStart = styler.GetLine(pos); - int lineStartPosn = styler.LineStart(lineStart); + Sci_Position lineStart = styler.GetLine(pos); + Sci_Position lineStartPosn = styler.LineStart(lineStart); // We want to step backwards until we don't care about the current // position. But first move lineStartPosn back behind any // continuations immediately above word. @@ -1599,13 +1599,13 @@ static bool keywordIsModifier(const char *word, // Nothing fancy -- look to see if we follow a while/until somewhere // on the current line -static bool keywordDoStartsLoop(int pos, +static bool keywordDoStartsLoop(Sci_Position pos, Accessor &styler) { char ch; int style; - int lineStart = styler.GetLine(pos); - int lineStartPosn = styler.LineStart(lineStart); + Sci_Position lineStart = styler.GetLine(pos); + Sci_Position lineStartPosn = styler.LineStart(lineStart); styler.Flush(); while (--pos >= lineStartPosn) { style = actual_style(styler.StyleAt(pos)); @@ -1621,7 +1621,7 @@ static bool keywordDoStartsLoop(int pos, char prevWord[MAX_KEYWORD_LENGTH + 1]; // 1 byte for zero char *dst = prevWord; int wordLen = 0; - int start_word; + Sci_Position start_word; for (start_word = pos; start_word >= lineStartPosn && actual_style(styler.StyleAt(start_word)) == SCE_RB_WORD; start_word--) { @@ -1651,10 +1651,10 @@ static bool keywordDoStartsLoop(int pos, return false; } -static bool IsCommentLine(int line, Accessor &styler) { - int pos = styler.LineStart(line); - int eol_pos = styler.LineStart(line + 1) - 1; - for (int i = pos; i < eol_pos; i++) { +static bool IsCommentLine(Sci_Position line, Accessor &styler) { + Sci_Position pos = styler.LineStart(line); + Sci_Position eol_pos = styler.LineStart(line + 1) - 1; + for (Sci_Position i = pos; i < eol_pos; i++) { char ch = styler[i]; if (ch == '#') return true; @@ -1725,9 +1725,9 @@ static void FoldRbDoc(Sci_PositionU startPos, Sci_Position length, int initStyle synchronizeDocStart(startPos, length, initStyle, styler, // ref args false); - unsigned int endPos = startPos + length; + Sci_PositionU endPos = startPos + length; int visibleChars = 0; - int lineCurrent = styler.GetLine(startPos); + Sci_Position lineCurrent = styler.GetLine(startPos); int levelPrev = startPos == 0 ? 0 : (styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK & ~SC_FOLDLEVELBASE); @@ -1736,7 +1736,7 @@ static void FoldRbDoc(Sci_PositionU startPos, Sci_Position length, int initStyle int styleNext = styler.StyleAt(startPos); int stylePrev = startPos <= 1 ? SCE_RB_DEFAULT : styler.StyleAt(startPos - 1); bool buffer_ends_with_eol = false; - 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 style = styleNext; diff --git a/lexers/LexRust.cxx b/lexers/LexRust.cxx index 398b6bf32..f98296bb3 100644 --- a/lexers/LexRust.cxx +++ b/lexers/LexRust.cxx @@ -161,7 +161,7 @@ Sci_Position SCI_METHOD LexerRust::PropertySet(const char *key, const char *val) } Sci_Position SCI_METHOD LexerRust::WordListSet(int n, const char *wl) { - int firstModification = -1; + Sci_Position firstModification = -1; if (n < NUM_RUST_KEYWORD_LISTS) { WordList *wordListN = &keywords[n]; WordList wlNew; @@ -188,7 +188,7 @@ static bool IsIdentifierContinue(int ch) { return (IsASCII(ch) && (isalnum(ch) || ch == '_')) || !IsASCII(ch); } -static void ScanWhitespace(Accessor& styler, int& pos, int max) { +static void ScanWhitespace(Accessor& styler, Sci_Position& pos, Sci_Position max) { while (IsWhitespace(styler.SafeGetCharAt(pos, '\0')) && pos < max) { if (pos == styler.LineEnd(styler.GetLine(pos))) styler.SetLineState(styler.GetLine(pos), 0); @@ -197,14 +197,14 @@ static void ScanWhitespace(Accessor& styler, int& pos, int max) { styler.ColourTo(pos-1, SCE_RUST_DEFAULT); } -static void GrabString(char* s, Accessor& styler, int start, int len) { - for (int ii = 0; ii < len; ii++) +static void GrabString(char* s, Accessor& styler, Sci_Position start, Sci_Position len) { + for (Sci_Position ii = 0; ii < len; ii++) s[ii] = styler[ii + start]; s[len] = '\0'; } -static void ScanIdentifier(Accessor& styler, int& pos, WordList *keywords) { - int start = pos; +static void ScanIdentifier(Accessor& styler, Sci_Position& pos, WordList *keywords) { + Sci_Position start = pos; while (IsIdentifierContinue(styler.SafeGetCharAt(pos, '\0'))) pos++; @@ -231,8 +231,8 @@ static void ScanIdentifier(Accessor& styler, int& pos, WordList *keywords) { } /* Scans a sequence of digits, returning true if it found any. */ -static bool ScanDigits(Accessor& styler, int& pos, int base) { - int old_pos = pos; +static bool ScanDigits(Accessor& styler, Sci_Position& pos, int base) { + Sci_Position old_pos = pos; for (;;) { int c = styler.SafeGetCharAt(pos, '\0'); if (IsADigit(c, base) || c == '_') @@ -244,7 +244,7 @@ static bool ScanDigits(Accessor& styler, int& pos, int base) { } /* Scans an integer and floating point literals. */ -static void ScanNumber(Accessor& styler, int& pos) { +static void ScanNumber(Accessor& styler, Sci_Position& pos) { int base = 10; int c = styler.SafeGetCharAt(pos, '\0'); int n = styler.SafeGetCharAt(pos + 1, '\0'); @@ -369,7 +369,7 @@ static bool IsValidStringEscape(int c) { return IsValidCharacterEscape(c) || c == '\n' || c == '\r'; } -static bool ScanNumericEscape(Accessor &styler, int& pos, int num_digits, bool stop_asap) { +static bool ScanNumericEscape(Accessor &styler, Sci_Position& pos, Sci_Position num_digits, bool stop_asap) { for (;;) { int c = styler.SafeGetCharAt(pos, '\0'); if (!IsADigit(c, 16)) @@ -388,7 +388,7 @@ static bool ScanNumericEscape(Accessor &styler, int& pos, int num_digits, bool s /* This is overly permissive for character literals in order to accept UTF-8 encoded * character literals. */ -static void ScanCharacterLiteralOrLifetime(Accessor &styler, int& pos, bool ascii_only) { +static void ScanCharacterLiteralOrLifetime(Accessor &styler, Sci_Position& pos, bool ascii_only) { pos++; int c = styler.SafeGetCharAt(pos, '\0'); int n = styler.SafeGetCharAt(pos + 1, '\0'); @@ -467,7 +467,7 @@ enum CommentState { * The rule for block-doc comments is as follows: /xxN and /x! (where x is an asterisk, N is a non-asterisk) start doc comments. * Otherwise it's a regular comment. */ -static void ResumeBlockComment(Accessor &styler, int& pos, int max, CommentState state, int level) { +static void ResumeBlockComment(Accessor &styler, Sci_Position& pos, Sci_Position max, CommentState state, int level) { int c = styler.SafeGetCharAt(pos, '\0'); bool maybe_doc_comment = false; if (c == '*') { @@ -522,7 +522,7 @@ static void ResumeBlockComment(Accessor &styler, int& pos, int max, CommentState * The rule for line-doc comments is as follows... ///N and //! (where N is a non slash) start doc comments. * Otherwise it's a normal line comment. */ -static void ResumeLineComment(Accessor &styler, int& pos, int max, CommentState state) { +static void ResumeLineComment(Accessor &styler, Sci_Position& pos, Sci_Position max, CommentState state) { bool maybe_doc_comment = false; int c = styler.SafeGetCharAt(pos, '\0'); if (c == '/') { @@ -550,7 +550,7 @@ static void ResumeLineComment(Accessor &styler, int& pos, int max, CommentState styler.ColourTo(pos - 1, SCE_RUST_COMMENTLINE); } -static void ScanComments(Accessor &styler, int& pos, int max) { +static void ScanComments(Accessor &styler, Sci_Position& pos, Sci_Position max) { pos++; int c = styler.SafeGetCharAt(pos, '\0'); pos++; @@ -560,7 +560,7 @@ static void ScanComments(Accessor &styler, int& pos, int max) { ResumeBlockComment(styler, pos, max, UnknownComment, 1); } -static void ResumeString(Accessor &styler, int& pos, int max, bool ascii_only) { +static void ResumeString(Accessor &styler, Sci_Position& pos, Sci_Position max, bool ascii_only) { int c = styler.SafeGetCharAt(pos, '\0'); bool error = false; while (c != '"' && !error) { @@ -600,7 +600,7 @@ static void ResumeString(Accessor &styler, int& pos, int max, bool ascii_only) { styler.ColourTo(pos - 1, ascii_only ? SCE_RUST_BYTESTRING : SCE_RUST_STRING); } -static void ResumeRawString(Accessor &styler, int& pos, int max, int num_hashes, bool ascii_only) { +static void ResumeRawString(Accessor &styler, Sci_Position& pos, Sci_Position max, int num_hashes, bool ascii_only) { for (;;) { if (pos == styler.LineEnd(styler.GetLine(pos))) styler.SetLineState(styler.GetLine(pos), num_hashes); @@ -628,7 +628,7 @@ static void ResumeRawString(Accessor &styler, int& pos, int max, int num_hashes, styler.ColourTo(pos - 1, ascii_only ? SCE_RUST_BYTESTRINGR : SCE_RUST_STRINGR); } -static void ScanRawString(Accessor &styler, int& pos, int max, bool ascii_only) { +static void ScanRawString(Accessor &styler, Sci_Position& pos, Sci_Position max, bool ascii_only) { pos++; int num_hashes = 0; while (styler.SafeGetCharAt(pos, '\0') == '#') { @@ -646,8 +646,8 @@ static void ScanRawString(Accessor &styler, int& pos, int max, bool ascii_only) void SCI_METHOD LexerRust::Lex(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess) { PropSetSimple props; Accessor styler(pAccess, &props); - int pos = startPos; - int max = pos + length; + Sci_Position pos = startPos; + Sci_Position max = pos + length; styler.StartAt(pos); styler.StartSegment(pos); @@ -723,21 +723,21 @@ void SCI_METHOD LexerRust::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 = styler.StyleAt(startPos); int style = 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; @@ -803,7 +803,7 @@ void SCI_METHOD LexerRust::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); } diff --git a/lexers/LexSML.cxx b/lexers/LexSML.cxx index 6adb86965..c380ac18b 100644 --- a/lexers/LexSML.cxx +++ b/lexers/LexSML.cxx @@ -46,7 +46,8 @@ void ColouriseSMLDoc( if (sc.state >= SCE_SML_COMMENT) nesting = (sc.state & 0x0f) - SCE_SML_COMMENT; - int chBase = 0, chToken = 0, chLit = 0; + Sci_PositionU chToken = 0; + int chBase = 0, chLit = 0; WordList& keywords = *keywordlists[0]; WordList& keywords2 = *keywordlists[1]; WordList& keywords3 = *keywordlists[2]; @@ -54,7 +55,7 @@ void ColouriseSMLDoc( while (sc.More()) { int state2 = -1; - int chColor = sc.currentPos - 1; + Sci_Position chColor = sc.currentPos - 1; bool advance = true; switch (sc.state & 0x0f) { @@ -89,10 +90,10 @@ void ColouriseSMLDoc( case SCE_SML_IDENTIFIER: if (!(issml(sc.ch) || sc.Match('\''))) { - const int n = sc.currentPos - chToken; + const Sci_Position n = sc.currentPos - chToken; if (n < 24) { char t[24]; - for (int i = -n; i < 0; i++) + for (Sci_Position i = -n; i < 0; i++) t[n + i] = static_cast<char>(sc.GetRelative(i)); t[n] = '\0'; if ((n == 1 && sc.chPrev == '_') || keywords.InList(t)) @@ -205,7 +206,7 @@ void ColouriseSMLDoc( } void FoldSMLDoc( - unsigned int, int, + Sci_PositionU, Sci_Position, int, WordList *[], Accessor &) diff --git a/lexers/LexSQL.cxx b/lexers/LexSQL.cxx index 82236e55f..34b601fba 100644 --- a/lexers/LexSQL.cxx +++ b/lexers/LexSQL.cxx @@ -66,7 +66,7 @@ typedef unsigned int sql_state_t; class SQLStates { public : - void Set(int lineNumber, unsigned short int sqlStatesLine) { + void Set(Sci_Position lineNumber, unsigned short int sqlStatesLine) { sqlStatement.Set(lineNumber, sqlStatesLine); } @@ -214,7 +214,7 @@ public : return (sqlStatesLine & MASK_INTO_CREATE_VIEW_AS_STATEMENT) != 0; } - sql_state_t ForLine(int lineNumber) { + sql_state_t ForLine(Sci_Position lineNumber) { return sqlStatement.ValueAt(lineNumber); } @@ -372,10 +372,10 @@ private: } } - bool IsCommentLine (int line, LexAccessor &styler) { - int pos = styler.LineStart(line); - int eol_pos = styler.LineStart(line + 1) - 1; - for (int i = pos; i + 1 < eol_pos; i++) { + bool IsCommentLine (Sci_Position line, LexAccessor &styler) { + Sci_Position pos = styler.LineStart(line); + Sci_Position eol_pos = styler.LineStart(line + 1) - 1; + for (Sci_Position i = pos; i + 1 < eol_pos; i++) { int style = styler.StyleAt(i); // MySQL needs -- comments to be followed by space or control char if (style == SCE_SQL_COMMENTLINE && styler.Match(i, "--")) @@ -427,7 +427,7 @@ Sci_Position SCI_METHOD LexerSQL::WordListSet(int n, const char *wl) { case 7: wordListN = &kw_user4; } - int firstModification = -1; + Sci_Position firstModification = -1; if (wordListN) { WordList wlNew; wlNew.Set(wl); @@ -443,7 +443,7 @@ void SCI_METHOD LexerSQL::Lex(Sci_PositionU startPos, Sci_Position length, int i LexAccessor styler(pAccess); StyleContext sc(startPos, length, initStyle, styler); int styleBeforeDCKeyword = SCE_SQL_DEFAULT; - int offset = 0; + Sci_Position offset = 0; for (; sc.More(); sc.Forward(), offset++) { // Determine if the current state should terminate. @@ -561,7 +561,7 @@ void SCI_METHOD LexerSQL::Lex(Sci_PositionU startPos, Sci_Position length, int i // Locate the unique Q operator character sc.Complete(); char qOperator = 0x00; - for (int styleStartPos = sc.currentPos; styleStartPos > 0; --styleStartPos) { + for (Sci_Position styleStartPos = sc.currentPos; styleStartPos > 0; --styleStartPos) { if (styler.StyleAt(styleStartPos - 1) != SCE_SQL_QOPERATOR) { qOperator = styler.SafeGetCharAt(styleStartPos + 2); break; @@ -632,14 +632,14 @@ void SCI_METHOD LexerSQL::Fold(Sci_PositionU startPos, Sci_Position length, int if (!options.fold) return; LexAccessor styler(pAccess); - unsigned int endPos = startPos + length; + Sci_PositionU endPos = startPos + length; int visibleChars = 0; - int lineCurrent = styler.GetLine(startPos); + Sci_Position lineCurrent = styler.GetLine(startPos); int levelCurrent = SC_FOLDLEVELBASE; if (lineCurrent > 0) { // Backtrack to previous line in case need to fix its fold status for folding block of single-line comments (i.e. '--'). - int lastNLPos = -1; + Sci_Position lastNLPos = -1; // And keep going back until we find an operator ';' followed // by white-space and/or comments. This will improve folding. while (--startPos > 0) { @@ -649,7 +649,7 @@ void SCI_METHOD LexerSQL::Fold(Sci_PositionU startPos, Sci_Position length, int } else if (ch == ';' && styler.StyleAt(startPos) == SCE_SQL_OPERATOR) { bool isAllClear = true; - for (int tempPos = startPos + 1; + for (Sci_Position tempPos = startPos + 1; tempPos < lastNLPos; ++tempPos) { int tempStyle = styler.StyleAt(tempPos); @@ -672,7 +672,7 @@ void SCI_METHOD LexerSQL::Fold(Sci_PositionU startPos, Sci_Position length, int // And because folding ends at ';', keep going until we find one // Otherwise if create ... view ... as is split over multiple // lines the folding won't always update immediately. - unsigned int docLength = styler.Length(); + Sci_PositionU docLength = styler.Length(); for (; endPos < docLength; ++endPos) { if (styler.SafeGetCharAt(endPos) == ';') { break; @@ -692,7 +692,7 @@ void SCI_METHOD LexerSQL::Fold(Sci_PositionU startPos, Sci_Position length, int if (!options.foldOnlyBegin) { sqlStatesCurrentLine = sqlStates.ForLine(lineCurrent); } - 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; diff --git a/lexers/LexSTTXT.cxx b/lexers/LexSTTXT.cxx index cddb73e3a..b7ac8f432 100644 --- a/lexers/LexSTTXT.cxx +++ b/lexers/LexSTTXT.cxx @@ -60,7 +60,7 @@ static void ClassifySTTXTWord(WordList *keywordlists[], StyleContext &sc) sc.SetState(SCE_STTXT_DEFAULT); } -static void ColouriseSTTXTDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, +static void ColouriseSTTXTDoc (Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *keywordlists[], Accessor &styler) { StyleContext sc(startPos, length, initStyle, styler); @@ -199,12 +199,12 @@ static const char * const STTXTWordListDesc[] = { 0 }; -static bool IsCommentLine(int line, Accessor &styler, bool type) +static bool IsCommentLine(Sci_Position line, Accessor &styler, bool type) { - int pos = styler.LineStart(line); - int eolPos = styler.LineStart(line + 1) - 1; + Sci_Position pos = styler.LineStart(line); + Sci_Position eolPos = styler.LineStart(line + 1) - 1; - for (int i = pos; i < eolPos; i++) + for (Sci_Position i = pos; i < eolPos; i++) { char ch = styler[i]; char chNext = styler.SafeGetCharAt(i + 1); @@ -221,7 +221,7 @@ static bool IsCommentLine(int line, Accessor &styler, bool type) return false; } - for (int i = eolPos-2; i>pos; i--) + for (Sci_Position i = eolPos-2; i>pos; i--) { char ch = styler[i]; char chPrev = styler.SafeGetCharAt(i-1); @@ -236,12 +236,12 @@ static bool IsCommentLine(int line, Accessor &styler, bool type) return false; } -static bool IsPragmaLine(int line, Accessor &styler) +static bool IsPragmaLine(Sci_Position line, Accessor &styler) { - int pos = styler.LineStart(line); - int eolPos = styler.LineStart(line+1) - 1; + Sci_Position pos = styler.LineStart(line); + Sci_Position eolPos = styler.LineStart(line+1) - 1; - for (int i = pos ; i < eolPos ; i++) + for (Sci_Position i = pos ; i < eolPos ; i++) { char ch = styler[i]; int style = styler.StyleAt(i); @@ -254,9 +254,9 @@ static bool IsPragmaLine(int line, Accessor &styler) return false; } -static void GetRangeUpper(unsigned int start,unsigned int end,Accessor &styler,char *s,unsigned int len) +static void GetRangeUpper(Sci_PositionU start,Sci_PositionU end,Accessor &styler,char *s,Sci_PositionU len) { - unsigned int i = 0; + Sci_PositionU i = 0; while ((i < end - start + 1) && (i < len-1)) { s[i] = static_cast<char>(toupper(styler[start + i])); i++; @@ -264,8 +264,8 @@ static void GetRangeUpper(unsigned int start,unsigned int end,Accessor &styler,c s[i] = '\0'; } -static void ClassifySTTXTWordFoldPoint(int &levelCurrent,unsigned int lastStart, - unsigned int currentPos, Accessor &styler) +static void ClassifySTTXTWordFoldPoint(int &levelCurrent,Sci_PositionU lastStart, + Sci_PositionU currentPos, Accessor &styler) { char s[256]; GetRangeUpper(lastStart, currentPos, styler, s, sizeof(s)); @@ -321,24 +321,24 @@ static void ClassifySTTXTWordFoldPoint(int &levelCurrent,unsigned int lastStart, } } -static void FoldSTTXTDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *[], Accessor &styler) +static void FoldSTTXTDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *[],Accessor &styler) { bool foldComment = styler.GetPropertyInt("fold.comment") != 0; bool foldPreprocessor = styler.GetPropertyInt("fold.preprocessor") != 0; bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0; - unsigned int endPos = startPos + length; + Sci_PositionU endPos = startPos + length; int visibleChars = 0; - int lineCurrent = styler.GetLine(startPos); + Sci_Position lineCurrent = styler.GetLine(startPos); int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK; int levelCurrent = levelPrev; char chNext = styler[startPos]; int styleNext = styler.StyleAt(startPos); int style = initStyle; - int lastStart = 0; + Sci_Position lastStart = 0; CharacterSet setWord(CharacterSet::setAlphaNum, "_", 0x80, true); - for (unsigned int i = startPos; i < endPos; i++) + for (Sci_PositionU i = startPos; i < endPos; i++) { char ch = chNext; chNext = styler.SafeGetCharAt(i + 1); diff --git a/lexers/LexScriptol.cxx b/lexers/LexScriptol.cxx index 694755b06..9c9d9c4c0 100644 --- a/lexers/LexScriptol.cxx +++ b/lexers/LexScriptol.cxx @@ -25,11 +25,11 @@ using namespace Scintilla; #endif -static void ClassifyWordSol(unsigned int start, unsigned int end, WordList &keywords, Accessor &styler, char *prevWord) +static void ClassifyWordSol(Sci_PositionU start, Sci_PositionU end, WordList &keywords, Accessor &styler, char *prevWord) { char s[100] = ""; bool wordIsNumber = isdigit(styler[start]) != 0; - for (unsigned int i = 0; i < end - start + 1 && i < 30; i++) + for (Sci_PositionU i = 0; i < end - start + 1 && i < 30; i++) { s[i] = styler[start + i]; s[i + 1] = '\0'; @@ -38,7 +38,7 @@ static void ClassifyWordSol(unsigned int start, unsigned int end, WordList &keyw if (0 == strcmp(prevWord, "class")) chAttr = SCE_SCRIPTOL_CLASSNAME; else if (wordIsNumber) chAttr = SCE_SCRIPTOL_NUMBER; else if (keywords.InList(s)) chAttr = SCE_SCRIPTOL_KEYWORD; - else for (unsigned int i = 0; i < end - start + 1; i++) // test dotted idents + else for (Sci_PositionU i = 0; i < end - start + 1; i++) // test dotted idents { if (styler[start + i] == '.') { @@ -50,7 +50,7 @@ static void ClassifyWordSol(unsigned int start, unsigned int end, WordList &keyw strcpy(prevWord, s); } -static bool IsSolComment(Accessor &styler, int pos, int len) +static bool IsSolComment(Accessor &styler, Sci_Position pos, Sci_Position len) { if(len > 0) { @@ -81,7 +81,7 @@ static bool IsSolWordStart(char ch) } -static int GetSolStringState(Accessor &styler, int i, int *nextIndex) +static int GetSolStringState(Accessor &styler, Sci_Position i, Sci_Position *nextIndex) { char ch = styler.SafeGetCharAt(i); char chNext = styler.SafeGetCharAt(i + 1); @@ -113,12 +113,12 @@ static void ColouriseSolDoc(Sci_PositionU startPos, Sci_Position length, int ini WordList *keywordlists[], Accessor &styler) { - int lengthDoc = startPos + length; + Sci_Position lengthDoc = startPos + length; char stringType = '\"'; if (startPos > 0) { - int lineCurrent = styler.GetLine(startPos); + Sci_Position lineCurrent = styler.GetLine(startPos); if (lineCurrent > 0) { startPos = styler.LineStart(lineCurrent-1); @@ -137,12 +137,12 @@ static void ColouriseSolDoc(Sci_PositionU startPos, Sci_Position length, int ini int state = initStyle & 31; - int nextIndex = 0; + Sci_Position nextIndex = 0; char chPrev = ' '; char chPrev2 = ' '; char chNext = styler[startPos]; styler.StartSegment(startPos); - for (int i = startPos; i < lengthDoc; i++) + for (Sci_Position i = startPos; i < lengthDoc; i++) { char ch = chNext; @@ -320,9 +320,9 @@ static void ColouriseSolDoc(Sci_PositionU startPos, Sci_Position length, int ini static void FoldSolDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *[], Accessor &styler) { - int lengthDoc = startPos + length; + Sci_Position lengthDoc = startPos + length; - int lineCurrent = styler.GetLine(startPos); + Sci_Position lineCurrent = styler.GetLine(startPos); if (startPos > 0) { if (lineCurrent > 0) @@ -341,7 +341,7 @@ static void FoldSolDoc(Sci_PositionU startPos, Sci_Position length, int initStyl if (state == SCE_SCRIPTOL_TRIPLE) indentCurrent |= SC_FOLDLEVELWHITEFLAG; char chNext = styler[startPos]; - for (int i = startPos; i < lengthDoc; i++) + for (Sci_Position i = startPos; i < lengthDoc; i++) { char ch = chNext; chNext = styler.SafeGetCharAt(i + 1); diff --git a/lexers/LexSpecman.cxx b/lexers/LexSpecman.cxx index 10721d244..72a973755 100644 --- a/lexers/LexSpecman.cxx +++ b/lexers/LexSpecman.cxx @@ -205,9 +205,9 @@ static void FoldNoBoxSpecmanDoc(Sci_PositionU startPos, Sci_Position length, int bool foldComment = styler.GetPropertyInt("fold.comment") != 0; bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0; bool foldAtElse = styler.GetPropertyInt("fold.at.else", 0) != 0; - unsigned int endPos = startPos + length; + Sci_PositionU endPos = startPos + length; int visibleChars = 0; - int lineCurrent = styler.GetLine(startPos); + Sci_Position lineCurrent = styler.GetLine(startPos); int levelCurrent = SC_FOLDLEVELBASE; if (lineCurrent > 0) levelCurrent = styler.LevelAt(lineCurrent-1) >> 16; @@ -216,7 +216,7 @@ static void FoldNoBoxSpecmanDoc(Sci_PositionU startPos, Sci_Position length, int char chNext = styler[startPos]; int styleNext = styler.StyleAt(startPos); int style; - 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; diff --git a/lexers/LexSpice.cxx b/lexers/LexSpice.cxx index 91575ea33..d834e26bf 100644 --- a/lexers/LexSpice.cxx +++ b/lexers/LexSpice.cxx @@ -145,7 +145,7 @@ static void ColouriseDocument( WordList &keywords2 = *keywordlists[1]; WordList &keywords3 = *keywordlists[2]; StyleContext sc(startPos, length, initStyle, styler); - int lineCurrent = styler.GetLine(startPos); + Sci_Position lineCurrent = styler.GetLine(startPos); bool apostropheStartsAttribute = (styler.GetLineState(lineCurrent) & 1) != 0; while (sc.More()) { if (sc.atLineEnd) { diff --git a/lexers/LexTACL.cxx b/lexers/LexTACL.cxx index 274dfd546..c7a15f220 100644 --- a/lexers/LexTACL.cxx +++ b/lexers/LexTACL.cxx @@ -45,12 +45,12 @@ inline bool isTACLwordstart(char ch) return ch == '#' || ch == '|' || ch == '_' || iswordstart(ch); } -static void getRange(unsigned int start, - unsigned int end, +static void getRange(Sci_PositionU start, + Sci_PositionU end, Accessor &styler, char *s, - unsigned int len) { - unsigned int i = 0; + Sci_PositionU len) { + Sci_PositionU i = 0; while ((i < end - start + 1) && (i < len-1)) { s[i] = static_cast<char>(tolower(styler[start + i])); i++; @@ -65,7 +65,7 @@ static bool IsStreamCommentStyle(int style) { style == SCE_C_COMMENTDOCKEYWORDERROR; } -static void ColourTo(Accessor &styler, unsigned int end, unsigned int attr, bool bInAsm) { +static void ColourTo(Accessor &styler, Sci_PositionU end, unsigned int attr, bool bInAsm) { if ((bInAsm) && (attr == SCE_C_OPERATOR || attr == SCE_C_NUMBER || attr == SCE_C_DEFAULT || attr == SCE_C_WORD || attr == SCE_C_IDENTIFIER)) { styler.ColourTo(end, SCE_C_REGEX); } else @@ -73,7 +73,7 @@ static void ColourTo(Accessor &styler, unsigned int end, unsigned int attr, bool } // returns 1 if the item starts a class definition, and -1 if the word is "end", and 2 if the word is "asm" -static int classifyWordTACL(unsigned int start, unsigned int end, /*WordList &keywords*/WordList *keywordlists[], Accessor &styler, bool bInAsm) { +static int classifyWordTACL(Sci_PositionU start, Sci_PositionU end, /*WordList &keywords*/WordList *keywordlists[], Accessor &styler, bool bInAsm) { int ret = 0; WordList& keywords = *keywordlists[0]; @@ -132,11 +132,11 @@ static void ColouriseTACLDoc(Sci_PositionU startPos, Sci_Position length, int in state = SCE_C_DEFAULT; char chPrev = ' '; char chNext = styler[startPos]; - unsigned int lengthDoc = startPos + length; + Sci_PositionU lengthDoc = startPos + length; bool bInClassDefinition; - int currentLine = styler.GetLine(startPos); + Sci_Position currentLine = styler.GetLine(startPos); if (currentLine > 0) { styler.SetLineState(currentLine, styler.GetLineState(currentLine-1)); bInClassDefinition = (styler.GetLineState(currentLine) == 1); @@ -151,7 +151,7 @@ static void ColouriseTACLDoc(Sci_PositionU startPos, Sci_Position length, int in styler.StartSegment(startPos); int visibleChars = 0; - unsigned int i; + Sci_PositionU i; for (i = startPos; i < lengthDoc; i++) { char ch = chNext; @@ -250,7 +250,7 @@ static void ColouriseTACLDoc(Sci_PositionU startPos, Sci_Position length, int in if (ch == '}' || (ch == '\r' || ch == '\n')) { if (((i > styler.GetStartSegment() + 2) || ( (initStyle == SCE_C_COMMENTDOC) && - (styler.GetStartSegment() == static_cast<unsigned int>(startPos))))) { + (styler.GetStartSegment() == static_cast<Sci_PositionU>(startPos))))) { ColourTo(styler, i, state, bInAsm); state = SCE_C_DEFAULT; } @@ -285,9 +285,9 @@ static void FoldTACLDoc(Sci_PositionU startPos, Sci_Position length, int initSty bool foldComment = styler.GetPropertyInt("fold.comment") != 0; bool foldPreprocessor = styler.GetPropertyInt("fold.preprocessor") != 0; bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0; - unsigned int endPos = startPos + length; + Sci_PositionU endPos = startPos + length; int visibleChars = 0; - int lineCurrent = styler.GetLine(startPos); + Sci_Position lineCurrent = styler.GetLine(startPos); int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK; int levelCurrent = levelPrev; char chNext = styler[startPos]; @@ -295,9 +295,9 @@ static void FoldTACLDoc(Sci_PositionU startPos, Sci_Position length, int initSty int style = initStyle; bool section = false; - int lastStart = 0; + Sci_Position lastStart = 0; - 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; @@ -346,7 +346,7 @@ static void FoldTACLDoc(Sci_PositionU startPos, Sci_Position length, int initSty if (foldPreprocessor && (style == SCE_C_PREPROCESSOR)) { if (ch == '{' && chNext == '$') { - unsigned int j=i+2; // skip {$ + Sci_PositionU j=i+2; // skip {$ while ((j<endPos) && IsASpaceOrTab(styler.SafeGetCharAt(j))) { j++; } diff --git a/lexers/LexTADS3.cxx b/lexers/LexTADS3.cxx index 17e3ff45d..03e82d31f 100644 --- a/lexers/LexTADS3.cxx +++ b/lexers/LexTADS3.cxx @@ -269,7 +269,7 @@ static void ColouriseTADS3HTMLTag(StyleContext &sc, int &lineState) { } static void ColouriseTADS3Keyword(StyleContext &sc, - WordList *keywordlists[], unsigned int endPos) { + WordList *keywordlists[], Sci_PositionU endPos) { char s[250]; WordList &keywords = *keywordlists[0]; WordList &userwords1 = *keywordlists[1]; @@ -283,7 +283,7 @@ static void ColouriseTADS3Keyword(StyleContext &sc, sc.GetCurrent(s, sizeof(s)); if ( strcmp(s, "is") == 0 || strcmp(s, "not") == 0) { // have to find if "in" is next - int n = 1; + Sci_Position n = 1; while (n + sc.currentPos < endPos && IsASpaceOrTab(sc.GetRelative(n))) n++; if (sc.GetRelative(n) == 'i' && sc.GetRelative(n+1) == 'n') { @@ -518,8 +518,8 @@ static void ColouriseTADS3Doc(Sci_PositionU startPos, Sci_Position length, int i int visibleChars = 0; int bracketLevel = 0; int lineState = 0; - unsigned int endPos = startPos + length; - int lineCurrent = styler.GetLine(startPos); + Sci_PositionU endPos = startPos + length; + Sci_Position lineCurrent = styler.GetLine(startPos); if (lineCurrent > 0) { lineState = styler.GetLineState(lineCurrent-1); } @@ -707,9 +707,9 @@ static inline bool IsSpaceEquivalent(const int ch, const int style) { || style == SCE_T3_PREPROCESSOR; } -static char peekAhead(unsigned int startPos, unsigned int endPos, +static char peekAhead(Sci_PositionU startPos, Sci_PositionU endPos, Accessor &styler) { - for (unsigned int i = startPos; i < endPos; i++) { + for (Sci_PositionU i = startPos; i < endPos; i++) { int style = styler.StyleAt(i); char ch = styler[i]; if (!IsSpaceEquivalent(ch, style)) { @@ -730,8 +730,8 @@ static char peekAhead(unsigned int startPos, unsigned int endPos, static void FoldTADS3Doc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *[], Accessor &styler) { - unsigned int endPos = startPos + length; - int lineCurrent = styler.GetLine(startPos); + Sci_PositionU endPos = startPos + length; + Sci_Position lineCurrent = styler.GetLine(startPos); int levelCurrent = SC_FOLDLEVELBASE; if (lineCurrent > 0) levelCurrent = styler.LevelAt(lineCurrent-1) >> 16; @@ -747,7 +747,7 @@ static void FoldTADS3Doc(Sci_PositionU startPos, Sci_Position length, int initSt char ch = chNext; int stylePrev = style; bool redo = false; - for (unsigned int i = startPos; i < endPos; i++) { + for (Sci_PositionU i = startPos; i < endPos; i++) { if (redo) { redo = false; i--; diff --git a/lexers/LexTAL.cxx b/lexers/LexTAL.cxx index 403a05686..e7f28eaaa 100644 --- a/lexers/LexTAL.cxx +++ b/lexers/LexTAL.cxx @@ -45,12 +45,12 @@ inline bool isTALwordstart(char ch) return ch == '$' || ch == '^' || iswordstart(ch); } -static void getRange(unsigned int start, - unsigned int end, +static void getRange(Sci_PositionU start, + Sci_PositionU end, Accessor &styler, char *s, - unsigned int len) { - unsigned int i = 0; + Sci_PositionU len) { + Sci_PositionU i = 0; while ((i < end - start + 1) && (i < len-1)) { s[i] = static_cast<char>(tolower(styler[start + i])); i++; @@ -65,7 +65,7 @@ static bool IsStreamCommentStyle(int style) { style == SCE_C_COMMENTDOCKEYWORDERROR; } -static void ColourTo(Accessor &styler, unsigned int end, unsigned int attr, bool bInAsm) { +static void ColourTo(Accessor &styler, Sci_PositionU end, unsigned int attr, bool bInAsm) { if ((bInAsm) && (attr == SCE_C_OPERATOR || attr == SCE_C_NUMBER || attr == SCE_C_DEFAULT || attr == SCE_C_WORD || attr == SCE_C_IDENTIFIER)) { styler.ColourTo(end, SCE_C_REGEX); } else @@ -73,7 +73,7 @@ static void ColourTo(Accessor &styler, unsigned int end, unsigned int attr, bool } // returns 1 if the item starts a class definition, and -1 if the word is "end", and 2 if the word is "asm" -static int classifyWordTAL(unsigned int start, unsigned int end, /*WordList &keywords*/WordList *keywordlists[], Accessor &styler, bool bInAsm) { +static int classifyWordTAL(Sci_PositionU start, Sci_PositionU end, /*WordList &keywords*/WordList *keywordlists[], Accessor &styler, bool bInAsm) { int ret = 0; WordList& keywords = *keywordlists[0]; @@ -132,11 +132,11 @@ static void ColouriseTALDoc(Sci_PositionU startPos, Sci_Position length, int ini state = SCE_C_DEFAULT; char chPrev = ' '; char chNext = styler[startPos]; - unsigned int lengthDoc = startPos + length; + Sci_PositionU lengthDoc = startPos + length; bool bInClassDefinition; - int currentLine = styler.GetLine(startPos); + Sci_Position currentLine = styler.GetLine(startPos); if (currentLine > 0) { styler.SetLineState(currentLine, styler.GetLineState(currentLine-1)); bInClassDefinition = (styler.GetLineState(currentLine) == 1); @@ -151,7 +151,7 @@ static void ColouriseTALDoc(Sci_PositionU startPos, Sci_Position length, int ini styler.StartSegment(startPos); int visibleChars = 0; - for (unsigned int i = startPos; i < lengthDoc; i++) { + for (Sci_PositionU i = startPos; i < lengthDoc; i++) { char ch = chNext; chNext = styler.SafeGetCharAt(i + 1); @@ -244,7 +244,7 @@ static void ColouriseTALDoc(Sci_PositionU startPos, Sci_Position length, int ini if (ch == '!' || (ch == '\r' || ch == '\n')) { if (((i > styler.GetStartSegment() + 2) || ( (initStyle == SCE_C_COMMENTDOC) && - (styler.GetStartSegment() == static_cast<unsigned int>(startPos))))) { + (styler.GetStartSegment() == static_cast<Sci_PositionU>(startPos))))) { ColourTo(styler, i, state, bInAsm); state = SCE_C_DEFAULT; } @@ -273,9 +273,9 @@ static void FoldTALDoc(Sci_PositionU startPos, Sci_Position length, int initStyl bool foldComment = styler.GetPropertyInt("fold.comment") != 0; bool foldPreprocessor = styler.GetPropertyInt("fold.preprocessor") != 0; bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0; - unsigned int endPos = startPos + length; + Sci_PositionU endPos = startPos + length; int visibleChars = 0; - int lineCurrent = styler.GetLine(startPos); + Sci_Position lineCurrent = styler.GetLine(startPos); int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK; int levelCurrent = levelPrev; char chNext = styler[startPos]; @@ -284,9 +284,9 @@ static void FoldTALDoc(Sci_PositionU startPos, Sci_Position length, int initStyl bool was_end = false; bool section = false; - int lastStart = 0; + Sci_Position lastStart = 0; - 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; @@ -345,7 +345,7 @@ static void FoldTALDoc(Sci_PositionU startPos, Sci_Position length, int initStyl if (foldPreprocessor && (style == SCE_C_PREPROCESSOR)) { if (ch == '{' && chNext == '$') { - unsigned int j=i+2; // skip {$ + Sci_PositionU j=i+2; // skip {$ while ((j<endPos) && IsASpaceOrTab(styler.SafeGetCharAt(j))) { j++; } diff --git a/lexers/LexTCL.cxx b/lexers/LexTCL.cxx index 18334a323..48af1e7fe 100644 --- a/lexers/LexTCL.cxx +++ b/lexers/LexTCL.cxx @@ -45,7 +45,7 @@ static inline bool IsANumberChar(int ch) { ch == '.' || ch == '-' || ch == '+'); } -static void ColouriseTCLDoc(Sci_PositionU startPos, Sci_Position length, int, WordList *keywordlists[], Accessor &styler) { +static void ColouriseTCLDoc(Sci_PositionU startPos, Sci_Position length, int , WordList *keywordlists[], Accessor &styler) { #define isComment(s) (s==SCE_TCL_COMMENT || s==SCE_TCL_COMMENTLINE || s==SCE_TCL_COMMENT_BOX || s==SCE_TCL_BLOCK_COMMENT) bool foldComment = styler.GetPropertyInt("fold.comment") != 0; bool commentLevel = false; @@ -58,7 +58,7 @@ static void ColouriseTCLDoc(Sci_PositionU startPos, Sci_Position length, int, Wo bool expected = 0; bool subParen = 0; - int currentLine = styler.GetLine(startPos); + Sci_Position currentLine = styler.GetLine(startPos); if (currentLine > 0) currentLine--; length += startPos - styler.LineStart(currentLine); diff --git a/lexers/LexTCMD.cxx b/lexers/LexTCMD.cxx index 7d86db2bc..150ceb32b 100644 --- a/lexers/LexTCMD.cxx +++ b/lexers/LexTCMD.cxx @@ -33,7 +33,7 @@ static bool IsAlphabetic(int ch) { return IsASCII(ch) && isalpha(ch); } -static inline bool AtEOL(Accessor &styler, unsigned int i) { +static inline bool AtEOL(Accessor &styler, Sci_PositionU i) { return (styler[i] == '\n') || ((styler[i] == '\r') && (styler.SafeGetCharAt(i + 1) != '\n')); } @@ -92,12 +92,12 @@ static unsigned int GetBatchVarLen( char *wordBuffer ) } -static void ColouriseTCMDLine( char *lineBuffer, unsigned int lengthLine, unsigned int startLine, unsigned int endPos, WordList *keywordlists[], Accessor &styler) +static void ColouriseTCMDLine( char *lineBuffer, Sci_PositionU lengthLine, Sci_PositionU startLine, Sci_PositionU endPos, WordList *keywordlists[], Accessor &styler) { - unsigned int offset = 0; // Line Buffer Offset + Sci_PositionU offset = 0; // Line Buffer Offset char wordBuffer[260]; // Word Buffer - large to catch long paths - unsigned int wbl; // Word Buffer Length - unsigned int wbo; // Word Buffer Offset - also Special Keyword Buffer Length + Sci_PositionU wbl; // Word Buffer Length + Sci_PositionU wbo; // Word Buffer Offset - also Special Keyword Buffer Length WordList &keywords = *keywordlists[0]; // Internal Commands // WordList &keywords2 = *keywordlists[1]; // Aliases (optional) bool isDelayedExpansion = 1; // !var! @@ -252,7 +252,7 @@ static void ColouriseTCMDLine( char *lineBuffer, unsigned int lengthLine, unsign // no further Regular Keyword Checking continueProcessing = false; sKeywordFound = true; - wbo = (unsigned int)strlen( sKeywordBuffer ); + wbo = (Sci_PositionU)strlen( sKeywordBuffer ); // Colorize Special Keyword as Regular Keyword styler.ColourTo(startLine + offset - 1 - (wbl - wbo), SCE_TCMD_WORD); @@ -401,15 +401,15 @@ ColorizeArg: styler.ColourTo(endPos, SCE_TCMD_DEFAULT); } -static void ColouriseTCMDDoc(Sci_PositionU startPos, Sci_Position length, int /*initStyle*/, WordList *keywordlists[], Accessor &styler) +static void ColouriseTCMDDoc( Sci_PositionU startPos, Sci_Position length, int /*initStyle*/, WordList *keywordlists[], Accessor &styler ) { char lineBuffer[16384]; styler.StartAt(startPos); styler.StartSegment(startPos); - unsigned int linePos = 0; - unsigned int startLine = startPos; - for (unsigned int i = startPos; i < startPos + length; i++) { + Sci_PositionU linePos = 0; + Sci_PositionU startLine = startPos; + for (Sci_PositionU i = startPos; i < startPos + length; i++) { lineBuffer[linePos++] = styler[i]; if (AtEOL(styler, i) || (linePos >= sizeof(lineBuffer) - 1)) { // End of line (or of line buffer) met, colourise it @@ -436,16 +436,16 @@ static void StrUpr(char *s) { // Folding support (for DO, IFF, SWITCH, TEXT, and command groups) static void FoldTCMDDoc(Sci_PositionU startPos, Sci_Position length, int, WordList *[], Accessor &styler) { - int line = styler.GetLine(startPos); + Sci_Position line = styler.GetLine(startPos); int level = styler.LevelAt(line); int levelIndent = 0; - unsigned int endPos = startPos + length; + Sci_PositionU endPos = startPos + length; char s[16] = ""; char chPrev = styler.SafeGetCharAt(startPos - 1); // Scan for ( and ) - for (unsigned int i = startPos; i < endPos; i++) { + for (Sci_PositionU i = startPos; i < endPos; i++) { int c = styler.SafeGetCharAt(i, '\n'); int style = styler.StyleAt(i); @@ -461,7 +461,7 @@ static void FoldTCMDDoc(Sci_PositionU startPos, Sci_Position length, int, WordLi } if (( bLineStart ) && ( style == SCE_TCMD_WORD )) { - for (unsigned int j = 0; j < 10; j++) { + for (Sci_PositionU j = 0; j < 10; j++) { if (!iswordchar(styler[i + j])) { break; } diff --git a/lexers/LexTeX.cxx b/lexers/LexTeX.cxx index 8468f9743..001416051 100644 --- a/lexers/LexTeX.cxx +++ b/lexers/LexTeX.cxx @@ -69,7 +69,7 @@ using namespace Scintilla; // Auxiliary functions: -static inline bool endOfLine(Accessor &styler, unsigned int i) { +static inline bool endOfLine(Accessor &styler, Sci_PositionU i) { return (styler[i] == '\n') || ((styler[i] == '\r') && (styler.SafeGetCharAt(i + 1) != '\n')) ; } @@ -128,12 +128,12 @@ static int CheckTeXInterface( int defaultInterface) { char lineBuffer[1024] ; - unsigned int linePos = 0 ; + Sci_PositionU linePos = 0 ; // some day we can make something lexer.tex.mapping=(all,0)(nl,1)(en,2)... if (styler.SafeGetCharAt(0) == '%') { - for (unsigned int i = 0; i < startPos + length; i++) { + for (Sci_PositionU i = 0; i < startPos + length; i++) { lineBuffer[linePos++] = styler.SafeGetCharAt(i) ; if (endOfLine(styler, i) || (linePos >= sizeof(lineBuffer) - 1)) { lineBuffer[linePos] = '\0'; @@ -297,9 +297,9 @@ static inline bool isWordChar(int ch) { return ((ch >= 'a') && (ch <= 'z')) || ((ch >= 'A') && (ch <= 'Z')); } -static int ParseTeXCommand(unsigned int pos, Accessor &styler, char *command) +static int ParseTeXCommand(Sci_PositionU pos, Accessor &styler, char *command) { - int length=0; + Sci_Position length=0; char ch=styler.SafeGetCharAt(pos+1); if(ch==',' || ch==':' || ch==';' || ch=='%'){ @@ -362,11 +362,11 @@ static int classifyFoldPointTeXUnpaired(const char* s) { return lev; } -static bool IsTeXCommentLine(int line, Accessor &styler) { - int pos = styler.LineStart(line); - int eol_pos = styler.LineStart(line + 1) - 1; +static bool IsTeXCommentLine(Sci_Position line, Accessor &styler) { + Sci_Position pos = styler.LineStart(line); + Sci_Position eol_pos = styler.LineStart(line + 1) - 1; - int startpos = pos; + Sci_Position startpos = pos; while (startpos<eol_pos){ char ch = styler[startpos]; @@ -383,15 +383,15 @@ static bool IsTeXCommentLine(int line, Accessor &styler) { static void FoldTexDoc(Sci_PositionU startPos, Sci_Position length, int, WordList *[], Accessor &styler) { bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0; - unsigned int endPos = startPos+length; + Sci_PositionU endPos = startPos+length; int visibleChars=0; - int lineCurrent=styler.GetLine(startPos); + Sci_Position lineCurrent=styler.GetLine(startPos); int levelPrev=styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK; int levelCurrent=levelPrev; char chNext=styler[startPos]; char buffer[100]=""; - for (unsigned int i=startPos; i < endPos; i++) { + for (Sci_PositionU i=startPos; i < endPos; i++) { char ch=chNext; chNext=styler.SafeGetCharAt(i+1); bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n'); diff --git a/lexers/LexTxt2tags.cxx b/lexers/LexTxt2tags.cxx index 2c95a7317..7e57e118c 100644 --- a/lexers/LexTxt2tags.cxx +++ b/lexers/LexTxt2tags.cxx @@ -45,8 +45,8 @@ static inline bool IsNewline(const int ch) { } // True if can follow ch down to the end with possibly trailing whitespace -static bool FollowToLineEnd(const int ch, const int state, const unsigned int endPos, StyleContext &sc) { - unsigned int i = 0; +static bool FollowToLineEnd(const int ch, const int state, const Sci_PositionU endPos, StyleContext &sc) { + Sci_PositionU i = 0; while (sc.GetRelative(++i) == ch) ; // Skip over whitespace @@ -63,7 +63,7 @@ static bool FollowToLineEnd(const int ch, const int state, const unsigned int en // Does the previous line have more than spaces and tabs? static bool HasPrevLineContent(StyleContext &sc) { - int i = 0; + Sci_Position i = 0; // Go back to the previous newline while ((--i + sc.currentPos) && !IsNewline(sc.GetRelative(i))) ; @@ -77,9 +77,9 @@ static bool HasPrevLineContent(StyleContext &sc) { } // Separator line -static bool IsValidHrule(const unsigned int endPos, StyleContext &sc) { +static bool IsValidHrule(const Sci_PositionU endPos, StyleContext &sc) { int count = 1; - unsigned int i = 0; + Sci_PositionU i = 0; for (;;) { ++i; int c = sc.GetRelative(i); @@ -105,7 +105,7 @@ static bool IsValidHrule(const unsigned int endPos, StyleContext &sc) { static void ColorizeTxt2tagsDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList **, Accessor &styler) { - unsigned int endPos = startPos + length; + Sci_PositionU endPos = startPos + length; int precharCount = 0; // Don't advance on a new loop iteration and retry at the same position. // Useful in the corner case of having to start at the beginning file position @@ -188,7 +188,7 @@ static void ColorizeTxt2tagsDoc(Sci_PositionU startPos, Sci_Position length, int if (IsNewline(sc.ch)) sc.SetState(SCE_TXT2TAGS_LINE_BEGIN); if (sc.atLineStart && sc.Match("```")) { - int i = 1; + Sci_Position i = 1; while (!IsNewline(sc.GetRelative(i)) && sc.currentPos + i < endPos) i++; sc.Forward(i); @@ -375,7 +375,7 @@ static void ColorizeTxt2tagsDoc(Sci_PositionU startPos, Sci_Position length, int } // Ordered list else if (IsADigit(sc.ch)) { - int digitCount = 0; + Sci_Position digitCount = 0; while (IsADigit(sc.GetRelative(++digitCount))) ; if (sc.GetRelative(digitCount) == '.' && @@ -405,8 +405,8 @@ static void ColorizeTxt2tagsDoc(Sci_PositionU startPos, Sci_Position length, int // } // Links and Images if (sc.Match("![") || sc.ch == '[') { - int i = 0, j = 0, k = 0; - int len = endPos - sc.currentPos; + Sci_Position i = 0, j = 0, k = 0; + Sci_Position len = endPos - sc.currentPos; while (i < len && (sc.GetRelative(++i) != ']' || sc.GetRelative(i - 1) == '\\')) ; if (sc.GetRelative(i) == ']') { diff --git a/lexers/LexVB.cxx b/lexers/LexVB.cxx index a7543fc73..d221dd470 100644 --- a/lexers/LexVB.cxx +++ b/lexers/LexVB.cxx @@ -256,10 +256,10 @@ static void ColouriseVBDoc(Sci_PositionU startPos, Sci_Position length, int init static void FoldVBDoc(Sci_PositionU startPos, Sci_Position length, int, WordList *[], Accessor &styler) { - int endPos = startPos + length; + Sci_Position endPos = startPos + length; // Backtrack to previous line in case need to fix its fold status - int lineCurrent = styler.GetLine(startPos); + Sci_Position lineCurrent = styler.GetLine(startPos); if (startPos > 0) { if (lineCurrent > 0) { lineCurrent--; @@ -269,7 +269,7 @@ static void FoldVBDoc(Sci_PositionU startPos, Sci_Position length, int, int spaceFlags = 0; int indentCurrent = styler.IndentAmount(lineCurrent, &spaceFlags, IsVBComment); char chNext = styler[startPos]; - for (int i = startPos; i < endPos; i++) { + for (Sci_Position i = startPos; i < endPos; i++) { char ch = chNext; chNext = styler.SafeGetCharAt(i + 1); diff --git a/lexers/LexVHDL.cxx b/lexers/LexVHDL.cxx index 746da7222..86f93f4e7 100644 --- a/lexers/LexVHDL.cxx +++ b/lexers/LexVHDL.cxx @@ -157,10 +157,10 @@ static void ColouriseVHDLDoc( sc.Complete(); } //============================================================================= -static bool IsCommentLine(int line, Accessor &styler) { - int pos = styler.LineStart(line); - int eol_pos = styler.LineStart(line + 1) - 1; - for (int i = pos; i < eol_pos; i++) { +static bool IsCommentLine(Sci_Position line, Accessor &styler) { + Sci_Position pos = styler.LineStart(line); + Sci_Position eol_pos = styler.LineStart(line + 1) - 1; + for (Sci_Position i = pos; i < eol_pos; i++) { char ch = styler[i]; char chNext = styler[i+1]; if ((ch == '-') && (chNext == '-')) @@ -170,11 +170,11 @@ static bool IsCommentLine(int line, Accessor &styler) { } return false; } -static bool IsCommentBlockStart(int line, Accessor &styler) +static bool IsCommentBlockStart(Sci_Position line, Accessor &styler) { - int pos = styler.LineStart(line); - int eol_pos = styler.LineStart(line + 1) - 1; - for (int i = pos; i < eol_pos; i++) { + Sci_Position pos = styler.LineStart(line); + Sci_Position eol_pos = styler.LineStart(line + 1) - 1; + for (Sci_Position i = pos; i < eol_pos; i++) { char ch = styler[i]; char chNext = styler[i+1]; char style = styler.StyleAt(i); @@ -184,12 +184,12 @@ static bool IsCommentBlockStart(int line, Accessor &styler) return false; } -static bool IsCommentBlockEnd(int line, Accessor &styler) +static bool IsCommentBlockEnd(Sci_Position line, Accessor &styler) { - int pos = styler.LineStart(line); - int eol_pos = styler.LineStart(line + 1) - 1; + Sci_Position pos = styler.LineStart(line); + Sci_Position eol_pos = styler.LineStart(line + 1) - 1; - for (int i = pos; i < eol_pos; i++) { + for (Sci_Position i = pos; i < eol_pos; i++) { char ch = styler[i]; char chNext = styler[i+1]; char style = styler.StyleAt(i); @@ -228,9 +228,9 @@ static void FoldNoBoxVHDLDoc( //bool foldAtWhen = styler.GetPropertyInt("fold.at.When", 1) != 0; //< fold at when in case statements int visibleChars = 0; - unsigned int endPos = startPos + length; + Sci_PositionU endPos = startPos + length; - int lineCurrent = styler.GetLine(startPos); + Sci_Position lineCurrent = styler.GetLine(startPos); int levelCurrent = SC_FOLDLEVELBASE; if(lineCurrent > 0) levelCurrent = styler.LevelAt(lineCurrent-1) >> 16; @@ -240,15 +240,15 @@ static void FoldNoBoxVHDLDoc( int levelNext = levelCurrent; /***************************************/ - int lastStart = 0; + Sci_Position lastStart = 0; char prevWord[32] = ""; /***************************************/ // Find prev word // The logic for going up or down a level depends on a the previous keyword // This code could be cleaned up. - int end = 0; - unsigned int j; + Sci_Position end = 0; + Sci_PositionU j; for(j = startPos; j>0; j--) { char ch = styler.SafeGetCharAt(j); @@ -267,7 +267,7 @@ static void FoldNoBoxVHDLDoc( if(!IsAWordChar(chPrev) && IsAWordStart(ch) && (end != 0)) { char s[32]; - unsigned int k; + Sci_PositionU k; for(k=0; (k<31 ) && (k<end-j+1 ); k++) { s[k] = static_cast<char>(tolower(styler[j+k])); } @@ -280,7 +280,7 @@ static void FoldNoBoxVHDLDoc( } } } - for(j=j+static_cast<unsigned int>(strlen(prevWord)); j<endPos; j++) + for(j=j+static_cast<Sci_PositionU>(strlen(prevWord)); j<endPos; j++) { char ch = styler.SafeGetCharAt(j); int style = styler.StyleAt(j); @@ -300,13 +300,13 @@ static void FoldNoBoxVHDLDoc( //Platform::DebugPrintf("Line[%04d] Prev[%20s] ************************* Level[%x]\n", lineCurrent+1, prevWord, levelCurrent); /***************************************/ - for (unsigned int i = startPos; i < endPos; i++) + for (Sci_PositionU i = startPos; i < endPos; i++) { char ch = chNext; chNext = styler.SafeGetCharAt(i + 1); chPrev = styler.SafeGetCharAt(i - 1); chNextNonBlank = chNext; - unsigned int j = i+1; + Sci_PositionU j = i+1; while(IsABlank(chNextNonBlank) && j<endPos) { j ++ ; @@ -365,7 +365,7 @@ static void FoldNoBoxVHDLDoc( if(IsAWordChar(ch) && !IsAWordChar(chNext)) { char s[32]; - unsigned int k; + Sci_PositionU k; for(k=0; (k<31 ) && (k<i-lastStart+1 ); k++) { s[k] = static_cast<char>(tolower(styler[lastStart+k])); } @@ -399,7 +399,7 @@ static void FoldNoBoxVHDLDoc( { if (strcmp(prevWord, "end") != 0 && lastStart) { // check for instantiated unit by backward searching for the colon. - unsigned pos = lastStart; + Sci_PositionU pos = lastStart; char chAtPos, styleAtPos; do{// skip white spaces pos--; @@ -427,7 +427,7 @@ static void FoldNoBoxVHDLDoc( { // This code checks to see if the procedure / function is a definition within a "package" // rather than the actual code in the body. int BracketLevel = 0; - for(int pos=i+1; pos<styler.Length(); pos++) + for(Sci_Position pos=i+1; pos<styler.Length(); pos++) { int styleAtPos = styler.StyleAt(pos); char chAtPos = styler.SafeGetCharAt(pos); diff --git a/lexers/LexVerilog.cxx b/lexers/LexVerilog.cxx index cee736492..9b5e9cd83 100644 --- a/lexers/LexVerilog.cxx +++ b/lexers/LexVerilog.cxx @@ -40,12 +40,12 @@ namespace { // Use an unnamed namespace to protect the functions and classes from name conflicts 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_) { } }; @@ -101,14 +101,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; } @@ -209,7 +209,7 @@ class LexerVerilog : public ILexerWithSubStyles { // typdefFlag: EOL while parsing typedef statement, terminated by ';' enum {foldExternFlag = 0x01, foldWaitDisableFlag = 0x02, typedefFlag = 0x04, protectedFlag = 0x08}; // map using line number as key to store fold state information - std::map<int, int> foldState; + std::map<Sci_Position, int> foldState; public: LexerVerilog() : @@ -307,7 +307,7 @@ Sci_Position SCI_METHOD LexerVerilog::WordListSet(int n, const char *wl) { wordListN = &ppDefinitions; break; } - int firstModification = -1; + Sci_Position firstModification = -1; if (wordListN) { WordList wlNew; wlNew.Set(wl); @@ -363,18 +363,18 @@ static inline bool AllUpperCase(const char *a) { // 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; } }; -static std::string GetRestOfLine(LexAccessor &styler, int start, bool allowSpace) { +static 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 == '*')) @@ -399,7 +399,7 @@ void SCI_METHOD LexerVerilog::Lex(Sci_PositionU startPos, Sci_Position length, i int lineState = kwOther; bool continuationLine = false; - int curLine = styler.GetLine(startPos); + Sci_Position curLine = styler.GetLine(startPos); if (curLine > 0) lineState = styler.GetLineState(curLine - 1); // Do not leak onto next line @@ -411,7 +411,7 @@ void SCI_METHOD LexerVerilog::Lex(Sci_PositionU startPos, Sci_Position length, i (MaskActive(initStyle) == SCE_V_COMMENTLINEBANG)) { // Set continuationLine if last character of previous line is '\' if (curLine > 0) { - int endLinePrevious = styler.LineEnd(curLine - 1); + Sci_Position endLinePrevious = styler.LineEnd(curLine - 1); if (endLinePrevious > 0) { continuationLine = styler.SafeGetCharAt(endLinePrevious-1) == '\\'; } @@ -443,7 +443,7 @@ void SCI_METHOD LexerVerilog::Lex(Sci_PositionU startPos, Sci_Position length, i } int activitySet = preproc.IsInactive() ? activeFlag : 0; - int lineEndNext = styler.LineEnd(curLine); + Sci_Position lineEndNext = styler.LineEnd(curLine); bool isEscapedId = false; // true when parsing an escaped Identifier bool isProtected = (lineState&kwProtected) != 0; // true when parsing a protected region @@ -473,7 +473,7 @@ void SCI_METHOD LexerVerilog::Lex(Sci_PositionU startPos, Sci_Position length, 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) { curLine++; lineEndNext = styler.LineEnd(curLine); vlls.Add(curLine, preproc); @@ -764,10 +764,10 @@ static bool IsStreamCommentStyle(int style) { return style == SCE_V_COMMENT; } -static bool IsCommentLine(int line, LexAccessor &styler) { - int pos = styler.LineStart(line); - int eolPos = styler.LineStart(line + 1) - 1; - for (int i = pos; i < eolPos; i++) { +static bool IsCommentLine(Sci_Position line, LexAccessor &styler) { + Sci_Position pos = styler.LineStart(line); + Sci_Position eolPos = styler.LineStart(line + 1) - 1; + for (Sci_Position i = pos; i < eolPos; i++) { char ch = styler[i]; char chNext = styler.SafeGetCharAt(i + 1); int style = styler.StyleAt(i); @@ -790,11 +790,11 @@ void SCI_METHOD LexerVerilog::Fold(Sci_PositionU startPos, Sci_Position length, bool foldAtBrace = 1; bool foldAtParenthese = 1; - int lineCurrent = styler.GetLine(startPos); + Sci_Position lineCurrent = styler.GetLine(startPos); // Move back one line to be compatible with LexerModule::Fold behavior, fixes problem with foldComment behavior if (lineCurrent > 0) { lineCurrent--; - int newStartPos = styler.LineStart(lineCurrent); + Sci_Position newStartPos = styler.LineStart(lineCurrent); length += startPos - newStartPos; startPos = newStartPos; initStyle = 0; @@ -802,7 +802,7 @@ void SCI_METHOD LexerVerilog::Fold(Sci_PositionU startPos, Sci_Position length, initStyle = styler.StyleAt(startPos - 1); } } - unsigned int endPos = startPos + length; + Sci_PositionU endPos = startPos + length; int visibleChars = 0; int levelCurrent = SC_FOLDLEVELBASE; if (lineCurrent > 0) @@ -815,7 +815,7 @@ void SCI_METHOD LexerVerilog::Fold(Sci_PositionU startPos, Sci_Position length, // restore fold state (if it exists) for prior line int stateCurrent = 0; - std::map<int,int>::iterator foldStateIterator = foldState.find(lineCurrent-1); + std::map<Sci_Position,int>::iterator foldStateIterator = foldState.find(lineCurrent-1); if (foldStateIterator != foldState.end()) { stateCurrent = foldStateIterator->second; } @@ -826,7 +826,7 @@ void SCI_METHOD LexerVerilog::Fold(Sci_PositionU startPos, Sci_Position length, foldState.erase(foldStateIterator, foldState.end()); } - 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; @@ -863,7 +863,7 @@ void SCI_METHOD LexerVerilog::Fold(Sci_PositionU startPos, Sci_Position length, } } if (ch == '`') { - unsigned int j = i + 1; + Sci_PositionU j = i + 1; while ((j < endPos) && IsASpaceOrTab(styler.SafeGetCharAt(j))) { j++; } @@ -943,7 +943,7 @@ void SCI_METHOD LexerVerilog::Fold(Sci_PositionU startPos, Sci_Position length, } } if (style == SCE_V_WORD && stylePrev != SCE_V_WORD) { - unsigned int j = i; + Sci_PositionU j = i; if (styler.Match(j, "case") || styler.Match(j, "casex") || styler.Match(j, "casez") || diff --git a/lexers/LexVisualProlog.cxx b/lexers/LexVisualProlog.cxx index 7d6851872..5166ab2ae 100644 --- a/lexers/LexVisualProlog.cxx +++ b/lexers/LexVisualProlog.cxx @@ -131,7 +131,7 @@ Sci_Position SCI_METHOD LexerVisualProlog::WordListSet(int n, const char *wl) { wordListN = &docKeywords; break; } - int firstModification = -1; + Sci_Position firstModification = -1; if (wordListN) { WordList wlNew; wlNew.Set(wl); @@ -145,8 +145,8 @@ Sci_Position SCI_METHOD LexerVisualProlog::WordListSet(int n, const char *wl) { // Functor used to truncate history struct After { - int line; - After(int line_) : line(line_) {} + Sci_Position line; + After(Sci_Position line_) : line(line_) {} }; static bool isLowerLetter(int ch){ @@ -208,13 +208,13 @@ static bool isOpenStringVerbatim(int next, int &closingQuote){ } // Look ahead to see which colour "end" should have (takes colour after the following keyword) -static void endLookAhead(char s[], LexAccessor &styler, int start) { +static void endLookAhead(char s[], LexAccessor &styler, Sci_Position start) { char ch = styler.SafeGetCharAt(start, '\n'); while (' ' == ch) { start++; ch = styler.SafeGetCharAt(start, '\n'); } - int i = 0; + Sci_Position i = 0; while (i < 100 && isLowerLetter(ch)){ s[i] = ch; i++; @@ -252,7 +252,7 @@ void SCI_METHOD LexerVisualProlog::Lex(Sci_PositionU startPos, Sci_Position leng StyleContext sc(startPos, length, initStyle, styler, 0x7f); int styleBeforeDocKeyword = SCE_VISUALPROLOG_DEFAULT; - int currentLine = styler.GetLine(startPos); + Sci_Position currentLine = styler.GetLine(startPos); int closingQuote = '"'; int nestLevel = 0; @@ -450,9 +450,9 @@ void SCI_METHOD LexerVisualProlog::Fold(Sci_PositionU startPos, Sci_Position len LexAccessor styler(pAccess); - unsigned int endPos = startPos + length; + Sci_PositionU endPos = startPos + length; int visibleChars = 0; - int currentLine = styler.GetLine(startPos); + Sci_Position currentLine = styler.GetLine(startPos); int levelCurrent = SC_FOLDLEVELBASE; if (currentLine > 0) levelCurrent = styler.LevelAt(currentLine-1) >> 16; @@ -461,7 +461,7 @@ void SCI_METHOD LexerVisualProlog::Fold(Sci_PositionU startPos, Sci_Position len char chNext = styler[startPos]; int styleNext = styler.StyleAt(startPos); int style = initStyle; - for (unsigned int i = startPos; i < endPos; i++) { + for (Sci_PositionU i = startPos; i < endPos; i++) { char ch = chNext; chNext = styler.SafeGetCharAt(i + 1); style = styleNext; @@ -492,7 +492,7 @@ void SCI_METHOD LexerVisualProlog::Fold(Sci_PositionU startPos, Sci_Position len currentLine++; 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(currentLine, (levelCurrent | levelCurrent << 16) | SC_FOLDLEVELWHITEFLAG); } diff --git a/lexers/LexYAML.cxx b/lexers/LexYAML.cxx index bb47e12bb..5cd348f46 100644 --- a/lexers/LexYAML.cxx +++ b/lexers/LexYAML.cxx @@ -32,7 +32,7 @@ static const char * const yamlWordListDesc[] = { 0 }; -static inline bool AtEOL(Accessor &styler, unsigned int i) { +static inline bool AtEOL(Accessor &styler, Sci_PositionU i) { return (styler[i] == '\n') || ((styler[i] == '\r') && (styler.SafeGetCharAt(i + 1) != '\n')); } @@ -59,14 +59,14 @@ static unsigned int SpaceCount(char* lineBuffer) { static void ColouriseYAMLLine( char *lineBuffer, - unsigned int currentLine, - unsigned int lengthLine, - unsigned int startLine, - unsigned int endPos, + Sci_PositionU currentLine, + Sci_PositionU lengthLine, + Sci_PositionU startLine, + Sci_PositionU endPos, WordList &keywords, Accessor &styler) { - unsigned int i = 0; + Sci_PositionU i = 0; bool bInQuotes = false; unsigned int indentAmount = SpaceCount(lineBuffer); @@ -111,7 +111,7 @@ static void ColouriseYAMLLine( i++; while ((i < lengthLine) && isspacechar(lineBuffer[i])) i++; - unsigned int endValue = lengthLine - 1; + Sci_PositionU endValue = lengthLine - 1; while ((endValue >= i) && isspacechar(lineBuffer[endValue])) endValue--; lineBuffer[endValue + 1] = '\0'; @@ -148,7 +148,7 @@ static void ColouriseYAMLLine( styler.ColourTo(endPos, SCE_YAML_KEYWORD); return; } else { - unsigned int i2 = i; + Sci_PositionU i2 = i; while ((i < lengthLine) && lineBuffer[i]) { if (!(IsASCII(lineBuffer[i]) && isdigit(lineBuffer[i])) && lineBuffer[i] != '-' && lineBuffer[i] != '.' && lineBuffer[i] != ',') { styler.ColourTo(endPos, SCE_YAML_DEFAULT); @@ -172,13 +172,13 @@ static void ColouriseYAMLDoc(Sci_PositionU startPos, Sci_Position length, int, W char lineBuffer[1024] = ""; styler.StartAt(startPos); styler.StartSegment(startPos); - unsigned int linePos = 0; - unsigned int startLine = startPos; - unsigned int endPos = startPos + length; - unsigned int maxPos = styler.Length(); - unsigned int lineCurrent = styler.GetLine(startPos); + Sci_PositionU linePos = 0; + Sci_PositionU startLine = startPos; + Sci_PositionU endPos = startPos + length; + Sci_PositionU maxPos = styler.Length(); + Sci_PositionU lineCurrent = styler.GetLine(startPos); - for (unsigned int i = startPos; i < maxPos && i < endPos; i++) { + for (Sci_PositionU i = startPos; i < maxPos && i < endPos; i++) { lineBuffer[linePos++] = styler[i]; if (AtEOL(styler, i) || (linePos >= sizeof(lineBuffer) - 1)) { // End of line (or of line buffer) met, colourise it @@ -194,8 +194,8 @@ static void ColouriseYAMLDoc(Sci_PositionU startPos, Sci_Position length, int, W } } -static bool IsCommentLine(int line, Accessor &styler) { - int pos = styler.LineStart(line); +static bool IsCommentLine(Sci_Position line, Accessor &styler) { + Sci_Position pos = styler.LineStart(line); if (styler[pos] == '#') return true; return false; @@ -203,9 +203,9 @@ static bool IsCommentLine(int line, Accessor &styler) { static void FoldYAMLDoc(Sci_PositionU startPos, Sci_Position length, int /*initStyle - unused*/, WordList *[], Accessor &styler) { - const int maxPos = startPos + length; - const int maxLines = styler.GetLine(maxPos - 1); // Requested last line - const int docLines = styler.GetLine(styler.Length() - 1); // Available last line + const Sci_Position maxPos = startPos + length; + const Sci_Position maxLines = styler.GetLine(maxPos - 1); // Requested last line + const Sci_Position docLines = styler.GetLine(styler.Length() - 1); // Available last line const bool foldComment = styler.GetPropertyInt("fold.comment.yaml") != 0; // Backtrack to previous non-blank line so we can determine indent level @@ -213,7 +213,7 @@ static void FoldYAMLDoc(Sci_PositionU startPos, Sci_Position length, int /*initS // and so we can fix any preceding fold level (which is why we go back // at least one line in all cases) int spaceFlags = 0; - int lineCurrent = styler.GetLine(startPos); + Sci_Position lineCurrent = styler.GetLine(startPos); int indentCurrent = styler.IndentAmount(lineCurrent, &spaceFlags, NULL); while (lineCurrent > 0) { lineCurrent--; @@ -236,7 +236,7 @@ static void FoldYAMLDoc(Sci_PositionU startPos, Sci_Position length, int /*initS // Gather info int lev = indentCurrent; - int lineNext = lineCurrent + 1; + Sci_Position lineNext = lineCurrent + 1; int indentNext = indentCurrent; if (lineNext <= docLines) { // Information about next line is only available if not at end of document @@ -280,7 +280,7 @@ static void FoldYAMLDoc(Sci_PositionU startPos, Sci_Position length, int /*initS // which is indented more than the line after the end of // the comment-block, use the level of the block before - int skipLine = lineNext; + Sci_Position skipLine = lineNext; int skipLevel = levelAfterComments; while (--skipLine > lineCurrent) { |