aboutsummaryrefslogtreecommitdiffhomepage
path: root/lexlib
diff options
context:
space:
mode:
Diffstat (limited to 'lexlib')
-rw-r--r--lexlib/Accessor.cxx8
-rw-r--r--lexlib/Accessor.h4
-rw-r--r--lexlib/LexAccessor.h54
-rw-r--r--lexlib/LexerModule.cxx4
-rw-r--r--lexlib/LexerModule.h2
-rw-r--r--lexlib/StyleContext.cxx20
-rw-r--r--lexlib/StyleContext.h54
7 files changed, 73 insertions, 73 deletions
diff --git a/lexlib/Accessor.cxx b/lexlib/Accessor.cxx
index f67737d4d..283de5bd4 100644
--- a/lexlib/Accessor.cxx
+++ b/lexlib/Accessor.cxx
@@ -32,8 +32,8 @@ int Accessor::GetPropertyInt(const char *key, int defaultValue) const {
return pprops->GetInt(key, defaultValue);
}
-int Accessor::IndentAmount(int line, int *flags, PFNIsCommentLeader pfnIsCommentLeader) {
- int end = Length();
+int Accessor::IndentAmount(Sci_Position line, int *flags, PFNIsCommentLeader pfnIsCommentLeader) {
+ Sci_Position end = Length();
int spaceFlags = 0;
// Determines the indentation level of the current line and also checks for consistent
@@ -41,11 +41,11 @@ int Accessor::IndentAmount(int line, int *flags, PFNIsCommentLeader pfnIsComment
// Indentation is judged consistent when the indentation whitespace of each line lines
// the same or the indentation of one line is a prefix of the other.
- int pos = LineStart(line);
+ Sci_Position pos = LineStart(line);
char ch = (*this)[pos];
int indent = 0;
bool inPrevPrefix = line > 0;
- int posPrev = inPrevPrefix ? LineStart(line-1) : 0;
+ Sci_Position posPrev = inPrevPrefix ? LineStart(line-1) : 0;
while ((ch == ' ' || ch == '\t') && (pos < end)) {
if (inPrevPrefix) {
char chPrev = (*this)[posPrev++];
diff --git a/lexlib/Accessor.h b/lexlib/Accessor.h
index 7a58785f3..00b2a54da 100644
--- a/lexlib/Accessor.h
+++ b/lexlib/Accessor.h
@@ -18,14 +18,14 @@ class Accessor;
class WordList;
class PropSetSimple;
-typedef bool(*PFNIsCommentLeader)(Accessor &styler, Sci_Position pos, Sci_Position len);
+typedef bool (*PFNIsCommentLeader)(Accessor &styler, Sci_Position pos, Sci_Position len);
class Accessor : public LexAccessor {
public:
PropSetSimple *pprops;
Accessor(IDocument *pAccess_, PropSetSimple *pprops_);
int GetPropertyInt(const char *, int defaultValue=0) const;
- int IndentAmount(int line, int *flags, PFNIsCommentLeader pfnIsCommentLeader = 0);
+ int IndentAmount(Sci_Position line, int *flags, PFNIsCommentLeader pfnIsCommentLeader = 0);
};
#ifdef SCI_NAMESPACE
diff --git a/lexlib/LexAccessor.h b/lexlib/LexAccessor.h
index 8e3455d0c..f2cce50bd 100644
--- a/lexlib/LexAccessor.h
+++ b/lexlib/LexAccessor.h
@@ -24,18 +24,18 @@ private:
* in case there is some backtracking. */
enum {bufferSize=4000, slopSize=bufferSize/8};
char buf[bufferSize+1];
- int startPos;
- int endPos;
+ Sci_Position startPos;
+ Sci_Position endPos;
int codePage;
enum EncodingType encodingType;
- int lenDoc;
+ Sci_Position lenDoc;
char styleBuf[bufferSize];
- int validLen;
- unsigned int startSeg;
- int startPosStyling;
+ Sci_Position validLen;
+ Sci_PositionU startSeg;
+ Sci_Position startPosStyling;
int documentVersion;
- void Fill(int position) {
+ void Fill(Sci_Position position) {
startPos = position - slopSize;
if (startPos + bufferSize > lenDoc)
startPos = lenDoc - bufferSize;
@@ -73,7 +73,7 @@ public:
encodingType = encDBCS;
}
}
- char operator[](int position) {
+ char operator[](Sci_Position position) {
if (position < startPos || position >= endPos) {
Fill(position);
}
@@ -86,7 +86,7 @@ public:
return 0;
}
/** Safe version of operator[], returning a defined value for invalid position. */
- char SafeGetCharAt(int position, char chDefault=' ') {
+ char SafeGetCharAt(Sci_Position position, char chDefault=' ') {
if (position < startPos || position >= endPos) {
Fill(position);
if (position < startPos || position >= endPos) {
@@ -102,7 +102,7 @@ public:
EncodingType Encoding() const {
return encodingType;
}
- bool Match(int pos, const char *s) {
+ bool Match(Sci_Position pos, const char *s) {
for (int i=0; *s; i++) {
if (*s != SafeGetCharAt(pos+i))
return false;
@@ -110,21 +110,21 @@ public:
}
return true;
}
- char StyleAt(int position) const {
+ char StyleAt(Sci_Position position) const {
return static_cast<char>(pAccess->StyleAt(position));
}
- int GetLine(int position) const {
+ Sci_Position GetLine(Sci_Position position) const {
return pAccess->LineFromPosition(position);
}
- int LineStart(int line) const {
+ Sci_Position LineStart(Sci_Position line) const {
return pAccess->LineStart(line);
}
- int LineEnd(int line) {
+ Sci_Position LineEnd(Sci_Position line) {
if (documentVersion >= dvLineEnd) {
return (static_cast<IDocumentWithLineEnd *>(pAccess))->LineEnd(line);
} else {
// Old interface means only '\r', '\n' and '\r\n' line ends.
- int startNext = pAccess->LineStart(line+1);
+ Sci_Position startNext = pAccess->LineStart(line+1);
char chLineEnd = SafeGetCharAt(startNext-1);
if (chLineEnd == '\n' && (SafeGetCharAt(startNext-2) == '\r'))
return startNext - 2;
@@ -132,10 +132,10 @@ public:
return startNext - 1;
}
}
- int LevelAt(int line) const {
+ int LevelAt(Sci_Position line) const {
return pAccess->GetLevel(line);
}
- int Length() const {
+ Sci_Position Length() const {
return lenDoc;
}
void Flush() {
@@ -145,24 +145,24 @@ public:
validLen = 0;
}
}
- int GetLineState(int line) const {
+ int GetLineState(Sci_Position line) const {
return pAccess->GetLineState(line);
}
- int SetLineState(int line, int state) {
+ int SetLineState(Sci_Position line, int state) {
return pAccess->SetLineState(line, state);
}
// Style setting
- void StartAt(unsigned int start) {
+ void StartAt(Sci_PositionU start) {
pAccess->StartStyling(start, '\377');
startPosStyling = start;
}
- unsigned int GetStartSegment() const {
+ Sci_PositionU GetStartSegment() const {
return startSeg;
}
- void StartSegment(unsigned int pos) {
+ void StartSegment(Sci_PositionU pos) {
startSeg = pos;
}
- void ColourTo(unsigned int pos, int chAttr) {
+ void ColourTo(Sci_PositionU pos, int chAttr) {
// Only perform styling if non empty range
if (pos != startSeg - 1) {
assert(pos >= startSeg);
@@ -176,7 +176,7 @@ public:
// Too big for buffer so send directly
pAccess->SetStyleFor(pos - startSeg + 1, static_cast<char>(chAttr));
} else {
- for (unsigned int i = startSeg; i <= pos; i++) {
+ for (Sci_PositionU i = startSeg; i <= pos; i++) {
assert((startPosStyling + validLen) < Length());
styleBuf[validLen++] = static_cast<char>(chAttr);
}
@@ -184,15 +184,15 @@ public:
}
startSeg = pos+1;
}
- void SetLevel(int line, int level) {
+ void SetLevel(Sci_Position line, int level) {
pAccess->SetLevel(line, level);
}
- void IndicatorFill(int start, int end, int indicator, int value) {
+ void IndicatorFill(Sci_Position start, Sci_Position end, int indicator, int value) {
pAccess->DecorationSetCurrentIndicator(indicator);
pAccess->DecorationFillRange(start, value, end - start);
}
- void ChangeLexerState(int start, int end) {
+ void ChangeLexerState(Sci_Position start, Sci_Position end) {
pAccess->ChangeLexerState(start, end);
}
};
diff --git a/lexlib/LexerModule.cxx b/lexlib/LexerModule.cxx
index aab868a41..390bae06e 100644
--- a/lexlib/LexerModule.cxx
+++ b/lexlib/LexerModule.cxx
@@ -94,11 +94,11 @@ void LexerModule::Lex(Sci_PositionU startPos, Sci_Position lengthDoc, int initSt
void LexerModule::Fold(Sci_PositionU startPos, Sci_Position lengthDoc, int initStyle,
WordList *keywordlists[], Accessor &styler) const {
if (fnFolder) {
- int lineCurrent = styler.GetLine(startPos);
+ Sci_Position lineCurrent = styler.GetLine(startPos);
// Move back one line in case deletion wrecked current line fold state
if (lineCurrent > 0) {
lineCurrent--;
- int newStartPos = styler.LineStart(lineCurrent);
+ Sci_Position newStartPos = styler.LineStart(lineCurrent);
lengthDoc += startPos - newStartPos;
startPos = newStartPos;
initStyle = 0;
diff --git a/lexlib/LexerModule.h b/lexlib/LexerModule.h
index 3ca978a53..356ff27e9 100644
--- a/lexlib/LexerModule.h
+++ b/lexlib/LexerModule.h
@@ -15,7 +15,7 @@ namespace Scintilla {
class Accessor;
class WordList;
-typedef void(*LexerFunction)(Sci_PositionU startPos, Sci_Position lengthDoc, int initStyle,
+typedef void (*LexerFunction)(Sci_PositionU startPos, Sci_Position lengthDoc, int initStyle,
WordList *keywordlists[], Accessor &styler);
typedef ILexer *(*LexerFactoryFunction)();
diff --git a/lexlib/StyleContext.cxx b/lexlib/StyleContext.cxx
index 9429c5ba8..5bcacb018 100644
--- a/lexlib/StyleContext.cxx
+++ b/lexlib/StyleContext.cxx
@@ -21,12 +21,12 @@
using namespace Scintilla;
#endif
-static void getRange(unsigned int start,
- unsigned int end,
+static void getRange(Sci_PositionU start,
+ Sci_PositionU end,
LexAccessor &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] = styler[start + i];
i++;
@@ -34,16 +34,16 @@ static void getRange(unsigned int start,
s[i] = '\0';
}
-void StyleContext::GetCurrent(char *s, unsigned int len) {
+void StyleContext::GetCurrent(char *s, Sci_PositionU len) {
getRange(styler.GetStartSegment(), currentPos - 1, styler, s, len);
}
-static void getRangeLowered(unsigned int start,
- unsigned int end,
+static void getRangeLowered(Sci_PositionU start,
+ Sci_PositionU end,
LexAccessor &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++;
@@ -51,6 +51,6 @@ static void getRangeLowered(unsigned int start,
s[i] = '\0';
}
-void StyleContext::GetCurrentLowered(char *s, unsigned int len) {
+void StyleContext::GetCurrentLowered(char *s, Sci_PositionU len) {
getRangeLowered(styler.GetStartSegment(), currentPos - 1, styler, s, len);
}
diff --git a/lexlib/StyleContext.h b/lexlib/StyleContext.h
index 837386cef..c8aa4ab02 100644
--- a/lexlib/StyleContext.h
+++ b/lexlib/StyleContext.h
@@ -26,13 +26,13 @@ static inline int MakeLowerCase(int ch) {
class StyleContext {
LexAccessor &styler;
IDocumentWithLineEnd *multiByteAccess;
- unsigned int endPos;
- unsigned int lengthDocument;
+ Sci_PositionU endPos;
+ Sci_PositionU lengthDocument;
// Used for optimizing GetRelativeCharacter
- unsigned int posRelative;
- unsigned int currentPosLastRelative;
- int offsetRelative;
+ Sci_PositionU posRelative;
+ Sci_PositionU currentPosLastRelative;
+ Sci_Position offsetRelative;
StyleContext &operator=(const StyleContext &);
@@ -46,26 +46,26 @@ class StyleContext {
// End of line determined from line end position, allowing CR, LF,
// CRLF and Unicode line ends as set by document.
if (currentLine < lineDocEnd)
- atLineEnd = static_cast<int>(currentPos) >= (lineStartNext-1);
+ atLineEnd = static_cast<Sci_Position>(currentPos) >= (lineStartNext-1);
else // Last line
- atLineEnd = static_cast<int>(currentPos) >= lineStartNext;
+ atLineEnd = static_cast<Sci_Position>(currentPos) >= lineStartNext;
}
public:
- unsigned int currentPos;
- int currentLine;
- int lineDocEnd;
- int lineStartNext;
+ Sci_PositionU currentPos;
+ Sci_Position currentLine;
+ Sci_Position lineDocEnd;
+ Sci_Position lineStartNext;
bool atLineStart;
bool atLineEnd;
int state;
int chPrev;
int ch;
- int width;
+ Sci_Position width;
int chNext;
- int widthNext;
+ Sci_Position widthNext;
- StyleContext(unsigned int startPos, unsigned int length,
+ StyleContext(Sci_PositionU startPos, Sci_PositionU length,
int initStyle, LexAccessor &styler_, char chMask='\377') :
styler(styler_),
multiByteAccess(0),
@@ -90,11 +90,11 @@ public:
styler.StartSegment(startPos);
currentLine = styler.GetLine(startPos);
lineStartNext = styler.LineStart(currentLine+1);
- lengthDocument = static_cast<unsigned int>(styler.Length());
+ lengthDocument = static_cast<Sci_PositionU>(styler.Length());
if (endPos == lengthDocument)
endPos++;
lineDocEnd = styler.GetLine(lengthDocument);
- atLineStart = static_cast<unsigned int>(styler.LineStart(currentLine)) == startPos;
+ atLineStart = static_cast<Sci_PositionU>(styler.LineStart(currentLine)) == startPos;
// Variable width is now 0 so GetNextChar gets the char at currentPos into chNext/widthNext
width = 0;
@@ -131,13 +131,13 @@ public:
atLineEnd = true;
}
}
- void Forward(int nb) {
- for (int i = 0; i < nb; i++) {
+ void Forward(Sci_Position nb) {
+ for (Sci_Position i = 0; i < nb; i++) {
Forward();
}
}
- void ForwardBytes(int nb) {
- size_t forwardPos = currentPos + nb;
+ void ForwardBytes(Sci_Position nb) {
+ Sci_PositionU forwardPos = currentPos + nb;
while (forwardPos > currentPos) {
Forward();
}
@@ -154,13 +154,13 @@ public:
styler.ColourTo(currentPos - ((currentPos > lengthDocument) ? 2 : 1), state);
state = state_;
}
- int LengthCurrent() const {
+ Sci_Position LengthCurrent() const {
return currentPos - styler.GetStartSegment();
}
- int GetRelative(int n) {
+ int GetRelative(Sci_Position n) {
return static_cast<unsigned char>(styler.SafeGetCharAt(currentPos+n, 0));
}
- int GetRelativeCharacter(int n) {
+ int GetRelativeCharacter(Sci_Position n) {
if (n == 0)
return ch;
if (multiByteAccess) {
@@ -170,8 +170,8 @@ public:
posRelative = currentPos;
offsetRelative = 0;
}
- int diffRelative = n - offsetRelative;
- int posNew = multiByteAccess->GetRelativePosition(posRelative, diffRelative);
+ Sci_Position diffRelative = n - offsetRelative;
+ Sci_Position posNew = multiByteAccess->GetRelativePosition(posRelative, diffRelative);
int chReturn = multiByteAccess->GetCharacterAndWidth(posNew, 0);
posRelative = posNew;
currentPosLastRelative = currentPos;
@@ -220,8 +220,8 @@ public:
return true;
}
// Non-inline
- void GetCurrent(char *s, unsigned int len);
- void GetCurrentLowered(char *s, unsigned int len);
+ void GetCurrent(char *s, Sci_PositionU len);
+ void GetCurrentLowered(char *s, Sci_PositionU len);
};
#ifdef SCI_NAMESPACE