Update to scintilla 5.5.0 & Lexilla 5.3.2

Sintilla Release 5.5.0 (https://www.scintilla.org/scintilla550.zip)

    Released 23 April 2024.
    Add elements for inactive additional selections SC_ELEMENT_SELECTION_INACTIVE_ADDITIONAL_TEXT and SC_ELEMENT_SELECTION_INACTIVE_ADDITIONAL_BACK. When not set these default to SC_ELEMENT_SELECTION_INACTIVE_TEXT and SC_ELEMENT_SELECTION_INACTIVE_BACK. Bug #2417.
    On Cocoa, avoid use of NSUserDefaults which will soon require justification when used in applications on the App Store.
    Fix Win32 IME crash in windowed mode. Bug #2433.
    Scale reverse arrow cursor for margins to match other cursors when user changes pointer size. Bug #2321.

Lexilla Release 5.3.2 (https://www.scintilla.org/lexilla532.zip)

    Released 23 April 2024.
    COBOL: Stop string literal continuing over line end. Issue #229.
    COBOL: Stop doc comment assigning different styles to \r and \n at line end. Issue #229.
    COBOL: Recognize keywords that start with 'V'. Issue #230.
    COBOL: Recognize comments after tag or that start with '/'. Issue #231.
    HTML: Implement substyles for tags, attributes, and identifiers SCE_H_TAG, SCE_H_ATTRIBUTE, SCE_HJ_WORD, SCE_HJA_WORD, SCE_HB_WORD, SCE_HP_WORD, SCE_HPHP_WORD.
    HTML: Implement context-sensitive attributes. "tag.attribute" matches "attribute" only inside "tag".
    HTML: Match standard handling of comments. Issue #232.
    Lua: Implement substyles for identifiers SCE_LUA_IDENTIFIER.
    Ruby: Allow non-ASCII here-doc delimiters. Issue #234.
    Ruby: Allow modifier if, unless, while and until after heredoc delimiter. Issue #236.
    Rust: Recognize raw identifiers. Issue #239, Pull request #240.

Close #15042
This commit is contained in:
Christian Grasser 2024-04-24 18:45:59 +02:00 committed by Don Ho
parent c823ca8150
commit 881e8c285e
119 changed files with 1916 additions and 765 deletions

View File

@ -30,6 +30,7 @@
**.php text
**.vb text
**.asm text
**.cob text
**.cmake text
**.d text
**.diff text

View File

@ -12,7 +12,7 @@ jobs:
cpp_compiler: [clang++]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Install Scintilla source
run: |
(cd .. && wget --no-verbose https://www.scintilla.org/scintilla500.zip)
@ -21,7 +21,7 @@ jobs:
run: (cd test/unit && make DEBUG=1 CXX=${{matrix.cpp_compiler}} test)
- name: Build Lexilla
run: (cd src && make DEBUG=1 CXX=${{matrix.cpp_compiler}})
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: liblexilla.dylib
path: bin/liblexilla.dylib

View File

@ -8,7 +8,7 @@ jobs:
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Preparing nmake
uses: ilammy/msvc-dev-cmd@v1
with:
@ -31,7 +31,7 @@ jobs:
cd src
nmake -f lexilla.mak DEBUG=1
cd ..
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: lexilla.dll
path: bin/lexilla.dll

View File

@ -12,7 +12,7 @@ jobs:
cpp_compiler: [g++, clang++]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Install Scintilla source
run: |
(cd .. && wget --no-verbose https://www.scintilla.org/scintilla500.zip)
@ -21,10 +21,11 @@ jobs:
run: (cd test/unit && make DEBUG=1 CXX=${{matrix.cpp_compiler}} test)
- name: Build Lexilla
run: (cd src && make DEBUG=1 CXX=${{matrix.cpp_compiler}})
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: liblexilla.so
name: liblexilla-${{matrix.cpp_compiler}}.so
path: bin/liblexilla.so
overwrite: true
- name: Test lexing and folding
run: (cd test && make DEBUG=1 CXX=${{matrix.cpp_compiler}} test)
- name: CheckLexilla C Example

View File

@ -28,9 +28,6 @@ returnDanglingLifetime:lexilla/access/LexillaAccess.cxx
// cppcheck seems to believe that unique_ptr<char *[]>::get returns void* instead of char**
arithOperationsOnVoidPointer:lexilla/lexlib/WordList.cxx
// This could be fixed but it should be rewritten to use string_view which doesn't have resize
uselessCallsSubstr:lexilla/lexers/LexCPP.cxx
// cppcheck 2.11 limits checking of complex functions unless --check-level=exhaustive but that
// only finds one false issue in LexRuby
checkLevelNormal:lexilla/lexers/LexBash.cxx
@ -90,7 +87,6 @@ variableScope:lexilla/lexers/LexGui4Cli.cxx
constParameterReference:lexilla/lexers/LexHaskell.cxx
constParameterReference:lexilla/lexers/LexHex.cxx
knownConditionTrueFalse:lexilla/lexers/LexHex.cxx
constParameterReference:lexilla/lexers/LexHTML.cxx
constVariable:lexilla/lexers/LexHollywood.cxx
variableScope:lexilla/lexers/LexInno.cxx
constVariableReference:lexilla/lexers/LexInno.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="20240305" />
<meta name="Date.Modified" content="20240423" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<style type="text/css">
.logo {
@ -61,8 +61,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.3.1<br />
Site last modified March 5 2024</font>
<font color="#FFCC99" size="3">Release version 5.3.2<br />
Site last modified April 23 2024</font>
</td>
<td width="20%">
&nbsp;
@ -77,11 +77,11 @@
</tr>
</table>
<ul id="versionlist">
<li>Version 5.3.2 improves COBOL, HTML, Lua, Ruby, and Rust.</li>
<li>Version 5.3.1 improves Assembler, Bash, Batch, JavaScript, Python, and Ruby.</li>
<li>Version 5.3.0 improves Bash, HTML, and Lua.</li>
<li>Version 5.2.9 fixes potential problems on macOS 12 and older when built with Xcode 15.0.</li>
<li>Version 5.2.8 improves Python and R.</li>
<li>Version 5.2.7 improves Bash, F#, and HTML.</li>
</ul>
<ul id="menu">
<li id="remote1"><a href="https://www.scintilla.org/SciTEImage.html">Screenshot</a></li>

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/lexilla531.zip">
<font size="4"> <a href="https://www.scintilla.org/lexilla532.zip">
Windows</a>&nbsp;&nbsp;
<a href="https://www.scintilla.org/lexilla531.tgz">
<a href="https://www.scintilla.org/lexilla532.tgz">
GTK/Linux</a>&nbsp;&nbsp;
</font>
</td>
@ -42,7 +42,7 @@
containing very few restrictions.
</p>
<h3>
Release 5.3.1
Release 5.3.2
</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/lexilla531.zip">zip format</a> (1.3M) commonly used on Windows</li>
<li><a href="https://www.scintilla.org/lexilla531.tgz">tgz format</a> (0.9M) commonly used on Linux and compatible operating systems</li>
<li><a href="https://www.scintilla.org/lexilla532.zip">zip format</a> (1.3M) commonly used on Windows</li>
<li><a href="https://www.scintilla.org/lexilla532.tgz">tgz format</a> (0.9M) 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

@ -588,6 +588,57 @@
</tr>
</table>
<h2>Releases</h2>
<h3>
<a href="https://www.scintilla.org/lexilla532.zip">Release 5.3.2</a>
</h3>
<ul>
<li>
Released 23 April 2024.
</li>
<li>
COBOL: Stop string literal continuing over line end.
<a href="https://github.com/ScintillaOrg/lexilla/issues/229">Issue #229</a>.
</li>
<li>
COBOL: Stop doc comment assigning different styles to \r and \n at line end.
<a href="https://github.com/ScintillaOrg/lexilla/issues/229">Issue #229</a>.
</li>
<li>
COBOL: Recognize keywords that start with 'V'.
<a href="https://github.com/ScintillaOrg/lexilla/issues/230">Issue #230</a>.
</li>
<li>
COBOL: Recognize comments after tag or that start with '/'.
<a href="https://github.com/ScintillaOrg/lexilla/issues/231">Issue #231</a>.
</li>
<li>
HTML: Implement substyles for tags, attributes, and identifiers
SCE_H_TAG, SCE_H_ATTRIBUTE, SCE_HJ_WORD, SCE_HJA_WORD, SCE_HB_WORD, SCE_HP_WORD, SCE_HPHP_WORD.
</li>
<li>
HTML: Implement context-sensitive attributes. "tag.attribute" matches "attribute" only inside "tag".
</li>
<li>
HTML: Match standard handling of comments.
<a href="https://github.com/ScintillaOrg/lexilla/issues/232">Issue #232</a>.
</li>
<li>
Lua: Implement substyles for identifiers SCE_LUA_IDENTIFIER.
</li>
<li>
Ruby: Allow non-ASCII here-doc delimiters.
<a href="https://github.com/ScintillaOrg/lexilla/issues/234">Issue #234</a>.
</li>
<li>
Ruby: Allow modifier if, unless, while and until after heredoc delimiter.
<a href="https://github.com/ScintillaOrg/lexilla/issues/236">Issue #236</a>.
</li>
<li>
Rust: Recognize raw identifiers.
<a href="https://github.com/ScintillaOrg/lexilla/issues/239">Issue #239</a>,
<a href="https://github.com/ScintillaOrg/lexilla/pull/240">Pull request #240</a>.
</li>
</ul>
<h3>
<a href="https://www.scintilla.org/lexilla531.zip">Release 5.3.1</a>
</h3>
@ -12774,7 +12825,7 @@
Pascal lexer handles comments more correctly.
</li>
<li>
C/C++/Java/JavaScipt lexer has a state for line doc comments.
C/C++/Java/JavaScript lexer has a state for line doc comments.
</li>
<li>
Error output lexer understands Sun CC messages.

View File

@ -240,10 +240,7 @@ Sci_Position SCI_METHOD LexerAsm::WordListSet(int n, const char *wl) {
}
Sci_Position firstModification = -1;
if (wordListN) {
WordList wlNew;
wlNew.Set(wl);
if (*wordListN != wlNew) {
wordListN->Set(wl);
if (wordListN->Set(wl)) {
firstModification = 0;
}
}

View File

@ -483,12 +483,11 @@ class LexerBash final : public DefaultLexer {
OptionSetBash osBash;
CharacterSet setParamStart;
enum { ssIdentifier, ssScalar };
SubStyles subStyles;
SubStyles subStyles{styleSubable};
public:
LexerBash() :
DefaultLexer("bash", SCLEX_BASH, lexicalClasses, std::size(lexicalClasses)),
setParamStart(CharacterSet::setAlphaNum, "_" BASH_SPECIAL_PARAMETER),
subStyles(styleSubable, 0x80, 0x40, 0) {
setParamStart(CharacterSet::setAlphaNum, "_" BASH_SPECIAL_PARAMETER) {
cmdDelimiter.Set("| || |& & && ; ;; ( ) { }");
bashStruct.Set("if elif fi while until else then do done esac eval");
bashStruct_in.Set("for case select");

View File

@ -59,7 +59,7 @@ constexpr bool IsBSeparator(char ch) noexcept {
}
// Tests for escape character
bool IsEscaped(const char* wordStr, Sci_PositionU pos) noexcept {
constexpr bool IsEscaped(const char* wordStr, Sci_PositionU pos) noexcept {
bool isQoted=false;
while (pos>0){
pos--;
@ -71,30 +71,24 @@ bool IsEscaped(const char* wordStr, Sci_PositionU pos) noexcept {
return isQoted;
}
// Tests for quote character
bool textQuoted(const char *lineBuffer, Sci_PositionU endPos) {
char strBuffer[1024];
strncpy(strBuffer, lineBuffer, endPos);
strBuffer[endPos] = '\0';
constexpr bool IsQuotedBy(std::string_view svBuffer, char quote) noexcept {
bool CurrentStatus = false;
const char strQuotes[] = "\"'";
const size_t strLength = strlen(strQuotes);
for (size_t i = 0; i < strLength; i++) {
const char *pQuote = strchr(strBuffer, strQuotes[i]);
while (pQuote)
{
if (!IsEscaped(strBuffer, pQuote - strBuffer)) {
CurrentStatus = !CurrentStatus;
}
pQuote = strchr(pQuote + 1, strQuotes[i]);
}
if (CurrentStatus) {
break;
size_t pQuote = svBuffer.find(quote);
while (pQuote != std::string_view::npos) {
if (!IsEscaped(svBuffer.data(), pQuote)) {
CurrentStatus = !CurrentStatus;
}
pQuote = svBuffer.find(quote, pQuote + 1);
}
return CurrentStatus;
}
// Tests for quote character
constexpr bool textQuoted(const char *lineBuffer, Sci_PositionU endPos) noexcept {
const std::string_view svBuffer(lineBuffer, endPos);
return IsQuotedBy(svBuffer, '\"') || IsQuotedBy(svBuffer, '\'');
}
void ColouriseBatchDoc(
Sci_PositionU startPos,
Sci_Position length,

View File

@ -55,15 +55,15 @@ inline bool isCOBOLwordstart(char ch)
}
static int CountBits(int nBits)
{
int count = 0;
for (int i = 0; i < 32; ++i)
{
count += nBits & 1;
nBits >>= 1;
}
return count;
}
{
int count = 0;
for (int i = 0; i < 32; ++i)
{
count += nBits & 1;
nBits >>= 1;
}
return count;
}
static void getRange(Sci_PositionU start,
Sci_PositionU end,
@ -86,28 +86,28 @@ static void ColourTo(Accessor &styler, Sci_PositionU end, unsigned int attr) {
static int classifyWordCOBOL(Sci_PositionU start, Sci_PositionU end, /*WordList &keywords*/WordList *keywordlists[], Accessor &styler, int nContainment, bool *bAarea) {
int ret = 0;
WordList& a_keywords = *keywordlists[0];
WordList& b_keywords = *keywordlists[1];
WordList& c_keywords = *keywordlists[2];
char s[100];
s[0] = '\0';
s[1] = '\0';
getRange(start, end, styler, s, sizeof(s));
char chAttr = SCE_C_IDENTIFIER;
int chAttr = SCE_C_IDENTIFIER;
if (isdigit(s[0]) || (s[0] == '.') || (s[0] == 'v')) {
chAttr = SCE_C_NUMBER;
char *p = s + 1;
while (*p) {
if ((!isdigit(*p) && (*p) != 'v') && isCOBOLwordchar(*p)) {
chAttr = SCE_C_IDENTIFIER;
break;
}
++p;
}
char *p = s + 1;
while (*p) {
if ((!isdigit(*p) && (*p) != 'v') && isCOBOLwordchar(*p)) {
chAttr = SCE_C_IDENTIFIER;
break;
}
++p;
}
}
else {
if (chAttr == SCE_C_IDENTIFIER) {
WordList& a_keywords = *keywordlists[0];
WordList& b_keywords = *keywordlists[1];
WordList& c_keywords = *keywordlists[2];
if (a_keywords.InList(s)) {
chAttr = SCE_C_WORD;
}
@ -121,22 +121,22 @@ static int classifyWordCOBOL(Sci_PositionU start, Sci_PositionU end, /*WordList
if (*bAarea) {
if (strcmp(s, "division") == 0) {
ret = IN_DIVISION;
// we've determined the containment, anything else is just ignored for those purposes
*bAarea = false;
} else if (strcmp(s, "declaratives") == 0) {
// we've determined the containment, anything else is just ignored for those purposes
*bAarea = false;
} else if (strcmp(s, "declaratives") == 0) {
ret = IN_DIVISION | IN_DECLARATIVES;
if (nContainment & IN_DECLARATIVES)
ret |= NOT_HEADER | IN_SECTION;
// we've determined the containment, anything else is just ignored for those purposes
*bAarea = false;
} else if (strcmp(s, "section") == 0) {
if (nContainment & IN_DECLARATIVES)
ret |= NOT_HEADER | IN_SECTION;
// we've determined the containment, anything else is just ignored for those purposes
*bAarea = false;
} else if (strcmp(s, "section") == 0) {
ret = (nContainment &~ IN_PARAGRAPH) | IN_SECTION;
// we've determined the containment, anything else is just ignored for those purposes
*bAarea = false;
} else if (strcmp(s, "end") == 0 && (nContainment & IN_DECLARATIVES)) {
// we've determined the containment, anything else is just ignored for those purposes
*bAarea = false;
} else if (strcmp(s, "end") == 0 && (nContainment & IN_DECLARATIVES)) {
ret = IN_DIVISION | IN_DECLARATIVES | IN_SECTION | NOT_HEADER;
} else {
ret = nContainment | IN_PARAGRAPH;
} else {
ret = nContainment | IN_PARAGRAPH;
}
}
ColourTo(styler, end, chAttr);
@ -161,7 +161,7 @@ static void ColouriseCOBOLDoc(Sci_PositionU startPos, Sci_Position length, int i
if (currentLine > 0) {
styler.SetLineState(currentLine, styler.GetLineState(currentLine-1));
nContainment = styler.GetLineState(currentLine);
nContainment &= ~NOT_HEADER;
nContainment &= ~NOT_HEADER;
} else {
styler.SetLineState(currentLine, 0);
nContainment = 0;
@ -170,20 +170,20 @@ static void ColouriseCOBOLDoc(Sci_PositionU startPos, Sci_Position length, int i
styler.StartSegment(startPos);
bool bNewLine = true;
bool bAarea = !isspacechar(chNext);
int column = 0;
int column = 0;
for (Sci_PositionU i = startPos; i < lengthDoc; i++) {
char ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
++column;
++column;
if (bNewLine) {
column = 0;
column = 0;
}
if (column <= 1 && !bAarea) {
bAarea = !isspacechar(ch);
}
if (column <= 1 && !bAarea) {
bAarea = !isspacechar(ch);
}
bool bSetNewLine = false;
if ((ch == '\r' && chNext != '\n') || (ch == '\n')) {
// Trigger on CR only (Mac style) or either on LF from CR+LF (Dos/Win) or on LF alone (Unix)
@ -196,8 +196,8 @@ static void ColouriseCOBOLDoc(Sci_PositionU startPos, Sci_Position length, int i
styler.SetLineState(currentLine, nContainment);
currentLine++;
bSetNewLine = true;
if (nContainment & NOT_HEADER)
nContainment &= ~(NOT_HEADER | IN_DECLARATIVES | IN_SECTION);
if (nContainment & NOT_HEADER)
nContainment &= ~(NOT_HEADER | IN_DECLARATIVES | IN_SECTION);
}
if (styler.IsLeadByte(ch)) {
@ -211,7 +211,7 @@ static void ColouriseCOBOLDoc(Sci_PositionU startPos, Sci_Position length, int i
if (isCOBOLwordstart(ch) || (ch == '$' && IsASCII(chNext) && isalpha(chNext))) {
ColourTo(styler, i-1, state);
state = SCE_C_IDENTIFIER;
} else if (column == 6 && ch == '*') {
} else if (column == 6 && (ch == '*' || ch == '/')) {
// Cobol comment line: asterisk in column 7.
ColourTo(styler, i-1, state);
state = SCE_C_COMMENTLINE;
@ -255,7 +255,9 @@ static void ColouriseCOBOLDoc(Sci_PositionU startPos, Sci_Position length, int i
state = SCE_C_DEFAULT;
chNext = styler.SafeGetCharAt(i + 1);
if (ch == '"') {
if (column == 6 && (ch == '*' || ch == '/')) {
state = SCE_C_COMMENTLINE;
} else if (ch == '"') {
state = SCE_C_STRING;
} else if (ch == '\'') {
state = SCE_C_CHARACTER;
@ -271,7 +273,7 @@ static void ColouriseCOBOLDoc(Sci_PositionU startPos, Sci_Position length, int i
}
} else if (state == SCE_C_COMMENT) {
if (ch == '\r' || ch == '\n') {
ColourTo(styler, i, state);
ColourTo(styler, i-1, state);
state = SCE_C_DEFAULT;
}
} else if (state == SCE_C_COMMENTDOC) {
@ -279,7 +281,7 @@ static void ColouriseCOBOLDoc(Sci_PositionU startPos, Sci_Position length, int i
if (((i > styler.GetStartSegment() + 2) || (
(initStyle == SCE_C_COMMENTDOC) &&
(styler.GetStartSegment() == static_cast<Sci_PositionU>(startPos))))) {
ColourTo(styler, i, state);
ColourTo(styler, i-1, state);
state = SCE_C_DEFAULT;
}
}
@ -292,6 +294,9 @@ static void ColouriseCOBOLDoc(Sci_PositionU startPos, Sci_Position length, int i
if (ch == '"') {
ColourTo(styler, i, state);
state = SCE_C_DEFAULT;
} else if (ch == '\r' || ch == '\n') {
ColourTo(styler, i-1, state);
state = SCE_C_DEFAULT;
}
} else if (state == SCE_C_CHARACTER) {
if (ch == '\'') {
@ -302,10 +307,10 @@ static void ColouriseCOBOLDoc(Sci_PositionU startPos, Sci_Position length, int i
}
chPrev = ch;
bNewLine = bSetNewLine;
if (bNewLine)
{
bAarea = false;
}
if (bNewLine)
{
bAarea = false;
}
}
ColourTo(styler, lengthDoc - 1, state);
}
@ -321,26 +326,26 @@ static void FoldCOBOLDoc(Sci_PositionU startPos, Sci_Position length, int, WordL
bool bNewLine = true;
bool bAarea = !isspacechar(chNext);
int column = 0;
bool bComment = false;
int column = 0;
bool bComment = false;
for (Sci_PositionU i = startPos; i < endPos; i++) {
char ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
++column;
++column;
if (bNewLine) {
column = 0;
bComment = (ch == '*' || ch == '/' || ch == '?');
column = 0;
bComment = (ch == '*' || ch == '/' || ch == '?');
}
if (column <= 1 && !bAarea) {
bAarea = !isspacechar(ch);
}
if (column <= 1 && !bAarea) {
bAarea = !isspacechar(ch);
}
bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n');
if (atEOL) {
int nContainment = styler.GetLineState(lineCurrent);
int nContainment = styler.GetLineState(lineCurrent);
int lev = CountBits(nContainment & IN_FLAGS) | SC_FOLDLEVELBASE;
if (bAarea && !bComment)
--lev;
if (bAarea && !bComment)
--lev;
if (visibleChars == 0 && foldCompact)
lev |= SC_FOLDLEVELWHITEFLAG;
if ((bAarea) && (visibleChars > 0) && !(nContainment & NOT_HEADER) && !bComment)
@ -348,14 +353,14 @@ static void FoldCOBOLDoc(Sci_PositionU startPos, Sci_Position length, int, WordL
if (lev != styler.LevelAt(lineCurrent)) {
styler.SetLevel(lineCurrent, lev);
}
if ((lev & SC_FOLDLEVELNUMBERMASK) <= (levelPrev & SC_FOLDLEVELNUMBERMASK)) {
// this level is at the same level or less than the previous line
// therefore these is nothing for the previous header to collapse, so remove the header
styler.SetLevel(lineCurrent - 1, levelPrev & ~SC_FOLDLEVELHEADERFLAG);
}
if ((lev & SC_FOLDLEVELNUMBERMASK) <= (levelPrev & SC_FOLDLEVELNUMBERMASK)) {
// this level is at the same level or less than the previous line
// therefore these is nothing for the previous header to collapse, so remove the header
styler.SetLevel(lineCurrent - 1, levelPrev & ~SC_FOLDLEVELHEADERFLAG);
}
levelPrev = lev;
visibleChars = 0;
bAarea = false;
bAarea = false;
bNewLine = true;
lineCurrent++;
} else {

View File

@ -87,17 +87,13 @@ bool followsReturnKeyword(const StyleContext &sc, LexAccessor &styler) {
return !*s;
}
constexpr bool IsSpaceOrTab(int ch) noexcept {
return ch == ' ' || ch == '\t';
}
constexpr bool IsOperatorOrSpace(int ch) noexcept {
return isoperator(ch) || IsASpace(ch);
}
bool OnlySpaceOrTab(const std::string &s) noexcept {
bool OnlySpaceOrTab(std::string_view s) noexcept {
for (const char ch : s) {
if (!IsSpaceOrTab(ch))
if (!IsASpaceOrTab(ch))
return false;
}
return true;
@ -141,7 +137,7 @@ BracketPair FindBracketPair(Tokens &tokens) {
}
void highlightTaskMarker(StyleContext &sc, LexAccessor &styler,
int activity, const WordList &markerList, bool caseSensitive){
int activity, const WordList &markerList, bool caseSensitive) {
if (IsOperatorOrSpace(sc.chPrev) && !IsOperatorOrSpace(sc.ch) && markerList.Length()) {
std::string marker;
for (Sci_PositionU currPos = sc.currentPos; true; currPos++) {
@ -160,10 +156,11 @@ void highlightTaskMarker(StyleContext &sc, LexAccessor &styler,
}
}
const CharacterSet setHexDigits(CharacterSet::setDigits, "ABCDEFabcdef");
const CharacterSet setOctDigits("01234567");
const CharacterSet setNoneNumeric;
class EscapeSequence {
const CharacterSet setHexDigits = CharacterSet(CharacterSet::setDigits, "ABCDEFabcdef");
const CharacterSet setOctDigits = CharacterSet("01234567");
const CharacterSet setNoneNumeric;
const CharacterSet *escapeSetValid = nullptr;
int digitsLeft = 0;
public:
@ -235,7 +232,7 @@ struct PPDefinition {
std::string value;
bool isUndef;
std::string arguments;
PPDefinition(Sci_Position line_, const std::string &key_, const std::string &value_, bool isUndef_ = false, const std::string &arguments_="") :
PPDefinition(Sci_Position line_, std::string_view key_, std::string_view value_, bool isUndef_, std::string_view arguments_) :
line(line_), key(key_), value(value_), isUndef(isUndef_), arguments(arguments_) {
}
};
@ -335,6 +332,56 @@ struct InterpolatingState {
int braceCount;
};
struct Definition {
std::string_view name;
std::string_view value;
std::string_view arguments;
};
constexpr std::string_view TrimSpaceTab(std::string_view sv) noexcept {
while (!sv.empty() && IsASpaceOrTab(sv.front())) {
sv.remove_prefix(1);
}
return sv;
}
// Parse a macro definition, either from a #define line in a file or from keywords.
// Either an object macro <NAME> <VALUE> or a function macro <NAME>(<ARGUMENTS>) <VALUE>.
// VALUE is optional and is treated as "1" if missing.
// #define ALLOW_PRINT
// #define VERSION 37
// #define VER(a,b) a*10+b
// Whitespace separates macro and value in files but keywords use '=' separator.
// 'endName' contains a set of characters that terminate the name of the macro.
constexpr Definition ParseDefine(std::string_view definition, std::string_view endName) {
Definition ret;
definition = TrimSpaceTab(definition);
const size_t afterName = definition.find_first_of(endName);
if (afterName != std::string_view::npos) {
ret.name = definition.substr(0, afterName);
if (definition.at(afterName) == '(') {
// Macro
definition.remove_prefix(afterName+1);
const size_t closeBracket = definition.find(')');
if (closeBracket != std::string_view::npos) {
ret.arguments = definition.substr(0, closeBracket);
definition.remove_prefix(closeBracket+1);
if (!definition.empty() && (endName.find(definition.front()) != std::string_view::npos)) {
definition.remove_prefix(1);
}
ret.value = definition;
} // else malformed as requires closing bracket
} else {
ret.value = definition.substr(afterName+1);
}
} else {
ret.name = definition;
ret.value = "1";
}
return ret;
}
// An individual named option for use in an OptionSet
// Options used for LexerCPP
@ -507,7 +554,7 @@ class LexerCPP : public ILexer5 {
std::string value;
std::string arguments;
SymbolValue() noexcept = default;
SymbolValue(const std::string &value_, const std::string &arguments_) : value(value_), arguments(arguments_) {
SymbolValue(std::string_view value_, std::string_view arguments_) : value(value_), arguments(arguments_) {
}
SymbolValue &operator = (const std::string &value_) {
value = value_;
@ -525,7 +572,7 @@ class LexerCPP : public ILexer5 {
EscapeSequence escapeSeq;
SparseState<std::string> rawStringTerminators;
enum { ssIdentifier, ssDocKeyword };
SubStyles subStyles;
SubStyles subStyles{ styleSubable, SubStylesFirst, SubStylesAvailable, inactiveFlag };
std::string returnBuffer;
public:
explicit LexerCPP(bool caseSensitive_) :
@ -535,8 +582,7 @@ public:
setAddOp("+-"),
setMultOp("*/%"),
setRelOp("=!<>"),
setLogicalOp("|&"),
subStyles(styleSubable, 0x80, 0x40, inactiveFlag) {
setLogicalOp("|&") {
}
// Deleted so LexerCPP objects can not be copied.
LexerCPP(const LexerCPP &) = delete;
@ -550,24 +596,24 @@ public:
int SCI_METHOD Version() const noexcept override {
return lvRelease5;
}
const char * SCI_METHOD PropertyNames() override {
const char *SCI_METHOD PropertyNames() override {
return osCPP.PropertyNames();
}
int SCI_METHOD PropertyType(const char *name) override {
return osCPP.PropertyType(name);
}
const char * SCI_METHOD DescribeProperty(const char *name) override {
const char *SCI_METHOD DescribeProperty(const char *name) override {
return osCPP.DescribeProperty(name);
}
Sci_Position SCI_METHOD PropertySet(const char *key, const char *val) override;
const char * SCI_METHOD DescribeWordListSets() override {
const char *SCI_METHOD DescribeWordListSets() override {
return osCPP.DescribeWordListSets();
}
Sci_Position SCI_METHOD WordListSet(int n, const char *wl) override;
void SCI_METHOD Lex(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess) override;
void SCI_METHOD Fold(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess) override;
void * SCI_METHOD PrivateCall(int, void *) noexcept override {
void *SCI_METHOD PrivateCall(int, void *) noexcept override {
return nullptr;
}
@ -601,7 +647,7 @@ public:
int SCI_METHOD DistanceToSecondaryStyles() noexcept override {
return inactiveFlag;
}
const char * SCI_METHOD GetSubStyleBases() noexcept override {
const char *SCI_METHOD GetSubStyleBases() noexcept override {
return styleSubable;
}
int SCI_METHOD NamedStyles() override {
@ -609,7 +655,7 @@ public:
sizeLexicalClasses) +
inactiveFlag;
}
const char * SCI_METHOD NameOfStyle(int style) override {
const char *SCI_METHOD NameOfStyle(int style) override {
if (style >= NamedStyles())
return "";
if (style < sizeLexicalClasses)
@ -617,7 +663,7 @@ public:
// TODO: inactive and substyles
return "";
}
const char * SCI_METHOD TagsOfStyle(int style) override {
const char *SCI_METHOD TagsOfStyle(int style) override {
if (style >= NamedStyles())
return "Excess";
returnBuffer.clear();
@ -649,7 +695,7 @@ public:
}
return "";
}
const char * SCI_METHOD DescriptionOfStyle(int style) override {
const char *SCI_METHOD DescriptionOfStyle(int style) override {
if (style >= NamedStyles())
return "";
if (style < sizeLexicalClasses)
@ -659,13 +705,13 @@ public:
}
// ILexer5 methods
const char * SCI_METHOD GetName() override {
const char *SCI_METHOD GetName() override {
return caseSensitive ? "cpp" : "cppnocase";
}
int SCI_METHOD GetIdentifier() override {
return caseSensitive ? SCLEX_CPP : SCLEX_CPPNOCASE;
}
const char * SCI_METHOD PropertyGet(const char *key) override;
const char *SCI_METHOD PropertyGet(const char *key) override;
static ILexer5 *LexerFactoryCPP() {
return new LexerCPP(true);
@ -694,7 +740,7 @@ Sci_Position SCI_METHOD LexerCPP::PropertySet(const char *key, const char *val)
return -1;
}
const char * SCI_METHOD LexerCPP::PropertyGet(const char *key) {
const char *SCI_METHOD LexerCPP::PropertyGet(const char *key) {
return osCPP.PropertyGet(key);
}
@ -730,24 +776,8 @@ Sci_Position SCI_METHOD LexerCPP::WordListSet(int n, const char *wl) {
// Rebuild preprocessorDefinitions
preprocessorDefinitionsStart.clear();
for (int nDefinition = 0; nDefinition < ppDefinitions.Length(); nDefinition++) {
const char *cpDefinition = ppDefinitions.WordAt(nDefinition);
const char *cpEquals = strchr(cpDefinition, '=');
if (cpEquals) {
std::string name(cpDefinition, cpEquals - cpDefinition);
const std::string val(cpEquals+1);
const size_t bracket = name.find('(');
const size_t bracketEnd = name.find(')');
if ((bracket != std::string::npos) && (bracketEnd != std::string::npos)) {
// Macro
const std::string args = name.substr(bracket + 1, bracketEnd - bracket - 1);
name = name.substr(0, bracket);
preprocessorDefinitionsStart[name] = SymbolValue(val, args);
} else {
preprocessorDefinitionsStart[name] = val;
}
} else {
preprocessorDefinitionsStart[std::string(cpDefinition)] = std::string("1");
}
const Definition def = ParseDefine(ppDefinitions.WordAt(nDefinition), "(=");
preprocessorDefinitionsStart[std::string(def.name)] = SymbolValue(def.value, def.arguments);
}
}
}
@ -930,8 +960,7 @@ void SCI_METHOD LexerCPP::Lex(Sci_PositionU startPos, Sci_Position length, int i
sc.ChangeState(SCE_C_USERLITERAL|activitySet);
} else if (!(setWord.Contains(sc.ch)
|| (sc.ch == '\'')
|| ((sc.ch == '+' || sc.ch == '-') && (sc.chPrev == 'e' || sc.chPrev == 'E' ||
sc.chPrev == 'p' || sc.chPrev == 'P')))) {
|| (AnyOf(sc.chPrev, 'e', 'E', 'p', 'P') && AnyOf(sc.ch, '+', '-')))) {
sc.SetState(SCE_C_DEFAULT|activitySet);
}
break;
@ -1076,7 +1105,7 @@ void SCI_METHOD LexerCPP::Lex(Sci_PositionU startPos, Sci_Position length, int i
} else if (sc.ch == '[' || sc.ch == '{') {
seenDocKeyBrace = true;
} else if (!setDoxygen.Contains(sc.ch)
&& !(seenDocKeyBrace && (sc.ch == ',' || sc.ch == '.'))) {
&& !(seenDocKeyBrace && AnyOf(sc.ch, ',', '.'))) {
if (!(IsASpace(sc.ch) || (sc.ch == 0))) {
sc.ChangeState(SCE_C_COMMENTDOCKEYWORDERROR|activitySet);
} else {
@ -1392,41 +1421,11 @@ void SCI_METHOD LexerCPP::Lex(Sci_PositionU startPos, Sci_Position length, int i
sc.ChangeState(SCE_C_PREPROCESSOR|activitySet);
} else if (sc.Match("define")) {
if (options.updatePreprocessor && preproc.IsActive()) {
std::string restOfLine = GetRestOfLine(styler, sc.currentPos + 6, true);
size_t startName = 0;
while ((startName < restOfLine.length()) && IsSpaceOrTab(restOfLine[startName]))
startName++;
size_t endName = startName;
while ((endName < restOfLine.length()) && setWord.Contains(restOfLine[endName]))
endName++;
const std::string key = restOfLine.substr(startName, endName-startName);
if ((endName < restOfLine.length()) && (restOfLine.at(endName) == '(')) {
// Macro
size_t endArgs = endName;
while ((endArgs < restOfLine.length()) && (restOfLine[endArgs] != ')'))
endArgs++;
const std::string args = restOfLine.substr(endName + 1, endArgs - endName - 1);
size_t startValue = endArgs+1;
while ((startValue < restOfLine.length()) && IsSpaceOrTab(restOfLine[startValue]))
startValue++;
std::string value;
if (startValue < restOfLine.length())
value = restOfLine.substr(startValue);
preprocessorDefinitions[key] = SymbolValue(value, args);
ppDefineHistory.push_back(PPDefinition(lineCurrent, key, value, false, args));
definitionsChanged = true;
} else {
// Value
size_t startValue = endName;
while ((startValue < restOfLine.length()) && IsSpaceOrTab(restOfLine[startValue]))
startValue++;
std::string value = restOfLine.substr(startValue);
if (OnlySpaceOrTab(value))
value = "1"; // No value defaults to 1
preprocessorDefinitions[key] = value;
ppDefineHistory.push_back(PPDefinition(lineCurrent, key, value));
definitionsChanged = true;
}
const std::string restOfLine = GetRestOfLine(styler, sc.currentPos + 6, true);
const Definition def = ParseDefine(restOfLine, "( \t");
preprocessorDefinitions[std::string(def.name)] = SymbolValue(def.value, def.arguments);
ppDefineHistory.emplace_back(lineCurrent, def.name, def.value, false, def.arguments);
definitionsChanged = true;
}
} else if (sc.Match("undef")) {
if (options.updatePreprocessor && preproc.IsActive()) {
@ -1435,7 +1434,7 @@ void SCI_METHOD LexerCPP::Lex(Sci_PositionU startPos, Sci_Position length, int i
if (!tokens.empty()) {
const std::string key = tokens[0];
preprocessorDefinitions.erase(key);
ppDefineHistory.push_back(PPDefinition(lineCurrent, key, "", true));
ppDefineHistory.emplace_back(lineCurrent, key, "", true, "");
definitionsChanged = true;
}
}
@ -1796,8 +1795,8 @@ Tokens LexerCPP::Tokenize(const std::string &expr) const {
word += *cp;
cp++;
}
} else if (IsSpaceOrTab(*cp)) {
while (IsSpaceOrTab(*cp)) {
} else if (IsASpaceOrTab(*cp)) {
while (IsASpaceOrTab(*cp)) {
word += *cp;
cp++;
}

View File

@ -198,9 +198,6 @@ public:
static ILexer5 *LexerFactoryD() {
return new LexerD(true);
}
static ILexer5 *LexerFactoryDInsensitive() {
return new LexerD(false);
}
};
Sci_Position SCI_METHOD LexerD::PropertySet(const char *key, const char *val) {

View File

@ -240,11 +240,10 @@ class LexerGDScript : public DefaultLexer {
OptionsGDScript options;
OptionSetGDScript osGDScript;
enum { ssIdentifier };
SubStyles subStyles;
SubStyles subStyles{styleSubable};
public:
explicit LexerGDScript() :
DefaultLexer("gdscript", SCLEX_GDSCRIPT, lexicalClasses, ELEMENTS(lexicalClasses)),
subStyles(styleSubable, 0x80, 0x40, 0) {
DefaultLexer("gdscript", SCLEX_GDSCRIPT, lexicalClasses, ELEMENTS(lexicalClasses)) {
}
~LexerGDScript() override {
}

View File

@ -14,6 +14,7 @@
#include <string>
#include <string_view>
#include <vector>
#include <map>
#include <set>
#include <functional>
@ -21,6 +22,7 @@
#include "ILexer.h"
#include "Scintilla.h"
#include "SciLexer.h"
#include "InList.h"
#include "WordList.h"
#include "LexAccessor.h"
#include "Accessor.h"
@ -28,6 +30,7 @@
#include "CharacterSet.h"
#include "LexerModule.h"
#include "OptionSet.h"
#include "SubStyles.h"
#include "DefaultLexer.h"
using namespace Scintilla;
@ -68,27 +71,12 @@ unsigned char SafeGetUnsignedCharAt(Accessor &styler, Sci_Position position, cha
return styler.SafeGetCharAt(position, chDefault);
}
void GetTextSegment(Accessor &styler, Sci_PositionU start, Sci_PositionU end, char *s, size_t len) {
Sci_PositionU i = 0;
for (; (i < end - start + 1) && (i < len-1); i++) {
s[i] = MakeLowerCase(styler[start + i]);
}
s[i] = '\0';
}
std::string GetStringSegment(Accessor &styler, Sci_PositionU start, Sci_PositionU end) {
std::string s;
Sci_PositionU i = 0;
for (; (i < end - start + 1); i++) {
s.push_back(MakeLowerCase(styler[start + i]));
}
return s;
}
// Put an upper limit to bound time taken for unexpected text.
constexpr Sci_PositionU maxLengthCheck = 200;
std::string GetNextWord(Accessor &styler, Sci_PositionU start) {
std::string ret;
Sci_PositionU i = 0;
for (; i < 200; i++) { // Put an upper limit to bound time taken for unexpected text.
for (Sci_PositionU i = 0; i < maxLengthCheck; i++) {
const char ch = styler.SafeGetCharAt(start + i);
if ((i == 0) && !IsAWordStart(ch))
break;
@ -99,25 +87,29 @@ std::string GetNextWord(Accessor &styler, Sci_PositionU start) {
return ret;
}
bool Contains(const std::string &s, std::string_view search) noexcept {
return s.find(search) != std::string::npos;
}
script_type segIsScriptingIndicator(Accessor &styler, Sci_PositionU start, Sci_PositionU end, script_type prevValue) {
char s[100];
GetTextSegment(styler, start, end, s, sizeof(s));
//Platform::DebugPrintf("Scripting indicator [%s]\n", s);
if (strstr(s, "vbs"))
const std::string s = styler.GetRangeLowered(start, end+1);
if (Contains(s, "vbs"))
return eScriptVBS;
if (strstr(s, "pyth"))
if (Contains(s, "pyth"))
return eScriptPython;
// https://html.spec.whatwg.org/multipage/scripting.html#attr-script-type
// https://mimesniff.spec.whatwg.org/#javascript-mime-type
if (strstr(s, "javas") || strstr(s, "ecmas") || strstr(s, "module") || strstr(s, "jscr"))
if (Contains(s, "javas") || Contains(s, "ecmas") || Contains(s, "module") || Contains(s, "jscr"))
return eScriptJS;
if (strstr(s, "php"))
if (Contains(s, "php"))
return eScriptPHP;
if (strstr(s, "xml")) {
const char *xml = strstr(s, "xml");
for (const char *t=s; t<xml; t++) {
if (!IsASpace(*t)) {
return prevValue;
if (Contains(s, "xml")) {
const size_t xml = s.find("xml");
if (xml != std::string::npos) {
for (size_t t = 0; t < xml; t++) {
if (!IsASpace(s[t])) {
return prevValue;
}
}
}
return eScriptXML;
@ -128,7 +120,7 @@ script_type segIsScriptingIndicator(Accessor &styler, Sci_PositionU start, Sci_P
int PrintScriptingIndicatorOffset(Accessor &styler, Sci_PositionU start, Sci_PositionU end) {
int iResult = 0;
std::string s = GetStringSegment(styler, start, end);
const std::string s = styler.GetRangeLowered(start, end+1);
if (0 == strncmp(s.c_str(), "php", 3)) {
iResult = 3;
}
@ -153,7 +145,7 @@ script_type ScriptOfState(int state) noexcept {
}
}
int statePrintForState(int state, script_mode inScriptType) noexcept {
constexpr int statePrintForState(int state, script_mode inScriptType) noexcept {
int StateToPrint = state;
if (state >= SCE_HJ_START) {
@ -169,8 +161,8 @@ int statePrintForState(int state, script_mode inScriptType) noexcept {
return StateToPrint;
}
int stateForPrintState(int StateToPrint) noexcept {
int state;
constexpr int stateForPrintState(int StateToPrint) noexcept {
int state = StateToPrint;
if ((StateToPrint >= SCE_HPA_START) && (StateToPrint <= SCE_HPA_IDENTIFIER)) {
state = StateToPrint - SCE_HA_PYTHON;
@ -178,8 +170,6 @@ int stateForPrintState(int StateToPrint) noexcept {
state = StateToPrint - SCE_HA_VBS;
} else if ((StateToPrint >= SCE_HJA_START) && (StateToPrint <= SCE_HJA_REGEX)) {
state = StateToPrint - SCE_HA_JS;
} else {
state = StateToPrint;
}
return state;
@ -189,8 +179,8 @@ constexpr bool IsNumberChar(char ch) noexcept {
return IsADigit(ch) || ch == '.' || ch == '-' || ch == '#';
}
bool isStringState(int state) noexcept {
bool bResult;
constexpr bool isStringState(int state) noexcept {
bool bResult = false;
switch (state) {
case SCE_HJ_DOUBLESTRING:
@ -214,13 +204,12 @@ bool isStringState(int state) noexcept {
bResult = true;
break;
default :
bResult = false;
break;
}
return bResult;
}
bool stateAllowsTermination(int state) noexcept {
constexpr bool stateAllowsTermination(int state) noexcept {
bool allowTermination = !isStringState(state);
if (allowTermination) {
switch (state) {
@ -228,12 +217,15 @@ bool stateAllowsTermination(int state) noexcept {
case SCE_HP_COMMENTLINE:
case SCE_HPA_COMMENTLINE:
allowTermination = false;
break;
default:
break;
}
}
return allowTermination;
}
bool isPreProcessorEndTag(int state, int ch) {
bool isPreProcessorEndTag(int state, int ch) noexcept {
const script_type type = ScriptOfState(state);
if (state == SCE_H_ASP || AnyOf(type, eScriptVBS, eScriptJS, eScriptPython)) {
return ch == '%';
@ -245,8 +237,8 @@ bool isPreProcessorEndTag(int state, int ch) {
}
// not really well done, since it's only comments that should lex the %> and <%
bool isCommentASPState(int state) noexcept {
bool bResult;
constexpr bool isCommentASPState(int state) noexcept {
bool bResult = false;
switch (state) {
case SCE_HJ_COMMENT:
@ -259,21 +251,32 @@ bool isCommentASPState(int state) noexcept {
bResult = true;
break;
default :
bResult = false;
break;
}
return bResult;
}
bool classifyAttribHTML(script_mode inScriptType, Sci_PositionU start, Sci_PositionU end, const WordList &keywords, Accessor &styler) {
char chAttr = SCE_H_ATTRIBUTEUNKNOWN;
bool classifyAttribHTML(script_mode inScriptType, Sci_PositionU start, Sci_PositionU end, const WordList &keywords, const WordClassifier &classifier, Accessor &styler, const std::string &tag) {
int chAttr = SCE_H_ATTRIBUTEUNKNOWN;
bool isLanguageType = false;
if (IsNumberChar(styler[start])) {
chAttr = SCE_H_NUMBER;
} else {
const std::string s = GetStringSegment(styler, start, end);
if (keywords.InList(s.c_str()))
const std::string s = styler.GetRangeLowered(start, end+1);
if (keywords.InList(s)) {
chAttr = SCE_H_ATTRIBUTE;
} else {
int subStyle = classifier.ValueFor(s);
if (subStyle < 0) {
// Didn't find attribute, check for tag.attribute
const std::string tagAttribute = tag + "." + s;
subStyle = classifier.ValueFor(tagAttribute);
}
if (subStyle >= 0) {
chAttr = subStyle;
}
}
if (inScriptType == eNonHtmlScript) {
// see https://html.spec.whatwg.org/multipage/scripting.html#script-processing-model
if (s == "type" || s == "language") {
@ -289,7 +292,7 @@ bool classifyAttribHTML(script_mode inScriptType, Sci_PositionU start, Sci_Posit
}
// https://html.spec.whatwg.org/multipage/custom-elements.html#custom-elements-core-concepts
bool isHTMLCustomElement(const std::string &tag) {
bool isHTMLCustomElement(const std::string &tag) noexcept {
// check valid HTML custom element name: starts with an ASCII lower alpha and contains hyphen.
// IsUpperOrLowerCase() is used for `html.tags.case.sensitive=1`.
if (tag.length() < 2 || !IsUpperOrLowerCase(tag[0])) {
@ -302,10 +305,11 @@ bool isHTMLCustomElement(const std::string &tag) {
}
int classifyTagHTML(Sci_PositionU start, Sci_PositionU end,
const WordList &keywords, Accessor &styler, bool &tagDontFold,
const WordList &keywords, const WordClassifier &classifier, Accessor &styler, bool &tagDontFold,
bool caseSensitive, bool isXml, bool allowScripts,
const std::set<std::string> &nonFoldingTags) {
std::string tag;
const std::set<std::string> &nonFoldingTags,
std::string &tag) {
tag.clear();
// Copy after the '<' and stop before ' '
for (Sci_PositionU cPos = start; cPos <= end; cPos++) {
const char ch = styler[cPos];
@ -321,13 +325,18 @@ int classifyTagHTML(Sci_PositionU start, Sci_PositionU end,
//...to find it in the list of no-container-tags
tagDontFold = (!isXml) && (nonFoldingTags.count(tag) > 0);
// No keywords -> all are known
char chAttr = SCE_H_TAGUNKNOWN;
int chAttr = SCE_H_TAGUNKNOWN;
if (!tag.empty() && (tag[0] == '!')) {
chAttr = SCE_H_SGML_DEFAULT;
} else if (!keywords || keywords.InList(tag.c_str())) {
} else if (!keywords || keywords.InList(tag)) {
chAttr = SCE_H_TAG;
} else if (!isXml && isHTMLCustomElement(tag)) {
chAttr = SCE_H_TAG;
} else {
const int subStyle = classifier.ValueFor(tag);
if (subStyle >= 0) {
chAttr = subStyle;
}
}
if (chAttr != SCE_H_TAGUNKNOWN) {
styler.ColourTo(end, chAttr);
@ -336,11 +345,11 @@ int classifyTagHTML(Sci_PositionU start, Sci_PositionU end,
if (allowScripts && (tag == "script")) {
// check to see if this is a self-closing tag by sniffing ahead
bool isSelfClose = false;
for (Sci_PositionU cPos = end; cPos <= end + 200; cPos++) {
for (Sci_PositionU cPos = end; cPos <= end + maxLengthCheck; cPos++) {
const char ch = styler.SafeGetCharAt(cPos, '\0');
if (ch == '\0' || ch == '>')
break;
else if (ch == '/' && styler.SafeGetCharAt(cPos + 1, '\0') == '>') {
if (ch == '/' && styler.SafeGetCharAt(cPos + 1, '\0') == '>') {
isSelfClose = true;
break;
}
@ -357,35 +366,40 @@ int classifyTagHTML(Sci_PositionU start, Sci_PositionU end,
}
void classifyWordHTJS(Sci_PositionU start, Sci_PositionU end,
const WordList &keywords, Accessor &styler, script_mode inScriptType) {
char s[30 + 1];
Sci_PositionU i = 0;
for (; i < end - start + 1 && i < 30; i++) {
s[i] = styler[start + i];
}
s[i] = '\0';
char chAttr = SCE_HJ_WORD;
const WordList &keywords, const WordClassifier &classifier, const WordClassifier &classifierServer, Accessor &styler, script_mode inScriptType) {
const std::string s = styler.GetRange(start, end+1);
int chAttr = SCE_HJ_WORD;
const bool wordIsNumber = IsADigit(s[0]) || ((s[0] == '.') && IsADigit(s[1]));
if (wordIsNumber) {
chAttr = SCE_HJ_NUMBER;
} else if (keywords.InList(s)) {
chAttr = SCE_HJ_KEYWORD;
} else {
const int subStyle = (inScriptType == eNonHtmlScript) ? classifier.ValueFor(s) : classifierServer.ValueFor(s);
if (subStyle >= 0) {
chAttr = subStyle;
}
}
styler.ColourTo(end, statePrintForState(chAttr, inScriptType));
}
int classifyWordHTVB(Sci_PositionU start, Sci_PositionU end, const WordList &keywords, Accessor &styler, script_mode inScriptType) {
char chAttr = SCE_HB_IDENTIFIER;
int classifyWordHTVB(Sci_PositionU start, Sci_PositionU end, const WordList &keywords, const WordClassifier &classifier, Accessor &styler, script_mode inScriptType) {
int chAttr = SCE_HB_IDENTIFIER;
const bool wordIsNumber = IsADigit(styler[start]) || (styler[start] == '.');
if (wordIsNumber) {
chAttr = SCE_HB_NUMBER;
} else {
std::string s = GetStringSegment(styler, start, end);
if (keywords.InList(s.c_str())) {
const std::string s = styler.GetRangeLowered(start, end+1);
if (keywords.InList(s)) {
chAttr = SCE_HB_WORD;
if (s == "rem")
chAttr = SCE_HB_COMMENTLINE;
} else {
const int subStyle = classifier.ValueFor(s);
if (subStyle >= 0) {
chAttr = subStyle;
}
}
}
styler.ColourTo(end, statePrintForState(chAttr, inScriptType));
@ -395,61 +409,64 @@ int classifyWordHTVB(Sci_PositionU start, Sci_PositionU end, const WordList &key
return SCE_HB_DEFAULT;
}
void classifyWordHTPy(Sci_PositionU start, Sci_PositionU end, const WordList &keywords, Accessor &styler, std::string &prevWord, script_mode inScriptType, bool isMako) {
void classifyWordHTPy(Sci_PositionU start, Sci_PositionU end, const WordList &keywords, const WordClassifier &classifier, Accessor &styler, std::string &prevWord, script_mode inScriptType, bool isMako) {
const bool wordIsNumber = IsADigit(styler[start]);
std::string s;
for (Sci_PositionU i = 0; i < end - start + 1 && i < 30; i++) {
s.push_back(styler[start + i]);
}
char chAttr = SCE_HP_IDENTIFIER;
const std::string s = styler.GetRange(start, end + 1);
int chAttr = SCE_HP_IDENTIFIER;
if (prevWord == "class")
chAttr = SCE_HP_CLASSNAME;
else if (prevWord == "def")
chAttr = SCE_HP_DEFNAME;
else if (wordIsNumber)
chAttr = SCE_HP_NUMBER;
else if (keywords.InList(s.c_str()))
else if (keywords.InList(s))
chAttr = SCE_HP_WORD;
else if (isMako && (s == "block"))
chAttr = SCE_HP_WORD;
else {
const int subStyle = classifier.ValueFor(s);
if (subStyle >= 0) {
chAttr = subStyle;
}
}
styler.ColourTo(end, statePrintForState(chAttr, inScriptType));
prevWord = s;
}
// Update the word colour to default or keyword
// Called when in a PHP word
void classifyWordHTPHP(Sci_PositionU start, Sci_PositionU end, const WordList &keywords, Accessor &styler) {
char chAttr = SCE_HPHP_DEFAULT;
void classifyWordHTPHP(Sci_PositionU start, Sci_PositionU end, const WordList &keywords, const WordClassifier &classifier, Accessor &styler) {
int chAttr = SCE_HPHP_DEFAULT;
const bool wordIsNumber = IsADigit(styler[start]) || (styler[start] == '.' && start+1 <= end && IsADigit(styler[start+1]));
if (wordIsNumber) {
chAttr = SCE_HPHP_NUMBER;
} else {
std::string s = GetStringSegment(styler, start, end);
if (keywords.InList(s.c_str()))
const std::string s = styler.GetRangeLowered(start, end+1);;
if (keywords.InList(s)) {
chAttr = SCE_HPHP_WORD;
} else {
const int subStyle = classifier.ValueFor(s);
if (subStyle >= 0) {
chAttr = subStyle;
}
}
}
styler.ColourTo(end, chAttr);
}
bool isWordHSGML(Sci_PositionU start, Sci_PositionU end, const WordList &keywords, Accessor &styler) {
std::string s;
for (Sci_PositionU i = 0; i < end - start + 1 && i < 30; i++) {
s.push_back(styler[start + i]);
}
return keywords.InList(s.c_str());
const std::string s = styler.GetRange(start, end + 1);
return keywords.InList(s);
}
bool isWordCdata(Sci_PositionU start, Sci_PositionU end, Accessor &styler) {
std::string s;
for (Sci_PositionU i = 0; i < end - start + 1 && i < 30; i++) {
s.push_back(styler[start + i]);
}
const std::string s = styler.GetRange(start, end + 1);
return s == "[CDATA[";
}
// Return the first state to reach when entering a scripting language
int StateForScript(script_type scriptLanguage) noexcept {
int Result;
constexpr int StateForScript(script_type scriptLanguage) noexcept {
int Result = SCE_HJ_START;
switch (scriptLanguage) {
case eScriptVBS:
Result = SCE_HB_START;
@ -470,7 +487,6 @@ int StateForScript(script_type scriptLanguage) noexcept {
Result = SCE_H_COMMENT;
break;
default :
Result = SCE_HJ_START;
break;
}
return Result;
@ -489,34 +505,30 @@ constexpr bool IsPhpWordChar(int ch) noexcept {
return IsADigit(ch) || IsPhpWordStart(ch);
}
bool InTagState(int state) noexcept {
return state == SCE_H_TAG || state == SCE_H_TAGUNKNOWN ||
state == SCE_H_SCRIPT ||
state == SCE_H_ATTRIBUTE || state == SCE_H_ATTRIBUTEUNKNOWN ||
state == SCE_H_NUMBER || state == SCE_H_OTHER ||
state == SCE_H_DOUBLESTRING || state == SCE_H_SINGLESTRING;
constexpr bool InTagState(int state) noexcept {
return AnyOf(state, SCE_H_TAG, SCE_H_TAGUNKNOWN, SCE_H_SCRIPT,
SCE_H_ATTRIBUTE, SCE_H_ATTRIBUTEUNKNOWN,
SCE_H_NUMBER, SCE_H_OTHER,
SCE_H_DOUBLESTRING, SCE_H_SINGLESTRING);
}
bool IsCommentState(const int state) noexcept {
constexpr bool IsCommentState(const int state) noexcept {
return state == SCE_H_COMMENT || state == SCE_H_SGML_COMMENT;
}
bool IsScriptCommentState(const int state) noexcept {
return state == SCE_HJ_COMMENT || state == SCE_HJ_COMMENTLINE || state == SCE_HJA_COMMENT ||
state == SCE_HJA_COMMENTLINE || state == SCE_HB_COMMENTLINE || state == SCE_HBA_COMMENTLINE;
constexpr bool IsScriptCommentState(const int state) noexcept {
return AnyOf(state, SCE_HJ_COMMENT, SCE_HJ_COMMENTLINE, SCE_HJA_COMMENT,
SCE_HJA_COMMENTLINE, SCE_HB_COMMENTLINE, SCE_HBA_COMMENTLINE);
}
constexpr bool isLineEnd(int ch) noexcept {
return ch == '\r' || ch == '\n';
}
bool isMakoBlockEnd(const int ch, const int chNext, const std::string &blockType) {
bool isMakoBlockEnd(const int ch, const int chNext, const std::string &blockType) noexcept {
if (blockType.empty()) {
return ((ch == '%') && (chNext == '>'));
} else if ((blockType == "inherit") ||
(blockType == "namespace") ||
(blockType == "include") ||
(blockType == "page")) {
} else if (InList(blockType, { "inherit", "namespace", "include", "page" })) {
return ((ch == '/') && (chNext == '>'));
} else if (blockType == "%") {
if (ch == '/' && isLineEnd(chNext))
@ -530,7 +542,7 @@ bool isMakoBlockEnd(const int ch, const int chNext, const std::string &blockType
}
}
bool isDjangoBlockEnd(const int ch, const int chNext, const std::string &blockType) {
bool isDjangoBlockEnd(const int ch, const int chNext, const std::string &blockType) noexcept {
if (blockType.empty()) {
return false;
} else if (blockType == "%") {
@ -563,7 +575,7 @@ public:
[[nodiscard]] bool isInvalid() const noexcept { return invalid; }
[[nodiscard]] bool isFinished() const noexcept { return finished; }
bool init(int ch, int chPlus1, int chPlus2) {
bool init(int ch, int chPlus1, int chPlus2) noexcept {
base = BASE_10;
decimalPart = false;
exponentPart = false;
@ -600,7 +612,7 @@ public:
return true;
}
bool check(int ch, int chPlus1) {
bool check(int ch, int chPlus1) noexcept {
if (strchr(digitList[base] + !betweenDigits, ch) != nullptr) {
if (leadingZero) {
invalidBase8 = invalidBase8 || strchr(digitList[BASE_8] + !betweenDigits, ch) == nullptr;
@ -655,7 +667,7 @@ public:
}
};
bool isPHPStringState(int state) noexcept {
constexpr bool isPHPStringState(int state) noexcept {
return
(state == SCE_HPHP_HSTRING) ||
(state == SCE_HPHP_SIMPLESTRING) ||
@ -664,7 +676,6 @@ bool isPHPStringState(int state) noexcept {
}
Sci_Position FindPhpStringDelimiter(std::string &phpStringDelimiter, Sci_Position i, const Sci_Position lengthDoc, Accessor &styler, bool &isSimpleString) {
Sci_Position j;
const Sci_Position beginning = i - 1;
bool isQuoted = false;
@ -685,7 +696,8 @@ Sci_Position FindPhpStringDelimiter(std::string &phpStringDelimiter, Sci_Positio
}
phpStringDelimiter.push_back(ch);
i++;
for (j = i; j < lengthDoc && !isLineEnd(styler[j]); j++) {
Sci_Position j = i;
for (; j < lengthDoc && !isLineEnd(styler[j]); j++) {
if (!IsPhpWordChar(styler[j]) && isQuoted) {
if (((isSimpleString && styler[j] == '\'') || (!isSimpleString && styler[j] == '\"')) && isLineEnd(styler.SafeGetCharAt(j + 1))) {
isQuoted = false;
@ -742,7 +754,7 @@ const char * const phpscriptWordListDesc[] = {
};
struct OptionSetHTML : public OptionSet<OptionsHTML> {
OptionSetHTML(bool isPHPScript_) {
explicit OptionSetHTML(bool isPHPScript_) {
DefineProperty("asp.default.language", &OptionsHTML::aspDefaultLanguage,
"Script in ASP code is initially assumed to be in JavaScript. "
@ -789,6 +801,10 @@ struct OptionSetHTML : public OptionSet<OptionsHTML> {
}
};
constexpr char styleSubable[] = { SCE_H_TAG, SCE_H_ATTRIBUTE, SCE_HJ_WORD, SCE_HJA_WORD, SCE_HB_WORD, SCE_HP_WORD, SCE_HPHP_WORD, 0 };
// Allow normal styles to be contiguous using 0x80 to 0xBF by assigning sub-styles from 0xC0 to 0xFF
constexpr int SubStylesHTML = 0xC0;
const LexicalClass lexicalClassesHTML[] = {
// Lexer HTML SCLEX_HTML SCE_H_ SCE_HJ_ SCE_HJA_ SCE_HB_ SCE_HBA_ SCE_HP_ SCE_HPHP_ SCE_HPA_:
0, "SCE_H_DEFAULT", "default", "Text",
@ -993,6 +1009,7 @@ class LexerHTML : public DefaultLexer {
OptionsHTML options;
OptionSetHTML osHTML;
std::set<std::string> nonFoldingTags;
SubStyles subStyles{styleSubable,SubStylesHTML,SubStylesAvailable,0};
public:
explicit LexerHTML(bool isXml_, bool isPHPScript_) :
DefaultLexer(
@ -1030,6 +1047,35 @@ public:
void SCI_METHOD Lex(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess) override;
// No Fold as all folding performs in Lex.
int SCI_METHOD AllocateSubStyles(int styleBase, int numberStyles) override {
return subStyles.Allocate(styleBase, numberStyles);
}
int SCI_METHOD SubStylesStart(int styleBase) override {
return subStyles.Start(styleBase);
}
int SCI_METHOD SubStylesLength(int styleBase) override {
return subStyles.Length(styleBase);
}
int SCI_METHOD StyleFromSubStyle(int subStyle) override {
const int styleBase = subStyles.BaseStyle(subStyle);
return styleBase;
}
int SCI_METHOD PrimaryStyleFromStyle(int style) override {
return style;
}
void SCI_METHOD FreeSubStyles() override {
subStyles.Free();
}
void SCI_METHOD SetIdentifiers(int style, const char *identifiers) override {
subStyles.SetIdentifiers(style, identifiers);
}
int SCI_METHOD DistanceToSecondaryStyles() override {
return 0;
}
const char *SCI_METHOD GetSubStyleBases() override {
return styleSubable;
}
static ILexer5 *LexerFactoryHTML() {
return new LexerHTML(false, false);
}
@ -1069,6 +1115,8 @@ Sci_Position SCI_METHOD LexerHTML::WordListSet(int n, const char *wl) {
case 5:
wordListN = &keywords6;
break;
default:
break;
}
Sci_Position firstModification = -1;
if (wordListN) {
@ -1081,10 +1129,20 @@ Sci_Position SCI_METHOD LexerHTML::WordListSet(int n, const char *wl) {
void SCI_METHOD LexerHTML::Lex(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess) {
Accessor styler(pAccess, nullptr);
const WordClassifier &classifierTags = subStyles.Classifier(SCE_H_TAG);
const WordClassifier &classifierAttributes = subStyles.Classifier(SCE_H_ATTRIBUTE);
const WordClassifier &classifierJavaScript = subStyles.Classifier(SCE_HJ_WORD);
const WordClassifier &classifierJavaScriptServer = subStyles.Classifier(SCE_HJA_WORD);
const WordClassifier &classifierBasic = subStyles.Classifier(SCE_HB_WORD);
const WordClassifier &classifierPython = subStyles.Classifier(SCE_HP_WORD);
const WordClassifier &classifierPHP = subStyles.Classifier(SCE_HPHP_WORD);
if (isPHPScript && (startPos == 0)) {
initStyle = SCE_HPHP_DEFAULT;
}
styler.StartAt(startPos);
std::string lastTag;
std::string prevWord;
PhpNumberState phpNumber;
std::string phpStringDelimiter;
@ -1095,7 +1153,7 @@ void SCI_METHOD LexerHTML::Lex(Sci_PositionU startPos, Sci_Position length, int
std::string djangoBlockType;
// If inside a tag, it may be a script tag, so reread from the start of line starting tag to ensure any language tags are seen
if (InTagState(state)) {
while ((startPos > 0) && (InTagState(styler.StyleAt(startPos - 1)))) {
while ((startPos > 0) && (InTagState(styler.StyleIndexAt(startPos - 1)))) {
const Sci_Position backLineStart = styler.LineStart(styler.GetLine(startPos-1));
length += startPos - backLineStart;
startPos = backLineStart;
@ -1107,7 +1165,7 @@ void SCI_METHOD LexerHTML::Lex(Sci_PositionU startPos, Sci_Position length, int
while (startPos > 0 && (isPHPStringState(state) || !isLineEnd(styler[startPos - 1]))) {
startPos--;
length++;
state = styler.StyleAt(startPos);
state = styler.StyleIndexAt(startPos);
}
if (startPos == 0)
state = SCE_H_DEFAULT;
@ -1123,6 +1181,8 @@ void SCI_METHOD LexerHTML::Lex(Sci_PositionU startPos, Sci_Position length, int
case SCE_H_ASP:
state = SCE_H_DEFAULT;
break;
default:
break;
}
Sci_Position lineCurrent = styler.GetLine(startPos);
@ -1182,7 +1242,7 @@ void SCI_METHOD LexerHTML::Lex(Sci_PositionU startPos, Sci_Position length, int
Sci_Position back = startPos;
int style = 0;
while (--back) {
style = styler.StyleAt(back);
style = styler.StyleIndexAt(back);
if (style < SCE_HJ_DEFAULT || style > SCE_HJ_COMMENTDOC)
// includes SCE_HJ_COMMENT & SCE_HJ_COMMENTLINE
break;
@ -1226,8 +1286,7 @@ void SCI_METHOD LexerHTML::Lex(Sci_PositionU startPos, Sci_Position length, int
case eScriptPHP:
//not currently supported case eScriptVBS:
if (!(state == SCE_HPHP_COMMENT || state == SCE_HPHP_COMMENTLINE) &&
!(state == SCE_HJ_REGEX || state == SCE_HJ_COMMENT || state == SCE_HJ_COMMENTLINE || state == SCE_HJ_COMMENTDOC) &&
if (!AnyOf(state, SCE_HPHP_COMMENT, SCE_HPHP_COMMENTLINE, SCE_HJ_REGEX, SCE_HJ_COMMENT, SCE_HJ_COMMENTLINE, SCE_HJ_COMMENTDOC) &&
!isStringState(state)) {
//Platform::DebugPrintf("state=%d, StateToPrint=%d, initStyle=%d\n", state, StateToPrint, initStyle);
//if ((state == SCE_HPHP_OPERATOR) || (state == SCE_HPHP_DEFAULT) || (state == SCE_HJ_SYMBOLS) || (state == SCE_HJ_START) || (state == SCE_HJ_DEFAULT)) {
@ -1254,11 +1313,12 @@ void SCI_METHOD LexerHTML::Lex(Sci_PositionU startPos, Sci_Position length, int
levelCurrent++;
} else if ((ch == '\n') && !((chNext == '\r') && (chNext2 == '\n')) && (chNext != '\n')) {
// check if the number of tabs is lower than the level
int Findlevel = (levelCurrent & ~SC_FOLDLEVELBASE) * 8;
constexpr int tabWidth = 8;
int Findlevel = (levelCurrent & ~SC_FOLDLEVELBASE) * tabWidth;
for (Sci_Position j = 0; Findlevel > 0; j++) {
const char chTmp = styler.SafeGetCharAt(i + j + 1);
if (chTmp == '\t') {
Findlevel -= 8;
Findlevel -= tabWidth;
} else if (chTmp == ' ') {
Findlevel--;
} else {
@ -1267,8 +1327,8 @@ void SCI_METHOD LexerHTML::Lex(Sci_PositionU startPos, Sci_Position length, int
}
if (Findlevel > 0) {
levelCurrent -= Findlevel / 8;
if (Findlevel % 8)
levelCurrent -= Findlevel / tabWidth;
if (Findlevel % tabWidth)
levelCurrent--;
}
}
@ -1431,9 +1491,9 @@ void SCI_METHOD LexerHTML::Lex(Sci_PositionU startPos, Sci_Position length, int
else if (ch == '$')
makoBlockType = "{";
else if (chNext == '/')
makoBlockType = GetNextWord(styler, i+3);
makoBlockType = GetNextWord(styler, i+3); // Tag end: </%tag>
else
makoBlockType = GetNextWord(styler, i+2);
makoBlockType = GetNextWord(styler, i+2); // Tag: <%tag...>
styler.ColourTo(i - 1, StateToPrint);
beforePreProc = state;
if (inScriptType == eNonHtmlScript)
@ -1454,7 +1514,7 @@ void SCI_METHOD LexerHTML::Lex(Sci_PositionU startPos, Sci_Position length, int
if (ch != '%' && ch != '$' && ch != '/') {
i += makoBlockType.length();
visibleChars += makoBlockType.length();
if (keywords4.InList(makoBlockType.c_str()))
if (keywords4.InList(makoBlockType))
styler.ColourTo(i, SCE_HP_WORD);
else
styler.ColourTo(i, SCE_H_TAGUNKNOWN);
@ -1572,6 +1632,18 @@ void SCI_METHOD LexerHTML::Lex(Sci_PositionU startPos, Sci_Position length, int
state = SCE_H_COMMENT; // wait for a pending command
styler.ColourTo(i + 2, SCE_H_COMMENT);
i += 2; // follow styling after the --
if (!isXml) {
// handle empty comment: <!-->, <!--->
// https://html.spec.whatwg.org/multipage/parsing.html#parse-error-abrupt-closing-of-empty-comment
chNext = SafeGetUnsignedCharAt(styler, i + 1);
if ((chNext == '>') || (chNext == '-' && SafeGetUnsignedCharAt(styler, i + 2) == '>')) {
if (chNext == '-') {
i += 1;
}
chPrev = '-';
ch = '-';
}
}
} else if (isWordCdata(i + 1, i + 7, styler)) {
state = SCE_H_CDATA;
} else {
@ -1595,15 +1667,14 @@ void SCI_METHOD LexerHTML::Lex(Sci_PositionU startPos, Sci_Position length, int
styler.GetStartSegment(), i - 1, aspScript);
}
if (state == SCE_HP_WORD) {
classifyWordHTPy(styler.GetStartSegment(), i - 1, keywords4, styler, prevWord, inScriptType, isMako);
classifyWordHTPy(styler.GetStartSegment(), i - 1, keywords4, classifierPython, styler, prevWord, inScriptType, isMako);
} else {
styler.ColourTo(i - 1, StateToPrint);
}
if ((makoBlockType != "%") && (makoBlockType != "{") && ch != '>') {
i++;
visibleChars++;
}
else if ((makoBlockType == "%") && ch == '/') {
} else if ((makoBlockType == "%") && ch == '/') {
i++;
visibleChars++;
}
@ -1629,7 +1700,7 @@ void SCI_METHOD LexerHTML::Lex(Sci_PositionU startPos, Sci_Position length, int
styler.GetStartSegment(), i - 1, aspScript);
}
if (state == SCE_HP_WORD) {
classifyWordHTPy(styler.GetStartSegment(), i - 1, keywords4, styler, prevWord, inScriptType, isMako);
classifyWordHTPy(styler.GetStartSegment(), i - 1, keywords4, classifierPython, styler, prevWord, inScriptType, isMako);
} else {
styler.ColourTo(i - 1, StateToPrint);
}
@ -1657,16 +1728,16 @@ void SCI_METHOD LexerHTML::Lex(Sci_PositionU startPos, Sci_Position length, int
// Bounce out of any ASP mode
switch (state) {
case SCE_HJ_WORD:
classifyWordHTJS(styler.GetStartSegment(), i - 1, keywords2, styler, inScriptType);
classifyWordHTJS(styler.GetStartSegment(), i - 1, keywords2, classifierJavaScript, classifierJavaScriptServer, styler, inScriptType);
break;
case SCE_HB_WORD:
classifyWordHTVB(styler.GetStartSegment(), i - 1, keywords3, styler, inScriptType);
classifyWordHTVB(styler.GetStartSegment(), i - 1, keywords3, classifierBasic, styler, inScriptType);
break;
case SCE_HP_WORD:
classifyWordHTPy(styler.GetStartSegment(), i - 1, keywords4, styler, prevWord, inScriptType, isMako);
classifyWordHTPy(styler.GetStartSegment(), i - 1, keywords4, classifierPython, styler, prevWord, inScriptType, isMako);
break;
case SCE_HPHP_WORD:
classifyWordHTPHP(styler.GetStartSegment(), i - 1, keywords5, styler);
classifyWordHTPHP(styler.GetStartSegment(), i - 1, keywords5, classifierPHP, styler);
break;
case SCE_H_XCCOMMENT:
styler.ColourTo(i - 1, state);
@ -1707,7 +1778,7 @@ void SCI_METHOD LexerHTML::Lex(Sci_PositionU startPos, Sci_Position length, int
// in HTML, fold on tag open and unfold on tag close
tagOpened = true;
tagClosing = (chNext == '/');
if (foldXmlAtTagOpen && !(chNext == '/' || chNext == '?' || chNext == '!' || chNext == '-' || chNext == '%')) {
if (foldXmlAtTagOpen && !AnyOf(chNext, '/', '?', '!', '-', '%')) {
levelCurrent++;
}
if (foldXmlAtTagOpen && chNext == '/') {
@ -1843,7 +1914,12 @@ void SCI_METHOD LexerHTML::Lex(Sci_PositionU startPos, Sci_Position length, int
}
break;
case SCE_H_COMMENT:
if ((scriptLanguage != eScriptComment) && (chPrev2 == '-') && (chPrev == '-') && (ch == '>')) {
if ((scriptLanguage != eScriptComment) && (chPrev2 == '-') && (chPrev == '-') && (ch == '>' || (!isXml && ch == '!' && chNext == '>'))) {
// close HTML comment with --!>
// https://html.spec.whatwg.org/multipage/parsing.html#parse-error-incorrectly-closed-comment
if (ch == '!') {
i += 1;
}
styler.ColourTo(i, StateToPrint);
state = SCE_H_DEFAULT;
levelCurrent--;
@ -1892,7 +1968,7 @@ void SCI_METHOD LexerHTML::Lex(Sci_PositionU startPos, Sci_Position length, int
case SCE_H_TAGUNKNOWN:
if (!setTagContinue.Contains(ch) && !((ch == '/') && (chPrev == '<'))) {
int eClass = classifyTagHTML(styler.GetStartSegment(),
i - 1, keywords, styler, tagDontFold, caseSensitive, isXml, allowScripts, nonFoldingTags);
i - 1, keywords, classifierTags, styler, tagDontFold, caseSensitive, isXml, allowScripts, nonFoldingTags, lastTag);
if (eClass == SCE_H_SCRIPT || eClass == SCE_H_COMMENT) {
if (!tagClosing) {
inScriptType = eNonHtmlScript;
@ -1946,7 +2022,7 @@ void SCI_METHOD LexerHTML::Lex(Sci_PositionU startPos, Sci_Position length, int
break;
case SCE_H_ATTRIBUTE:
if (!setAttributeContinue.Contains(ch)) {
isLanguageType = classifyAttribHTML(inScriptType, styler.GetStartSegment(), i - 1, keywords, styler);
isLanguageType = classifyAttribHTML(inScriptType, styler.GetStartSegment(), i - 1, keywords, classifierAttributes, styler, lastTag);
if (ch == '>') {
styler.ColourTo(i, SCE_H_TAG);
if (inScriptType == eNonHtmlScript) {
@ -2125,7 +2201,8 @@ void SCI_METHOD LexerHTML::Lex(Sci_PositionU startPos, Sci_Position length, int
break;
case SCE_HJ_WORD:
if (!IsAWordChar(ch)) {
classifyWordHTJS(styler.GetStartSegment(), i - 1, keywords2, styler, inScriptType);
classifyWordHTJS(styler.GetStartSegment(), i - 1, keywords2,
classifierJavaScript, classifierJavaScriptServer, styler, inScriptType);
//styler.ColourTo(i - 1, eHTJSKeyword);
state = SCE_HJ_DEFAULT;
if (ch == '/' && chNext == '*') {
@ -2251,7 +2328,7 @@ void SCI_METHOD LexerHTML::Lex(Sci_PositionU startPos, Sci_Position length, int
break;
case SCE_HB_WORD:
if (!IsAWordChar(ch)) {
state = classifyWordHTVB(styler.GetStartSegment(), i - 1, keywords3, styler, inScriptType);
state = classifyWordHTVB(styler.GetStartSegment(), i - 1, keywords3, classifierBasic, styler, inScriptType);
if (state == SCE_HB_DEFAULT) {
if (ch == '\"') {
state = SCE_HB_STRING;
@ -2335,7 +2412,7 @@ void SCI_METHOD LexerHTML::Lex(Sci_PositionU startPos, Sci_Position length, int
break;
case SCE_HP_WORD:
if (!IsAWordChar(ch)) {
classifyWordHTPy(styler.GetStartSegment(), i - 1, keywords4, styler, prevWord, inScriptType, isMako);
classifyWordHTPy(styler.GetStartSegment(), i - 1, keywords4, classifierPython, styler, prevWord, inScriptType, isMako);
state = SCE_HP_DEFAULT;
if (ch == '#') {
state = SCE_HP_COMMENTLINE;
@ -2409,7 +2486,7 @@ void SCI_METHOD LexerHTML::Lex(Sci_PositionU startPos, Sci_Position length, int
///////////// start - PHP state handling
case SCE_HPHP_WORD:
if (!IsPhpWordChar(ch)) {
classifyWordHTPHP(styler.GetStartSegment(), i - 1, keywords5, styler);
classifyWordHTPHP(styler.GetStartSegment(), i - 1, keywords5, classifierPHP, styler);
if (ch == '/' && chNext == '*') {
i++;
state = SCE_HPHP_COMMENT;
@ -2611,16 +2688,17 @@ void SCI_METHOD LexerHTML::Lex(Sci_PositionU startPos, Sci_Position length, int
switch (state) {
case SCE_HJ_WORD:
classifyWordHTJS(styler.GetStartSegment(), lengthDoc - 1, keywords2, styler, inScriptType);
classifyWordHTJS(styler.GetStartSegment(), lengthDoc - 1, keywords2,
classifierJavaScript, classifierJavaScriptServer, styler, inScriptType);
break;
case SCE_HB_WORD:
classifyWordHTVB(styler.GetStartSegment(), lengthDoc - 1, keywords3, styler, inScriptType);
classifyWordHTVB(styler.GetStartSegment(), lengthDoc - 1, keywords3, classifierBasic, styler, inScriptType);
break;
case SCE_HP_WORD:
classifyWordHTPy(styler.GetStartSegment(), lengthDoc - 1, keywords4, styler, prevWord, inScriptType, isMako);
classifyWordHTPy(styler.GetStartSegment(), lengthDoc - 1, keywords4, classifierPython, styler, prevWord, inScriptType, isMako);
break;
case SCE_HPHP_WORD:
classifyWordHTPHP(styler.GetStartSegment(), lengthDoc - 1, keywords5, styler);
classifyWordHTPHP(styler.GetStartSegment(), lengthDoc - 1, keywords5, classifierPHP, styler);
break;
default:
StateToPrint = statePrintForState(state, inScriptType);

View File

@ -248,10 +248,7 @@ class LexerJSON : public DefaultLexer {
}
Sci_Position firstModification = -1;
if (wordListN) {
WordList wlNew;
wlNew.Set(wl);
if (*wordListN != wlNew) {
wordListN->Set(wl);
if (wordListN->Set(wl)) {
firstModification = 0;
}
}

View File

@ -192,10 +192,7 @@ Sci_Position SCI_METHOD LexerJulia::WordListSet(int n, const char *wl) {
}
Sci_Position firstModification = -1;
if (wordListN) {
WordList wlNew;
wlNew.Set(wl);
if (*wordListN != wlNew) {
wordListN->Set(wl);
if (wordListN->Set(wl)) {
firstModification = 0;
}
}

View File

@ -13,6 +13,7 @@
#include <string>
#include <string_view>
#include <vector>
#include <map>
#include "ILexer.h"
@ -26,6 +27,7 @@
#include "CharacterSet.h"
#include "LexerModule.h"
#include "OptionSet.h"
#include "SubStyles.h"
#include "DefaultLexer.h"
using namespace Scintilla;
@ -45,7 +47,7 @@ int LongDelimCheck(StyleContext &sc) {
return 0;
}
const char * const luaWordListDesc[] = {
const char *const luaWordListDesc[] = {
"Keywords",
"Basic functions",
"String, (table) & math functions",
@ -54,9 +56,11 @@ const char * const luaWordListDesc[] = {
"user2",
"user3",
"user4",
nullptr
nullptr
};
const char styleSubable[] = { SCE_LUA_IDENTIFIER, 0 };
const LexicalClass lexicalClasses[] = {
// Lexer Lua SCLEX_LUA SCE_LUA_:
0, "SCE_LUA_DEFAULT", "default", "White space: Visible only in View Whitespace mode (or if it has a back colour)",
@ -106,6 +110,7 @@ class LexerLua : public DefaultLexer {
WordList keywords8;
OptionsLua options;
OptionSetLua osLua;
SubStyles subStyles{styleSubable};
public:
explicit LexerLua() :
DefaultLexer("lua", SCLEX_LUA, lexicalClasses, std::size(lexicalClasses)) {
@ -137,6 +142,35 @@ public:
void SCI_METHOD Lex(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess) override;
void SCI_METHOD Fold(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess) override;
int SCI_METHOD AllocateSubStyles(int styleBase, int numberStyles) override {
return subStyles.Allocate(styleBase, numberStyles);
}
int SCI_METHOD SubStylesStart(int styleBase) override {
return subStyles.Start(styleBase);
}
int SCI_METHOD SubStylesLength(int styleBase) override {
return subStyles.Length(styleBase);
}
int SCI_METHOD StyleFromSubStyle(int subStyle) override {
const int styleBase = subStyles.BaseStyle(subStyle);
return styleBase;
}
int SCI_METHOD PrimaryStyleFromStyle(int style) override {
return style;
}
void SCI_METHOD FreeSubStyles() override {
subStyles.Free();
}
void SCI_METHOD SetIdentifiers(int style, const char *identifiers) override {
subStyles.SetIdentifiers(style, identifiers);
}
int SCI_METHOD DistanceToSecondaryStyles() override {
return 0;
}
const char *SCI_METHOD GetSubStyleBases() override {
return styleSubable;
}
static ILexer5 *LexerFactoryLua() {
return new LexerLua();
}
@ -205,6 +239,8 @@ void LexerLua::Lex(Sci_PositionU startPos, Sci_Position length, int initStyle, I
const CharacterSet setLuaOperator("*/-+()={}~[];<>,.^%:#&|");
const CharacterSet setEscapeSkip("\"'\\");
const WordClassifier &classifierIdentifiers = subStyles.Classifier(SCE_LUA_IDENTIFIER);
Sci_Position currentLine = styler.GetLine(startPos);
// Initialize long string [[ ... ]] or block comment --[[ ... ]],
// if we are inside such a string. Block comment was introduced in Lua 5.0,
@ -449,6 +485,11 @@ void LexerLua::Lex(Sci_PositionU startPos, Sci_Position length, int initStyle, I
newStyle = SCE_LUA_WORD7;
} else if (keywords8.InList(ident)) {
newStyle = SCE_LUA_WORD8;
} else {
const int subStyle = classifierIdentifiers.ValueFor(ident);
if (subStyle >= 0) {
newStyle = subStyle;
}
}
if (newStyle != SCE_LUA_IDENTIFIER) {
idenStyle = newStyle;
@ -464,7 +505,7 @@ void LexerLua::Lex(Sci_PositionU startPos, Sci_Position length, int initStyle, I
cNext = 0;
}
} while (cNext);
if ((idenStyle == SCE_LUA_WORD) && (ident == "goto")) {
if ((idenStyle == SCE_LUA_WORD) && (ident == "goto")) {
foundGoto = true;
}
sc.SetState(SCE_LUA_IDENTIFIER);

View File

@ -538,10 +538,7 @@ Sci_Position SCI_METHOD LexerPerl::WordListSet(int n, const char *wl) {
}
Sci_Position firstModification = -1;
if (wordListN) {
WordList wlNew;
wlNew.Set(wl);
if (*wordListN != wlNew) {
wordListN->Set(wl);
if (wordListN->Set(wl)) {
firstModification = 0;
}
}

View File

@ -5,12 +5,8 @@
// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <stdarg.h>
#include <assert.h>
#include <ctype.h>
#include <cstdlib>
#include <cassert>
#include <string>
#include <string_view>
@ -28,22 +24,24 @@
using namespace Lexilla;
static inline bool AtEOL(Accessor &styler, Sci_PositionU i) {
namespace {
bool AtEOL(Accessor &styler, Sci_PositionU i) {
return (styler[i] == '\n') ||
((styler[i] == '\r') && (styler.SafeGetCharAt(i + 1) != '\n'));
}
static inline bool isassignchar(unsigned char ch) {
constexpr bool isAssignChar(char ch) noexcept {
return (ch == '=') || (ch == ':');
}
static void ColourisePropsLine(
void ColourisePropsLine(
const char *lineBuffer,
Sci_PositionU lengthLine,
Sci_PositionU startLine,
Sci_PositionU endPos,
Accessor &styler,
bool allowInitialSpaces) {
Sci_PositionU lengthLine,
Sci_PositionU startLine,
Sci_PositionU endPos,
Accessor &styler,
bool allowInitialSpaces) {
Sci_PositionU i = 0;
if (allowInitialSpaces) {
@ -61,14 +59,14 @@ static void ColourisePropsLine(
styler.ColourTo(endPos, SCE_PROPS_SECTION);
} else if (lineBuffer[i] == '@') {
styler.ColourTo(startLine + i, SCE_PROPS_DEFVAL);
if (isassignchar(lineBuffer[i++]))
if (isAssignChar(lineBuffer[i++]))
styler.ColourTo(startLine + i, SCE_PROPS_ASSIGNMENT);
styler.ColourTo(endPos, SCE_PROPS_DEFAULT);
} else {
// Search for the '=' character
while ((i < lengthLine) && !isassignchar(lineBuffer[i]))
while ((i < lengthLine) && !isAssignChar(lineBuffer[i]))
i++;
if ((i < lengthLine) && isassignchar(lineBuffer[i])) {
if ((i < lengthLine) && isAssignChar(lineBuffer[i])) {
styler.ColourTo(startLine + i - 1, SCE_PROPS_KEY);
styler.ColourTo(startLine + i, SCE_PROPS_ASSIGNMENT);
styler.ColourTo(endPos, SCE_PROPS_DEFAULT);
@ -81,7 +79,7 @@ static void ColourisePropsLine(
}
}
static void ColourisePropsDoc(Sci_PositionU startPos, Sci_Position length, int, WordList *[], Accessor &styler) {
void ColourisePropsDoc(Sci_PositionU startPos, Sci_Position length, int, WordList *[], Accessor &styler) {
std::string lineBuffer;
styler.StartAt(startPos);
styler.StartSegment(startPos);
@ -109,7 +107,7 @@ 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) {
void FoldPropsDoc(Sci_PositionU startPos, Sci_Position length, int, WordList *[], Accessor &styler) {
const bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;
const Sci_PositionU endPos = startPos + length;
@ -117,7 +115,6 @@ static void FoldPropsDoc(Sci_PositionU startPos, Sci_Position length, int, WordL
Sci_Position lineCurrent = styler.GetLine(startPos);
char chNext = styler[startPos];
int styleNext = styler.StyleAt(startPos);
bool headerPoint = false;
int levelPrevious = (lineCurrent > 0) ? styler.LevelAt(lineCurrent - 1) : SC_FOLDLEVELBASE;
@ -125,8 +122,7 @@ static void FoldPropsDoc(Sci_PositionU startPos, Sci_Position length, int, WordL
const char ch = chNext;
chNext = styler[i+1];
const int style = styleNext;
styleNext = styler.StyleAt(i + 1);
const int style = styler.StyleIndexAt(i);
const bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n');
if (style == SCE_PROPS_SECTION) {
@ -164,12 +160,14 @@ static void FoldPropsDoc(Sci_PositionU startPos, Sci_Position length, int, WordL
if (levelPrevious & SC_FOLDLEVELHEADERFLAG) {
level += 1;
}
int flagsNext = styler.LevelAt(lineCurrent);
const int flagsNext = styler.LevelAt(lineCurrent);
styler.SetLevel(lineCurrent, level | (flagsNext & ~SC_FOLDLEVELNUMBERMASK));
}
static const char *const emptyWordListDesc[] = {
0
const char *const emptyWordListDesc[] = {
nullptr
};
}
LexerModule lmProps(SCLEX_PROPERTIES, ColourisePropsDoc, "props", FoldPropsDoc, emptyWordListDesc);

View File

@ -203,7 +203,7 @@ int GetPyStringState(Accessor &styler, Sci_Position i, Sci_PositionU *nextIndex,
}
}
bool IsAWordChar(int ch, bool unicodeIdentifiers) {
bool IsAWordChar(int ch, bool unicodeIdentifiers) noexcept {
if (IsASCII(ch))
return (IsAlphaNumeric(ch) || ch == '.' || ch == '_');
@ -214,7 +214,7 @@ bool IsAWordChar(int ch, bool unicodeIdentifiers) {
return IsXidContinue(ch);
}
bool IsAWordStart(int ch, bool unicodeIdentifiers) {
bool IsAWordStart(int ch, bool unicodeIdentifiers) noexcept {
if (IsASCII(ch))
return (IsUpperOrLowerCase(ch) || ch == '_');
@ -403,12 +403,11 @@ class LexerPython : public DefaultLexer {
OptionsPython options;
OptionSetPython osPython;
enum { ssIdentifier };
SubStyles subStyles;
SubStyles subStyles{styleSubable};
std::map<Sci_Position, std::vector<SingleFStringExpState> > ftripleStateAtEol;
public:
explicit LexerPython() :
DefaultLexer("python", SCLEX_PYTHON, lexicalClasses, std::size(lexicalClasses)),
subStyles(styleSubable, 0x80, 0x40, 0) {
DefaultLexer("python", SCLEX_PYTHON, lexicalClasses, std::size(lexicalClasses)) {
}
~LexerPython() override = default;
void SCI_METHOD Release() override {
@ -427,7 +426,7 @@ public:
return osPython.DescribeProperty(name);
}
Sci_Position SCI_METHOD PropertySet(const char *key, const char *val) override;
const char * SCI_METHOD PropertyGet(const char *key) override {
const char *SCI_METHOD PropertyGet(const char *key) override {
return osPython.PropertyGet(key);
}
const char *SCI_METHOD DescribeWordListSets() override {
@ -730,11 +729,11 @@ void SCI_METHOD LexerPython::Lex(Sci_PositionU startPos, Sci_Position length, in
if (!IsASpaceOrTab(ch))
break;
}
if (((isDecoratorAttribute) && (!isComment)) && (((options.decoratorAttributes == 1) && (style == SCE_P_IDENTIFIER)) || (options.decoratorAttributes == 2))){
if (((isDecoratorAttribute) && (!isComment)) && (((options.decoratorAttributes == 1) && (style == SCE_P_IDENTIFIER)) || (options.decoratorAttributes == 2))) {
// Style decorator attributes as decorators but respect already styled identifiers (unless requested to ignore already styled identifiers)
style = SCE_P_DECORATOR;
}
if (((!isDecoratorAttribute) && (!isComment)) && (((options.identifierAttributes == 1) && (style == SCE_P_IDENTIFIER)) || (options.identifierAttributes == 2))){
if (((!isDecoratorAttribute) && (!isComment)) && (((options.identifierAttributes == 1) && (style == SCE_P_IDENTIFIER)) || (options.identifierAttributes == 2))) {
// Style attributes and ignore decorator attributes but respect already styled identifiers (unless requested to ignore already styled identifiers)
style = SCE_P_ATTRIBUTE;
}
@ -818,7 +817,7 @@ void SCI_METHOD LexerPython::Lex(Sci_PositionU startPos, Sci_Position length, in
}
// If in an f-string expression and pre pep 701 lexing is used,
// check for the ending quote(s) and end f-string to handle
// check for the ending quote(s) and end f-string to handle
// syntactically incorrect cases like f'{' and f"""{""". Post
// pep 701, a quote may appear in a { } field so cases like
// f"n = {":".join(seq)}" is valid

View File

@ -848,10 +848,7 @@ Sci_Position SCI_METHOD LexerRaku::WordListSet(int n, const char *wl) {
}
Sci_Position firstModification = -1;
if (wordListN) {
WordList wlNew;
wlNew.Set(wl);
if (*wordListN != wlNew) {
wordListN->Set(wl);
if (wordListN->Set(wl)) {
firstModification = 0;
}
}

View File

@ -48,6 +48,10 @@ inline bool isSafeAlpha(char ch) noexcept {
return (isSafeASCII(ch) && isalpha(ch)) || ch == '_';
}
inline bool isSafeAlphaOrHigh(char ch) noexcept {
return isHighBitChar(ch) || isalpha(ch) || ch == '_';
}
inline bool isSafeAlnum(char ch) noexcept {
return (isSafeASCII(ch) && isalnum(ch)) || ch == '_';
}
@ -155,7 +159,7 @@ int ClassifyWordRb(Sci_PositionU start, Sci_PositionU end, char ch, WordList &ke
// 1. <<if test ...>> : normal
// 2. <<stmt if test>> : demoted
// 3. <<lhs = if ...>> : normal: start a new indent level
// 4. <<obj.if = 10>> : color as identifer, since it follows '.'
// 4. <<obj.if = 10>> : color as identifier, since it follows '.'
chAttr = SCE_RB_WORD_DEMOTED;
} else {
@ -613,7 +617,7 @@ bool sureThisIsNotHeredoc(Sci_Position lt2StartPos, Accessor &styler) {
j += 1;
}
if (isSafeAlnum(styler[j])) {
if (isSafeAlnumOrHigh(styler[j])) {
// Init target_end because some compilers think it won't
// be initialized by the time it's used
target_start = target_end = j;
@ -622,7 +626,7 @@ bool sureThisIsNotHeredoc(Sci_Position lt2StartPos, Accessor &styler) {
return definitely_not_a_here_doc;
}
for (; j < lengthDoc; j++) {
if (!isSafeAlnum(styler[j])) {
if (!isSafeAlnumOrHigh(styler[j])) {
if (target_quote && styler[j] != target_quote) {
// unquoted end
return definitely_not_a_here_doc;
@ -641,7 +645,7 @@ bool sureThisIsNotHeredoc(Sci_Position lt2StartPos, Accessor &styler) {
return definitely_not_a_here_doc;
} else {
const char ch = styler[j];
if (ch == '#' || isEOLChar(ch) || ch == '.' || ch == ',') {
if (ch == '#' || isEOLChar(ch) || ch == '.' || ch == ',' || IsLowerCase(ch)) {
// This is OK, so break and continue;
break;
} else {
@ -877,7 +881,7 @@ void ColouriseRbDoc(Sci_PositionU startPos, Sci_Position length, int initStyle,
styler.ColourTo(i - 1, state);
state = SCE_RB_NUMBER;
is_real_number = true;
} else if (isHighBitChar(ch) || iswordstart(ch)) {
} else if (isSafeAlphaOrHigh(ch)) {
styler.ColourTo(i - 1, state);
state = SCE_RB_WORD;
} else if (ch == '#') {
@ -929,7 +933,7 @@ void ColouriseRbDoc(Sci_PositionU startPos, Sci_Position length, int initStyle,
// Recognize it bit by bit
state = SCE_RB_GLOBAL;
} else if (ch == '/' && preferRE) {
// Ambigous operator
// Ambiguous operator
styler.ColourTo(i - 1, state);
state = SCE_RB_REGEX;
Quote.New();
@ -945,7 +949,7 @@ void ColouriseRbDoc(Sci_PositionU startPos, Sci_Position length, int initStyle,
chNext = chNext2;
styler.ColourTo(i, SCE_RB_OPERATOR);
if (!(strchr("\"\'`_-~", chNext2) || isSafeAlpha(chNext2))) {
if (!(strchr("\"\'`_-~", chNext2) || isSafeAlphaOrHigh(chNext2))) {
// It's definitely not a here-doc,
// based on Ruby's lexer/parser in the
// heredoc_identifier routine.

View File

@ -171,10 +171,7 @@ Sci_Position SCI_METHOD LexerRust::WordListSet(int n, const char *wl) {
Sci_Position firstModification = -1;
if (n < NUM_RUST_KEYWORD_LISTS) {
WordList *wordListN = &keywords[n];
WordList wlNew;
wlNew.Set(wl);
if (*wordListN != wlNew) {
wordListN->Set(wl);
if (wordListN->Set(wl)) {
firstModification = 0;
}
}
@ -210,6 +207,24 @@ static void GrabString(char* s, Accessor& styler, Sci_Position start, Sci_Positi
s[len] = '\0';
}
static void ScanRawIdentifier(Accessor& styler, Sci_Position& pos) {
Sci_Position start = pos;
while (IsIdentifierContinue(styler.SafeGetCharAt(pos, '\0')))
pos++;
char s[MAX_RUST_IDENT_CHARS + 1];
Sci_Position len = pos - start;
len = len > MAX_RUST_IDENT_CHARS ? MAX_RUST_IDENT_CHARS : len;
GrabString(s, styler, start, len);
// restricted values https://doc.rust-lang.org/reference/identifiers.html#raw-identifiers
if (strcmp(s, "crate") != 0 && strcmp(s, "self") != 0 &&
strcmp(s, "super") != 0 && strcmp(s, "Self") != 0) {
styler.ColourTo(pos - 1, SCE_RUST_IDENTIFIER);
} else {
styler.ColourTo(pos - 1, SCE_RUST_LEXERROR);
}
}
static void ScanIdentifier(Accessor& styler, Sci_Position& pos, WordList *keywords) {
Sci_Position start = pos;
while (IsIdentifierContinue(styler.SafeGetCharAt(pos, '\0')))
@ -707,6 +722,9 @@ void SCI_METHOD LexerRust::Lex(Sci_PositionU startPos, Sci_Position length, int
ScanWhitespace(styler, pos, max);
} else if (c == '/' && (n == '/' || n == '*')) {
ScanComments(styler, pos, max);
} else if (c == 'r' && (n == '#' && IsIdentifierStart(n2))) {
pos += 2;
ScanRawIdentifier(styler, pos);
} else if (c == 'r' && (n == '#' || n == '"')) {
ScanRawString(styler, pos, max, false);
} else if (c == 'b' && n == 'r' && (n2 == '#' || n2 == '"')) {

View File

@ -7,12 +7,10 @@
// Copyright 1998-2012 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
#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 <string>
#include <string_view>
@ -38,25 +36,27 @@
using namespace Scintilla;
using namespace Lexilla;
static inline bool IsAWordChar(int ch, bool sqlAllowDottedWord) {
namespace {
bool IsAWordChar(int ch, bool sqlAllowDottedWord) noexcept {
if (!sqlAllowDottedWord)
return (ch < 0x80) && (isalnum(ch) || ch == '_');
else
return (ch < 0x80) && (isalnum(ch) || ch == '_' || ch == '.');
}
static inline bool IsAWordStart(int ch) {
bool IsAWordStart(int ch) noexcept {
return (ch < 0x80) && (isalpha(ch) || ch == '_');
}
static inline bool IsADoxygenChar(int ch) {
bool IsADoxygenChar(int ch) noexcept {
return (islower(ch) || ch == '$' || ch == '@' ||
ch == '\\' || ch == '&' || ch == '<' ||
ch == '>' || ch == '#' || ch == '{' ||
ch == '}' || ch == '[' || ch == ']');
}
static inline bool IsANumberChar(int ch, int chPrev) {
bool IsANumberChar(int ch, int chPrev) noexcept {
// Not exactly following number definition (several dots are seen as OK, etc.)
// but probably enough in most cases.
return (ch < 0x80) &&
@ -263,7 +263,7 @@ struct OptionsSQL {
}
};
static const char * const sqlWordListDesc[] = {
const char * const sqlWordListDesc[] = {
"Keywords",
"Database Objects",
"PLDoc",
@ -272,7 +272,7 @@ static const char * const sqlWordListDesc[] = {
"User Keywords 2",
"User Keywords 3",
"User Keywords 4",
0
nullptr
};
struct OptionSetSQL : public OptionSet<OptionsSQL> {
@ -381,10 +381,10 @@ private:
}
bool IsCommentLine (Sci_Position line, LexAccessor &styler) {
Sci_Position pos = styler.LineStart(line);
Sci_Position eol_pos = styler.LineStart(line + 1) - 1;
const Sci_Position pos = styler.LineStart(line);
const Sci_Position eol_pos = styler.LineStart(line + 1) - 1;
for (Sci_Position i = pos; i + 1 < eol_pos; i++) {
int style = styler.StyleAt(i);
const int style = styler.StyleAt(i);
// MySQL needs -- comments to be followed by space or control char
if (style == SCE_SQL_COMMENTLINE && styler.Match(i, "--"))
return true;
@ -437,10 +437,7 @@ Sci_Position SCI_METHOD LexerSQL::WordListSet(int n, const char *wl) {
}
Sci_Position firstModification = -1;
if (wordListN) {
WordList wlNew;
wlNew.Set(wl);
if (*wordListN != wlNew) {
wordListN->Set(wl);
if (wordListN->Set(wl)) {
firstModification = 0;
}
}
@ -627,7 +624,7 @@ void SCI_METHOD LexerSQL::Lex(Sci_PositionU startPos, Sci_Position length, int i
sc.SetState(SCE_SQL_CHARACTER);
} else if (sc.ch == '\"') {
sc.SetState(SCE_SQL_STRING);
} else if (isoperator(static_cast<char>(sc.ch))) {
} else if (isoperator(sc.ch)) {
sc.SetState(SCE_SQL_OPERATOR);
}
}
@ -650,7 +647,7 @@ void SCI_METHOD LexerSQL::Fold(Sci_PositionU startPos, Sci_Position length, int
// And keep going back until we find an operator ';' followed
// by white-space and/or comments. This will improve folding.
while (--startPos > 0) {
char ch = styler[startPos];
const char ch = styler[startPos];
if (ch == '\n' || (ch == '\r' && styler[startPos + 1] != '\n')) {
lastNLPos = startPos;
} else if (ch == ';' &&
@ -659,7 +656,7 @@ void SCI_METHOD LexerSQL::Fold(Sci_PositionU startPos, Sci_Position length, int
for (Sci_Position tempPos = startPos + 1;
tempPos < lastNLPos;
++tempPos) {
int tempStyle = styler.StyleAt(tempPos);
const int tempStyle = styler.StyleAt(tempPos);
if (!IsCommentStyle(tempStyle)
&& tempStyle != SCE_SQL_DEFAULT) {
isAllClear = false;
@ -679,7 +676,7 @@ void SCI_METHOD LexerSQL::Fold(Sci_PositionU startPos, Sci_Position length, int
// And because folding ends at ';', keep going until we find one
// Otherwise if create ... view ... as is split over multiple
// lines the folding won't always update immediately.
Sci_PositionU docLength = styler.Length();
const Sci_PositionU docLength = styler.Length();
for (; endPos < docLength; ++endPos) {
if (styler.SafeGetCharAt(endPos) == ';') {
break;
@ -700,12 +697,12 @@ void SCI_METHOD LexerSQL::Fold(Sci_PositionU startPos, Sci_Position length, int
sqlStatesCurrentLine = sqlStates.ForLine(lineCurrent);
}
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 = styler.StyleAt(i + 1);
bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n');
const bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n');
if (atEOL || (!IsCommentStyle(style) && ch == ';')) {
if (endFound) {
//Maybe this is the end of "EXCEPTION" BLOCK (eg. "BEGIN ... EXCEPTION ... END;")
@ -750,8 +747,8 @@ void SCI_METHOD LexerSQL::Fold(Sci_PositionU startPos, Sci_Position length, int
if (options.foldComment && (style == SCE_SQL_COMMENTLINE)) {
// MySQL needs -- comments to be followed by space or control char
if ((ch == '-') && (chNext == '-')) {
char chNext2 = styler.SafeGetCharAt(i + 2);
char chNext3 = styler.SafeGetCharAt(i + 3);
const char chNext2 = styler.SafeGetCharAt(i + 2);
const char chNext3 = styler.SafeGetCharAt(i + 3);
if (chNext2 == '{' || chNext3 == '{') {
levelNext++;
} else if (chNext2 == '}' || chNext3 == '}') {
@ -779,7 +776,7 @@ void SCI_METHOD LexerSQL::Fold(Sci_PositionU startPos, Sci_Position length, int
}
// If new keyword (cannot trigger on elseif or nullif, does less tests)
if (style == SCE_SQL_WORD && stylePrev != SCE_SQL_WORD) {
const int MAX_KW_LEN = 9; // Maximum length of folding keywords
constexpr int MAX_KW_LEN = 9; // Maximum length of folding keywords
char s[MAX_KW_LEN + 2];
unsigned int j = 0;
for (; j < MAX_KW_LEN + 1; j++) {
@ -950,7 +947,7 @@ void SCI_METHOD LexerSQL::Fold(Sci_PositionU startPos, Sci_Position length, int
}
}
if (atEOL) {
int levelUse = levelCurrent;
const int levelUse = levelCurrent;
int lev = levelUse | levelNext << 16;
if (visibleChars == 0 && options.foldCompact)
lev |= SC_FOLDLEVELWHITEFLAG;
@ -972,4 +969,6 @@ void SCI_METHOD LexerSQL::Fold(Sci_PositionU startPos, Sci_Position length, int
}
}
}
LexerModule lmSQL(SCLEX_SQL, LexerSQL::LexerFactorySQL, "sql", sqlWordListDesc);

View File

@ -5,12 +5,10 @@
// Copyright 1998-2005 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
#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 <string>
#include <string_view>
@ -28,30 +26,31 @@
using namespace Lexilla;
namespace {
// Internal state, highlighted as number
#define SCE_B_FILENUMBER SCE_B_DEFAULT+100
constexpr int SCE_B_FILENUMBER = SCE_B_DEFAULT + 100;
static bool IsVBComment(Accessor &styler, Sci_Position pos, Sci_Position len) {
bool IsVBComment(Accessor &styler, Sci_Position pos, Sci_Position len) {
return len > 0 && styler[pos] == '\'';
}
static inline bool IsTypeCharacter(int ch) {
constexpr bool IsTypeCharacter(int ch) noexcept {
return ch == '%' || ch == '&' || ch == '@' || ch == '!' || ch == '#' || ch == '$';
}
// Extended to accept accented characters
static inline bool IsAWordChar(int ch) {
bool IsAWordChar(int ch) noexcept {
return ch >= 0x80 ||
(isalnum(ch) || ch == '.' || ch == '_');
}
static inline bool IsAWordStart(int ch) {
bool IsAWordStart(int ch) noexcept {
return ch >= 0x80 ||
(isalpha(ch) || ch == '_');
}
static inline bool IsANumberChar(int ch) {
bool IsANumberChar(int ch) noexcept {
// Not exactly following number definition (several dots are seen as OK, etc.)
// but probably enough in most cases.
return (ch < 0x80) &&
@ -59,13 +58,13 @@ static inline bool IsANumberChar(int ch) {
ch == '.' || ch == '-' || ch == '+' || ch == '_');
}
static void ColouriseVBDoc(Sci_PositionU startPos, Sci_Position length, int initStyle,
void ColouriseVBDoc(Sci_PositionU startPos, Sci_Position length, int initStyle,
WordList *keywordlists[], Accessor &styler, bool vbScriptSyntax) {
WordList &keywords = *keywordlists[0];
WordList &keywords2 = *keywordlists[1];
WordList &keywords3 = *keywordlists[2];
WordList &keywords4 = *keywordlists[3];
const WordList &keywords = *keywordlists[0];
const WordList &keywords2 = *keywordlists[1];
const WordList &keywords3 = *keywordlists[2];
const WordList &keywords4 = *keywordlists[3];
styler.StartAt(startPos);
@ -74,7 +73,7 @@ static void ColouriseVBDoc(Sci_PositionU startPos, Sci_Position length, int init
// property lexer.vb.strings.multiline
// Set to 1 to allow strings to continue over line ends.
bool allowMultilineStr = styler.GetPropertyInt("lexer.vb.strings.multiline", 0) != 0;
const bool allowMultilineStr = styler.GetPropertyInt("lexer.vb.strings.multiline", 0) != 0;
// Do not leak onto next line
if (initStyle == SCE_B_STRINGEOL || initStyle == SCE_B_COMMENT || initStyle == SCE_B_PREPROCESSOR) {
@ -214,7 +213,7 @@ static void ColouriseVBDoc(Sci_PositionU startPos, Sci_Position length, int init
sc.SetState(SCE_B_NUMBER);
} else if (IsAWordStart(sc.ch) || (sc.ch == '[')) {
sc.SetState(SCE_B_IDENTIFIER);
} else if (isoperator(static_cast<char>(sc.ch)) || (sc.ch == '\\')) { // Integer division
} else if (isoperator(sc.ch) || (sc.ch == '\\')) { // Integer division
sc.SetState(SCE_B_OPERATOR);
}
}
@ -263,9 +262,9 @@ static void ColouriseVBDoc(Sci_PositionU startPos, Sci_Position length, int init
sc.Complete();
}
static void FoldVBDoc(Sci_PositionU startPos, Sci_Position length, int,
void FoldVBDoc(Sci_PositionU startPos, Sci_Position length, int,
WordList *[], Accessor &styler) {
Sci_Position endPos = startPos + length;
const Sci_Position endPos = startPos + length;
// Backtrack to previous line in case need to fix its fold status
Sci_Position lineCurrent = styler.GetLine(startPos);
@ -279,12 +278,12 @@ static void FoldVBDoc(Sci_PositionU startPos, Sci_Position length, int,
int indentCurrent = styler.IndentAmount(lineCurrent, &spaceFlags, IsVBComment);
char chNext = styler[startPos];
for (Sci_Position i = startPos; i < endPos; i++) {
char ch = chNext;
const char ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
if ((ch == '\r' && chNext != '\n') || (ch == '\n') || (i == endPos)) {
int lev = indentCurrent;
int indentNext = styler.IndentAmount(lineCurrent + 1, &spaceFlags, IsVBComment);
const int indentNext = styler.IndentAmount(lineCurrent + 1, &spaceFlags, IsVBComment);
if (!(indentCurrent & SC_FOLDLEVELWHITEFLAG)) {
// Only non whitespace lines can be headers
if ((indentCurrent & SC_FOLDLEVELNUMBERMASK) < (indentNext & SC_FOLDLEVELNUMBERMASK)) {
@ -292,7 +291,7 @@ static void FoldVBDoc(Sci_PositionU startPos, Sci_Position length, int,
} else if (indentNext & SC_FOLDLEVELWHITEFLAG) {
// Line after is blank so check the next - maybe should continue further?
int spaceFlags2 = 0;
int indentNext2 = styler.IndentAmount(lineCurrent + 2, &spaceFlags2, IsVBComment);
const int indentNext2 = styler.IndentAmount(lineCurrent + 2, &spaceFlags2, IsVBComment);
if ((indentCurrent & SC_FOLDLEVELNUMBERMASK) < (indentNext2 & SC_FOLDLEVELNUMBERMASK)) {
lev |= SC_FOLDLEVELHEADERFLAG;
}
@ -305,24 +304,26 @@ static void FoldVBDoc(Sci_PositionU startPos, Sci_Position length, int,
}
}
static void ColouriseVBNetDoc(Sci_PositionU startPos, Sci_Position length, int initStyle,
void ColouriseVBNetDoc(Sci_PositionU startPos, Sci_Position length, int initStyle,
WordList *keywordlists[], Accessor &styler) {
ColouriseVBDoc(startPos, length, initStyle, keywordlists, styler, false);
}
static void ColouriseVBScriptDoc(Sci_PositionU startPos, Sci_Position length, int initStyle,
void ColouriseVBScriptDoc(Sci_PositionU startPos, Sci_Position length, int initStyle,
WordList *keywordlists[], Accessor &styler) {
ColouriseVBDoc(startPos, length, initStyle, keywordlists, styler, true);
}
static const char * const vbWordListDesc[] = {
const char * const vbWordListDesc[] = {
"Keywords",
"user1",
"user2",
"user3",
0
nullptr
};
}
LexerModule lmVB(SCLEX_VB, ColouriseVBNetDoc, "vb", FoldVBDoc, vbWordListDesc);
LexerModule lmVBScript(SCLEX_VBSCRIPT, ColouriseVBScriptDoc, "vbscript", FoldVBDoc, vbWordListDesc);

View File

@ -4048,12 +4048,17 @@ constexpr int maskCategory = 0x1F;
// possibly for 0..0xff for most Western European text or 0..0xfff for most
// alphabetic languages.
CharacterCategory CategoriseCharacter(int character) {
CharacterCategory CategoriseCharacter(int character) noexcept {
if (character < 0 || character > maxUnicode)
return ccCn;
const int baseValue = character * (maskCategory+1) + maskCategory;
const int *placeAfter = std::lower_bound(catRanges, std::end(catRanges), baseValue);
return static_cast<CharacterCategory>(*(placeAfter-1) & maskCategory);
try {
// lower_bound will never throw with these args but its not marked noexcept so add catch to pretend.
const int *placeAfter = std::lower_bound(catRanges, std::end(catRanges), baseValue);
return static_cast<CharacterCategory>(*(placeAfter - 1) & maskCategory);
} catch (...) {
return ccCn;
}
}
// Implementation of character sets recommended for identifiers in Unicode Standard Annex #31.
@ -4156,7 +4161,7 @@ bool OmitXidContinue(int character) noexcept {
// UAX #31 defines ID_Start as
// [[:L:][:Nl:][:Other_ID_Start:]--[:Pattern_Syntax:]--[:Pattern_White_Space:]]
bool IsIdStart(int character) {
bool IsIdStart(int character) noexcept {
if (IsIdPattern(character)) {
return false;
}
@ -4171,7 +4176,7 @@ bool IsIdStart(int character) {
// UAX #31 defines ID_Continue as
// [[:ID_Start:][:Mn:][:Mc:][:Nd:][:Pc:][:Other_ID_Continue:]--[:Pattern_Syntax:]--[:Pattern_White_Space:]]
bool IsIdContinue(int character) {
bool IsIdContinue(int character) noexcept {
if (IsIdPattern(character)) {
return false;
}
@ -4185,7 +4190,7 @@ bool IsIdContinue(int character) {
}
// XID_Start is ID_Start modified for Normalization Form KC in UAX #31
bool IsXidStart(int character) {
bool IsXidStart(int character) noexcept {
if (OmitXidStart(character)) {
return false;
} else {
@ -4194,7 +4199,7 @@ bool IsXidStart(int character) {
}
// XID_Continue is ID_Continue modified for Normalization Form KC in UAX #31
bool IsXidContinue(int character) {
bool IsXidContinue(int character) noexcept {
if (OmitXidContinue(character)) {
return false;
} else {

View File

@ -20,20 +20,20 @@ enum CharacterCategory {
ccCc, ccCf, ccCs, ccCo, ccCn
};
CharacterCategory CategoriseCharacter(int character);
CharacterCategory CategoriseCharacter(int character) noexcept;
// Common definitions of allowable characters in identifiers from UAX #31.
bool IsIdStart(int character);
bool IsIdContinue(int character);
bool IsXidStart(int character);
bool IsXidContinue(int character);
bool IsIdStart(int character) noexcept;
bool IsIdContinue(int character) noexcept;
bool IsXidStart(int character) noexcept;
bool IsXidContinue(int character) noexcept;
class CharacterCategoryMap {
private:
std::vector<unsigned char> dense;
public:
CharacterCategoryMap();
CharacterCategory CategoryFor(int character) const {
CharacterCategory CategoryFor(int character) const noexcept {
if (static_cast<size_t>(character) < dense.size()) {
return static_cast<CharacterCategory>(dense[character]);
} else {

View File

@ -22,7 +22,7 @@ public:
explicit WordClassifier(int baseStyle_) : baseStyle(baseStyle_), firstStyle(0), lenStyles(0) {
}
void Allocate(int firstStyle_, int lenStyles_) {
void Allocate(int firstStyle_, int lenStyles_) noexcept {
firstStyle = firstStyle_;
lenStyles = lenStyles_;
wordToStyle.clear();
@ -92,6 +92,10 @@ public:
}
};
// This is the common configuration: 64 sub-styles allocated from 128 to 191
constexpr int SubStylesFirst = 0x80;
constexpr int SubStylesAvailable = 0x40;
class SubStyles {
int classifications;
const char *baseStyles;
@ -121,7 +125,7 @@ class SubStyles {
public:
SubStyles(const char *baseStyles_, int styleFirst_, int stylesAvailable_, int secondaryDistance_) :
SubStyles(const char *baseStyles_, int styleFirst_=SubStylesFirst, int stylesAvailable_=SubStylesAvailable, int secondaryDistance_=0) :
classifications(0),
baseStyles(baseStyles_),
styleFirst(styleFirst_),
@ -134,7 +138,7 @@ public:
}
}
int Allocate(int styleBase, int numberStyles) {
int Allocate(int styleBase, int numberStyles) noexcept {
const int block = BlockFromBaseStyle(styleBase);
if (block >= 0) {
if ((allocated + numberStyles) > stylesAvailable)

View File

@ -25,7 +25,7 @@ import LexFacer
sys.path.append(str(thisPath.parent.parent / "src"))
import DepGen
# RegenerateXcodeProject and assiciated functions is copied from scintilla/scripts/LexGen.py
# RegenerateXcodeProject and associated functions are copied from scintilla/scripts/LexGen.py
def uid24():
""" Last 24 digits of UUID, used for item IDs in Xcode. """

View File

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

View File

@ -866,7 +866,7 @@
buildSettings = {
CLANG_CXX_LANGUAGE_STANDARD = "gnu++17";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 5.3.1;
CURRENT_PROJECT_VERSION = 5.3.2;
DEAD_CODE_STRIPPING = YES;
DEVELOPMENT_TEAM = 4F446KW87E;
DYLIB_COMPATIBILITY_VERSION = 1;
@ -894,7 +894,7 @@
buildSettings = {
CLANG_CXX_LANGUAGE_STANDARD = "gnu++17";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 5.3.1;
CURRENT_PROJECT_VERSION = 5.3.2;
DEAD_CODE_STRIPPING = YES;
DEVELOPMENT_TEAM = 4F446KW87E;
DYLIB_COMPATIBILITY_VERSION = 1;

View File

@ -4,8 +4,8 @@
#include <windows.h>
#define VERSION_LEXILLA "5.3.1"
#define VERSION_WORDS 5, 3, 1, 0
#define VERSION_LEXILLA "5.3.2"
#define VERSION_WORDS 5, 3, 2, 0
VS_VERSION_INFO VERSIONINFO
FILEVERSION VERSION_WORDS

View File

@ -730,6 +730,7 @@ $(DIR_O)/LexHTML.o: \
../../scintilla/include/Sci_Position.h \
../../scintilla/include/Scintilla.h \
../include/SciLexer.h \
../lexlib/InList.h \
../lexlib/WordList.h \
../lexlib/LexAccessor.h \
../lexlib/Accessor.h \
@ -737,6 +738,7 @@ $(DIR_O)/LexHTML.o: \
../lexlib/CharacterSet.h \
../lexlib/LexerModule.h \
../lexlib/OptionSet.h \
../lexlib/SubStyles.h \
../lexlib/DefaultLexer.h
$(DIR_O)/LexIndent.o: \
../lexers/LexIndent.cxx \
@ -868,6 +870,7 @@ $(DIR_O)/LexLua.o: \
../lexlib/CharacterSet.h \
../lexlib/LexerModule.h \
../lexlib/OptionSet.h \
../lexlib/SubStyles.h \
../lexlib/DefaultLexer.h
$(DIR_O)/LexMagik.o: \
../lexers/LexMagik.cxx \

View File

@ -730,6 +730,7 @@ $(DIR_O)/LexHTML.obj: \
../../scintilla/include/Sci_Position.h \
../../scintilla/include/Scintilla.h \
../include/SciLexer.h \
../lexlib/InList.h \
../lexlib/WordList.h \
../lexlib/LexAccessor.h \
../lexlib/Accessor.h \
@ -737,6 +738,7 @@ $(DIR_O)/LexHTML.obj: \
../lexlib/CharacterSet.h \
../lexlib/LexerModule.h \
../lexlib/OptionSet.h \
../lexlib/SubStyles.h \
../lexlib/DefaultLexer.h
$(DIR_O)/LexIndent.obj: \
../lexers/LexIndent.cxx \
@ -868,6 +870,7 @@ $(DIR_O)/LexLua.obj: \
../lexlib/CharacterSet.h \
../lexlib/LexerModule.h \
../lexlib/OptionSet.h \
../lexlib/SubStyles.h \
../lexlib/DefaultLexer.h
$(DIR_O)/LexMagik.obj: \
../lexers/LexMagik.cxx \

View File

@ -11,3 +11,29 @@ for /f %%A in ("rem this") do echo %%A
:: BackQuote command string
for /f "usebackq" %%A in (`rem this`) do echo %%A
:: Test the handling of quotes ' and " and escape ^
:: Comment
:: With quotes
":: Text
"":: Comment
':: Text
'':: Comment
:: Mixing quotes - likely incorrect as lexer tries ' and " separately, leaving an active quote
"'":: Text
:: With escapes
^:: Text
^":: Comment
^"":: Text
^""":: Comment
^^":: Text
^^"":: Comment
^^""":: Text
:: With preceding command
mkdir archive ":: Text
mkdir archive "":: Comment
mkdir archive ^":: Comment
mkdir archive ^"":: Text

View File

@ -11,4 +11,30 @@
0 400 0
0 400 0 :: BackQuote command string
0 400 0 for /f "usebackq" %%A in (`rem this`) do echo %%A
0 400 0
0 400 0 :: Test the handling of quotes ' and " and escape ^
0 400 0 :: Comment
0 400 0
0 400 0 :: With quotes
0 400 0 ":: Text
0 400 0 "":: Comment
0 400 0 ':: Text
0 400 0 '':: Comment
0 400 0 :: Mixing quotes - likely incorrect as lexer tries ' and " separately, leaving an active quote
0 400 0 "'":: Text
0 400 0
0 400 0 :: With escapes
0 400 0 ^:: Text
0 400 0 ^":: Comment
0 400 0 ^"":: Text
0 400 0 ^""":: Comment
0 400 0 ^^":: Text
0 400 0 ^^"":: Comment
0 400 0 ^^""":: Text
0 400 0
0 400 0 :: With preceding command
0 400 0 mkdir archive ":: Text
0 400 0 mkdir archive "":: Comment
0 400 0 mkdir archive ^":: Comment
0 400 0 mkdir archive ^"":: Text
0 400 0

View File

@ -11,3 +11,29 @@
{1}:: BackQuote command string
{2}for{0} /f "usebackq" {6}%%A{2} in{0} (`rem this`){2} do echo{0} {6}%%A{0}
{1}:: Test the handling of quotes ' and " and escape ^
:: Comment
{0}
{1}:: With quotes
{0}":: Text
""{1}:: Comment
{0}':: Text
''{1}:: Comment
:: Mixing quotes - likely incorrect as lexer tries ' and " separately, leaving an active quote
{0}"'":: Text
{1}:: With escapes
{5}^::{0} Text
{5}^{0}"{1}:: Comment
{5}^{0}"":: Text
{5}^{0}"""{1}:: Comment
{5}^^{0}":: Text
{5}^^{0}""{1}:: Comment
{5}^^{0}""":: Text
{1}:: With preceding command
{5}mkdir{0} archive ":: Text
{5}mkdir{0} archive ""{1}:: Comment
{5}mkdir{0} archive ^"{1}:: Comment
{5}mkdir{0} archive ^"":: Text

View File

@ -0,0 +1,10 @@
* Fix string style to not continue to next line
DISPLAY MESSAGE BOX
"The following process must be applied to Earnings, Deduct
- "ions and Company Contributions separately."
LP61A DISPLAY MESSAGE BOX
lp61b "S*** strives to continually develop and improve its pr
LP61B - "oducts and services to deliver more value to our custo
LP61B - "mers."

View File

@ -0,0 +1,11 @@
0 400 0 * Fix string style to not continue to next line
0 400 0
0 400 0 DISPLAY MESSAGE BOX
0 400 0 "The following process must be applied to Earnings, Deduct
0 400 0 - "ions and Company Contributions separately."
0 400 0
0 400 0 LP61A DISPLAY MESSAGE BOX
0 400 0 lp61b "S*** strives to continually develop and improve its pr
0 400 0 LP61B - "oducts and services to deliver more value to our custo
0 400 0 LP61B - "mers."
0 400 0

View File

@ -0,0 +1,10 @@
{0} {2}* Fix string style to not continue to next line{0}
{11}DISPLAY{0} {11}MESSAGE{0} {11}BOX{0}
{6}"The following process must be applied to Earnings, Deduct{0}
{10}-{0} {6}"ions and Company Contributions separately."{0}
{11}LP61A{0} {11}DISPLAY{0} {11}MESSAGE{0} {11}BOX{0}
{11}lp61b{0} {6}"S*** strives to continually develop and improve its pr{0}
{11}LP61B{0} {10}-{0} {6}"oducts and services to deliver more value to our custo{0}
{11}LP61B{0} {10}-{0} {6}"mers."{0}

View File

@ -0,0 +1,7 @@
* Keywords starting with V to be identified and styled
* in list keywords2
VARIANCE
* in list keywords3
VARYING

View File

@ -0,0 +1,8 @@
0 400 0 * Keywords starting with V to be identified and styled
0 400 0
0 400 0 * in list keywords2
0 400 0 VARIANCE
0 400 0
0 400 0 * in list keywords3
0 400 0 VARYING
0 400 0

View File

@ -0,0 +1,7 @@
{0} {2}* Keywords starting with V to be identified and styled{0}
{2}* in list keywords2{0}
{16}VARIANCE{0}
{2}* in list keywords3{0}
{8}VARYING{0}

View File

@ -0,0 +1,9 @@
* Comment preceded by 6 characters to be styled
* Include / to be styled as a comment
* Comment colored in green
ABCDE * Comment colored in green
ABCDEF* Comment NOT colored in green
/ Comment NOT colored in green
ABCDE / Comment NOT colored in green
ABCDEF/ Comment NOT colored in green

View File

@ -0,0 +1,10 @@
0 400 0 * Comment preceded by 6 characters to be styled
0 400 0 * Include / to be styled as a comment
0 400 0
0 400 0 * Comment colored in green
0 400 0 ABCDE * Comment colored in green
0 400 0 ABCDEF* Comment NOT colored in green
0 400 0 / Comment NOT colored in green
0 400 0 ABCDE / Comment NOT colored in green
0 400 0 ABCDEF/ Comment NOT colored in green
0 400 0

View File

@ -0,0 +1,9 @@
{0} {2}* Comment preceded by 6 characters to be styled{0}
{2}* Include / to be styled as a comment{0}
{2}* Comment colored in green{0}
{11}ABCDE{0} {2}* Comment colored in green{0}
{11}ABCDEF{2}* Comment NOT colored in green{0}
{2}/ Comment NOT colored in green{0}
{11}ABCDE{0} {2}/ Comment NOT colored in green{0}
{11}ABCDEF{2}/ Comment NOT colored in green{0}

View File

@ -0,0 +1,35 @@
* Enumerate all styles: 0, 2 to 11, 16
* SCE_C_COMMENTLINE=2
* SCE_C_DEFAULT=0
* SCE_C_IDENTIFIER=11
identifier
* SCE_C_NUMBER=4
4
* SCE_C_WORD=5
data
* SCE_C_WORD2=16
cancel
* SCE_C_UUID=8
remarks
* SCE_C_COMMENTDOC=3 not implemented
** at line start
* SCE_C_STRING=6
"string"
* SCE_C_CHARACTER=7
'c'
* SCE_C_PREPROCESSOR=9
?preprocessor
* SCE_C_OPERATOR=10
+

View File

@ -0,0 +1,36 @@
0 400 0 * Enumerate all styles: 0, 2 to 11, 16
0 400 0 * SCE_C_COMMENTLINE=2
0 400 0
0 400 0 * SCE_C_DEFAULT=0
0 400 0
0 400 0
0 400 0 * SCE_C_IDENTIFIER=11
0 400 0 identifier
0 400 0
0 400 0 * SCE_C_NUMBER=4
0 400 0 4
0 400 0
0 400 0 * SCE_C_WORD=5
0 400 0 data
0 400 0
0 400 0 * SCE_C_WORD2=16
0 400 0 cancel
0 400 0
0 400 0 * SCE_C_UUID=8
0 400 0 remarks
0 400 0
0 400 0 * SCE_C_COMMENTDOC=3 not implemented
0 400 0 ** at line start
0 400 0
0 400 0 * SCE_C_STRING=6
0 400 0 "string"
0 400 0
0 400 0 * SCE_C_CHARACTER=7
0 400 0 'c'
0 400 0
0 400 0 * SCE_C_PREPROCESSOR=9
0 400 0 ?preprocessor
0 400 0
0 400 0 * SCE_C_OPERATOR=10
0 400 0 +
0 400 0

View File

@ -0,0 +1,35 @@
{0} {2}* Enumerate all styles: 0, 2 to 11, 16{0}
{2}* SCE_C_COMMENTLINE=2{0}
{2}* SCE_C_DEFAULT=0{0}
{2}* SCE_C_IDENTIFIER=11{0}
{11}identifier{0}
{2}* SCE_C_NUMBER=4{0}
{4}4{0}
{2}* SCE_C_WORD=5{0}
{5}data{0}
{2}* SCE_C_WORD2=16{0}
{16}cancel{0}
{2}* SCE_C_UUID=8{0}
{8}remarks{0}
{2}* SCE_C_COMMENTDOC=3 not implemented{0}
{3}** at line start{0}
{2}* SCE_C_STRING=6{0}
{6}"string"{0}
{2}* SCE_C_CHARACTER=7{0}
{7}'c'{0}
{2}* SCE_C_PREPROCESSOR=9{0}
{9}?preprocessor{0}
{2}* SCE_C_OPERATOR=10{0}
{10}+{0}

View File

@ -0,0 +1,4 @@
lexer.*.cob=COBOL
keywords.*.cob=data
keywords2.*.cob=cancel variance
keywords3.*.cob=remarks varying

View File

@ -4,7 +4,7 @@ keywords.*.cxx=int let uuid var
keywords2.*.cxx=charCodeAt second stringify Upper
keywords3.*.cxx=file
keywords4.*.cxx=global JSON
keywords5.*.cxx=
keywords5.*.cxx=HAVE_COLOUR FEATURE=2 VERSION(a,b)=a+b
keywords6.*.cxx=TODO
substyles.cpp.11=2

View File

@ -28,6 +28,40 @@ b
\
// Test preprocessor active branches feature
#if HAVE_COLOUR
// Active
#endif
#if NOT_HAVE_COLOUR
// Inactive
#endif
#if FEATURE==2
// Active
#endif
#if FEATURE==3
// Inactive
#endif
#if VERSION(1,2)==3
// Active
#endif
#if VERSION(1,2)==4
// Inactive
#endif
#undef HAVE_COLOUR
#if HAVE_COLOUR
// Inactive
#endif
#define MULTIPLY(a,b) a*b
#if MULTIPLY(2,3)==6
// Active
#endif
int main() {
double x[] = {3.14159,6.02e23,1.6e-19,1.0+1};
int y[] = {75,0113,0x4b};

View File

@ -28,6 +28,40 @@
1 400 400
0 400 400 \
1 400 400
1 400 400
0 400 400 // Test preprocessor active branches feature
1 400 400
2 400 401 + #if HAVE_COLOUR
0 401 401 | // Active
0 401 400 | #endif
2 400 401 + #if NOT_HAVE_COLOUR
0 401 401 | // Inactive
0 401 400 | #endif
1 400 400
2 400 401 + #if FEATURE==2
0 401 401 | // Active
0 401 400 | #endif
2 400 401 + #if FEATURE==3
0 401 401 | // Inactive
0 401 400 | #endif
1 400 400
2 400 401 + #if VERSION(1,2)==3
0 401 401 | // Active
0 401 400 | #endif
2 400 401 + #if VERSION(1,2)==4
0 401 401 | // Inactive
0 401 400 | #endif
1 400 400
0 400 400 #undef HAVE_COLOUR
2 400 401 + #if HAVE_COLOUR
0 401 401 | // Inactive
0 401 400 | #endif
1 400 400
0 400 400 #define MULTIPLY(a,b) a*b
2 400 401 + #if MULTIPLY(2,3)==6
0 401 401 | // Active
0 401 400 | #endif
1 400 400
2 400 401 + int main() {
0 401 401 | double x[] = {3.14159,6.02e23,1.6e-19,1.0+1};
0 401 401 | int y[] = {75,0113,0x4b};

View File

@ -28,6 +28,40 @@
{0}\
{2}// Test preprocessor active branches feature
{0}
{9}#if HAVE_COLOUR
{2}// Active
{9}#endif
#if NOT_HAVE_COLOUR
{66}// Inactive
{9}#endif
{0}
{9}#if FEATURE==2
{2}// Active
{9}#endif
#if FEATURE==3
{66}// Inactive
{9}#endif
{0}
{9}#if VERSION(1,2)==3
{2}// Active
{9}#endif
#if VERSION(1,2)==4
{66}// Inactive
{9}#endif
{0}
{9}#undef HAVE_COLOUR
#if HAVE_COLOUR
{66}// Inactive
{9}#endif
{0}
{9}#define MULTIPLY(a,b) a*b
#if MULTIPLY(2,3)==6
{2}// Active
{9}#endif
{0}
{5}int{0} {11}main{10}(){0} {10}{{0}
{11}double{0} {11}x{10}[]{0} {10}={0} {10}{{4}3.14159{10},{4}6.02e23{10},{4}1.6e-19{10},{4}1.0{10}+{4}1{10}};{0}
{5}int{0} {11}y{10}[]{0} {10}={0} {10}{{4}75{10},{4}0113{10},{4}0x4b{10}};{0}

View File

@ -1,10 +1,44 @@
lexer.*=hypertext
keywords.*=b br body content encoding head height href html img language link meta \
name p rel runat script src strong title type version width xml xmlns
# Tags and attributes
keywords.*=b br body content encoding head href html img language li link meta \
name p rel runat script src strong title type ul version xml xmlns
# JavaScript
keywords2.*=function var
# Basic
keywords3.*=dim sub
# Python
keywords4.*=import pass
# PHP
keywords5.*=echo __file__ __line__
# SGML
keywords6.*=ELEMENT
# Tag
substyles.hypertext.1=1
substylewords.1.1.*=destination
# Attribute
substyles.hypertext.3=1
substylewords.3.1.*=from img.height img.width
# JavaScript
substyles.hypertext.46=1
substylewords.46.1.*=let
# Server JavaScript
substyles.hypertext.61=1
substylewords.61.1.*=serve
# Basic
substyles.hypertext.74=1
substylewords.74.1.*=peek
# Python
substyles.hypertext.96=1
substylewords.96.1.*=parse
# PHP
substyles.hypertext.121=1
substylewords.121.1.*=decrypt
fold=1
fold.html=1
fold.html.preprocessor=1
fold.hypertext.comment=1
match mako.html
lexer.html.mako=1

View File

@ -0,0 +1,8 @@
<!----><p>1 normal comment</p>
<!-- > and <!--><p>2 valid comment</p>
<!--><p>3 abrupt-closing-of-empty-comment</p>
<!---><p>4 abrupt-closing-of-empty-comment</p>
<!----!><p>5 incorrectly-closed-comment</p>
<!--!> <h1 value="--!><p>6 incorrectly-closed-comment</p>
<!--<!---><p>7 nested-comment</p>
<!--<!---!><p>8 nested-comment</p>

View File

@ -0,0 +1,9 @@
0 400 0 <!----><p>1 normal comment</p>
0 400 0 <!-- > and <!--><p>2 valid comment</p>
0 400 0 <!--><p>3 abrupt-closing-of-empty-comment</p>
0 400 0 <!---><p>4 abrupt-closing-of-empty-comment</p>
0 400 0 <!----!><p>5 incorrectly-closed-comment</p>
0 400 0 <!--!> <h1 value="--!><p>6 incorrectly-closed-comment</p>
0 400 0 <!--<!---><p>7 nested-comment</p>
0 400 0 <!--<!---!><p>8 nested-comment</p>
0 400 0

View File

@ -0,0 +1,8 @@
{9}<!---->{1}<p>{0}1 normal comment{1}</p>{0}
{9}<!-- > and <!-->{1}<p>{0}2 valid comment{1}</p>{0}
{9}<!-->{1}<p>{0}3 abrupt-closing-of-empty-comment{1}</p>{0}
{9}<!--->{1}<p>{0}4 abrupt-closing-of-empty-comment{1}</p>{0}
{9}<!----!>{1}<p>{0}5 incorrectly-closed-comment{1}</p>{0}
{9}<!--!> <h1 value="--!>{1}<p>{0}6 incorrectly-closed-comment{1}</p>{0}
{9}<!--<!--->{1}<p>{0}7 nested-comment{1}</p>{0}
{9}<!--<!---!>{1}<p>{0}8 nested-comment{1}</p>{0}

View File

@ -0,0 +1,76 @@
Mako examples extracted from https://docs.makotemplates.org/en/latest/syntax.html
Expression
${x}
${}
${pow(x,2) + pow(y,2)}
Expression Escaping
${"this is some text" | u}
Control Structures
% if x==5:
this is some output
% endif
% for a in ['one', 'two', 'three', 'four', 'five']:
% if a[0] == 't':
its two or three
% elif a[0] == 'f':
four/five
% else:
one
% endif
% endfor
The % sign can also be “escaped”, if you actually want to emit a percent sign as the first non whitespace character on a line, by escaping it as in %%:
%% some text
%% some more text
The Loop Context
The loop context provides additional information about a loop while inside of a % for structure:
<ul>
% for a in ("one", "two", "three"):
<li>Item ${loop.index}: ${a}</li>
% endfor
</ul>
A multiline version exists using <%doc> ...text... </%doc>:
<%doc>
these are comments
more comments
</%doc>
Python Blocks
Any arbitrary block of python can be dropped in using the <% %> tags:
this is a template
<%
x = db.get_resource('foo')
y = [z.element for z in x if x.frobnizzle==5]
%>
% for elem in y:
element: ${elem}
% endfor
Within <% %>, youre writing a regular block of Python code. While the code can appear with an arbitrary level of preceding whitespace, it has to be consistently formatted with itself. Makos compiler will adjust the block of Python to be consistent with the surrounding generated Python code.
Module-level Blocks
A variant on <% %> is the module-level code block, denoted by <%! %>. Code within these tags is executed at the module level of the template, and not within the rendering function of the template. Therefore, this code does not have access to the templates context and is only executed when the template is loaded into memory (which can be only once per application, or more, depending on the runtime environment). Use the <%! %> tags to declare your templates imports, as well as any pure-Python functions you might want to declare:
<%!
import mylib
import re
def filter(text):
return re.sub(r'^@', '', text)
%>
Tags
The rest of what Mako offers takes place in the form of tags. All tags use the same syntax, which is similar to an XML tag except that the first character of the tag name is a % character. The tag is closed either by a contained slash character, or an explicit closing tag:
<%include file="foo.txt"/>
<%def name="foo" buffered="True">
this is a def
</%def>

View File

@ -0,0 +1,77 @@
0 400 0 Mako examples extracted from https://docs.makotemplates.org/en/latest/syntax.html
1 400 0
0 400 0 Expression
0 400 0 ${x}
0 400 0 ${}
0 400 0 ${pow(x,2) + pow(y,2)}
1 400 0
0 400 0 Expression Escaping
0 400 0 ${"this is some text" | u}
1 400 0
0 400 0 Control Structures
0 400 0 % if x==5:
0 400 0 this is some output
0 400 0 % endif
1 400 0
0 400 0 % for a in ['one', 'two', 'three', 'four', 'five']:
0 400 0 % if a[0] == 't':
0 400 0 its two or three
0 400 0 % elif a[0] == 'f':
0 400 0 four/five
0 400 0 % else:
0 400 0 one
0 400 0 % endif
0 400 0 % endfor
1 400 0
0 400 0 The % sign can also be “escaped”, if you actually want to emit a percent sign as the first non whitespace character on a line, by escaping it as in %%:
0 400 0 %% some text
0 400 0 %% some more text
1 400 0
0 400 0 The Loop Context
0 400 0 The loop context provides additional information about a loop while inside of a % for structure:
1 400 0
2 400 0 + <ul>
0 401 0 | % for a in ("one", "two", "three"):
0 401 0 | <li>Item ${loop.index}: ${a}</li>
0 401 0 | % endfor
0 401 0 | </ul>
1 400 0
0 400 0 A multiline version exists using <%doc> ...text... </%doc>:
0 400 0 <%doc>
0 400 0 these are comments
0 400 0 more comments
0 400 0 </%doc>
1 400 0
0 400 0 Python Blocks
0 400 0 Any arbitrary block of python can be dropped in using the <% %> tags:
0 400 0 this is a template
1 400 0
0 400 0 <%
0 400 0 x = db.get_resource('foo')
0 400 0 y = [z.element for z in x if x.frobnizzle==5]
0 400 0 %>
0 400 0 % for elem in y:
0 400 0 element: ${elem}
0 400 0 % endfor
0 400 0 Within <% %>, youre writing a regular block of Python code. While the code can appear with an arbitrary level of preceding whitespace, it has to be consistently formatted with itself. Makos compiler will adjust the block of Python to be consistent with the surrounding generated Python code.
1 400 0
0 400 0 Module-level Blocks
0 400 0 A variant on <% %> is the module-level code block, denoted by <%! %>. Code within these tags is executed at the module level of the template, and not within the rendering function of the template. Therefore, this code does not have access to the templates context and is only executed when the template is loaded into memory (which can be only once per application, or more, depending on the runtime environment). Use the <%! %> tags to declare your templates imports, as well as any pure-Python functions you might want to declare:
1 400 0
0 400 0 <%!
0 400 0 import mylib
0 400 0 import re
1 400 0
0 400 0 def filter(text):
0 400 0 return re.sub(r'^@', '', text)
0 400 0 %>
1 400 0
0 400 0 Tags
0 400 0 The rest of what Mako offers takes place in the form of tags. All tags use the same syntax, which is similar to an XML tag except that the first character of the tag name is a % character. The tag is closed either by a contained slash character, or an explicit closing tag:
1 400 0
0 400 0 <%include file="foo.txt"/>
1 400 0
0 400 0 <%def name="foo" buffered="True">
0 400 0 this is a def
0 400 0 </%def>
0 400 0

View File

@ -0,0 +1,76 @@
{0}Mako examples extracted from https://docs.makotemplates.org/en/latest/syntax.html
Expression
{15}${{117}x{15}}{0}
{15}${}{0}
{15}${{117}pow{116}({117}x{116},{108}2{116}){106} {116}+{106} {117}pow{116}({117}y{116},{108}2{116}){15}}{0}
Expression Escaping
{15}${{109}"this is some text"{106} {116}|{106} {117}u{15}}{0}
Control Structures
{15}%{106} {117}if{106} {117}x{116}=={108}5{116}:{0}
this is some output
{15}%{106} {117}endif{0}
{15}%{106} {117}for{106} {117}a{106} {117}in{106} {116}[{110}'one'{116},{106} {110}'two'{116},{106} {110}'three'{116},{106} {110}'four'{116},{106} {110}'five'{116}]:{0}
{15}%{106} {117}if{106} {117}a{116}[{108}0{116}]{106} {116}=={106} {110}'t'{116}:{0}
its two or three
{15}%{106} {117}elif{106} {117}a{116}[{108}0{116}]{106} {116}=={106} {110}'f'{116}:{0}
four/five
{15}%{106} {117}else{116}:{0}
one
{15}%{106} {117}endif{0}
{15}%{106} {117}endfor{0}
The % sign can also be “escaped”, if you actually want to emit a percent sign as the first non whitespace character on a line, by escaping it as in %%:
{15}%{116}%{106} {117}some{106} {117}text{0}
{15}%{116}%{106} {117}some{106} {117}more{106} {117}text{0}
The Loop Context
The loop context provides additional information about a loop while inside of a % for structure:
{1}<ul>{0}
{15}%{106} {117}for{106} {117}a{106} {117}in{106} {116}({109}"one"{116},{106} {109}"two"{116},{106} {109}"three"{116}):{0}
{1}<li>{0}Item {15}${{117}loop.index{15}}{0}: {15}${{117}a{15}}{1}</li>{0}
{15}%{106} {117}endfor{0}
{1}</ul>{0}
A multiline version exists using {15}<%{2}doc{15}>{0} ...text... {15}</%{2}doc{15}>{0}:
{15}<%{2}doc{15}>{0}
these are comments
more comments
{15}</%{2}doc{15}>{0}
Python Blocks
Any arbitrary block of python can be dropped in using the {15}<%{106} {15}%>{0} tags:
this is a template
{15}<%{105}
{106} {117}x{106} {116}={106} {117}db.get_resource{116}({110}'foo'{116}){106}
{117}y{106} {116}={106} {116}[{117}z.element{106} {117}for{106} {117}z{106} {117}in{106} {117}x{106} {117}if{106} {117}x.frobnizzle{116}=={108}5{116}]{106}
{15}%>{0}
{15}%{106} {117}for{106} {117}elem{106} {117}in{106} {117}y{116}:{0}
element: {15}${{117}elem{15}}{0}
{15}%{106} {117}endfor{0}
Within {15}<%{106} {15}%>{0}, youre writing a regular block of Python code. While the code can appear with an arbitrary level of preceding whitespace, it has to be consistently formatted with itself. Makos compiler will adjust the block of Python to be consistent with the surrounding generated Python code.
Module-level Blocks
A variant on {15}<%{106} {15}%>{0} is the module-level code block, denoted by {15}<%{116}!{106} {15}%>{0}. Code within these tags is executed at the module level of the template, and not within the rendering function of the template. Therefore, this code does not have access to the templates context and is only executed when the template is loaded into memory (which can be only once per application, or more, depending on the runtime environment). Use the {15}<%{116}!{106} {15}%>{0} tags to declare your templates imports, as well as any pure-Python functions you might want to declare:
{15}<%{116}!{105}
{106} {111}import{106} {117}mylib{106}
{111}import{106} {117}re{106}
{117}def{106} {115}filter{116}({117}text{116}):{106}
{117}return{106} {117}re.sub{116}({117}r{110}'^@'{116},{106} {110}''{116},{106} {117}text{116}){106}
{15}%>{0}
Tags
The rest of what Mako offers takes place in the form of tags. All tags use the same syntax, which is similar to an XML tag except that the first character of the tag name is a % character. The tag is closed either by a contained slash character, or an explicit closing tag:
{15}<%{2}include{106} {117}file{116}={109}"foo.txt"{15}/>{0}
{15}<%{2}def{106} {117}name{116}={109}"foo"{106} {117}buffered{116}={109}"True"{15}>{0}
this is a def
{15}</%{2}def{15}>{0}

View File

@ -1,12 +1,21 @@
<%@language=javas%>
<%
#include
serve x;
function x() {
}
%>
<%@language=vbscript%>
<%
sub x 'comment
peek 1024
%>
<!-- Folding for Python is incorrect. See #235. -->
<%@language=python%>
<%
import random
x = 'comment'
parse "x=8"
%>
<head>
<body></body>

View File

@ -1,13 +1,22 @@
0 400 0 <%@language=javas%>
2 400 0 + <%
0 401 0 | #include
0 401 0 | serve x;
2 401 0 + function x() {
0 402 0 | }
0 401 0 | %>
0 400 0 <%@language=vbscript%>
2 400 0 + <%
0 401 0 | sub x 'comment
0 401 0 | peek 1024
0 401 0 | %>
2 400 0 + <head>
0 401 0 | <body></body>
0 401 0 |
0 400 0 <!-- Folding for Python is incorrect. See #235. -->
0 400 0 <%@language=python%>
0 400 0 <%
0 400 0 import random
0 400 0 x = 'comment'
0 400 0 parse "x=8"
0 400 0 %>
2 3ff 0 + <head>
0 400 0 <body></body>
0 400 0

View File

@ -1,12 +1,21 @@
{15}<%@{16}language=javas{15}%>{0}
{15}<%{56}
#{61}include{56}
{195}serve{56} {61}x{65};{56}
{62}function{56} {61}x{65}(){56} {65}{{56}
{65}}{56}
{15}%>{0}
{15}<%@{16}language=vbscript{15}%>{0}
{15}<%{81}
{84}sub{81} {86}x{81} {82}'comment {81}
{196}peek{81} {83}1024{81}
{15}%>{0}
{9}<!-- Folding for Python is incorrect. See #235. -->{0}
{15}<%@{16}language=python{15}%>{0}
{15}<%{106}
{111}import{106} {117}random{106}
{117}x{106} {116}={106} {110}'comment'{106}
{197}parse{106} {109}"x=8"{106}
{15}%>{0}
{1}<head>{0}
{1}<body></body>{0}

View File

@ -2,6 +2,7 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<script type="text/javascript">
var b = /abc/i.test('abc');
let b = 1;
'x\
</t>'
// issue 214 fix to behave same as single quote escaped eol
@ -14,5 +15,7 @@ var b = /abc/i.test('abc');
§
<unknown>SinkWorld - Portability</unknown>
<img src="SciTEIco.png" height=64 width=64 />
<link rel="stylesheet" type="text/css" href="SW.css">
<link rel="stylesheet" type="text/css" from="SW.css">
<destination href="SW.css" height=64 width=64></destination>
</head>
</html>

View File

@ -2,6 +2,7 @@
2 400 0 + <html xmlns="http://www.w3.org/1999/xhtml">
2 401 0 + <script type="text/javascript">
0 402 0 | var b = /abc/i.test('abc');
0 402 0 | let b = 1;
0 402 0 | 'x\
0 402 0 | </t>'
0 402 0 | // issue 214 fix to behave same as single quote escaped eol
@ -14,6 +15,8 @@
0 402 0 | §
0 402 0 | <unknown>SinkWorld - Portability</unknown>
0 402 0 | <img src="SciTEIco.png" height=64 width=64 />
0 402 0 | <link rel="stylesheet" type="text/css" href="SW.css">
0 402 0 | <link rel="stylesheet" type="text/css" from="SW.css">
0 402 0 | <destination href="SW.css" height=64 width=64></destination>
0 402 0 | </head>
0 401 0 |
0 401 0 | </html>
0 400 0

View File

@ -2,6 +2,7 @@
{1}<html{8} {3}xmlns{8}={6}"http://www.w3.org/1999/xhtml"{1}>{0}
{1}<script{8} {3}type{8}={6}"text/javascript"{1}>{40}
{47}var{41} {46}b{41} {50}={41} {52}/abc/i{46}.test{50}({49}'abc'{50});{41}
{194}let{41} {46}b{41} {50}={41} {45}1{50};{41}
{49}'x\
</t>'{41}
{43}// issue 214 fix to behave same as single quote escaped eol{41}
@ -13,6 +14,8 @@
{1}<title>{0}SinkWorld - Portability{1}</title>{0}
§
{2}<unknown>{0}SinkWorld - Portability{2}</unknown>{0}
{1}<img{8} {3}src{8}={6}"SciTEIco.png"{8} {3}height{8}={5}64{8} {3}width{8}={5}64{8} {11}/>{0}
{1}<link{8} {3}rel{8}={6}"stylesheet"{8} {3}type{8}={6}"text/css"{8} {3}href{8}={6}"SW.css"{1}>{0}
{1}<img{8} {3}src{8}={6}"SciTEIco.png"{8} {193}height{8}={5}64{8} {193}width{8}={5}64{8} {11}/>{0}
{1}<link{8} {3}rel{8}={6}"stylesheet"{8} {3}type{8}={6}"text/css"{8} {193}from{8}={6}"SW.css"{1}>{0}
{192}<destination{8} {3}href{8}={6}"SW.css"{8} {4}height{8}={5}64{8} {4}width{8}={5}64{1}>{192}</destination>{0}
{1}</head>{0}
{1}</html>{0}

View File

@ -1,5 +1,6 @@
<head> <!-- About to script -->
<?php
decrypt "xyzzy";
echo __FILE__.__LINE__;
echo "<!-- -->\n";
/* ?> */

View File

@ -1,5 +1,6 @@
2 400 0 + <head> <!-- About to script -->
2 401 0 + <?php
0 402 0 | decrypt "xyzzy";
0 402 0 | echo __FILE__.__LINE__;
0 402 0 | echo "<!-- -->\n";
0 402 0 | /* ?> */

View File

@ -1,5 +1,6 @@
{1}<head>{0} {9}<!-- About to script -->{0}
{18}<?php{118}
{198}decrypt{118} {119}"xyzzy"{127};{118}
{121}echo{118} {121}__FILE__{127}.{121}__LINE__{127};{118}
{121}echo{118} {119}"<!-- -->\n"{127};{118}
{124}/* ?> */{118}

View File

@ -64,3 +64,6 @@ keyword8
-- label=20
::label::
-- identifier substyles.11.1=128
moon

View File

@ -64,4 +64,7 @@
1 400 0
0 400 0 -- label=20
0 400 0 ::label::
1 400 0
0 400 0 -- identifier substyles.11.1=128
0 400 0 moon
0 400 0

View File

@ -64,3 +64,6 @@
{2}-- label=20
{20}::label::{0}
{2}-- identifier substyles.11.1=128
{128}moon{0}

View File

@ -7,4 +7,8 @@ keywords5.*.lua=keyword5
keywords6.*.lua=keyword6
keywords7.*.lua=keyword7
keywords8.*.lua=keyword8
substyles.lua.11=1
substylewords.11.1.*.lua=moon
fold=1

View File

@ -0,0 +1,8 @@
# encoding: utf-8
puts <<A中
#{1+2}
A中
puts <<
#{1+2}

View File

@ -0,0 +1,9 @@
0 400 0 # encoding: utf-8
2 400 0 + puts <<A中
0 401 0 | #{1+2}
0 401 0 | A中
1 400 0
2 400 0 + puts <<中
0 401 0 | #{1+2}
0 401 0 | 中
0 400 0

View File

@ -0,0 +1,8 @@
{2}# encoding: utf-8{0}
{11}puts{0} {10}<<{20}A中{22}
{10}#{{4}1{10}+{4}2{10}}{22}
{20}A中{0}
{11}puts{0} {10}<<{20}中{22}
{10}#{{4}1{10}+{4}2{10}}{22}
{20}中{0}

View File

@ -11,3 +11,22 @@ ONE
$stdout.puts <<~EOT.chomp
squiggly heredoc
EOT
# Issue #236: modifier if, unless, while and until
alias error puts
error <<EOF if true
heredoc if true
EOF
error <<EOF unless false
heredoc unless false
EOF
error <<EOF while false
heredoc while false
EOF
error <<EOF until true
heredoc until true
EOF

View File

@ -11,4 +11,23 @@
2 400 0 + $stdout.puts <<~EOT.chomp
0 401 0 | squiggly heredoc
0 401 0 | EOT
1 400 0
0 400 0 # Issue #236: modifier if, unless, while and until
0 400 0 alias error puts
1 400 0
2 400 0 + error <<EOF if true
0 401 0 | heredoc if true
0 401 0 | EOF
1 400 0
2 400 0 + error <<EOF unless false
0 401 0 | heredoc unless false
0 401 0 | EOF
1 400 0
2 400 0 + error <<EOF while false
0 401 0 | heredoc while false
0 401 0 | EOF
1 400 0
2 400 0 + error <<EOF until true
0 401 0 | heredoc until true
0 401 0 | EOF
0 400 0

View File

@ -11,3 +11,22 @@ content for heredoc one
{13}$stdout{10}.{11}puts{0} {10}<<{20}~EOT{10}.{11}chomp{22}
squiggly heredoc
{20}EOT{0}
{2}# Issue #236: modifier if, unless, while and until{0}
{11}alias{0} {11}error{0} {11}puts{0}
{11}error{0} {10}<<{20}EOF{0} {29}if{0} {5}true{22}
heredoc if true
{20}EOF{0}
{11}error{0} {10}<<{20}EOF{0} {29}unless{0} {5}false{22}
heredoc unless false
{20}EOF{0}
{11}error{0} {10}<<{20}EOF{0} {29}while{0} {5}false{22}
heredoc while false
{20}EOF{0}
{11}error{0} {10}<<{20}EOF{0} {29}until{0} {5}true{22}
heredoc until true
{20}EOF{0}

View File

@ -1,4 +1,4 @@
lexer.*.rb=ruby
keywords.*.rb=begin class def do end false if module return self super true while \
keywords.*.rb=begin class def do end false if module return self super true unless until while \
__FILE__ __LINE__
fold=1

View File

@ -0,0 +1,4 @@
fn main() {
let r#true = false;
println!("{}", r#true);
}

View File

@ -0,0 +1,4 @@
2 400 401 + fn main() {
0 401 401 | let r#true = false;
0 401 401 | println!("{}", r#true);
0 401 400 | }

View File

@ -0,0 +1,4 @@
{6}fn{0} {17}main{16}(){0} {16}{{0}
{6}let{0} {17}r#true{0} {16}={0} {6}false{16};{0}
{19}println!{16}({13}"{}"{16},{0} {17}r#true{16});{0}
{16}}

View File

@ -1,9 +1,9 @@
/*
* Catch v2.13.7
* Generated: 2021-07-28 20:29:27.753164
* Catch v2.13.10
* Generated: 2022-10-16 11:01:23.452308
* ----------------------------------------------------------
* This file has been merged from multiple headers. Please don't edit it directly
* Copyright (c) 2021 Two Blue Cubes Ltd. All rights reserved.
* Copyright (c) 2022 Two Blue Cubes Ltd. All rights reserved.
*
* Distributed under the Boost Software License, Version 1.0. (See accompanying
* file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@ -15,7 +15,7 @@
#define CATCH_VERSION_MAJOR 2
#define CATCH_VERSION_MINOR 13
#define CATCH_VERSION_PATCH 7
#define CATCH_VERSION_PATCH 10
#ifdef __clang__
# pragma clang system_header
@ -240,9 +240,6 @@ namespace Catch {
// Visual C++
#if defined(_MSC_VER)
# define CATCH_INTERNAL_START_WARNINGS_SUPPRESSION __pragma( warning(push) )
# define CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION __pragma( warning(pop) )
// Universal Windows platform does not support SEH
// Or console colours (or console at all...)
# if defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_APP)
@ -251,13 +248,18 @@ namespace Catch {
# define CATCH_INTERNAL_CONFIG_WINDOWS_SEH
# endif
# if !defined(__clang__) // Handle Clang masquerading for msvc
// MSVC traditional preprocessor needs some workaround for __VA_ARGS__
// _MSVC_TRADITIONAL == 0 means new conformant preprocessor
// _MSVC_TRADITIONAL == 1 means old traditional non-conformant preprocessor
# if !defined(__clang__) // Handle Clang masquerading for msvc
# if !defined(_MSVC_TRADITIONAL) || (defined(_MSVC_TRADITIONAL) && _MSVC_TRADITIONAL)
# define CATCH_INTERNAL_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR
# endif // MSVC_TRADITIONAL
// Only do this if we're not using clang on Windows, which uses `diagnostic push` & `diagnostic pop`
# define CATCH_INTERNAL_START_WARNINGS_SUPPRESSION __pragma( warning(push) )
# define CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION __pragma( warning(pop) )
# endif // __clang__
#endif // _MSC_VER
@ -1010,34 +1012,34 @@ struct AutoReg : NonCopyable {
#ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR
#define INTERNAL_CATCH_TEMPLATE_TEST_CASE_NO_REGISTRATION(Name, Tags, ...) \
INTERNAL_CATCH_TEMPLATE_TEST_CASE_NO_REGISTRATION_2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____F_U_N_C____ ), Name, Tags, typename TestType, __VA_ARGS__ )
INTERNAL_CATCH_TEMPLATE_TEST_CASE_NO_REGISTRATION_2( INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_ ), INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_F_U_N_C_ ), Name, Tags, typename TestType, __VA_ARGS__ )
#else
#define INTERNAL_CATCH_TEMPLATE_TEST_CASE_NO_REGISTRATION(Name, Tags, ...) \
INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_NO_REGISTRATION_2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____F_U_N_C____ ), Name, Tags, typename TestType, __VA_ARGS__ ) )
INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_NO_REGISTRATION_2( INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_ ), INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_F_U_N_C_ ), Name, Tags, typename TestType, __VA_ARGS__ ) )
#endif
#ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR
#define INTERNAL_CATCH_TEMPLATE_TEST_CASE_SIG_NO_REGISTRATION(Name, Tags, Signature, ...) \
INTERNAL_CATCH_TEMPLATE_TEST_CASE_NO_REGISTRATION_2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____F_U_N_C____ ), Name, Tags, Signature, __VA_ARGS__ )
INTERNAL_CATCH_TEMPLATE_TEST_CASE_NO_REGISTRATION_2( INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_ ), INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_F_U_N_C_ ), Name, Tags, Signature, __VA_ARGS__ )
#else
#define INTERNAL_CATCH_TEMPLATE_TEST_CASE_SIG_NO_REGISTRATION(Name, Tags, Signature, ...) \
INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_NO_REGISTRATION_2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____F_U_N_C____ ), Name, Tags, Signature, __VA_ARGS__ ) )
INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_NO_REGISTRATION_2( INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_ ), INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_F_U_N_C_ ), Name, Tags, Signature, __VA_ARGS__ ) )
#endif
#ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR
#define INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_NO_REGISTRATION( ClassName, Name, Tags,... ) \
INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_NO_REGISTRATION_2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____C_L_A_S_S____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ) , ClassName, Name, Tags, typename T, __VA_ARGS__ )
INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_NO_REGISTRATION_2( INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_C_L_A_S_S_ ), INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_ ) , ClassName, Name, Tags, typename T, __VA_ARGS__ )
#else
#define INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_NO_REGISTRATION( ClassName, Name, Tags,... ) \
INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_NO_REGISTRATION_2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____C_L_A_S_S____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ) , ClassName, Name, Tags, typename T, __VA_ARGS__ ) )
INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_NO_REGISTRATION_2( INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_C_L_A_S_S_ ), INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_ ) , ClassName, Name, Tags, typename T, __VA_ARGS__ ) )
#endif
#ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR
#define INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_SIG_NO_REGISTRATION( ClassName, Name, Tags, Signature, ... ) \
INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_NO_REGISTRATION_2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____C_L_A_S_S____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ) , ClassName, Name, Tags, Signature, __VA_ARGS__ )
INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_NO_REGISTRATION_2( INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_C_L_A_S_S_ ), INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_ ) , ClassName, Name, Tags, Signature, __VA_ARGS__ )
#else
#define INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_SIG_NO_REGISTRATION( ClassName, Name, Tags, Signature, ... ) \
INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_NO_REGISTRATION_2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____C_L_A_S_S____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ) , ClassName, Name, Tags, Signature, __VA_ARGS__ ) )
INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_NO_REGISTRATION_2( INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_C_L_A_S_S_ ), INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_ ) , ClassName, Name, Tags, Signature, __VA_ARGS__ ) )
#endif
#endif
@ -1050,7 +1052,7 @@ struct AutoReg : NonCopyable {
CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION \
static void TestName()
#define INTERNAL_CATCH_TESTCASE( ... ) \
INTERNAL_CATCH_TESTCASE2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ), __VA_ARGS__ )
INTERNAL_CATCH_TESTCASE2( INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_S_T_ ), __VA_ARGS__ )
///////////////////////////////////////////////////////////////////////////////
#define INTERNAL_CATCH_METHOD_AS_TEST_CASE( QualifiedMethod, ... ) \
@ -1072,7 +1074,7 @@ struct AutoReg : NonCopyable {
CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION \
void TestName::test()
#define INTERNAL_CATCH_TEST_CASE_METHOD( ClassName, ... ) \
INTERNAL_CATCH_TEST_CASE_METHOD2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ), ClassName, __VA_ARGS__ )
INTERNAL_CATCH_TEST_CASE_METHOD2( INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_S_T_ ), ClassName, __VA_ARGS__ )
///////////////////////////////////////////////////////////////////////////////
#define INTERNAL_CATCH_REGISTER_TESTCASE( Function, ... ) \
@ -1113,18 +1115,18 @@ struct AutoReg : NonCopyable {
#ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR
#define INTERNAL_CATCH_TEMPLATE_TEST_CASE(Name, Tags, ...) \
INTERNAL_CATCH_TEMPLATE_TEST_CASE_2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____F_U_N_C____ ), Name, Tags, typename TestType, __VA_ARGS__ )
INTERNAL_CATCH_TEMPLATE_TEST_CASE_2( INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_ ), INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_F_U_N_C_ ), Name, Tags, typename TestType, __VA_ARGS__ )
#else
#define INTERNAL_CATCH_TEMPLATE_TEST_CASE(Name, Tags, ...) \
INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____F_U_N_C____ ), Name, Tags, typename TestType, __VA_ARGS__ ) )
INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_2( INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_ ), INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_F_U_N_C_ ), Name, Tags, typename TestType, __VA_ARGS__ ) )
#endif
#ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR
#define INTERNAL_CATCH_TEMPLATE_TEST_CASE_SIG(Name, Tags, Signature, ...) \
INTERNAL_CATCH_TEMPLATE_TEST_CASE_2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____F_U_N_C____ ), Name, Tags, Signature, __VA_ARGS__ )
INTERNAL_CATCH_TEMPLATE_TEST_CASE_2( INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_ ), INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_F_U_N_C_ ), Name, Tags, Signature, __VA_ARGS__ )
#else
#define INTERNAL_CATCH_TEMPLATE_TEST_CASE_SIG(Name, Tags, Signature, ...) \
INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____F_U_N_C____ ), Name, Tags, Signature, __VA_ARGS__ ) )
INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_2( INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_ ), INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_F_U_N_C_ ), Name, Tags, Signature, __VA_ARGS__ ) )
#endif
#define INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE2(TestName, TestFuncName, Name, Tags, Signature, TmplTypes, TypesList) \
@ -1162,18 +1164,18 @@ struct AutoReg : NonCopyable {
#ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR
#define INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE(Name, Tags, ...)\
INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE2(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____F_U_N_C____ ), Name, Tags, typename T,__VA_ARGS__)
INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE2(INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_ ), INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_F_U_N_C_ ), Name, Tags, typename T,__VA_ARGS__)
#else
#define INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE(Name, Tags, ...)\
INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____F_U_N_C____ ), Name, Tags, typename T, __VA_ARGS__ ) )
INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE2( INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_ ), INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_F_U_N_C_ ), Name, Tags, typename T, __VA_ARGS__ ) )
#endif
#ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR
#define INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_SIG(Name, Tags, Signature, ...)\
INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE2(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____F_U_N_C____ ), Name, Tags, Signature, __VA_ARGS__)
INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE2(INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_ ), INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_F_U_N_C_ ), Name, Tags, Signature, __VA_ARGS__)
#else
#define INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_SIG(Name, Tags, Signature, ...)\
INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____F_U_N_C____ ), Name, Tags, Signature, __VA_ARGS__ ) )
INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE2( INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_ ), INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_F_U_N_C_ ), Name, Tags, Signature, __VA_ARGS__ ) )
#endif
#define INTERNAL_CATCH_TEMPLATE_LIST_TEST_CASE_2(TestName, TestFunc, Name, Tags, TmplList)\
@ -1204,7 +1206,7 @@ struct AutoReg : NonCopyable {
static void TestFunc()
#define INTERNAL_CATCH_TEMPLATE_LIST_TEST_CASE(Name, Tags, TmplList) \
INTERNAL_CATCH_TEMPLATE_LIST_TEST_CASE_2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____F_U_N_C____ ), Name, Tags, TmplList )
INTERNAL_CATCH_TEMPLATE_LIST_TEST_CASE_2( INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_ ), INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_F_U_N_C_ ), Name, Tags, TmplList )
#define INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_2( TestNameClass, TestName, ClassName, Name, Tags, Signature, ... ) \
CATCH_INTERNAL_START_WARNINGS_SUPPRESSION \
@ -1237,18 +1239,18 @@ struct AutoReg : NonCopyable {
#ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR
#define INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD( ClassName, Name, Tags,... ) \
INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____C_L_A_S_S____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ) , ClassName, Name, Tags, typename T, __VA_ARGS__ )
INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_2( INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_C_L_A_S_S_ ), INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_ ) , ClassName, Name, Tags, typename T, __VA_ARGS__ )
#else
#define INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD( ClassName, Name, Tags,... ) \
INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____C_L_A_S_S____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ) , ClassName, Name, Tags, typename T, __VA_ARGS__ ) )
INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_2( INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_C_L_A_S_S_ ), INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_ ) , ClassName, Name, Tags, typename T, __VA_ARGS__ ) )
#endif
#ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR
#define INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_SIG( ClassName, Name, Tags, Signature, ... ) \
INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____C_L_A_S_S____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ) , ClassName, Name, Tags, Signature, __VA_ARGS__ )
INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_2( INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_C_L_A_S_S_ ), INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_ ) , ClassName, Name, Tags, Signature, __VA_ARGS__ )
#else
#define INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_SIG( ClassName, Name, Tags, Signature, ... ) \
INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____C_L_A_S_S____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ) , ClassName, Name, Tags, Signature, __VA_ARGS__ ) )
INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_2( INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_C_L_A_S_S_ ), INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_ ) , ClassName, Name, Tags, Signature, __VA_ARGS__ ) )
#endif
#define INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD_2(TestNameClass, TestName, ClassName, Name, Tags, Signature, TmplTypes, TypesList)\
@ -1289,18 +1291,18 @@ struct AutoReg : NonCopyable {
#ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR
#define INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD( ClassName, Name, Tags, ... )\
INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD_2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____F_U_N_C____ ), ClassName, Name, Tags, typename T, __VA_ARGS__ )
INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD_2( INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_ ), INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_F_U_N_C_ ), ClassName, Name, Tags, typename T, __VA_ARGS__ )
#else
#define INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD( ClassName, Name, Tags, ... )\
INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD_2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____F_U_N_C____ ), ClassName, Name, Tags, typename T,__VA_ARGS__ ) )
INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD_2( INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_ ), INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_F_U_N_C_ ), ClassName, Name, Tags, typename T,__VA_ARGS__ ) )
#endif
#ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR
#define INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG( ClassName, Name, Tags, Signature, ... )\
INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD_2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____F_U_N_C____ ), ClassName, Name, Tags, Signature, __VA_ARGS__ )
INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD_2( INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_ ), INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_F_U_N_C_ ), ClassName, Name, Tags, Signature, __VA_ARGS__ )
#else
#define INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG( ClassName, Name, Tags, Signature, ... )\
INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD_2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____F_U_N_C____ ), ClassName, Name, Tags, Signature,__VA_ARGS__ ) )
INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD_2( INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_ ), INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_F_U_N_C_ ), ClassName, Name, Tags, Signature,__VA_ARGS__ ) )
#endif
#define INTERNAL_CATCH_TEMPLATE_LIST_TEST_CASE_METHOD_2( TestNameClass, TestName, ClassName, Name, Tags, TmplList) \
@ -1334,7 +1336,7 @@ struct AutoReg : NonCopyable {
void TestName<TestType>::test()
#define INTERNAL_CATCH_TEMPLATE_LIST_TEST_CASE_METHOD(ClassName, Name, Tags, TmplList) \
INTERNAL_CATCH_TEMPLATE_LIST_TEST_CASE_METHOD_2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____F_U_N_C____ ), ClassName, Name, Tags, TmplList )
INTERNAL_CATCH_TEMPLATE_LIST_TEST_CASE_METHOD_2( INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_ ), INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_F_U_N_C_ ), ClassName, Name, Tags, TmplList )
// end catch_test_registry.h
// start catch_capture.hpp
@ -3091,7 +3093,7 @@ namespace Detail {
Approx operator-() const;
template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
Approx operator()( T const& value ) {
Approx operator()( T const& value ) const {
Approx approx( static_cast<double>(value) );
approx.m_epsilon = m_epsilon;
approx.m_margin = m_margin;
@ -4163,7 +4165,7 @@ namespace Generators {
if (!m_predicate(m_generator.get())) {
// It might happen that there are no values that pass the
// filter. In that case we throw an exception.
auto has_initial_value = next();
auto has_initial_value = nextImpl();
if (!has_initial_value) {
Catch::throw_exception(GeneratorException("No valid value found in filtered generator"));
}
@ -4175,6 +4177,11 @@ namespace Generators {
}
bool next() override {
return nextImpl();
}
private:
bool nextImpl() {
bool success = m_generator.next();
if (!success) {
return false;
@ -7388,8 +7395,6 @@ namespace Catch {
template <typename T, bool Destruct>
struct ObjectStorage
{
using TStorage = typename std::aligned_storage<sizeof(T), std::alignment_of<T>::value>::type;
ObjectStorage() : data() {}
ObjectStorage(const ObjectStorage& other)
@ -7432,7 +7437,7 @@ namespace Catch {
return *static_cast<T*>(static_cast<void*>(&data));
}
TStorage data;
struct { alignas(T) unsigned char data[sizeof(T)]; } data;
};
}
@ -7942,7 +7947,7 @@ namespace Catch {
#if defined(__i386__) || defined(__x86_64__)
#define CATCH_TRAP() __asm__("int $3\n" : : ) /* NOLINT */
#elif defined(__aarch64__)
#define CATCH_TRAP() __asm__(".inst 0xd4200000")
#define CATCH_TRAP() __asm__(".inst 0xd43e0000")
#endif
#elif defined(CATCH_PLATFORM_IPHONE)
@ -13385,6 +13390,10 @@ namespace Catch {
filename.erase(0, lastSlash);
filename[0] = '#';
}
else
{
filename.insert(0, "#");
}
auto lastDot = filename.find_last_of('.');
if (lastDot != std::string::npos) {
@ -13547,7 +13556,7 @@ namespace Catch {
// Handle list request
if( Option<std::size_t> listed = list( m_config ) )
return static_cast<int>( *listed );
return (std::min) (MaxExitCode, static_cast<int>(*listed));
TestGroup tests { m_config };
auto const totals = tests.execute();
@ -15380,7 +15389,7 @@ namespace Catch {
}
Version const& libraryVersion() {
static Version version( 2, 13, 7, "", 0 );
static Version version( 2, 13, 10, "", 0 );
return version;
}
@ -17515,12 +17524,20 @@ namespace Catch {
#ifndef __OBJC__
#ifndef CATCH_INTERNAL_CDECL
#ifdef _MSC_VER
#define CATCH_INTERNAL_CDECL __cdecl
#else
#define CATCH_INTERNAL_CDECL
#endif
#endif
#if defined(CATCH_CONFIG_WCHAR) && defined(CATCH_PLATFORM_WINDOWS) && defined(_UNICODE) && !defined(DO_NOT_USE_WMAIN)
// Standard C/C++ Win32 Unicode wmain entry point
extern "C" int wmain (int argc, wchar_t * argv[], wchar_t * []) {
extern "C" int CATCH_INTERNAL_CDECL wmain (int argc, wchar_t * argv[], wchar_t * []) {
#else
// Standard C/C++ main entry point
int main (int argc, char * argv[]) {
int CATCH_INTERNAL_CDECL main (int argc, char * argv[]) {
#endif
return Catch::Session().run( argc, argv );
@ -17648,9 +17665,9 @@ int main (int argc, char * const argv[]) {
#if defined(CATCH_CONFIG_ENABLE_BENCHMARKING)
#define CATCH_BENCHMARK(...) \
INTERNAL_CATCH_BENCHMARK(INTERNAL_CATCH_UNIQUE_NAME(____C_A_T_C_H____B_E_N_C_H____), INTERNAL_CATCH_GET_1_ARG(__VA_ARGS__,,), INTERNAL_CATCH_GET_2_ARG(__VA_ARGS__,,))
INTERNAL_CATCH_BENCHMARK(INTERNAL_CATCH_UNIQUE_NAME(C_A_T_C_H_B_E_N_C_H_), INTERNAL_CATCH_GET_1_ARG(__VA_ARGS__,,), INTERNAL_CATCH_GET_2_ARG(__VA_ARGS__,,))
#define CATCH_BENCHMARK_ADVANCED(name) \
INTERNAL_CATCH_BENCHMARK_ADVANCED(INTERNAL_CATCH_UNIQUE_NAME(____C_A_T_C_H____B_E_N_C_H____), name)
INTERNAL_CATCH_BENCHMARK_ADVANCED(INTERNAL_CATCH_UNIQUE_NAME(C_A_T_C_H_B_E_N_C_H_), name)
#endif // CATCH_CONFIG_ENABLE_BENCHMARKING
// If CATCH_CONFIG_PREFIX_ALL is not defined then the CATCH_ prefix is not required
@ -17752,9 +17769,9 @@ int main (int argc, char * const argv[]) {
#if defined(CATCH_CONFIG_ENABLE_BENCHMARKING)
#define BENCHMARK(...) \
INTERNAL_CATCH_BENCHMARK(INTERNAL_CATCH_UNIQUE_NAME(____C_A_T_C_H____B_E_N_C_H____), INTERNAL_CATCH_GET_1_ARG(__VA_ARGS__,,), INTERNAL_CATCH_GET_2_ARG(__VA_ARGS__,,))
INTERNAL_CATCH_BENCHMARK(INTERNAL_CATCH_UNIQUE_NAME(C_A_T_C_H_B_E_N_C_H_), INTERNAL_CATCH_GET_1_ARG(__VA_ARGS__,,), INTERNAL_CATCH_GET_2_ARG(__VA_ARGS__,,))
#define BENCHMARK_ADVANCED(name) \
INTERNAL_CATCH_BENCHMARK_ADVANCED(INTERNAL_CATCH_UNIQUE_NAME(____C_A_T_C_H____B_E_N_C_H____), name)
INTERNAL_CATCH_BENCHMARK_ADVANCED(INTERNAL_CATCH_UNIQUE_NAME(C_A_T_C_H_B_E_N_C_H_), name)
#endif // CATCH_CONFIG_ENABLE_BENCHMARKING
using Catch::Detail::Approx;
@ -17801,8 +17818,8 @@ using Catch::Detail::Approx;
#define CATCH_WARN( msg ) (void)(0)
#define CATCH_CAPTURE( msg ) (void)(0)
#define CATCH_TEST_CASE( ... ) INTERNAL_CATCH_TESTCASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ))
#define CATCH_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_TESTCASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ))
#define CATCH_TEST_CASE( ... ) INTERNAL_CATCH_TESTCASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_S_T_ ))
#define CATCH_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_TESTCASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_S_T_ ))
#define CATCH_METHOD_AS_TEST_CASE( method, ... )
#define CATCH_REGISTER_TEST_CASE( Function, ... ) (void)(0)
#define CATCH_SECTION( ... )
@ -17811,7 +17828,7 @@ using Catch::Detail::Approx;
#define CATCH_FAIL_CHECK( ... ) (void)(0)
#define CATCH_SUCCEED( ... ) (void)(0)
#define CATCH_ANON_TEST_CASE() INTERNAL_CATCH_TESTCASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ))
#define CATCH_ANON_TEST_CASE() INTERNAL_CATCH_TESTCASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_S_T_ ))
#ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR
#define CATCH_TEMPLATE_TEST_CASE( ... ) INTERNAL_CATCH_TEMPLATE_TEST_CASE_NO_REGISTRATION(__VA_ARGS__)
@ -17834,8 +17851,8 @@ using Catch::Detail::Approx;
#endif
// "BDD-style" convenience wrappers
#define CATCH_SCENARIO( ... ) INTERNAL_CATCH_TESTCASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ))
#define CATCH_SCENARIO_METHOD( className, ... ) INTERNAL_CATCH_TESTCASE_METHOD_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ), className )
#define CATCH_SCENARIO( ... ) INTERNAL_CATCH_TESTCASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_S_T_ ))
#define CATCH_SCENARIO_METHOD( className, ... ) INTERNAL_CATCH_TESTCASE_METHOD_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_S_T_ ), className )
#define CATCH_GIVEN( desc )
#define CATCH_AND_GIVEN( desc )
#define CATCH_WHEN( desc )
@ -17883,10 +17900,10 @@ using Catch::Detail::Approx;
#define INFO( msg ) (void)(0)
#define UNSCOPED_INFO( msg ) (void)(0)
#define WARN( msg ) (void)(0)
#define CAPTURE( msg ) (void)(0)
#define CAPTURE( ... ) (void)(0)
#define TEST_CASE( ... ) INTERNAL_CATCH_TESTCASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ))
#define TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_TESTCASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ))
#define TEST_CASE( ... ) INTERNAL_CATCH_TESTCASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_S_T_ ))
#define TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_TESTCASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_S_T_ ))
#define METHOD_AS_TEST_CASE( method, ... )
#define REGISTER_TEST_CASE( Function, ... ) (void)(0)
#define SECTION( ... )
@ -17894,7 +17911,7 @@ using Catch::Detail::Approx;
#define FAIL( ... ) (void)(0)
#define FAIL_CHECK( ... ) (void)(0)
#define SUCCEED( ... ) (void)(0)
#define ANON_TEST_CASE() INTERNAL_CATCH_TESTCASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ))
#define ANON_TEST_CASE() INTERNAL_CATCH_TESTCASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_S_T_ ))
#ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR
#define TEMPLATE_TEST_CASE( ... ) INTERNAL_CATCH_TEMPLATE_TEST_CASE_NO_REGISTRATION(__VA_ARGS__)
@ -17924,8 +17941,8 @@ using Catch::Detail::Approx;
#define CATCH_TRANSLATE_EXCEPTION( signature ) INTERNAL_CATCH_TRANSLATE_EXCEPTION_NO_REG( INTERNAL_CATCH_UNIQUE_NAME( catch_internal_ExceptionTranslator ), signature )
// "BDD-style" convenience wrappers
#define SCENARIO( ... ) INTERNAL_CATCH_TESTCASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ) )
#define SCENARIO_METHOD( className, ... ) INTERNAL_CATCH_TESTCASE_METHOD_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ), className )
#define SCENARIO( ... ) INTERNAL_CATCH_TESTCASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_S_T_ ) )
#define SCENARIO_METHOD( className, ... ) INTERNAL_CATCH_TESTCASE_METHOD_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_S_T_ ), className )
#define GIVEN( desc )
#define AND_GIVEN( desc )

View File

@ -1 +1 @@
531
532

View File

@ -2298,8 +2298,7 @@ ColourRGBA Platform::ChromeHighlight() {
* Returns the currently set system font for the user.
*/
const char *Platform::DefaultFont() {
NSString *name = [[NSUserDefaults standardUserDefaults] stringForKey: @"NSFixedPitchFont"];
return name.UTF8String;
return "Menlo-Regular";
}
//--------------------------------------------------------------------------------------------------
@ -2308,8 +2307,7 @@ const char *Platform::DefaultFont() {
* Returns the currently set system font size for the user.
*/
int Platform::DefaultFontSize() {
return static_cast<int>([[NSUserDefaults standardUserDefaults]
integerForKey: @"NSFixedPitchFontSize"]);
return 11;
}
//--------------------------------------------------------------------------------------------------
@ -2321,8 +2319,7 @@ int Platform::DefaultFontSize() {
* @return time span in milliseconds
*/
unsigned int Platform::DoubleClickTime() {
float threshold = [[NSUserDefaults standardUserDefaults] floatForKey:
@"com.apple.mouse.doubleClickThreshold"];
NSTimeInterval threshold = NSEvent.doubleClickInterval;
if (threshold == 0)
threshold = 0.5;
return static_cast<unsigned int>(threshold * 1000.0);

View File

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

View File

@ -582,7 +582,7 @@
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 5.4.3;
CURRENT_PROJECT_VERSION = 5.5.0;
DEAD_CODE_STRIPPING = YES;
DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_STRICT_OBJC_MSGSEND = YES;
@ -647,7 +647,7 @@
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 5.4.3;
CURRENT_PROJECT_VERSION = 5.5.0;
DEAD_CODE_STRIPPING = YES;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
@ -680,7 +680,7 @@
CODE_SIGN_IDENTITY = "-";
CODE_SIGN_STYLE = Manual;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 5.4.3;
CURRENT_PROJECT_VERSION = 5.5.0;
DEAD_CODE_STRIPPING = YES;
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = "";
@ -715,7 +715,7 @@
CODE_SIGN_IDENTITY = "-";
CODE_SIGN_STYLE = Manual;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 5.4.3;
CURRENT_PROJECT_VERSION = 5.5.0;
DEAD_CODE_STRIPPING = YES;
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = "";

View File

@ -217,6 +217,7 @@ const char user_keywords[] = // Definition of own keywords, not used by MySQL.
[mEditor setColorProperty: SCI_MARKERSETBACK parameter: 0 fromHTML: @"#B1151C"];
[mEditor setColorProperty: SCI_SETSELBACK parameter: 1 value: [NSColor selectedTextBackgroundColor]];
[mEditor setGeneralProperty: SCI_SETMULTIPLESELECTION parameter: 1 value: 0];
// Uncomment if you wanna see auto wrapping in action.
//[mEditor setGeneralProperty: SCI_SETWRAPMODE parameter: SC_WRAP_WORD value: 0];

View File

@ -129,7 +129,7 @@
<h1>Scintilla Documentation</h1>
<p>Last edited 16 February 2024 NH</p>
<p>Last edited 22 March 2024 NH</p>
<p style="background:#90F0C0">Scintilla 5 has moved the lexers from Scintilla into a new
<a href="Lexilla.html">Lexilla</a> project.<br />
@ -3804,6 +3804,22 @@ struct Sci_TextToFindFull {
<td>Cocoa</td>
<td>Background colour of selections when another window has focus</td>
</tr>
<tr>
<th align="left"><code>SC_ELEMENT_SELECTION_INACTIVE_ADDITIONAL_TEXT</code></th>
<td>18</td>
<td>Translucent</td>
<td>All</td>
<td></td>
<td>Text colour of additional selections when another window has focus</td>
</tr>
<tr>
<th align="left"><code>SC_ELEMENT_SELECTION_INACTIVE_ADDITIONAL_BACK</code></th>
<td>19</td>
<td>Translucent</td>
<td>All</td>
<td></td>
<td>Background colour of additional selections when another window has focus</td>
</tr>
<tr class="section">
<th align="left"><code>SC_ELEMENT_CARET</code></th>
<td>40</td>
@ -3911,6 +3927,8 @@ struct Sci_TextToFindFull {
<br />
<a class="element" href="#SC_ELEMENT_SELECTION_INACTIVE_TEXT">SC_ELEMENT_SELECTION_INACTIVE_TEXT : colouralpha</a><br />
<a class="element" href="#SC_ELEMENT_SELECTION_INACTIVE_BACK">SC_ELEMENT_SELECTION_INACTIVE_BACK : colouralpha</a><br />
<a class="element" href="#SC_ELEMENT_SELECTION_INACTIVE_TEXT">SC_ELEMENT_SELECTION_INACTIVE_ADDITIONAL_TEXT : colouralpha</a><br />
<a class="element" href="#SC_ELEMENT_SELECTION_INACTIVE_BACK">SC_ELEMENT_SELECTION_INACTIVE_ADDITIONAL_BACK : colouralpha</a><br />
<br />
<a class="element" href="#SC_ELEMENT_CARET_LINE_BACK">SC_ELEMENT_CARET_LINE_BACK : colouralpha</a><br />
<a class="message" href="#SCI_SETCARETLINELAYER">SCI_SETCARETLINELAYER(int layer)</a><br />
@ -4035,8 +4053,13 @@ struct Sci_TextToFindFull {
<p>
<b id="SC_ELEMENT_SELECTION_INACTIVE_TEXT">SC_ELEMENT_SELECTION_INACTIVE_TEXT : colouralpha</b><br />
<b id="SC_ELEMENT_SELECTION_INACTIVE_BACK">SC_ELEMENT_SELECTION_INACTIVE_BACK : colouralpha</b><br />
<b id="SC_ELEMENT_SELECTION_INACTIVE_ADDITIONAL_TEXT">SC_ELEMENT_SELECTION_INACTIVE_ADDITIONAL_TEXT : colouralpha</b><br />
<b id="SC_ELEMENT_SELECTION_INACTIVE_ADDITIONAL_BACK">SC_ELEMENT_SELECTION_INACTIVE_ADDITIONAL_BACK : colouralpha</b><br />
When a window no longer has the keyboard focus, it is customary to make its selection less noticeable by colouring it grey.
These elements define the colours to be used for selections without focus.
These elements define the colours to be used for selections without focus. When the <code>ADDITIONAL</code> elements are not set then
the standard values are used:
<code>SC_ELEMENT_SELECTION_INACTIVE_ADDITIONAL_TEXT</code>&rarr;<code>SC_ELEMENT_SELECTION_INACTIVE_TEXT</code> and
<code>SC_ELEMENT_SELECTION_INACTIVE_ADDITIONAL_BACK</code>&rarr;<code>SC_ELEMENT_SELECTION_INACTIVE_BACK</code>.
</p>
<p>
@ -8575,6 +8598,8 @@ sptr_t CallScintilla(unsigned int iMessage, uptr_t wParam, sptr_t lParam){
<p><b id="SCI_ALLOCATESUBSTYLES">SCI_ALLOCATESUBSTYLES(int styleBase, int numberStyles) &rarr; int</b><br />
Allocate some number of substyles for a particular base style returning the first substyle number allocated.
A failure, such as requesting more substyles than available, is indicated by returning a negative number.
Lexers that support substyles will commonly allow allocating 64 substyles.
Substyles are allocated contiguously.</p>
<p><b id="SCI_FREESUBSTYLES">SCI_FREESUBSTYLES</b><br />
@ -8673,7 +8698,7 @@ sptr_t CallScintilla(unsigned int iMessage, uptr_t wParam, sptr_t lParam){
<p>
The types <code>Sci_Position</code> and <code>Sci_PositionU</code> are used for positions and line numbers in the document.
With Scintilla 4, 64-bit builds define these as 64-bit types to allow future implementation of documents larger than 2 GB.
64-bit builds define these as 64-bit types to allow documents larger than 2 GB.
</p>
<p>
@ -8711,6 +8736,9 @@ needs to be folded as this allowed fixing up the last line from the previous fol
The new approach allows the lexer to decide whether to backtrack or to handle this
more efficiently.</p>
<p><code>AllocateSubStyles</code> returns a negative number when more
substyles are requested than is available.</p>
<p><code>NamedStyles</code>, <code>NameOfStyle</code>,
<code>TagsOfStyle</code>, and <code>DescriptionOfStyle</code>
are used to provide information on the set of styles used by this lexer.
@ -8851,7 +8879,7 @@ struct SCNotification {
int x; /* SCN_DWELLSTART, SCN_DWELLEND */
int y; /* SCN_DWELLSTART, SCN_DWELLEND */
int token; /* SCN_MODIFIED with SC_MOD_CONTAINER */
int annotationLinesAdded; /* SCN_MODIFIED with SC_MOD_CHANGEANNOTATION */
Sci_Position annotationLinesAdded; /* SCN_MODIFIED with SC_MOD_CHANGEANNOTATION */
int updated; /* SCN_UPDATEUI */
int listCompletionMethod;
/* SCN_AUTOCSELECTION, SCN_AUTOCCOMPLETED, SCN_USERLISTSELECTION */

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/scintilla543.zip">
<font size="4"> <a href="https://www.scintilla.org/scintilla550.zip">
Windows</a>&nbsp;&nbsp;
<a href="https://www.scintilla.org/scintilla543.tgz">
<a href="https://www.scintilla.org/scintilla550.tgz">
GTK/Linux</a>&nbsp;&nbsp;
</font>
</td>
@ -42,7 +42,7 @@
containing very few restrictions.
</p>
<h3>
Release 5.4.3
Release 5.5.0
</h3>
<h4>
Source Code
@ -50,8 +50,8 @@
The source code package contains all of the source code for Scintilla but no binary
executable code and is available in
<ul>
<li><a href="https://www.scintilla.org/scintilla543.zip">zip format</a> (1.8M) commonly used on Windows</li>
<li><a href="https://www.scintilla.org/scintilla543.tgz">tgz format</a> (1.7M) commonly used on Linux and compatible operating systems</li>
<li><a href="https://www.scintilla.org/scintilla550.zip">zip format</a> (1.8M) commonly used on Windows</li>
<li><a href="https://www.scintilla.org/scintilla550.tgz">tgz format</a> (1.7M) 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

@ -583,6 +583,31 @@
</tr>
</table>
<h2>Releases</h2>
<h3>
<a href="https://www.scintilla.org/scintilla550.zip">Release 5.5.0</a>
</h3>
<ul>
<li>
Released 23 April 2024.
</li>
<li>
Add elements for inactive additional selections SC_ELEMENT_SELECTION_INACTIVE_ADDITIONAL_TEXT
and SC_ELEMENT_SELECTION_INACTIVE_ADDITIONAL_BACK.
When not set these default to SC_ELEMENT_SELECTION_INACTIVE_TEXT and SC_ELEMENT_SELECTION_INACTIVE_BACK.
<a href="https://sourceforge.net/p/scintilla/bugs/2417/">Bug #2417</a>.
</li>
<li>
On Cocoa, avoid use of NSUserDefaults which will soon require justification when used in applications on the App Store.
</li>
<li>
Fix Win32 IME crash in windowed mode.
<a href="https://sourceforge.net/p/scintilla/bugs/2433/">Bug #2433</a>.
</li>
<li>
Scale reverse arrow cursor for margins to match other cursors when user changes pointer size.
<a href="https://sourceforge.net/p/scintilla/bugs/2321/">Bug #2321</a>.
</li>
</ul>
<h3>
<a href="https://www.scintilla.org/scintilla543.zip">Release 5.4.3</a>
</h3>

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="20240309" />
<meta name="Date.Modified" content="20240423" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<style type="text/css">
.logo {
@ -60,8 +60,8 @@
GTK, and macOS</font>
</td>
<td width="40%" align="right">
<font color="#FFCC99" size="3"> Release version 5.4.3<br />
Site last modified March 9 2024</font>
<font color="#FFCC99" size="3"> Release version 5.5.0<br />
Site last modified April 23 2024</font>
</td>
<td width="20%">
&nbsp;
@ -76,11 +76,11 @@
</tr>
</table>
<ul id="versionlist">
<li>Version 5.5.0 fixes adds elements for inactive additional selections.</li>
<li>Version 5.4.3 fixes a redo bug.</li>
<li>Version 5.4.2 can save and restore undo history.</li>
<li>Version 5.4.1 adds IDocumentEditable interface to allow efficient interaction with document objects.</li>
<li>Version 5.4.0 fixes crashes on macOS 12 and older when built with Xcode 15.0.</li>
<li>Version 5.3.8 fixes excesssive memory use when deleting contiguous ranges backwards and is compatible with new macOS 14.</li>
</ul>
<ul id="menu">
<li id="remote1"><a href="https://www.scintilla.org/SciTEImage.html">Screenshot</a></li>

View File

@ -295,6 +295,8 @@ typedef sptr_t (*SciFnDirectStatus)(sptr_t ptr, unsigned int iMessage, uptr_t wP
#define SC_ELEMENT_SELECTION_SECONDARY_BACK 15
#define SC_ELEMENT_SELECTION_INACTIVE_TEXT 16
#define SC_ELEMENT_SELECTION_INACTIVE_BACK 17
#define SC_ELEMENT_SELECTION_INACTIVE_ADDITIONAL_TEXT 18
#define SC_ELEMENT_SELECTION_INACTIVE_ADDITIONAL_BACK 19
#define SC_ELEMENT_CARET 40
#define SC_ELEMENT_CARET_ADDITIONAL 41
#define SC_ELEMENT_CARET_LINE_BACK 50

View File

@ -717,6 +717,8 @@ val SC_ELEMENT_SELECTION_SECONDARY_TEXT=14
val SC_ELEMENT_SELECTION_SECONDARY_BACK=15
val SC_ELEMENT_SELECTION_INACTIVE_TEXT=16
val SC_ELEMENT_SELECTION_INACTIVE_BACK=17
val SC_ELEMENT_SELECTION_INACTIVE_ADDITIONAL_TEXT=18
val SC_ELEMENT_SELECTION_INACTIVE_ADDITIONAL_BACK=19
val SC_ELEMENT_CARET=40
val SC_ELEMENT_CARET_ADDITIONAL=41
val SC_ELEMENT_CARET_LINE_BACK=50

Some files were not shown because too many files have changed in this diff Show More