diff options
author | Joe Mueller <unknown> | 2015-07-30 14:35:17 +1000 |
---|---|---|
committer | Joe Mueller <unknown> | 2015-07-30 14:35:17 +1000 |
commit | 58471e908a3b74b27379bb19a13d62cd8d4476b0 (patch) | |
tree | 8f61293f34d008fea20584c631d23e58b3fe53aa /lexers/LexHaskell.cxx | |
parent | 2270ab97445c6f12bd0fddb273ab617fdb421594 (diff) | |
download | scintilla-mirror-58471e908a3b74b27379bb19a13d62cd8d4476b0.tar.gz |
Use Sci_Position / Sci_PositionU for variables in lexers that represent
positions and line numbers and may be widened to 64-bits in a future release.
Diffstat (limited to 'lexers/LexHaskell.cxx')
-rw-r--r-- | lexers/LexHaskell.cxx | 34 |
1 files changed, 17 insertions, 17 deletions
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) { |