aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--lexers/LexCPP.cxx42
-rw-r--r--lexers/LexDiff.cxx2
-rw-r--r--lexers/LexErrorList.cxx6
-rw-r--r--lexers/LexLua.cxx30
-rw-r--r--lexers/LexProps.cxx18
-rw-r--r--lexers/LexPython.cxx24
6 files changed, 61 insertions, 61 deletions
diff --git a/lexers/LexCPP.cxx b/lexers/LexCPP.cxx
index 777ae0c48..d08ed7eac 100644
--- a/lexers/LexCPP.cxx
+++ b/lexers/LexCPP.cxx
@@ -56,7 +56,7 @@ bool IsSpaceEquiv(int state) {
bool FollowsPostfixOperator(StyleContext &sc, LexAccessor &styler) {
Sci_Position pos = (Sci_Position) sc.currentPos;
while (--pos > 0) {
- char ch = styler[pos];
+ const char ch = styler[pos];
if (ch == '+' || ch == '-') {
return styler[pos - 1] == ch;
}
@@ -68,9 +68,9 @@ bool followsReturnKeyword(StyleContext &sc, LexAccessor &styler) {
// Don't look at styles, so no need to flush.
Sci_Position pos = (Sci_Position) sc.currentPos;
Sci_Position currentLine = styler.GetLine(pos);
- Sci_Position lineStartPos = styler.LineStart(currentLine);
+ const Sci_Position lineStartPos = styler.LineStart(currentLine);
while (--pos > lineStartPos) {
- char ch = styler.SafeGetCharAt(pos);
+ const char ch = styler.SafeGetCharAt(pos);
if (ch != ' ' && ch != '\t') {
break;
}
@@ -141,14 +141,14 @@ BracketPair FindBracketPair(std::vector<std::string> &tokens) {
}
void highlightTaskMarker(StyleContext &sc, LexAccessor &styler,
- int activity, WordList &markerList, bool caseSensitive){
+ int activity, const WordList &markerList, bool caseSensitive){
if ((isoperator(sc.chPrev) || IsASpace(sc.chPrev)) && markerList.Length()) {
const int lengthMarker = 50;
char marker[lengthMarker+1];
Sci_Position currPos = (Sci_Position) sc.currentPos;
int i = 0;
while (i < lengthMarker) {
- char ch = styler.SafeGetCharAt(currPos + i);
+ const char ch = styler.SafeGetCharAt(currPos + i);
if (IsASpace(ch) || isoperator(ch)) {
break;
}
@@ -203,9 +203,9 @@ std::string GetRestOfLine(LexAccessor &styler, Sci_Position start, bool allowSpa
std::string restOfLine;
Sci_Position i =0;
char ch = styler.SafeGetCharAt(start, '\n');
- Sci_Position endLine = styler.LineEnd(styler.GetLine(start));
+ const Sci_Position endLine = styler.LineEnd(styler.GetLine(start));
while (((start+i) < endLine) && (ch != '\r')) {
- char chNext = styler.SafeGetCharAt(start + i + 1, '\n');
+ const char chNext = styler.SafeGetCharAt(start + i + 1, '\n');
if (ch == '/' && (chNext == '/' || chNext == '*'))
break;
if (allowSpace || (ch != ' '))
@@ -526,8 +526,8 @@ public:
return subStyles.Length(styleBase);
}
int SCI_METHOD StyleFromSubStyle(int subStyle) override {
- int styleBase = subStyles.BaseStyle(MaskActive(subStyle));
- int active = subStyle & activeFlag;
+ const int styleBase = subStyles.BaseStyle(MaskActive(subStyle));
+ const int active = subStyle & activeFlag;
return styleBase | active;
}
int SCI_METHOD PrimaryStyleFromStyle(int style) override {
@@ -637,7 +637,7 @@ Sci_Position SCI_METHOD LexerCPP::WordListSet(int n, const char *wl) {
struct After {
Sci_Position line;
explicit After(Sci_Position line_) : line(line_) {}
- bool operator()(PPDefinition &p) const {
+ bool operator()(const PPDefinition &p) const {
return p.line > line;
}
};
@@ -829,7 +829,7 @@ void SCI_METHOD LexerCPP::Lex(Sci_PositionU startPos, Sci_Position length, int i
const bool raw = literalString && sc.chPrev == 'R' && !setInvalidRawFirst.Contains(sc.chNext);
if (raw)
s[lenS--] = '\0';
- bool valid =
+ const bool valid =
(lenS == 0) ||
((lenS == 1) && ((s[0] == 'L') || (s[0] == 'u') || (s[0] == 'U'))) ||
((lenS == 2) && literalString && (s[0] == 'u') && (s[1] == '8'));
@@ -1198,7 +1198,7 @@ void SCI_METHOD LexerCPP::Lex(Sci_PositionU startPos, Sci_Position length, int i
if (!preproc.CurrentIfTaken()) {
// Similar to #if
std::string restOfLine = GetRestOfLine(styler, sc.currentPos + 2, true);
- bool ifGood = EvaluateExpression(restOfLine, preprocessorDefinitions);
+ const bool ifGood = EvaluateExpression(restOfLine, preprocessorDefinitions);
if (ifGood) {
preproc.InvertCurrentLevel();
activitySet = preproc.IsInactive() ? activeFlag : 0;
@@ -1294,7 +1294,7 @@ void SCI_METHOD LexerCPP::Fold(Sci_PositionU startPos, Sci_Position length, int
LexAccessor styler(pAccess);
- Sci_PositionU endPos = startPos + length;
+ const Sci_PositionU endPos = startPos + length;
int visibleChars = 0;
bool inLineComment = false;
Sci_Position lineCurrent = styler.GetLine(startPos);
@@ -1309,12 +1309,12 @@ void SCI_METHOD LexerCPP::Fold(Sci_PositionU startPos, Sci_Position length, int
int style = MaskActive(initStyle);
const bool userDefinedFoldMarkers = !options.foldExplicitStart.empty() && !options.foldExplicitEnd.empty();
for (Sci_PositionU i = startPos; i < endPos; i++) {
- char ch = chNext;
+ const char ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
- int stylePrev = style;
+ const int stylePrev = style;
style = styleNext;
styleNext = MaskActive(styler.StyleAt(i + 1));
- bool atEOL = i == (lineStartNext-1);
+ const bool atEOL = i == (lineStartNext-1);
if ((style == SCE_C_COMMENTLINE) || (style == SCE_C_COMMENTLINEDOC))
inLineComment = true;
if (options.foldComment && options.foldCommentMultiline && IsStreamCommentStyle(style) && !inLineComment) {
@@ -1334,7 +1334,7 @@ void SCI_METHOD LexerCPP::Fold(Sci_PositionU startPos, Sci_Position length, int
}
} else {
if ((ch == '/') && (chNext == '/')) {
- char chNext2 = styler.SafeGetCharAt(i + 2);
+ const char chNext2 = styler.SafeGetCharAt(i + 2);
if (chNext2 == '{') {
levelNext++;
} else if (chNext2 == '}') {
@@ -1537,14 +1537,14 @@ void LexerCPP::EvaluateTokens(std::vector<std::string> &tokens, const SymbolTabl
for (int prec=precArithmetic; prec <= precLogical; prec++) {
// Looking at 3 tokens at a time so end at 2 before end
for (size_t k=0; (k+2)<tokens.size();) {
- char chOp = tokens[k+1][0];
+ const char chOp = tokens[k+1][0];
if (
((prec==precArithmetic) && setArithmethicOp.Contains(chOp)) ||
((prec==precRelative) && setRelOp.Contains(chOp)) ||
((prec==precLogical) && setLogicalOp.Contains(chOp))
) {
- int valA = atoi(tokens[k].c_str());
- int valB = atoi(tokens[k+2].c_str());
+ const int valA = atoi(tokens[k].c_str());
+ const int valB = atoi(tokens[k+2].c_str());
int result = 0;
if (tokens[k+1] == "+")
result = valA + valB;
@@ -1631,7 +1631,7 @@ bool LexerCPP::EvaluateExpression(const std::string &expr, const SymbolTable &pr
EvaluateTokens(tokens, preprocessorDefinitions);
// "0" or "" -> false else true
- bool isFalse = tokens.empty() ||
+ const bool isFalse = tokens.empty() ||
((tokens.size() == 1) && ((tokens[0] == "") || tokens[0] == "0"));
return !isFalse;
}
diff --git a/lexers/LexDiff.cxx b/lexers/LexDiff.cxx
index bfc22b9f6..9512550c8 100644
--- a/lexers/LexDiff.cxx
+++ b/lexers/LexDiff.cxx
@@ -126,7 +126,7 @@ static void FoldDiffDoc(Sci_PositionU startPos, Sci_Position length, int, WordLi
int nextLevel;
do {
- int lineType = styler.StyleAt(curLineStart);
+ const int lineType = styler.StyleAt(curLineStart);
if (lineType == SCE_DIFF_COMMAND)
nextLevel = SC_FOLDLEVELBASE | SC_FOLDLEVELHEADERFLAG;
else if (lineType == SCE_DIFF_HEADER)
diff --git a/lexers/LexErrorList.cxx b/lexers/LexErrorList.cxx
index b1b99c503..871902a88 100644
--- a/lexers/LexErrorList.cxx
+++ b/lexers/LexErrorList.cxx
@@ -142,7 +142,7 @@ static int RecogniseErrorListLine(const char *lineBuffer, Sci_PositionU lengthLi
// CTags: <identifier>\t<filename>\t<message>
// Lua 5 traceback: \t<filename>:<line>:<message>
// Lua 5.1: <exe>: <filename>:<line>:<message>
- bool initialTab = (lineBuffer[0] == '\t');
+ const bool initialTab = (lineBuffer[0] == '\t');
bool initialColonPart = false;
bool canBeCtags = !initialTab; // For ctags must have an identifier with no spaces then a tab
enum { stInitial,
@@ -152,7 +152,7 @@ static int RecogniseErrorListLine(const char *lineBuffer, Sci_PositionU lengthLi
stUnrecognized
} state = stInitial;
for (Sci_PositionU i = 0; i < lengthLine; i++) {
- char ch = lineBuffer[i];
+ const char ch = lineBuffer[i];
char chNext = ' ';
if ((i + 1) < lengthLine)
chNext = lineBuffer[i + 1];
@@ -367,7 +367,7 @@ static void ColouriseErrorListDoc(Sci_PositionU startPos, Sci_Position length, i
// diagnostics, style the path and line number separately from the rest of the
// 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;
+ const bool valueSeparate = styler.GetPropertyInt("lexer.errorlist.value.separate", 0) != 0;
// property lexer.errorlist.escape.sequences
// Set to 1 to interpret escape sequences.
diff --git a/lexers/LexLua.cxx b/lexers/LexLua.cxx
index 1086b40e8..9e86b8a14 100644
--- a/lexers/LexLua.cxx
+++ b/lexers/LexLua.cxx
@@ -48,14 +48,14 @@ static void ColouriseLuaDoc(
WordList *keywordlists[],
Accessor &styler) {
- WordList &keywords = *keywordlists[0];
- WordList &keywords2 = *keywordlists[1];
- WordList &keywords3 = *keywordlists[2];
- WordList &keywords4 = *keywordlists[3];
- WordList &keywords5 = *keywordlists[4];
- WordList &keywords6 = *keywordlists[5];
- WordList &keywords7 = *keywordlists[6];
- WordList &keywords8 = *keywordlists[7];
+ const WordList &keywords = *keywordlists[0];
+ const WordList &keywords2 = *keywordlists[1];
+ const WordList &keywords3 = *keywordlists[2];
+ const WordList &keywords4 = *keywordlists[3];
+ const WordList &keywords5 = *keywordlists[4];
+ const WordList &keywords6 = *keywordlists[5];
+ const WordList &keywords7 = *keywordlists[6];
+ const WordList &keywords8 = *keywordlists[7];
// Accepts accented characters
CharacterSet setWordStart(CharacterSet::setAlpha, "_", 0x80, true);
@@ -77,7 +77,7 @@ static void ColouriseLuaDoc(
int stringWs = 0;
if (initStyle == SCE_LUA_LITERALSTRING || initStyle == SCE_LUA_COMMENT ||
initStyle == SCE_LUA_STRING || initStyle == SCE_LUA_CHARACTER) {
- int lineState = styler.GetLineState(currentLine - 1);
+ const int lineState = styler.GetLineState(currentLine - 1);
nestLevel = lineState >> 9;
sepCount = lineState & 0xFF;
stringWs = lineState & 0x100;
@@ -257,7 +257,7 @@ static void ColouriseLuaDoc(
}
} else if (sc.state == SCE_LUA_LITERALSTRING || sc.state == SCE_LUA_COMMENT) {
if (sc.ch == '[') {
- int sep = LongDelimCheck(sc);
+ const int sep = LongDelimCheck(sc);
if (sep == 1 && sepCount == 1) { // [[-only allowed to nest
nestLevel++;
sc.Forward();
@@ -349,21 +349,21 @@ static void ColouriseLuaDoc(
static void FoldLuaDoc(Sci_PositionU startPos, Sci_Position length, int /* initStyle */, WordList *[],
Accessor &styler) {
- Sci_PositionU lengthDoc = startPos + length;
+ const Sci_PositionU lengthDoc = startPos + length;
int visibleChars = 0;
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;
+ const bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;
int styleNext = styler.StyleAt(startPos);
for (Sci_PositionU i = startPos; i < lengthDoc; i++) {
- char ch = chNext;
+ const char ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
- int style = styleNext;
+ const int style = styleNext;
styleNext = styler.StyleAt(i + 1);
- bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n');
+ const bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n');
if (style == SCE_LUA_WORD) {
if (ch == 'i' || ch == 'd' || ch == 'f' || ch == 'e' || ch == 'r' || ch == 'u') {
char s[10] = "";
diff --git a/lexers/LexProps.cxx b/lexers/LexProps.cxx
index 45af72928..ddfecb06f 100644
--- a/lexers/LexProps.cxx
+++ b/lexers/LexProps.cxx
@@ -37,7 +37,7 @@ static inline bool isassignchar(unsigned char ch) {
}
static void ColourisePropsLine(
- char *lineBuffer,
+ const char *lineBuffer,
Sci_PositionU lengthLine,
Sci_PositionU startLine,
Sci_PositionU endPos,
@@ -91,7 +91,7 @@ static void ColourisePropsDoc(Sci_PositionU startPos, Sci_Position length, int,
// For properties files, set to 0 to style all lines that start with whitespace in the default style.
// This is not suitable for SciTE .properties files which use indentation for flow control but
// can be used for RFC2822 text where indentation is used for continuation lines.
- bool allowInitialSpaces = styler.GetPropertyInt("lexer.props.allow.initial.spaces", 1) != 0;
+ const bool allowInitialSpaces = styler.GetPropertyInt("lexer.props.allow.initial.spaces", 1) != 0;
for (Sci_PositionU i = startPos; i < startPos + length; i++) {
lineBuffer[linePos++] = styler[i];
@@ -111,9 +111,9 @@ static void ColourisePropsDoc(Sci_PositionU startPos, Sci_Position length, int,
// adaption by ksc, using the "} else {" trick of 1.53
// 030721
static void FoldPropsDoc(Sci_PositionU startPos, Sci_Position length, int, WordList *[], Accessor &styler) {
- bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;
+ const bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;
- Sci_PositionU endPos = startPos + length;
+ const Sci_PositionU endPos = startPos + length;
int visibleChars = 0;
Sci_Position lineCurrent = styler.GetLine(startPos);
@@ -123,12 +123,12 @@ static void FoldPropsDoc(Sci_PositionU startPos, Sci_Position length, int, WordL
int lev;
for (Sci_PositionU i = startPos; i < endPos; i++) {
- char ch = chNext;
+ const char ch = chNext;
chNext = styler[i+1];
- int style = styleNext;
+ const int style = styleNext;
styleNext = styler.StyleAt(i + 1);
- bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n');
+ const bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n');
if (style == SCE_PROPS_SECTION) {
headerPoint = true;
@@ -138,7 +138,7 @@ static void FoldPropsDoc(Sci_PositionU startPos, Sci_Position length, int, WordL
lev = SC_FOLDLEVELBASE;
if (lineCurrent > 0) {
- int levelPrevious = styler.LevelAt(lineCurrent - 1);
+ const int levelPrevious = styler.LevelAt(lineCurrent - 1);
if (levelPrevious & SC_FOLDLEVELHEADERFLAG) {
lev = SC_FOLDLEVELBASE + 1;
@@ -169,7 +169,7 @@ static void FoldPropsDoc(Sci_PositionU startPos, Sci_Position length, int, WordL
}
if (lineCurrent > 0) {
- int levelPrevious = styler.LevelAt(lineCurrent - 1);
+ const int levelPrevious = styler.LevelAt(lineCurrent - 1);
if (levelPrevious & SC_FOLDLEVELHEADERFLAG) {
lev = SC_FOLDLEVELBASE + 1;
} else {
diff --git a/lexers/LexPython.cxx b/lexers/LexPython.cxx
index 62ed83c95..f80721e2a 100644
--- a/lexers/LexPython.cxx
+++ b/lexers/LexPython.cxx
@@ -147,7 +147,7 @@ int PopFromStateStack(std::vector<SingleFStringExpState> &stack, SingleFStringEx
int GetPyStringState(Accessor &styler, Sci_Position i, Sci_PositionU *nextIndex, literalsAllowed allowed) {
char ch = styler.SafeGetCharAt(i);
char chNext = styler.SafeGetCharAt(i + 1);
- int firstIsF = (ch == 'f' || ch == 'F');
+ const int firstIsF = (ch == 'f' || ch == 'F');
// Advance beyond r, u, or ur prefix (or r, b, or br in Python 2.7+ and r, f, or fr in Python 3.6+), but bail if there are any unexpected chars
if (ch == 'r' || ch == 'R') {
@@ -211,7 +211,7 @@ static bool IsFirstNonWhitespace(Sci_Position pos, Accessor &styler) {
Sci_Position line = styler.GetLine(pos);
Sci_Position start_pos = styler.LineStart(line);
for (Sci_Position i = start_pos; i < pos; i++) {
- char ch = styler[i];
+ const char ch = styler[i];
if (!(ch == ' ' || ch == '\t'))
return false;
}
@@ -365,7 +365,7 @@ public:
return subStyles.Length(styleBase);
}
int SCI_METHOD StyleFromSubStyle(int subStyle) override {
- int styleBase = subStyles.BaseStyle(subStyle);
+ const int styleBase = subStyles.BaseStyle(subStyle);
return styleBase;
}
int SCI_METHOD PrimaryStyleFromStyle(int style) override {
@@ -481,7 +481,7 @@ void SCI_METHOD LexerPython::Lex(Sci_PositionU startPos, Sci_Position length, in
// Look for backslash-continued lines
while (lineCurrent > 0) {
Sci_Position eolPos = styler.LineStart(lineCurrent) - 1;
- int eolStyle = styler.StyleAt(eolPos);
+ const int eolStyle = styler.StyleAt(eolPos);
if (eolStyle == SCE_P_STRING
|| eolStyle == SCE_P_CHARACTER
|| eolStyle == SCE_P_STRINGEOL) {
@@ -694,8 +694,8 @@ void SCI_METHOD LexerPython::Lex(Sci_PositionU startPos, Sci_Position length, in
if (!fstringStateStack.empty() && (sc.ch == '\'' || sc.ch == '"')) {
long matching_stack_i = -1;
for (unsigned long stack_i = 0; stack_i < fstringStateStack.size() && matching_stack_i == -1; stack_i++) {
- int stack_state = fstringStateStack[stack_i].state;
- char quote = GetPyStringQuoteChar(stack_state);
+ const int stack_state = fstringStateStack[stack_i].state;
+ const char quote = GetPyStringQuoteChar(stack_state);
if (sc.ch == quote) {
if (IsPySingleQuoteStringState(stack_state)) {
matching_stack_i = stack_i;
@@ -799,9 +799,9 @@ void SCI_METHOD LexerPython::Lex(Sci_PositionU startPos, Sci_Position length, in
static bool IsCommentLine(Sci_Position line, Accessor &styler) {
Sci_Position pos = styler.LineStart(line);
- Sci_Position eol_pos = styler.LineStart(line + 1) - 1;
+ const Sci_Position eol_pos = styler.LineStart(line + 1) - 1;
for (Sci_Position i = pos; i < eol_pos; i++) {
- char ch = styler[i];
+ const char ch = styler[i];
if (ch == '#')
return true;
else if (ch != ' ' && ch != '\t')
@@ -810,8 +810,8 @@ static bool IsCommentLine(Sci_Position line, Accessor &styler) {
return false;
}
-static bool IsQuoteLine(Sci_Position line, Accessor &styler) {
- int style = styler.StyleAt(styler.LineStart(line)) & 31;
+static bool IsQuoteLine(Sci_Position line, const Accessor &styler) {
+ const int style = styler.StyleAt(styler.LineStart(line)) & 31;
return ((style == SCE_P_TRIPLE) || (style == SCE_P_TRIPLEDOUBLE));
}
@@ -864,7 +864,7 @@ void SCI_METHOD LexerPython::Fold(Sci_PositionU startPos, Sci_Position length, i
// Information about next line is only available if not at end of document
indentNext = styler.IndentAmount(lineNext, &spaceFlags, NULL);
Sci_Position lookAtPos = (styler.LineStart(lineNext) == styler.Length()) ? styler.Length() - 1 : styler.LineStart(lineNext);
- int style = styler.StyleAt(lookAtPos) & 31;
+ const int style = styler.StyleAt(lookAtPos) & 31;
quote = options.foldQuotes && ((style == SCE_P_TRIPLE) || (style == SCE_P_TRIPLEDOUBLE));
}
const int quote_start = (quote && !prevQuote);
@@ -910,7 +910,7 @@ void SCI_METHOD LexerPython::Fold(Sci_PositionU startPos, Sci_Position length, i
int skipLevel = levelAfterComments;
while (--skipLine > lineCurrent) {
- int skipLineIndent = styler.IndentAmount(skipLine, &spaceFlags, NULL);
+ const int skipLineIndent = styler.IndentAmount(skipLine, &spaceFlags, NULL);
if (options.foldCompact) {
if ((skipLineIndent & SC_FOLDLEVELNUMBERMASK) > levelAfterComments)