Skip to content

Commit

Permalink
#298 Use an unnamed namespace to avoid potential conflicts.
Browse files Browse the repository at this point in the history
Remove static since no longer needed.
  • Loading branch information
nyamatongwe committed Jan 4, 2025
1 parent 511ccff commit 7b15e41
Showing 1 changed file with 17 additions and 13 deletions.
30 changes: 17 additions & 13 deletions lexers/LexPascal.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,9 @@ contains requires

using namespace Lexilla;

static void GetRangeLowered(Sci_PositionU start,
namespace {

void GetRangeLowered(Sci_PositionU start,
Sci_PositionU end,
Accessor &styler,
char *s,
Expand All @@ -146,7 +148,7 @@ static void GetRangeLowered(Sci_PositionU start,
s[i] = '\0';
}

static void GetForwardRangeLowered(Sci_PositionU start,
void GetForwardRangeLowered(Sci_PositionU start,
CharacterSet &charSet,
Accessor &styler,
char *s,
Expand All @@ -170,7 +172,7 @@ enum {
stateFoldMaskAll = 0x0FFF
};

static void ClassifyPascalWord(WordList *keywordlists[], StyleContext &sc, int &curLineState, bool bSmartHighlighting) {
void ClassifyPascalWord(WordList *keywordlists[], StyleContext &sc, int &curLineState, bool bSmartHighlighting) {
WordList& keywords = *keywordlists[0];

char s[100];
Expand Down Expand Up @@ -215,7 +217,7 @@ static void ClassifyPascalWord(WordList *keywordlists[], StyleContext &sc, int &
sc.SetState(SCE_PAS_DEFAULT);
}

static void ColourisePascalDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *keywordlists[],
void ColourisePascalDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *keywordlists[],
Accessor &styler) {
bool bSmartHighlighting = styler.GetPropertyInt("lexer.pascal.smart.highlighting", 1) != 0;

Expand Down Expand Up @@ -345,11 +347,11 @@ static void ColourisePascalDoc(Sci_PositionU startPos, Sci_Position length, int
sc.Complete();
}

static bool IsStreamCommentStyle(int style) {
bool IsStreamCommentStyle(int style) {
return style == SCE_PAS_COMMENT || style == SCE_PAS_COMMENT2;
}

static bool IsCommentLine(Sci_Position line, Accessor &styler) {
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++) {
Expand All @@ -365,16 +367,16 @@ static bool IsCommentLine(Sci_Position line, Accessor &styler) {
return false;
}

static unsigned int GetFoldInPreprocessorLevelFlag(int lineFoldStateCurrent) {
unsigned int GetFoldInPreprocessorLevelFlag(int lineFoldStateCurrent) {
return lineFoldStateCurrent & stateFoldInPreprocessorLevelMask;
}

static void SetFoldInPreprocessorLevelFlag(int &lineFoldStateCurrent, unsigned int nestLevel) {
void SetFoldInPreprocessorLevelFlag(int &lineFoldStateCurrent, unsigned int nestLevel) {
lineFoldStateCurrent &= ~stateFoldInPreprocessorLevelMask;
lineFoldStateCurrent |= nestLevel & stateFoldInPreprocessorLevelMask;
}

static void ClassifyPascalPreprocessorFoldPoint(int &levelCurrent, int &lineFoldStateCurrent,
void ClassifyPascalPreprocessorFoldPoint(int &levelCurrent, int &lineFoldStateCurrent,
Sci_PositionU startPos, Accessor &styler) {
CharacterSet setWord(CharacterSet::setAlpha);

Expand Down Expand Up @@ -407,7 +409,7 @@ static void ClassifyPascalPreprocessorFoldPoint(int &levelCurrent, int &lineFold
}
}

static Sci_PositionU SkipWhiteSpace(Sci_PositionU currentPos, Sci_PositionU endPos,
Sci_PositionU SkipWhiteSpace(Sci_PositionU currentPos, Sci_PositionU endPos,
Accessor &styler, bool includeChars = false) {
CharacterSet setWord(CharacterSet::setAlphaNum, "_");
Sci_PositionU j = currentPos + 1;
Expand All @@ -420,7 +422,7 @@ static Sci_PositionU SkipWhiteSpace(Sci_PositionU currentPos, Sci_PositionU endP
return j;
}

static void ClassifyPascalWordFoldPoint(int &levelCurrent, int &lineFoldStateCurrent,
void ClassifyPascalWordFoldPoint(int &levelCurrent, int &lineFoldStateCurrent,
Sci_Position startPos, Sci_PositionU endPos,
Sci_PositionU lastStart, Sci_PositionU currentPos, Accessor &styler) {
char s[100];
Expand Down Expand Up @@ -518,7 +520,7 @@ static void ClassifyPascalWordFoldPoint(int &levelCurrent, int &lineFoldStateCur
}
}

static void FoldPascalDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *[],
void FoldPascalDoc(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;
Expand Down Expand Up @@ -609,9 +611,11 @@ static void FoldPascalDoc(Sci_PositionU startPos, Sci_Position length, int initS
styler.SetLevel(lineCurrent, lev);
}

static const char * const pascalWordListDesc[] = {
const char * const pascalWordListDesc[] = {
"Keywords",
0
};

}

extern const LexerModule lmPascal(SCLEX_PASCAL, ColourisePascalDoc, "pascal", FoldPascalDoc, pascalWordListDesc);

0 comments on commit 7b15e41

Please sign in to comment.