chore: update Lexilla to v5.5.1

This commit is contained in:
METANEOCORTEX\Kotti 2026-07-09 09:17:17 +02:00
parent 4e6054641f
commit 2212cf1298
29 changed files with 267 additions and 164 deletions

View File

@ -117,7 +117,6 @@ knownConditionTrueFalse:lexilla/lexers/LexJulia.cxx
unreadVariable:lexilla/lexers/LexJulia.cxx
variableScope:lexilla/lexers/LexJulia.cxx
variableScope:lexilla/lexers/LexLaTeX.cxx
constParameterReference:lexilla/lexers/LexLaTeX.cxx
constParameterReference:lexilla/lexers/LexLisp.cxx
constParameterPointer:lexilla/lexers/LexMagik.cxx
constParameterReference:lexilla/lexers/LexMagik.cxx

View File

@ -9,7 +9,7 @@
<meta name="keywords" content="Scintilla, SciTE, Editing Component, Text Editor" />
<meta name="Description"
content="www.scintilla.org is the home of the Scintilla editing component and SciTE text editor application." />
<meta name="Date.Modified" content="20260429" />
<meta name="Date.Modified" content="20260706" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<style type="text/css">
.logo {
@ -62,8 +62,8 @@
<font color="#FFCC99" size="4"> A library of language lexers for use with Scintilla</font>
</td>
<td width="40%" align="right">
<font color="#FFCC99" size="3">Release version 5.4.9<br />
Site last modified April 29 2026</font>
<font color="#FFCC99" size="3">Release version 5.5.1<br />
Site last modified July 6 2026</font>
</td>
<td width="20%">
&nbsp;
@ -78,11 +78,11 @@
</tr>
</table>
<ul id="versionlist">
<li>Version 5.5.1 improves Baan, HTML, and XML.</li>
<li>Version 5.5.0 improves Fortran and LaTeX.</li>
<li>Version 5.4.9 improves Assembler, C++, F#, LaTeX, Pascal, and Ruby.</li>
<li>Version 5.4.8 improves Batch, Forth, JavaScript, and JSON.</li>
<li>Version 5.4.7 adds EscapeSequence lexer escseq. Improves Errorlist, Makefile, Perl, and Progress.</li>
<li>Version 5.4.6 adds SINEX lexer. Improves Errorlist, Progress, and Python.</li>
<li>Version 5.4.5 improves Dart, Makefile, Nix, TOML, and Zig.</li>
</ul>
<ul id="menu">
<li id="remote1"><a href="https://www.scintilla.org/SciTEImage.html">Screenshot</a></li>

View File

@ -70,7 +70,7 @@
<h1>Lexilla Documentation</h1>
<p>Last edited 21 April 2021 NH</p>
<p>Last edited 24 May 2026 NH</p>
<h2>Introduction</h2>
@ -250,6 +250,21 @@
<span class="console">make check</span>.
</p>
<h2>Other implementations</h2>
<p>There are projects that provide libraries that implement the Lexilla protocol and can be used to augment or replace Lexilla.</p>
<p>
<a href="https://orbitalquark.github.io/scintillua">Scintillua</a> provides lexers implemented in Lua with
<a href="https://www.inf.puc-rio.br/~roberto/lpeg/">LPeg</a>.
</p>
<p>
<a href="https://github.com/Thorium/NppTreeSitter">NppTreeSitter</a> wraps
<a href="https://tree-sitter.github.io/tree-sitter/">Tree-sitter</a> for
<a href="https://notepad-plus-plus.org/">Notepad++</a>.
</p>
</body>
</html>

View File

@ -26,9 +26,9 @@
<table bgcolor="#CCCCCC" width="100%" cellspacing="0" cellpadding="8" border="0">
<tr>
<td>
<font size="4"> <a href="https://www.scintilla.org/lexilla549.zip">
<font size="4"> <a href="https://www.scintilla.org/lexilla551.zip">
Windows</a>&nbsp;&nbsp;
<a href="https://www.scintilla.org/lexilla549.tgz">
<a href="https://www.scintilla.org/lexilla551.tgz">
GTK/Linux</a>&nbsp;&nbsp;
</font>
</td>
@ -42,7 +42,7 @@
containing very few restrictions.
</p>
<h3>
Release 5.4.9
Release 5.5.1
</h3>
<h4>
Source Code
@ -50,8 +50,8 @@
The source code package contains all of the source code for Lexilla but no binary
executable code and is available in
<ul>
<li><a href="https://www.scintilla.org/lexilla549.zip">zip format</a> (1.5M) commonly used on Windows</li>
<li><a href="https://www.scintilla.org/lexilla549.tgz">tgz format</a> (1.1M) commonly used on Linux and compatible operating systems</li>
<li><a href="https://www.scintilla.org/lexilla551.zip">zip format</a> (1.5M) commonly used on Windows</li>
<li><a href="https://www.scintilla.org/lexilla551.tgz">tgz format</a> (1.1M) commonly used on Linux and compatible operating systems</li>
</ul>
Instructions for building on both Windows and Linux are included in the readme file.
<h4>

View File

@ -595,21 +595,48 @@
<td>Franck Reinquin</td>
<td>Peter C. Jones</td>
<td>Stefan Löffler</td>
<td>p4p3r of CYBERONE</td>
</tr>
</table>
<h2 id="Releases">Releases</h2>
<h3>
<a href="https://www.scintilla.org/lexilla551.zip">Release 5.5.1</a>
</h3>
<ul>
<li>
Released 6 July 2026.
</li>
<li>
Baan: Fix stack out-of-bounds write for with long preprocessor token and long identifier.
<a href="https://github.com/ScintillaOrg/lexilla/issues/364">Issue #364</a>.
</li>
<li>
XML and HTML: Change CDATA styling so that only the contents are in SCE_H_CDATA.
The "CDATA" is styled as SCE_H_SGML_COMMAND and the punctuation as SCE_H_SGML_DEFAULT.
<a href="https://github.com/ScintillaOrg/lexilla/issues/365">Issue #365</a>.
</li>
</ul>
<h3>
<a href="https://www.scintilla.org/lexilla550.zip">Release 5.5.0</a>
</h3>
<ul>
<li>
Released 29 April 2026.
Released 6 June 2026.
</li>
<li>
Fortran: Fold enumeration type and select rank. Treat GFortran !GCC$ as preprocessor.
<a href="https://github.com/ScintillaOrg/lexilla/issues/363">Issue #363</a>,
<a href="https://sourceforge.net/p/scintilla/bugs/2509/">Bug #2509</a>.
</li>
<li>
LaTeX: Fix issues at end of file.
<a href="https://github.com/ScintillaOrg/lexilla/issues/355">Issue #355</a>,
<a href="https://github.com/ScintillaOrg/lexilla/pull/358">Pull request #358</a>.
</li>
<li>
LaTeX: Fix non-terminating optional argument by lexing as SCE_L_MATH.
<a href="https://github.com/ScintillaOrg/lexilla/issues/360">Issue #360</a>.
</li>
</ul>
<h3>
<a href="https://www.scintilla.org/lexilla549.zip">Release 5.4.9</a>

View File

@ -474,9 +474,9 @@ void SCI_METHOD LexerAsm::Fold(Sci_PositionU startPos_, Sci_Position length, int
}
if (options.foldCommentExplicit && ((style == SCE_ASM_COMMENT) || options.foldExplicitAnywhere)) {
if (userDefinedFoldMarkers) {
if (styler.Match(i, options.foldExplicitStart.c_str())) {
if (styler.Match(i, options.foldExplicitStart)) {
levelNext++;
} else if (styler.Match(i, options.foldExplicitEnd.c_str())) {
} else if (styler.Match(i, options.foldExplicitEnd)) {
levelNext--;
}
} else {

View File

@ -1453,7 +1453,7 @@ void SCI_METHOD LexerCPP::Lex(Sci_PositionU startPos, Sci_Position length, int i
const std::string restOfLine = GetRestOfLine(styler, sc.currentPos + 5, false);
Tokens tokens = Tokenize(restOfLine);
if (!tokens.empty()) {
const std::string key = tokens[0];
const std::string &key = tokens[0];
preprocessorDefinitions.erase(key);
ppDefineHistory.emplace_back(lineCurrent, key, "", true, "");
definitionsChanged = true;
@ -1544,9 +1544,9 @@ void SCI_METHOD LexerCPP::Fold(Sci_PositionU startPos, Sci_Position length, int
}
if (options.foldComment && options.foldCommentExplicit && ((style == SCE_C_COMMENTLINE) || options.foldExplicitAnywhere)) {
if (userDefinedFoldMarkers) {
if (styler.Match(i, options.foldExplicitStart.c_str())) {
if (styler.Match(i, std::string_view(options.foldExplicitStart))) {
levelNext++;
} else if (styler.Match(i, options.foldExplicitEnd.c_str())) {
} else if (styler.Match(i, std::string_view(options.foldExplicitEnd))) {
levelNext--;
}
} else {
@ -1749,7 +1749,7 @@ void LexerCPP::EvaluateTokens(Tokens &tokens, const SymbolTable &preprocessorDef
// Evaluate logical negations
for (size_t j=0; (j+1)<tokens.size();) {
if (setNegationOp.Contains(tokens[j][0]) && (tokens[j] != "!=")) {
int isTrue = atoi(tokens[j+1].c_str());
bool isTrue = atoi(tokens[j+1].c_str());
if (tokens[j] == "!")
isTrue = !isTrue;
const Tokens::iterator itInsert =

View File

@ -37,8 +37,9 @@
using namespace Lexilla;
namespace {
static inline bool IsAWordChar(const unsigned int ch) {
inline bool IsAWordChar(const unsigned int ch) {
/* FIXME:
* The CSS spec allows "ISO 10646 characters U+00A1 and higher" to be treated as word chars.
* Unfortunately, we are only getting string bytes here, and not full unicode characters. We cannot guarantee
@ -75,7 +76,7 @@ inline int NestingLevelLookBehind(Sci_PositionU startPos, Accessor &styler) {
return nestingLevel;
}
static void ColouriseCssDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *keywordlists[], Accessor &styler) {
void ColouriseCssDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *keywordlists[], Accessor &styler) {
WordList &css1Props = *keywordlists[0];
WordList &pseudoClasses = *keywordlists[1];
WordList &css2Props = *keywordlists[2];
@ -505,7 +506,7 @@ static void ColouriseCssDoc(Sci_PositionU startPos, Sci_Position length, int ini
sc.Complete();
}
static void FoldCSSDoc(Sci_PositionU startPos, Sci_Position length, int, WordList *[], Accessor &styler) {
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;
Sci_PositionU endPos = startPos + length;
@ -555,7 +556,7 @@ static void FoldCSSDoc(Sci_PositionU startPos, Sci_Position length, int, WordLis
styler.SetLevel(lineCurrent, levelPrev | flagsNext);
}
static const char * const cssWordListDesc[] = {
const char * const cssWordListDesc[] = {
"CSS1 Properties",
"Pseudo-classes",
"CSS2 Properties",
@ -567,4 +568,6 @@ static const char * const cssWordListDesc[] = {
0
};
}
extern const LexerModule lmCss(SCLEX_CSS, ColouriseCssDoc, "css", FoldCSSDoc, cssWordListDesc);

View File

@ -34,6 +34,8 @@
using namespace Scintilla;
using namespace Lexilla;
namespace {
/* Nested comments require keeping the value of the nesting level for every
position in the document. But since scintilla always styles line by line,
we only need to store one value per line. The non-negative number indicates
@ -42,15 +44,15 @@ using namespace Lexilla;
// Underscore, letter, digit and universal alphas from C99 Appendix D.
static bool IsWordStart(int ch) {
bool IsWordStart(int ch) {
return (IsASCII(ch) && (isalpha(ch) || ch == '_')) || !IsASCII(ch);
}
static bool IsWord(int ch) {
bool IsWord(int ch) {
return (IsASCII(ch) && (isalnum(ch) || ch == '_')) || !IsASCII(ch);
}
static bool IsDoxygen(int ch) {
bool IsDoxygen(int ch) {
if (IsASCII(ch) && islower(ch))
return true;
if (ch == '$' || ch == '@' || ch == '\\' ||
@ -60,11 +62,11 @@ static bool IsDoxygen(int ch) {
return false;
}
static bool IsStringSuffix(int ch) {
bool IsStringSuffix(int ch) {
return ch == 'c' || ch == 'w' || ch == 'd';
}
static bool IsStreamCommentStyle(int style) {
bool IsStreamCommentStyle(int style) {
return style == SCE_D_COMMENT ||
style == SCE_D_COMMENTDOC ||
style == SCE_D_COMMENTDOCKEYWORD ||
@ -101,7 +103,7 @@ struct OptionsD {
}
};
static const char * const dWordLists[] = {
const char * const dWordLists[] = {
"Primary keywords and identifiers",
"Secondary keywords and identifiers",
"Documentation comment keywords",
@ -568,4 +570,6 @@ void SCI_METHOD LexerD::Fold(Sci_PositionU startPos, Sci_Position length, int in
}
}
}
extern const LexerModule lmD(SCLEX_D, LexerD::LexerFactoryD, "d", dWordLists);

View File

@ -30,24 +30,26 @@
using namespace Lexilla;
namespace {
/***********************************************/
static inline bool IsAWordChar(const int ch) {
inline bool IsAWordChar(const int ch) {
return (ch < 0x80) && (isalnum(ch) || ch == '_' || ch == '%');
}
/**********************************************/
static inline bool IsAWordStart(const int ch) {
inline bool IsAWordStart(const int ch) {
return (ch < 0x80) && (isalnum(ch));
}
/***************************************/
static inline bool IsABlank(unsigned int ch) {
inline bool IsABlank(unsigned int ch) {
return (ch == ' ') || (ch == 0x09) || (ch == 0x0b) ;
}
/***************************************/
static inline bool IsALineEnd(char ch) {
inline bool IsALineEnd(char ch) {
return ((ch == '\n') || (ch == '\r')) ;
}
/***************************************/
static Sci_PositionU GetContinuedPos(Sci_PositionU pos, Accessor &styler) {
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;
@ -60,7 +62,7 @@ static Sci_PositionU GetContinuedPos(Sci_PositionU pos, Accessor &styler) {
}
}
/***************************************/
static void ColouriseFortranDoc(Sci_PositionU startPos, Sci_Position length, int initStyle,
void ColouriseFortranDoc(Sci_PositionU startPos, Sci_Position length, int initStyle,
WordList *keywordlists[], Accessor &styler, bool isFixFormat) {
WordList &keywords = *keywordlists[0];
WordList &keywords2 = *keywordlists[1];
@ -94,7 +96,7 @@ static void ColouriseFortranDoc(Sci_PositionU startPos, Sci_Position length, int
if (sc.MatchIgnoreCase("cdec$") || sc.MatchIgnoreCase("*dec$") || sc.MatchIgnoreCase("!dec$") ||
sc.MatchIgnoreCase("cdir$") || sc.MatchIgnoreCase("*dir$") || sc.MatchIgnoreCase("!dir$") ||
sc.MatchIgnoreCase("cms$") || sc.MatchIgnoreCase("*ms$") || sc.MatchIgnoreCase("!ms$") ||
sc.chNext == '$') {
sc.MatchIgnoreCase("!gcc$") || sc.chNext == '$') {
sc.SetState(SCE_F_PREPROCESSOR);
} else {
sc.SetState(SCE_F_COMMENT);
@ -228,7 +230,7 @@ static void ColouriseFortranDoc(Sci_PositionU startPos, Sci_Position length, int
if (sc.state == SCE_F_DEFAULT) {
if (sc.ch == '!') {
if (sc.MatchIgnoreCase("!dec$") || sc.MatchIgnoreCase("!dir$") ||
sc.MatchIgnoreCase("!ms$") || sc.chNext == '$') {
sc.MatchIgnoreCase("!gcc$") || sc.MatchIgnoreCase("!ms$") || sc.chNext == '$') {
sc.SetState(SCE_F_PREPROCESSOR);
} else {
sc.SetState(SCE_F_COMMENT);
@ -257,7 +259,7 @@ static void ColouriseFortranDoc(Sci_PositionU startPos, Sci_Position length, int
sc.Complete();
}
/***************************************/
static void CheckLevelCommentLine(const unsigned int nComL,
void CheckLevelCommentLine(const unsigned int nComL,
Sci_Position nComColB[], Sci_Position nComColF[], Sci_Position &nComCur,
bool comLineB[], bool comLineF[], bool &comLineCur,
int &levelDeltaNext) {
@ -290,7 +292,7 @@ static void CheckLevelCommentLine(const unsigned int nComL,
}
}
/***************************************/
static void GetIfLineComment(Accessor &styler, bool isFixFormat, const Sci_Position line, bool &isComLine, Sci_Position &comCol) {
void GetIfLineComment(Accessor &styler, bool isFixFormat, const Sci_Position line, bool &isComLine, Sci_Position &comCol) {
Sci_Position col = 0;
isComLine = false;
Sci_Position pos = styler.LineStart(line);
@ -310,7 +312,7 @@ static void GetIfLineComment(Accessor &styler, bool isFixFormat, const Sci_Posit
}
}
/***************************************/
static void StepCommentLine(Accessor &styler, bool isFixFormat, Sci_Position lineCurrent, const unsigned int nComL,
void StepCommentLine(Accessor &styler, bool isFixFormat, Sci_Position lineCurrent, const unsigned int nComL,
Sci_Position nComColB[], Sci_Position nComColF[], Sci_Position &nComCur,
bool comLineB[], bool comLineF[], bool &comLineCur) {
Sci_Position nLineTotal = styler.GetLine(styler.Length()-1) + 1;
@ -339,7 +341,7 @@ static void StepCommentLine(Accessor &styler, bool isFixFormat, Sci_Position lin
}
}
/***************************************/
static void CheckBackComLines(Accessor &styler, bool isFixFormat, Sci_Position lineCurrent, const unsigned int nComL,
void CheckBackComLines(Accessor &styler, bool isFixFormat, Sci_Position lineCurrent, const unsigned int nComL,
Sci_Position nComColB[], Sci_Position nComColF[], Sci_Position nComCur,
bool comLineB[], bool comLineF[], bool &comLineCur) {
unsigned int nLines = nComL + nComL + 1;
@ -361,7 +363,7 @@ static void CheckBackComLines(Accessor &styler, bool isFixFormat, Sci_Position l
comL[copyTo] = comLineF[i];
nComCol[copyTo] = nComColF[i];
}
Sci_Position lineC = lineCurrent - nComL + 1;
Sci_PositionU iStart;
if (lineC <= 0) {
@ -373,7 +375,7 @@ static void CheckBackComLines(Accessor &styler, bool isFixFormat, Sci_Position l
}
bool levChanged = false;
int lev = styler.LevelAt(lineC) & SC_FOLDLEVELNUMBERMASK;
for (Sci_PositionU i=iStart; i<=nComL; i++) {
if (comL[i] && (!comL[i-1] || nComCol[i] != nComCol[i-1])) {
bool increase = true;
@ -417,7 +419,7 @@ static void CheckBackComLines(Accessor &styler, bool isFixFormat, Sci_Position l
}
/***************************************/
// To determine the folding level depending on keywords
static int classifyFoldPointFortran(const char* s, const char* prevWord, const char chNextNonBlank) {
int classifyFoldPointFortran(const char* s, const char* prevWord, const char chNextNonBlank) {
int lev = 0;
if ((strcmp(prevWord, "module") == 0 && strcmp(s, "subroutine") == 0)
@ -426,17 +428,18 @@ static int classifyFoldPointFortran(const char* s, const char* prevWord, const c
} else if (strcmp(s, "associate") == 0 || strcmp(s, "block") == 0
|| strcmp(s, "blockdata") == 0 || strcmp(s, "select") == 0
|| strcmp(s, "selecttype") == 0 || strcmp(s, "selectcase") == 0
|| strcmp(s, "do") == 0 || strcmp(s, "enum") ==0
|| strcmp(s, "do") == 0 || strcmp(s, "enum") == 0
|| strcmp(s, "function") == 0 || strcmp(s, "interface") == 0
|| strcmp(s, "module") == 0 || strcmp(s, "program") == 0
|| strcmp(s, "subroutine") == 0 || strcmp(s, "then") == 0
|| (strcmp(s, "type") == 0 && chNextNonBlank != '(')
|| (strcmp(s, "type") == 0 && chNextNonBlank != '(' && strcmp(prevWord, "enumeration") != 0)
|| strcmp(s, "enumeration") == 0
|| strcmp(s, "critical") == 0 || strcmp(s, "submodule") == 0){
if (strcmp(prevWord, "end") == 0)
lev = 0;
else
lev = 1;
} else if ((strcmp(s, "end") == 0 && chNextNonBlank != '=')
} else if ((strcmp(s, "end") == 0 && chNextNonBlank != '=' && chNextNonBlank != '(')
|| strcmp(s, "endassociate") == 0 || strcmp(s, "endblock") == 0
|| strcmp(s, "endblockdata") == 0 || strcmp(s, "endselect") == 0
|| strcmp(s, "enddo") == 0 || strcmp(s, "endenum") ==0
@ -462,7 +465,7 @@ static int classifyFoldPointFortran(const char* s, const char* prevWord, const c
}
/***************************************/
// Folding the code
static void FoldFortranDoc(Sci_PositionU startPos, Sci_Position length, int initStyle,
void FoldFortranDoc(Sci_PositionU startPos, Sci_Position length, int initStyle,
Accessor &styler, bool isFixFormat) {
bool foldComment = styler.GetPropertyInt("fold.comment", 1) != 0;
@ -515,7 +518,7 @@ static void FoldFortranDoc(Sci_PositionU startPos, Sci_Position length, int init
GetIfLineComment(styler, isFixFormat, chL, comLineF[i], nComColF[i]);
}
GetIfLineComment(styler, isFixFormat, lineCurrent, comLineCur, nComCur);
CheckBackComLines(styler, isFixFormat, lineCurrent, nComL, nComColB, nComColF, nComCur,
CheckBackComLines(styler, isFixFormat, lineCurrent, nComL, nComColB, nComColF, nComCur,
comLineB, comLineF, comLineCur);
}
int levelCurrent = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK;
@ -636,7 +639,8 @@ static void FoldFortranDoc(Sci_PositionU startPos, Sci_Position length, int init
levelCurrent--;
}
} else if ((strcmp(prevWord, "select") == 0 && strcmp(s, "case") == 0) || strcmp(s, "selectcase") == 0 ||
(strcmp(prevWord, "select") == 0 && strcmp(s, "type") == 0) || strcmp(s, "selecttype") == 0) {
(strcmp(prevWord, "select") == 0 && strcmp(s, "type") == 0) || strcmp(s, "selecttype") == 0 ||
(strcmp(prevWord, "select") == 0 && strcmp(s, "rank") == 0)) {
levelDeltaNext += 2;
} else if ((strcmp(s, "case") == 0 && chNextNonBlank == '(') || (strcmp(prevWord, "case") == 0 && strcmp(s, "default") == 0) ||
(strcmp(prevWord, "type") == 0 && strcmp(s, "is") == 0) ||
@ -693,32 +697,35 @@ static void FoldFortranDoc(Sci_PositionU startPos, Sci_Position length, int init
/***************************************/
}
/***************************************/
static const char * const FortranWordLists[] = {
const char * const FortranWordLists[] = {
"Primary keywords and identifiers",
"Intrinsic functions",
"Extended and user defined functions",
0,
};
/***************************************/
static void ColouriseFortranDocFreeFormat(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *keywordlists[],
void ColouriseFortranDocFreeFormat(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *keywordlists[],
Accessor &styler) {
ColouriseFortranDoc(startPos, length, initStyle, keywordlists, styler, false);
}
/***************************************/
static void ColouriseFortranDocFixFormat(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *keywordlists[],
void ColouriseFortranDocFixFormat(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *keywordlists[],
Accessor &styler) {
ColouriseFortranDoc(startPos, length, initStyle, keywordlists, styler, true);
}
/***************************************/
static void FoldFortranDocFreeFormat(Sci_PositionU startPos, Sci_Position length, int initStyle,
void FoldFortranDocFreeFormat(Sci_PositionU startPos, Sci_Position length, int initStyle,
WordList *[], Accessor &styler) {
FoldFortranDoc(startPos, length, initStyle,styler, false);
}
/***************************************/
static void FoldFortranDocFixFormat(Sci_PositionU startPos, Sci_Position length, int initStyle,
void FoldFortranDocFixFormat(Sci_PositionU startPos, Sci_Position length, int initStyle,
WordList *[], Accessor &styler) {
FoldFortranDoc(startPos, length, initStyle,styler, true);
}
}
/***************************************/
extern const LexerModule lmFortran(SCLEX_FORTRAN, ColouriseFortranDocFreeFormat, "fortran", FoldFortranDocFreeFormat, FortranWordLists);
extern const LexerModule lmF77(SCLEX_F77, ColouriseFortranDocFixFormat, "f77", FoldFortranDocFixFormat, FortranWordLists);

View File

@ -1693,6 +1693,9 @@ void SCI_METHOD LexerHTML::Lex(Sci_PositionU startPos, Sci_Position length, int
}
} else if ((state != SCE_H_SGML_BLOCK_DEFAULT) && isWordCdata(i + 1, i + 7, styler)) {
state = SCE_H_CDATA;
styler.ColourTo(i + 1, SCE_H_SGML_DEFAULT);
styler.ColourTo(i + 1 + 5, SCE_H_SGML_COMMAND);
styler.ColourTo(i + 1 + 5 + 1, SCE_H_SGML_DEFAULT);
} else {
styler.ColourTo(i, SCE_H_SGML_DEFAULT); // <! is default
beforeLanguage = scriptLanguage;
@ -1944,7 +1947,8 @@ void SCI_METHOD LexerHTML::Lex(Sci_PositionU startPos, Sci_Position length, int
break;
case SCE_H_CDATA:
if ((chPrev2 == ']') && (chPrev == ']') && (ch == '>')) {
styler.ColourTo(i, StateToPrint);
styler.ColourTo(i - 3, StateToPrint);
styler.ColourTo(i, SCE_H_SGML_DEFAULT);
state = SCE_H_DEFAULT;
levelCurrent--;
}
@ -2570,7 +2574,7 @@ void SCI_METHOD LexerHTML::Lex(Sci_PositionU startPos, Sci_Position length, int
} else if (ch == '$' && IsPhpWordStart(chNext)) {
styler.ColourTo(i - 1, StateToPrint);
state = SCE_HPHP_HSTRING_VARIABLE;
} else if (styler.Match(i, phpStringDelimiter.c_str())) {
} else if (styler.Match(i, phpStringDelimiter)) {
if (phpStringDelimiter == "\"") {
styler.ColourTo(i, StateToPrint);
state = SCE_HPHP_DEFAULT;
@ -2594,7 +2598,7 @@ void SCI_METHOD LexerHTML::Lex(Sci_PositionU startPos, Sci_Position length, int
styler.ColourTo(i, StateToPrint);
state = SCE_HPHP_DEFAULT;
}
} else if (lineStartVisibleChars == 1 && styler.Match(i, phpStringDelimiter.c_str())) {
} else if (lineStartVisibleChars == 1 && styler.Match(i, phpStringDelimiter)) {
const int psdLength = static_cast<int>(phpStringDelimiter.length());
if (!IsPhpWordChar(styler.SafeGetCharAt(i + psdLength))) {
i += (((i + psdLength) < lengthDoc) ? psdLength : lengthDoc) - 1;

View File

@ -40,7 +40,9 @@
using namespace Scintilla;
using namespace Lexilla;
static const int MAX_JULIA_IDENT_CHARS = 1023;
namespace {
const int MAX_JULIA_IDENT_CHARS = 1023;
// Options used for LexerJulia
struct OptionsJulia {
@ -199,7 +201,7 @@ Sci_Position SCI_METHOD LexerJulia::WordListSet(int n, const char *wl) {
return firstModification;
}
static inline bool IsJuliaOperator(int ch) {
inline bool IsJuliaOperator(int ch) {
if (ch == '%' || ch == '^' || ch == '&' || ch == '*' ||
ch == '-' || ch == '+' || ch == '=' || ch == '|' ||
ch == '<' || ch == '>' || ch == '/' || ch == '~' ||
@ -210,7 +212,7 @@ static inline bool IsJuliaOperator(int ch) {
}
// The list contains non-ascii unary operators
static inline bool IsJuliaUnaryOperator (int ch) {
inline bool IsJuliaUnaryOperator (int ch) {
if (ch == 0x00ac || ch == 0x221a || ch == 0x221b ||
ch == 0x221c || ch == 0x22c6 || ch == 0x00b1 ||
ch == 0x2213 ) {
@ -219,7 +221,7 @@ static inline bool IsJuliaUnaryOperator (int ch) {
return false;
}
static inline bool IsJuliaParen (int ch) {
inline bool IsJuliaParen (int ch) {
if (ch == '(' || ch == ')' || ch == '{' || ch == '}' ||
ch == '[' || ch == ']' ) {
return true;
@ -230,7 +232,7 @@ static inline bool IsJuliaParen (int ch) {
// Unicode parsing from Julia source code:
// https://github.com/JuliaLang/julia/blob/master/src/flisp/julia_extensions.c
// keep the same function name to be easy to find again
static int is_wc_cat_id_start(uint32_t wc) {
int is_wc_cat_id_start(uint32_t wc) {
const CharacterCategory cat = CategoriseCharacter((int) wc);
return (cat == ccLu || cat == ccLl ||
@ -291,7 +293,7 @@ static int is_wc_cat_id_start(uint32_t wc) {
(wc >= 0x1D7CE && wc <= 0x1D7E1)); // 𝟎 through 𝟗 (inclusive), 𝟘 through 𝟡 (inclusive)
}
static inline bool IsIdentifierFirstCharacter (int ch) {
inline bool IsIdentifierFirstCharacter (int ch) {
if (IsASCII(ch)) {
return (bool) (isalpha(ch) || ch == '_');
}
@ -302,7 +304,7 @@ static inline bool IsIdentifierFirstCharacter (int ch) {
return is_wc_cat_id_start((uint32_t) ch);
}
static inline bool IsIdentifierCharacter (int ch) {
inline bool IsIdentifierCharacter (int ch) {
if (IsASCII(ch)) {
return (bool) (isalnum(ch) || ch == '_' || ch == '!');
}
@ -328,7 +330,7 @@ static inline bool IsIdentifierCharacter (int ch) {
}
// keep the same function name to be easy to find again
static const uint32_t opsuffs[] = {
const uint32_t opsuffs[] = {
0x00b2, // ²
0x00b3, // ³
0x00b9, // ¹
@ -447,10 +449,10 @@ static const uint32_t opsuffs[] = {
0xa71c, // ꜜ
0xa71d // ꜝ
};
static const size_t opsuffs_len = sizeof(opsuffs) / (sizeof(uint32_t));
const size_t opsuffs_len = sizeof(opsuffs) / (sizeof(uint32_t));
// keep the same function name to be easy to find again
static bool jl_op_suffix_char(uint32_t wc) {
bool jl_op_suffix_char(uint32_t wc) {
if (wc < 0xA1 || wc > 0x10ffff) {
return false;
}
@ -469,7 +471,7 @@ static bool jl_op_suffix_char(uint32_t wc) {
}
// keep the same function name to be easy to find again
static bool never_id_char(uint32_t wc) {
bool never_id_char(uint32_t wc) {
const CharacterCategory cat = CategoriseCharacter((int) wc);
return (
// spaces and control characters:
@ -494,7 +496,7 @@ static bool never_id_char(uint32_t wc) {
}
static bool IsOperatorFirstCharacter (int ch) {
bool IsOperatorFirstCharacter (int ch) {
if (IsASCII(ch)) {
if (IsJuliaOperator(ch) ||
ch == '!' || ch == '?' ||
@ -513,7 +515,7 @@ static bool IsOperatorFirstCharacter (int ch) {
return false;
}
static bool IsOperatorCharacter (int ch) {
bool IsOperatorCharacter (int ch) {
if (IsOperatorFirstCharacter(ch) ||
(!IsASCII(ch) && jl_op_suffix_char((uint32_t) ch)) ) {
return true;
@ -521,14 +523,14 @@ static bool IsOperatorCharacter (int ch) {
return false;
}
static bool CheckBoundsIndexing(char *str) {
bool CheckBoundsIndexing(char *str) {
if (strcmp("begin", str) == 0 || strcmp("end", str) == 0 ) {
return true;
}
return false;
}
static int CheckKeywordFoldPoint(char *str) {
int CheckKeywordFoldPoint(char *str) {
if (strcmp ("if", str) == 0 ||
strcmp ("for", str) == 0 ||
strcmp ("while", str) == 0 ||
@ -551,7 +553,7 @@ static int CheckKeywordFoldPoint(char *str) {
return 0;
}
static bool IsNumberExpon(int ch, int base) {
bool IsNumberExpon(int ch, int base) {
if ((base == 10 && (ch == 'e' || ch == 'E' || ch == 'f')) ||
(base == 16 && (ch == 'p' || ch == 'P'))) {
return true;
@ -560,7 +562,7 @@ static bool IsNumberExpon(int ch, int base) {
}
/* Scans a sequence of digits, returning true if it found any. */
static bool ScanDigits(StyleContext& sc, int base, bool allow_sep) {
bool ScanDigits(StyleContext& sc, int base, bool allow_sep) {
bool found = false;
for (;;) {
if (IsADigit(sc.chNext, base) || (allow_sep && sc.chNext == '_')) {
@ -573,7 +575,7 @@ static bool ScanDigits(StyleContext& sc, int base, bool allow_sep) {
return found;
}
static inline bool ScanNHexas(StyleContext &sc, int max) {
inline bool ScanNHexas(StyleContext &sc, int max) {
int n = 0;
bool error = false;
@ -589,7 +591,7 @@ static inline bool ScanNHexas(StyleContext &sc, int max) {
return error;
}
static void resumeCharacter(StyleContext &sc, bool lexerror) {
void resumeCharacter(StyleContext &sc, bool lexerror) {
bool error = false;
// ''' case
@ -674,11 +676,11 @@ static void resumeCharacter(StyleContext &sc, bool lexerror) {
}
}
static inline bool IsACharacter(StyleContext &sc) {
inline bool IsACharacter(StyleContext &sc) {
return (sc.chPrev == '\'' && sc.chNext == '\'');
}
static void ScanParenInterpolation(StyleContext &sc) {
void ScanParenInterpolation(StyleContext &sc) {
// TODO: no syntax highlighting inside a string interpolation
// Level of nested parenthesis
@ -712,7 +714,7 @@ static void ScanParenInterpolation(StyleContext &sc) {
/*
* Start parsing a number, parse the base.
*/
static void initNumber (StyleContext &sc, int &base, bool &with_dot) {
void initNumber (StyleContext &sc, int &base, bool &with_dot) {
base = 10;
with_dot = false;
sc.SetState(SCE_JULIA_NUMBER);
@ -741,7 +743,7 @@ static void initNumber (StyleContext &sc, int &base, bool &with_dot) {
* The `triple` argument specifies if it is a triple-quote String or Command.
* Interpolation is detected (with `$`), and parsed if `allow_interp` is true.
*/
static void resumeStringLike(StyleContext &sc, int quote, bool triple, bool allow_interp, bool full_highlight) {
void resumeStringLike(StyleContext &sc, int quote, bool triple, bool allow_interp, bool full_highlight) {
int stylePrev = sc.state;
bool checkcurrent = false;
@ -799,15 +801,15 @@ static void resumeStringLike(StyleContext &sc, int quote, bool triple, bool allo
}
}
static void resumeCommand(StyleContext &sc, bool triple, bool allow_interp) {
void resumeCommand(StyleContext &sc, bool triple, bool allow_interp) {
return resumeStringLike(sc, '`', triple, allow_interp, true);
}
static void resumeString(StyleContext &sc, bool triple, bool allow_interp) {
void resumeString(StyleContext &sc, bool triple, bool allow_interp) {
return resumeStringLike(sc, '"', triple, allow_interp, true);
}
static void resumeNumber (StyleContext &sc, int base, bool &with_dot, bool lexerror) {
void resumeNumber (StyleContext &sc, int base, bool &with_dot, bool lexerror) {
if (IsNumberExpon(sc.ch, base)) {
if (IsADigit(sc.chNext) || sc.chNext == '+' || sc.chNext == '-') {
sc.Forward();
@ -837,7 +839,7 @@ static void resumeNumber (StyleContext &sc, int base, bool &with_dot, bool lexer
}
}
static void resumeOperator (StyleContext &sc) {
void resumeOperator (StyleContext &sc) {
if (sc.chNext == ':' && (sc.ch == ':' || sc.ch == '<' ||
(sc.ch == '>' && (sc.chPrev != '-' && sc.chPrev != '=')))) {
// Case `:a=>:b`
@ -1259,4 +1261,6 @@ void SCI_METHOD LexerJulia::Fold(Sci_PositionU startPos, Sci_Position length, in
}
}
}
extern const LexerModule lmJulia(SCLEX_JULIA, LexerJulia::LexerFactoryJulia, "julia", juliaWordLists);

View File

@ -5,14 +5,14 @@
// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
// Modified by G. HU in 2013. Added folding, syntax highting inside math environments, and changed some minor behaviors.
// Modified by G. HU in 2013. Added folding, syntax highlighting inside math environments, and changed some minor behaviors.
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <stdarg.h>
#include <assert.h>
#include <ctype.h>
#include <cstdlib>
#include <cassert>
#include <cstring>
#include <cctype>
#include <cstdio>
#include <cstdarg>
#include <string>
#include <string_view>
@ -37,6 +37,8 @@ using namespace Lexilla;
using namespace std;
namespace {
struct latexFoldSave {
latexFoldSave() : structLev(0) {
for (int i = 0; i < 8; ++i) openBegins[i] = 0;
@ -103,24 +105,24 @@ public:
}
};
static bool latexIsSpecial(int ch) {
bool latexIsSpecial(int ch) noexcept {
return (ch == '#') || (ch == '$') || (ch == '%') || (ch == '&') || (ch == '_') ||
(ch == '{') || (ch == '}') || (ch == ' ');
}
static bool latexIsBlank(int ch) {
bool latexIsBlank(int ch) noexcept {
return (ch == ' ') || (ch == '\t');
}
static bool latexIsBlankAndNL(int ch) {
bool latexIsBlankAndNL(int ch) noexcept {
return (ch == ' ') || (ch == '\t') || (ch == '\r') || (ch == '\n');
}
static bool latexIsLetter(int ch) {
bool latexIsLetter(int ch) {
return IsASCII(ch) && isalpha(ch);
}
static bool latexIsTagValid(Sci_Position &i, Sci_Position l, Accessor &styler) {
bool latexIsTagValid(Sci_Position &i, Sci_Position l, Accessor &styler) {
while (i < l) {
if (styler.SafeGetCharAt(i) == '{') {
while (i < l) {
@ -140,22 +142,33 @@ static bool latexIsTagValid(Sci_Position &i, Sci_Position l, Accessor &styler) {
return false;
}
static bool latexNextNotBlankIs(Sci_Position i, Accessor &styler, char needle) {
char ch;
while (i < styler.Length()) {
ch = styler.SafeGetCharAt(i);
if (!latexIsBlankAndNL(ch) && ch != '*') {
if (ch == needle)
return true;
else
return false;
// Determine if there is a valid [optional argument] after a command.
// Heuristic searches for '[' followed by non-special characters then ']'
// but is not exhaustive and may fail.
bool latexIsCmdOpt(Sci_Position i, Accessor &styler) {
bool beforeOptional = true;
for (; i < styler.Length(); i++) {
const char ch = styler.SafeGetCharAt(i);
if (beforeOptional) {
if (ch == '[') {
beforeOptional = false;
} else if (!latexIsBlankAndNL(ch) && ch != '*') {
return false;
}
} else {
if (ch == ']') { // Whole [optional] -> success
return true;
}
if (ch > ' ' && latexIsSpecial(ch)) {
// Prefer inner highlighting inside optional command argument
return false;
}
}
i++;
}
return false;
}
static bool latexLastWordIs(Sci_Position start, Accessor &styler, const char *needle) {
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;
@ -170,7 +183,7 @@ static bool latexLastWordIs(Sci_Position start, Accessor &styler, const char *ne
return (strcmp(s, needle) == 0);
}
static bool latexLastWordIsMathEnv(Sci_Position pos, Accessor &styler) {
bool latexLastWordIsMathEnv(Sci_Position pos, Accessor &styler) {
Sci_Position i, j;
char s[32];
const char *mathEnvs[] = { "align", "alignat", "flalign", "gather",
@ -192,7 +205,7 @@ static bool latexLastWordIsMathEnv(Sci_Position pos, Accessor &styler) {
return false;
}
static inline void latexStateReset(int &mode, int &state) {
void latexStateReset(int mode, int &state) noexcept {
switch (mode) {
case 1: state = SCE_L_MATH; break;
case 2: state = SCE_L_MATH2; break;
@ -285,7 +298,7 @@ void SCI_METHOD LexerLaTeX::Lex(Sci_PositionU startPos, Sci_Position length, int
case SCE_L_COMMAND :
if (!latexIsLetter(chNext)) {
styler.ColourTo(i, state);
if (latexNextNotBlankIs(i + 1, styler, '[' )) {
if (latexIsCmdOpt(i + 1, styler)) {
state = SCE_L_CMDOPT;
} else if (latexLastWordIs(i, styler, "\\begin")) {
state = SCE_L_TAG;
@ -490,7 +503,7 @@ void SCI_METHOD LexerLaTeX::Lex(Sci_PositionU startPos, Sci_Position length, int
styler.Flush();
}
static int latexFoldSaveToInt(const latexFoldSave &save) {
int latexFoldSaveToInt(const latexFoldSave &save) {
int sum = 0;
for (int i = 0; i <= save.structLev; ++i)
sum += save.openBegins[i];
@ -562,8 +575,10 @@ void SCI_METHOD LexerLaTeX::Fold(Sci_PositionU startPos, Sci_Position length, in
styler.Flush();
}
static const char *const emptyWordListDesc[] = {
0
const char *const emptyWordListDesc[] = {
nullptr
};
}
extern const LexerModule lmLatex(SCLEX_LATEX, LexerLaTeX::LexerFactoryLaTeX, "latex", emptyWordListDesc);

View File

@ -52,21 +52,23 @@
using namespace Lexilla;
static bool IsMatlabCommentChar(int c) {
namespace {
bool IsMatlabCommentChar(int c) {
return (c == '%') ;
}
static bool IsOctaveCommentChar(int c) {
bool IsOctaveCommentChar(int c) {
return (c == '%' || c == '#') ;
}
static inline int LowerCase(int c) {
inline int LowerCase(int c) {
if (c >= 'A' && c <= 'Z')
return 'a' + c - 'A';
return c;
}
static int CheckKeywordFoldPoint(char *str) {
int CheckKeywordFoldPoint(char *str) {
if (strcmp ("if", str) == 0 ||
strcmp ("for", str) == 0 ||
strcmp ("switch", str) == 0 ||
@ -88,7 +90,7 @@ static int CheckKeywordFoldPoint(char *str) {
return 0;
}
static bool IsSpaceToEOL(Sci_Position startPos, Accessor &styler) {
bool IsSpaceToEOL(Sci_Position startPos, Accessor &styler) {
Sci_Position line = styler.GetLine(startPos);
Sci_Position eol_pos = styler.LineStart(line + 1) - 1;
for (Sci_Position i = startPos; i < eol_pos; i++) {
@ -107,7 +109,7 @@ static bool IsSpaceToEOL(Sci_Position startPos, Accessor &styler) {
#define MATLAB_STATE_IN_CLASS_SCOPE (1 <<(MATLAB_STATE_FLAGS_OFFSET+1))
#define MATLAB_STATE_IN_ARGUMENTS_SCOPE (1 <<(MATLAB_STATE_FLAGS_OFFSET+2))
static int ComposeLineState(int commentDepth,
int ComposeLineState(int commentDepth,
int foldingLevel,
int expectingArgumentsBlock,
int inClassScope,
@ -125,7 +127,7 @@ static int ComposeLineState(int commentDepth,
& MATLAB_STATE_IN_ARGUMENTS_SCOPE);
}
static void ColouriseMatlabOctaveDoc(
void ColouriseMatlabOctaveDoc(
Sci_PositionU startPos, Sci_Position length, int initStyle,
WordList *keywordlists[], Accessor &styler,
bool (*IsCommentChar)(int),
@ -419,17 +421,17 @@ static void ColouriseMatlabOctaveDoc(
sc.Complete();
}
static void ColouriseMatlabDoc(Sci_PositionU startPos, Sci_Position length, int initStyle,
void ColouriseMatlabDoc(Sci_PositionU startPos, Sci_Position length, int initStyle,
WordList *keywordlists[], Accessor &styler) {
ColouriseMatlabOctaveDoc(startPos, length, initStyle, keywordlists, styler, IsMatlabCommentChar, true);
}
static void ColouriseOctaveDoc(Sci_PositionU startPos, Sci_Position length, int initStyle,
void ColouriseOctaveDoc(Sci_PositionU startPos, Sci_Position length, int initStyle,
WordList *keywordlists[], Accessor &styler) {
ColouriseMatlabOctaveDoc(startPos, length, initStyle, keywordlists, styler, IsOctaveCommentChar, false);
}
static void FoldMatlabOctaveDoc(Sci_PositionU startPos, Sci_Position length, int initStyle,
void FoldMatlabOctaveDoc(Sci_PositionU startPos, Sci_Position length, int initStyle,
WordList *[], Accessor &styler,
bool (*IsComment)(int ch)) {
@ -503,26 +505,28 @@ static void FoldMatlabOctaveDoc(Sci_PositionU startPos, Sci_Position length, int
}
}
static void FoldMatlabDoc(Sci_PositionU startPos, Sci_Position length, int initStyle,
void FoldMatlabDoc(Sci_PositionU startPos, Sci_Position length, int initStyle,
WordList *keywordlists[], Accessor &styler) {
FoldMatlabOctaveDoc(startPos, length, initStyle, keywordlists, styler, IsMatlabCommentChar);
}
static void FoldOctaveDoc(Sci_PositionU startPos, Sci_Position length, int initStyle,
void FoldOctaveDoc(Sci_PositionU startPos, Sci_Position length, int initStyle,
WordList *keywordlists[], Accessor &styler) {
FoldMatlabOctaveDoc(startPos, length, initStyle, keywordlists, styler, IsOctaveCommentChar);
}
static const char * const matlabWordListDesc[] = {
const char * const matlabWordListDesc[] = {
"Keywords",
0
};
static const char * const octaveWordListDesc[] = {
const char * const octaveWordListDesc[] = {
"Keywords",
0
};
}
extern const LexerModule lmMatlab(SCLEX_MATLAB, ColouriseMatlabDoc, "matlab", FoldMatlabDoc, matlabWordListDesc);
extern const LexerModule lmOctave(SCLEX_OCTAVE, ColouriseOctaveDoc, "octave", FoldOctaveDoc, octaveWordListDesc);

View File

@ -117,6 +117,7 @@ contains requires
#include <string>
#include <string_view>
#include <map>
#include <algorithm>
#include "ILexer.h"
#include "Scintilla.h"

View File

@ -620,7 +620,7 @@ void SCI_METHOD LexerPython::Lex(Sci_PositionU startPos, Sci_Position length, in
StyleContext sc(startPos, endPos - startPos, initStyle, styler);
bool indentGood = true;
Sci_Position startIndicator = sc.currentPos;
Sci_Position startIndent = sc.currentPos;
bool inContinuedString = false;
for (; sc.More(); sc.Forward()) {
@ -638,8 +638,8 @@ void SCI_METHOD LexerPython::Lex(Sci_PositionU startPos, Sci_Position length, in
indentGood = (spaceFlags & wsTab) == 0;
}
if (!indentGood) {
styler.IndicatorFill(startIndicator, sc.currentPos, indicatorWhitespace, 0);
startIndicator = sc.currentPos;
styler.IndicatorFill(startIndent, sc.currentPos, indicatorWhitespace, 0);
startIndent = sc.currentPos;
}
}
@ -857,8 +857,8 @@ void SCI_METHOD LexerPython::Lex(Sci_PositionU startPos, Sci_Position length, in
// End of code to find the end of a state
if (!indentGood && !IsASpaceOrTab(sc.ch)) {
styler.IndicatorFill(startIndicator, sc.currentPos, indicatorWhitespace, 1);
startIndicator = sc.currentPos;
styler.IndicatorFill(startIndent, sc.currentPos, indicatorWhitespace, 1);
startIndent = sc.currentPos;
indentGood = true;
}
@ -928,7 +928,7 @@ void SCI_METHOD LexerPython::Lex(Sci_PositionU startPos, Sci_Position length, in
}
}
}
styler.IndicatorFill(startIndicator, sc.currentPos, indicatorWhitespace, 0);
styler.IndicatorFill(startIndent, sc.currentPos, indicatorWhitespace, 0);
sc.Complete();
}

View File

@ -28,11 +28,11 @@ using namespace Lexilla;
namespace {
inline bool IsAWordChar(int ch) noexcept {
return (ch < 0x80) && (isalnum(ch) || ch == '.' || ch == '_');
return IsAlphaNumeric(ch) || ch == '.' || ch == '_';
}
inline bool IsAWordStart(int ch) noexcept {
return (ch < 0x80) && (isalnum(ch) || ch == '_');
return IsAlphaNumeric(ch) || ch == '_';
}
constexpr bool IsAnOperator(int ch) noexcept {

View File

@ -16,6 +16,7 @@
#include <string_view>
#include <vector>
#include <map>
#include <algorithm>
#include "ILexer.h"
#include "Scintilla.h"

View File

@ -28,17 +28,19 @@
using namespace Lexilla;
namespace {
// Extended to accept accented characters
static inline bool IsAWordChar(int ch) {
inline bool IsAWordChar(int ch) {
return ch >= 0x80 ||
(isalnum(ch) || ch == '_' || ch ==':' || ch=='.'); // : name space separator
}
static inline bool IsAWordStart(int ch) {
inline bool IsAWordStart(int ch) {
return ch >= 0x80 || (ch ==':' || isalpha(ch) || ch == '_');
}
static inline bool IsANumberChar(int ch) {
inline bool IsANumberChar(int ch) {
// Not exactly following number definition (several dots are seen as OK, etc.)
// but probably enough in most cases.
return (ch < 0x80) &&
@ -46,7 +48,7 @@ static inline bool IsANumberChar(int ch) {
ch == '.' || ch == '-' || ch == '+');
}
static void ColouriseTCLDoc(Sci_PositionU startPos, Sci_Position length, int , WordList *keywordlists[], Accessor &styler) {
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)
const bool foldComment = styler.GetPropertyInt("fold.comment") != 0;
const bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;
@ -358,7 +360,7 @@ next:
sc.Complete();
}
static const char *const tclWordListDesc[] = {
const char *const tclWordListDesc[] = {
"TCL Keywords",
"TK Keywords",
"iTCL Keywords",
@ -371,5 +373,7 @@ static const char *const tclWordListDesc[] = {
0
};
}
// this code supports folding in the colourizer
extern const LexerModule lmTCL(SCLEX_TCL, ColouriseTCLDoc, "tcl", 0, tclWordListDesc);

View File

@ -33,6 +33,8 @@
using namespace Lexilla;
namespace {
static void ColouriseVHDLDoc(
Sci_PositionU startPos,
Sci_Position length,
@ -42,22 +44,22 @@ static void ColouriseVHDLDoc(
/***************************************/
static inline bool IsAWordChar(const int ch) {
return (ch < 0x80) && (isalnum(ch) || ch == '.' || ch == '_' );
inline bool IsAWordChar(const int ch) {
return IsAlphaNumeric(ch) || ch == '.' || ch == '_';
}
/***************************************/
static inline bool IsAWordStart(const int ch) {
return (ch < 0x80) && (isalnum(ch) || ch == '_');
inline bool IsAWordStart(const int ch) {
return IsAlphaNumeric(ch) || ch == '_';
}
/***************************************/
static inline bool IsABlank(unsigned int ch) {
inline bool IsABlank(unsigned int ch) {
return (ch == ' ') || (ch == 0x09) || (ch == 0x0b) ;
}
/***************************************/
static void ColouriseVHDLDoc(
void ColouriseVHDLDoc(
Sci_PositionU startPos,
Sci_Position length,
int initStyle,
@ -177,7 +179,7 @@ static void ColouriseVHDLDoc(
sc.Complete();
}
//=============================================================================
static bool IsCommentLine(Sci_Position line, Accessor &styler) {
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++) {
@ -190,7 +192,7 @@ static bool IsCommentLine(Sci_Position line, Accessor &styler) {
}
return false;
}
static bool IsCommentBlockStart(Sci_Position line, Accessor &styler)
bool IsCommentBlockStart(Sci_Position line, Accessor &styler)
{
Sci_Position pos = styler.LineStart(line);
Sci_Position eol_pos = styler.LineStart(line + 1) - 1;
@ -204,7 +206,7 @@ static bool IsCommentBlockStart(Sci_Position line, Accessor &styler)
return false;
}
static bool IsCommentBlockEnd(Sci_Position line, Accessor &styler)
bool IsCommentBlockEnd(Sci_Position line, Accessor &styler)
{
Sci_Position pos = styler.LineStart(line);
Sci_Position eol_pos = styler.LineStart(line + 1) - 1;
@ -219,14 +221,14 @@ static bool IsCommentBlockEnd(Sci_Position line, Accessor &styler)
return false;
}
static bool IsCommentStyle(char style)
bool IsCommentStyle(char style)
{
return style == SCE_VHDL_BLOCK_COMMENT || style == SCE_VHDL_COMMENT || style == SCE_VHDL_COMMENTLINEBANG;
}
//=============================================================================
// Folding the code
static void FoldNoBoxVHDLDoc(
void FoldNoBoxVHDLDoc(
Sci_PositionU startPos,
Sci_Position length,
int,
@ -289,7 +291,7 @@ static void FoldNoBoxVHDLDoc(
char s[32];
Sci_PositionU k;
for(k=0; (k<31 ) && (k<end-j+1 ); k++) {
s[k] = static_cast<char>(tolower(styler[j+k]));
s[k] = MakeLowerCase(styler[j+k]);
}
s[k] = '\0';
@ -387,7 +389,7 @@ static void FoldNoBoxVHDLDoc(
char s[32];
Sci_PositionU k;
for(k=0; (k<31 ) && (k<i-lastStart+1 ); k++) {
s[k] = static_cast<char>(tolower(styler[lastStart+k]));
s[k] = MakeLowerCase(styler[lastStart+k]);
}
s[k] = '\0';
@ -543,13 +545,13 @@ static void FoldNoBoxVHDLDoc(
}
//=============================================================================
static void FoldVHDLDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *[],
void FoldVHDLDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *[],
Accessor &styler) {
FoldNoBoxVHDLDoc(startPos, length, initStyle, styler);
}
//=============================================================================
static const char * const VHDLWordLists[] = {
const char * const VHDLWordLists[] = {
"Keywords",
"Operators",
"Attributes",
@ -560,6 +562,7 @@ static const char * const VHDLWordLists[] = {
0,
};
}
extern const LexerModule lmVHDL(SCLEX_VHDL, ColouriseVHDLDoc, "vhdl", FoldVHDLDoc, VHDLWordLists);

View File

@ -193,7 +193,7 @@ void ColouriseYAMLLine(
}
const Sci_PositionU i2 = i;
while ((i < startComment) && lineBuffer[i]) {
if (!(IsASCII(lineBuffer[i]) && isdigit(lineBuffer[i])) && lineBuffer[i] != '-'
if (!(IsASCII(lineBuffer[i]) && IsADigit(lineBuffer[i])) && lineBuffer[i] != '-'
&& lineBuffer[i] != '.' && lineBuffer[i] != ',' && lineBuffer[i] != ' ') {
styler.ColourTo(startLine + startComment - 1, SCE_YAML_DEFAULT);
if (startComment < lengthLine)

View File

@ -20,6 +20,15 @@ using namespace Lexilla;
namespace Lexilla {
bool LexAccessor::Match(Sci_Position pos, std::string_view sv) {
for (unsigned int i = 0; i < sv.size(); i++) {
if (sv[i] != SafeGetCharAt(pos + i)) {
return false;
}
}
return true;
}
bool LexAccessor::MatchIgnoreCase(Sci_Position pos, const char *s) {
assert(s);
for (; *s; s++, pos++) {

View File

@ -113,6 +113,7 @@ public:
}
return true;
}
[[nodiscard]] bool Match(Sci_Position pos, std::string_view sv);
bool MatchIgnoreCase(Sci_Position pos, const char *s);
// Get first len - 1 characters in range [startPos_, endPos_).

View File

@ -10,6 +10,7 @@
#include <cstring>
#include <string>
#include <string_view>
#include <algorithm>
#include <iterator>
#include <memory>

View File

@ -34,6 +34,7 @@
#include <cstdarg>
// C++ standard library
#include <stdexcept>
#include <utility>
#include <string>
#include <string_view>
@ -46,7 +47,7 @@
#include <iterator>
#include <functional>
#include <memory>
#include <regex>
#include <ios>
#include <iostream>
#include <sstream>
#include <fstream>

View File

@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
<key>CFBundleShortVersionString</key>
<string>5.4.9</string>
<string>5.5.1</string>
<key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string>
<key>NSHumanReadableCopyright</key>

View File

@ -900,7 +900,7 @@
buildSettings = {
CLANG_CXX_LANGUAGE_STANDARD = "gnu++17";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 5.4.9;
CURRENT_PROJECT_VERSION = 5.5.1;
DEAD_CODE_STRIPPING = YES;
DEVELOPMENT_TEAM = 4F446KW87E;
DYLIB_COMPATIBILITY_VERSION = 1;
@ -928,7 +928,7 @@
buildSettings = {
CLANG_CXX_LANGUAGE_STANDARD = "gnu++17";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 5.4.9;
CURRENT_PROJECT_VERSION = 5.5.1;
DEAD_CODE_STRIPPING = YES;
DEVELOPMENT_TEAM = 4F446KW87E;
DYLIB_COMPATIBILITY_VERSION = 1;

View File

@ -4,8 +4,8 @@
#include <windows.h>
#define VERSION_LEXILLA "5.4.9"
#define VERSION_WORDS 5, 4, 9, 0
#define VERSION_LEXILLA "5.5.1"
#define VERSION_WORDS 5, 5, 1, 0
VS_VERSION_INFO VERSIONINFO
FILEVERSION VERSION_WORDS

View File

@ -1 +1 @@
549
551