Update to scintilla 5.5.2 & Lexilla 5.4.0

Release 5.5.2 ( https://www.scintilla.org/scintilla552.zip )

    Released 21 August 2024.
    Add SCI_SETCOPYSEPARATOR for separator between parts of a multiple selection when copied to the clipboard. Feature #1530.
    Add SCI_GETUNDOSEQUENCE to determine whether an undo sequence is active and its nesting depth.
    Add SCI_STYLESETSTRETCH to support condensed and expanded text styles.
    Add SCI_LINEINDENT and SCI_LINEDEDENT. Feature #1524.
    Fix bug on Cocoa where double-click stopped working when system had been running for a long time.
    On Cocoa implement more values of font weight and stretch.

Release 5.4.0 ( https://www.scintilla.org/lexilla540.zip )

    Released 21 August 2024.
    Inside Lexilla, LexerModule instances are now const. This will require changes to applications that modify Lexilla.cxx, which may be done to add custom lexers.
    Lexer added for TOML "toml".
    Bash: Handle backslash in heredoc delimiter. Issue #257.
    Progress: Fix lexing of nested comments. Pull request #258.
    Force lower-casing of case-insensitive keyword lists so keywords match in some lexers. Issue #259.

Close #15564
This commit is contained in:
Christian Grasser 2024-08-22 08:27:33 +02:00 committed by Don Ho
parent d84f9b2048
commit ad79718fc8
213 changed files with 3082 additions and 644 deletions

View File

@ -9,6 +9,7 @@
**.iface text **.iface text
**.template text **.template text
**.mk text **.mk text
**.mk text
**.py text **.py text
**.rc text **.rc text
**.css text **.css text
@ -29,6 +30,7 @@
**.aspx text **.aspx text
**.php text **.php text
**.vb text **.vb text
**.vbs text
**.asm text **.asm text
**.cob text **.cob text
**.cmake text **.cmake text
@ -47,6 +49,7 @@
**.ml text **.ml text
**.nim text **.nim text
**.octave text **.octave text
**.p text
**.pl text **.pl text
**.p6 text **.p6 text
**.ps1 text **.ps1 text
@ -55,6 +58,7 @@
**.rs text **.rs text
**.sql text **.sql text
**.tcl text **.tcl text
**.toml text
**.tsql text **.tsql text
**.err text **.err text
**.mms text **.mms text

View File

@ -9,7 +9,7 @@
<meta name="keywords" content="Scintilla, SciTE, Editing Component, Text Editor" /> <meta name="keywords" content="Scintilla, SciTE, Editing Component, Text Editor" />
<meta name="Description" <meta name="Description"
content="www.scintilla.org is the home of the Scintilla editing component and SciTE text editor application." /> content="www.scintilla.org is the home of the Scintilla editing component and SciTE text editor application." />
<meta name="Date.Modified" content="20240722" /> <meta name="Date.Modified" content="20240821" />
<meta name="viewport" content="width=device-width, initial-scale=1" /> <meta name="viewport" content="width=device-width, initial-scale=1" />
<style type="text/css"> <style type="text/css">
.logo { .logo {
@ -61,8 +61,8 @@
<font color="#FFCC99" size="4"> A library of language lexers for use with Scintilla</font> <font color="#FFCC99" size="4"> A library of language lexers for use with Scintilla</font>
</td> </td>
<td width="40%" align="right"> <td width="40%" align="right">
<font color="#FFCC99" size="3">Release version 5.3.3<br /> <font color="#FFCC99" size="3">Release version 5.4.0<br />
Site last modified July 22 2024</font> Site last modified August 21 2024</font>
</td> </td>
<td width="20%"> <td width="20%">
&nbsp; &nbsp;
@ -77,11 +77,11 @@
</tr> </tr>
</table> </table>
<ul id="versionlist"> <ul id="versionlist">
<li>Version 5.4.0 adds a TOML lexer.</li>
<li>Version 5.3.3 improves HTML, JavaScript, Lua, PHP, and XML.</li> <li>Version 5.3.3 improves HTML, JavaScript, Lua, PHP, and XML.</li>
<li>Version 5.3.2 improves COBOL, HTML, Lua, Ruby, and Rust.</li> <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.1 improves Assembler, Bash, Batch, JavaScript, Python, and Ruby.</li>
<li>Version 5.3.0 improves Bash, HTML, and Lua.</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>
</ul> </ul>
<ul id="menu"> <ul id="menu">
<li id="remote1"><a href="https://www.scintilla.org/SciTEImage.html">Screenshot</a></li> <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"> <table bgcolor="#CCCCCC" width="100%" cellspacing="0" cellpadding="8" border="0">
<tr> <tr>
<td> <td>
<font size="4"> <a href="https://www.scintilla.org/lexilla533.zip"> <font size="4"> <a href="https://www.scintilla.org/lexilla540.zip">
Windows</a>&nbsp;&nbsp; Windows</a>&nbsp;&nbsp;
<a href="https://www.scintilla.org/lexilla533.tgz"> <a href="https://www.scintilla.org/lexilla540.tgz">
GTK/Linux</a>&nbsp;&nbsp; GTK/Linux</a>&nbsp;&nbsp;
</font> </font>
</td> </td>
@ -42,7 +42,7 @@
containing very few restrictions. containing very few restrictions.
</p> </p>
<h3> <h3>
Release 5.3.3 Release 5.4.0
</h3> </h3>
<h4> <h4>
Source Code Source Code
@ -50,8 +50,8 @@
The source code package contains all of the source code for Lexilla but no binary The source code package contains all of the source code for Lexilla but no binary
executable code and is available in executable code and is available in
<ul> <ul>
<li><a href="https://www.scintilla.org/lexilla533.zip">zip format</a> (1.3M) commonly used on Windows</li> <li><a href="https://www.scintilla.org/lexilla540.zip">zip format</a> (1.3M) commonly used on Windows</li>
<li><a href="https://www.scintilla.org/lexilla533.tgz">tgz format</a> (0.9M) commonly used on Linux and compatible operating systems</li> <li><a href="https://www.scintilla.org/lexilla540.tgz">tgz format</a> (0.9M) commonly used on Linux and compatible operating systems</li>
</ul> </ul>
Instructions for building on both Windows and Linux are included in the readme file. Instructions for building on both Windows and Linux are included in the readme file.
<h4> <h4>

View File

@ -588,6 +588,34 @@
</tr> </tr>
</table> </table>
<h2>Releases</h2> <h2>Releases</h2>
<h3>
<a href="https://www.scintilla.org/lexilla540.zip">Release 5.4.0</a>
</h3>
<ul>
<li>
Released 21 August 2024.
</li>
<li>
Inside Lexilla, LexerModule instances are now const.
This will require changes to applications that modify Lexilla.cxx, which
may be done to add custom lexers.
</li>
<li>
Lexer added for TOML "toml".
</li>
<li>
Bash: Handle backslash in heredoc delimiter.
<a href="https://github.com/ScintillaOrg/lexilla/issues/257">Issue #257</a>.
</li>
<li>
Progress: Fix lexing of nested comments.
<a href="https://github.com/ScintillaOrg/lexilla/pull/258">Pull request #258</a>.
</li>
<li>
Force lower-casing of case-insensitive keyword lists so keywords match in some lexers.
<a href="https://github.com/ScintillaOrg/lexilla/issues/259">Issue #259</a>.
</li>
</ul>
<h3> <h3>
<a href="https://www.scintilla.org/lexilla533.zip">Release 5.3.3</a> <a href="https://www.scintilla.org/lexilla533.zip">Release 5.3.3</a>
</h3> </h3>

View File

@ -144,6 +144,7 @@ val SCLEX_FSHARP=132
val SCLEX_JULIA=133 val SCLEX_JULIA=133
val SCLEX_ASCIIDOC=134 val SCLEX_ASCIIDOC=134
val SCLEX_GDSCRIPT=135 val SCLEX_GDSCRIPT=135
val SCLEX_TOML=136
# When a lexer specifies its language as SCLEX_AUTOMATIC it receives a # When a lexer specifies its language as SCLEX_AUTOMATIC it receives a
# value assigned in sequence from SCLEX_AUTOMATIC+1. # value assigned in sequence from SCLEX_AUTOMATIC+1.
@ -2310,3 +2311,20 @@ val SCE_GD_STRINGEOL=13
val SCE_GD_WORD2=14 val SCE_GD_WORD2=14
val SCE_GD_ANNOTATION=15 val SCE_GD_ANNOTATION=15
val SCE_GD_NODEPATH=16 val SCE_GD_NODEPATH=16
# Lexical states for SCLEX_TOML
lex TOML=SCLEX_TOML SCE_TOML_
val SCE_TOML_DEFAULT=0
val SCE_TOML_COMMENT=1
val SCE_TOML_IDENTIFIER=2
val SCE_TOML_KEYWORD=3
val SCE_TOML_NUMBER=4
val SCE_TOML_TABLE=5
val SCE_TOML_KEY=6
val SCE_TOML_ERROR=7
val SCE_TOML_OPERATOR=8
val SCE_TOML_STRING_SQ=9
val SCE_TOML_STRING_DQ=10
val SCE_TOML_TRIPLE_STRING_SQ=11
val SCE_TOML_TRIPLE_STRING_DQ=12
val SCE_TOML_ESCAPECHAR=13
val SCE_TOML_DATETIME=14

View File

@ -102,7 +102,7 @@ namespace Lexilla {
class LexerModule; class LexerModule;
} }
// Add a static lexer (in the same binary) to Lexilla's list // Add a static lexer (in the same binary) to Lexilla's list
void AddStaticLexerModule(Lexilla::LexerModule *plm); void AddStaticLexerModule(const Lexilla::LexerModule *plm);
#endif #endif
#endif #endif

View File

@ -148,6 +148,7 @@
#define SCLEX_JULIA 133 #define SCLEX_JULIA 133
#define SCLEX_ASCIIDOC 134 #define SCLEX_ASCIIDOC 134
#define SCLEX_GDSCRIPT 135 #define SCLEX_GDSCRIPT 135
#define SCLEX_TOML 136
#define SCLEX_SEARCHRESULT 150 #define SCLEX_SEARCHRESULT 150
#define SCLEX_OBJC 151 #define SCLEX_OBJC 151
#define SCLEX_USER 152 #define SCLEX_USER 152
@ -2061,6 +2062,21 @@
#define SCE_GD_WORD2 14 #define SCE_GD_WORD2 14
#define SCE_GD_ANNOTATION 15 #define SCE_GD_ANNOTATION 15
#define SCE_GD_NODEPATH 16 #define SCE_GD_NODEPATH 16
#define SCE_TOML_DEFAULT 0
#define SCE_TOML_COMMENT 1
#define SCE_TOML_IDENTIFIER 2
#define SCE_TOML_KEYWORD 3
#define SCE_TOML_NUMBER 4
#define SCE_TOML_TABLE 5
#define SCE_TOML_KEY 6
#define SCE_TOML_ERROR 7
#define SCE_TOML_OPERATOR 8
#define SCE_TOML_STRING_SQ 9
#define SCE_TOML_STRING_DQ 10
#define SCE_TOML_TRIPLE_STRING_SQ 11
#define SCE_TOML_TRIPLE_STRING_DQ 12
#define SCE_TOML_ESCAPECHAR 13
#define SCE_TOML_DATETIME 14
/* --Autogenerated -- end of section automatically generated from Scintilla.iface */ /* --Autogenerated -- end of section automatically generated from Scintilla.iface */

View File

@ -345,4 +345,4 @@ static const char * const a68kWordListDesc[] =
0 0
}; };
LexerModule lmA68k(SCLEX_A68K, ColouriseA68kDoc, "a68k", 0, a68kWordListDesc); extern const LexerModule lmA68k(SCLEX_A68K, ColouriseA68kDoc, "a68k", 0, a68kWordListDesc);

View File

@ -257,4 +257,4 @@ static const char * const apdlWordListDesc[] = {
0 0
}; };
LexerModule lmAPDL(SCLEX_APDL, ColouriseAPDLDoc, "apdl", FoldAPDLDoc, apdlWordListDesc); extern const LexerModule lmAPDL(SCLEX_APDL, ColouriseAPDLDoc, "apdl", FoldAPDLDoc, apdlWordListDesc);

View File

@ -272,4 +272,4 @@ static const char * const asyWordLists[] = {
0, 0,
}; };
LexerModule lmASY(SCLEX_ASYMPTOTE, ColouriseAsyDoc, "asy", FoldAsyDoc, asyWordLists); extern const LexerModule lmASY(SCLEX_ASYMPTOTE, ColouriseAsyDoc, "asy", FoldAsyDoc, asyWordLists);

View File

@ -908,4 +908,4 @@ static const char * const AU3WordLists[] = {
"#autoit UDF", "#autoit UDF",
0 0
}; };
LexerModule lmAU3(SCLEX_AU3, ColouriseAU3Doc, "au3", FoldAU3Doc , AU3WordLists); extern const LexerModule lmAU3(SCLEX_AU3, ColouriseAU3Doc, "au3", FoldAU3Doc , AU3WordLists);

View File

@ -228,5 +228,5 @@ static void FoldAveDoc(Sci_PositionU startPos, Sci_Position length, int /* initS
styler.SetLevel(lineCurrent, levelPrev | flagsNext); styler.SetLevel(lineCurrent, levelPrev | flagsNext);
} }
LexerModule lmAVE(SCLEX_AVE, ColouriseAveDoc, "ave", FoldAveDoc); extern const LexerModule lmAVE(SCLEX_AVE, ColouriseAveDoc, "ave", FoldAveDoc);

View File

@ -291,4 +291,4 @@ static const char * const avsWordLists[] = {
0, 0,
}; };
LexerModule lmAVS(SCLEX_AVS, ColouriseAvsDoc, "avs", FoldAvsDoc, avsWordLists); extern const LexerModule lmAVS(SCLEX_AVS, ColouriseAvsDoc, "avs", FoldAvsDoc, avsWordLists);

View File

@ -603,4 +603,4 @@ static const char * const abaqusWordListDesc[] = {
0 0
}; };
LexerModule lmAbaqus(SCLEX_ABAQUS, ColouriseABAQUSDoc, "abaqus", FoldABAQUSDoc, abaqusWordListDesc); extern const LexerModule lmAbaqus(SCLEX_ABAQUS, ColouriseABAQUSDoc, "abaqus", FoldABAQUSDoc, abaqusWordListDesc);

View File

@ -44,7 +44,7 @@ static const char * const adaWordListDesc[] = {
0 0
}; };
LexerModule lmAda(SCLEX_ADA, ColouriseDocument, "ada", NULL, adaWordListDesc); extern const LexerModule lmAda(SCLEX_ADA, ColouriseDocument, "ada", NULL, adaWordListDesc);
/* /*
* Implementation * Implementation

View File

@ -390,4 +390,4 @@ static void ColorizeAsciidocDoc(Sci_PositionU startPos, Sci_Position length, int
sc.Complete(); sc.Complete();
} }
LexerModule lmAsciidoc(SCLEX_ASCIIDOC, ColorizeAsciidocDoc, "asciidoc"); extern const LexerModule lmAsciidoc(SCLEX_ASCIIDOC, ColorizeAsciidocDoc, "asciidoc");

View File

@ -9,12 +9,12 @@
// Copyright 1998-2003 by Neil Hodgson <neilh@scintilla.org> // Copyright 1998-2003 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed. // The License.txt file describes the conditions under which this software may be distributed.
#include <stdlib.h> #include <cstdlib>
#include <string.h> #include <cassert>
#include <stdio.h> #include <cstring>
#include <stdarg.h> #include <cctype>
#include <assert.h> #include <cstdio>
#include <ctype.h> #include <cstdarg>
#include <string> #include <string>
#include <string_view> #include <string_view>
@ -37,17 +37,19 @@
using namespace Scintilla; using namespace Scintilla;
using namespace Lexilla; using namespace Lexilla;
static inline bool IsAWordChar(const int ch) { namespace {
bool IsAWordChar(const int ch) noexcept {
return (ch < 0x80) && (isalnum(ch) || ch == '.' || return (ch < 0x80) && (isalnum(ch) || ch == '.' ||
ch == '_' || ch == '?'); ch == '_' || ch == '?');
} }
static inline bool IsAWordStart(const int ch) { bool IsAWordStart(const int ch) noexcept {
return (ch < 0x80) && (isalnum(ch) || ch == '_' || ch == '.' || return (ch < 0x80) && (isalnum(ch) || ch == '_' || ch == '.' ||
ch == '%' || ch == '@' || ch == '$' || ch == '?'); ch == '%' || ch == '@' || ch == '$' || ch == '?');
} }
static inline bool IsAsmOperator(const int ch) { bool IsAsmOperator(const int ch) noexcept {
if ((ch < 0x80) && (isalnum(ch))) if ((ch < 0x80) && (isalnum(ch)))
return false; return false;
// '.' left out as it is used to make up numbers // '.' left out as it is used to make up numbers
@ -60,16 +62,10 @@ static inline bool IsAsmOperator(const int ch) {
return false; return false;
} }
static bool IsStreamCommentStyle(int style) { constexpr bool IsStreamCommentStyle(int style) noexcept {
return style == SCE_ASM_COMMENTDIRECTIVE || style == SCE_ASM_COMMENTBLOCK; return style == SCE_ASM_COMMENTDIRECTIVE || style == SCE_ASM_COMMENTBLOCK;
} }
static inline int LowerCase(int c) {
if (c >= 'A' && c <= 'Z')
return 'a' + c - 'A';
return c;
}
// An individual named option for use in an OptionSet // An individual named option for use in an OptionSet
// Options used for LexerAsm // Options used for LexerAsm
@ -98,7 +94,7 @@ struct OptionsAsm {
} }
}; };
static const char * const asmWordListDesc[] = { const char *const asmWordListDesc[] = {
"CPU instructions", "CPU instructions",
"FPU instructions", "FPU instructions",
"Registers", "Registers",
@ -107,7 +103,7 @@ static const char * const asmWordListDesc[] = {
"Extended instructions", "Extended instructions",
"Directives4Foldstart", "Directives4Foldstart",
"Directives4Foldend", "Directives4Foldend",
0 nullptr
}; };
struct OptionSetAsm : public OptionSet<OptionsAsm> { struct OptionSetAsm : public OptionSet<OptionsAsm> {
@ -191,7 +187,7 @@ public:
void SCI_METHOD Fold(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 *) override { void * SCI_METHOD PrivateCall(int, void *) override {
return 0; return nullptr;
} }
static ILexer5 *LexerFactoryAsm() { static ILexer5 *LexerFactoryAsm() {
@ -211,7 +207,7 @@ Sci_Position SCI_METHOD LexerAsm::PropertySet(const char *key, const char *val)
} }
Sci_Position SCI_METHOD LexerAsm::WordListSet(int n, const char *wl) { Sci_Position SCI_METHOD LexerAsm::WordListSet(int n, const char *wl) {
WordList *wordListN = 0; WordList *wordListN = nullptr;
switch (n) { switch (n) {
case 0: case 0:
wordListN = &cpuInstruction; wordListN = &cpuInstruction;
@ -240,7 +236,7 @@ Sci_Position SCI_METHOD LexerAsm::WordListSet(int n, const char *wl) {
} }
Sci_Position firstModification = -1; Sci_Position firstModification = -1;
if (wordListN) { if (wordListN) {
if (wordListN->Set(wl)) { if (wordListN->Set(wl, true)) {
firstModification = 0; firstModification = 0;
} }
} }
@ -319,7 +315,7 @@ void SCI_METHOD LexerAsm::Lex(Sci_PositionU startPos, Sci_Position length, int i
} }
sc.SetState(SCE_ASM_DEFAULT); sc.SetState(SCE_ASM_DEFAULT);
if (IsDirective && !strcmp(s, "comment")) { if (IsDirective && !strcmp(s, "comment")) {
char delimiter = options.delimiter.empty() ? '~' : options.delimiter.c_str()[0]; const char delimiter = options.delimiter.empty() ? '~' : options.delimiter.c_str()[0];
while (IsASpaceOrTab(sc.ch) && !sc.atLineEnd) { while (IsASpaceOrTab(sc.ch) && !sc.atLineEnd) {
sc.ForwardSetState(SCE_ASM_DEFAULT); sc.ForwardSetState(SCE_ASM_DEFAULT);
} }
@ -329,7 +325,7 @@ void SCI_METHOD LexerAsm::Lex(Sci_PositionU startPos, Sci_Position length, int i
} }
} }
} else if (sc.state == SCE_ASM_COMMENTDIRECTIVE) { } else if (sc.state == SCE_ASM_COMMENTDIRECTIVE) {
char delimiter = options.delimiter.empty() ? '~' : options.delimiter.c_str()[0]; const char delimiter = options.delimiter.empty() ? '~' : options.delimiter.c_str()[0];
if (sc.ch == delimiter) { if (sc.ch == delimiter) {
while (!sc.MatchLineEnd()) { while (!sc.MatchLineEnd()) {
sc.Forward(); sc.Forward();
@ -392,7 +388,7 @@ void SCI_METHOD LexerAsm::Fold(Sci_PositionU startPos, Sci_Position length, int
LexAccessor styler(pAccess); LexAccessor styler(pAccess);
Sci_PositionU endPos = startPos + length; const Sci_PositionU endPos = startPos + length;
int visibleChars = 0; int visibleChars = 0;
Sci_Position lineCurrent = styler.GetLine(startPos); Sci_Position lineCurrent = styler.GetLine(startPos);
int levelCurrent = SC_FOLDLEVELBASE; int levelCurrent = SC_FOLDLEVELBASE;
@ -402,16 +398,16 @@ void SCI_METHOD LexerAsm::Fold(Sci_PositionU startPos, Sci_Position length, int
char chNext = styler[startPos]; char chNext = styler[startPos];
int styleNext = styler.StyleAt(startPos); int styleNext = styler.StyleAt(startPos);
int style = initStyle; int style = initStyle;
char word[100]; char word[100]{};
int wordlen = 0; int wordlen = 0;
const bool userDefinedFoldMarkers = !options.foldExplicitStart.empty() && !options.foldExplicitEnd.empty(); const bool userDefinedFoldMarkers = !options.foldExplicitStart.empty() && !options.foldExplicitEnd.empty();
for (Sci_PositionU i = startPos; i < endPos; i++) { for (Sci_PositionU i = startPos; i < endPos; i++) {
char ch = chNext; const char ch = chNext;
chNext = styler.SafeGetCharAt(i + 1); chNext = styler.SafeGetCharAt(i + 1);
int stylePrev = style; const int stylePrev = style;
style = styleNext; style = styleNext;
styleNext = styler.StyleAt(i + 1); styleNext = styler.StyleAt(i + 1);
bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n'); const bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n');
if (options.foldCommentMultiline && IsStreamCommentStyle(style)) { if (options.foldCommentMultiline && IsStreamCommentStyle(style)) {
if (!IsStreamCommentStyle(stylePrev)) { if (!IsStreamCommentStyle(stylePrev)) {
levelNext++; levelNext++;
@ -438,7 +434,7 @@ void SCI_METHOD LexerAsm::Fold(Sci_PositionU startPos, Sci_Position length, int
} }
} }
if (options.foldSyntaxBased && (style == SCE_ASM_DIRECTIVE)) { if (options.foldSyntaxBased && (style == SCE_ASM_DIRECTIVE)) {
word[wordlen++] = static_cast<char>(LowerCase(ch)); word[wordlen++] = MakeLowerCase(ch);
if (wordlen == 100) { // prevent overflow if (wordlen == 100) { // prevent overflow
word[0] = '\0'; word[0] = '\0';
wordlen = 1; wordlen = 1;
@ -456,7 +452,7 @@ void SCI_METHOD LexerAsm::Fold(Sci_PositionU startPos, Sci_Position length, int
if (!IsASpace(ch)) if (!IsASpace(ch))
visibleChars++; visibleChars++;
if (atEOL || (i == endPos-1)) { if (atEOL || (i == endPos-1)) {
int levelUse = levelCurrent; const int levelUse = levelCurrent;
int lev = levelUse | levelNext << 16; int lev = levelUse | levelNext << 16;
if (visibleChars == 0 && options.foldCompact) if (visibleChars == 0 && options.foldCompact)
lev |= SC_FOLDLEVELWHITEFLAG; lev |= SC_FOLDLEVELWHITEFLAG;
@ -476,6 +472,8 @@ void SCI_METHOD LexerAsm::Fold(Sci_PositionU startPos, Sci_Position length, int
} }
} }
LexerModule lmAsm(SCLEX_ASM, LexerAsm::LexerFactoryAsm, "asm", asmWordListDesc); }
LexerModule lmAs(SCLEX_AS, LexerAsm::LexerFactoryAs, "as", asmWordListDesc);
extern const LexerModule lmAsm(SCLEX_ASM, LexerAsm::LexerFactoryAsm, "asm", asmWordListDesc);
extern const LexerModule lmAs(SCLEX_AS, LexerAsm::LexerFactoryAs, "as", asmWordListDesc);

View File

@ -186,4 +186,4 @@ static const char * const asn1WordLists[] = {
0, }; 0, };
LexerModule lmAsn1(SCLEX_ASN1, ColouriseAsn1Doc, "asn1", FoldAsn1Doc, asn1WordLists); extern const LexerModule lmAsn1(SCLEX_ASN1, ColouriseAsn1Doc, "asn1", FoldAsn1Doc, asn1WordLists);

View File

@ -992,4 +992,4 @@ void SCI_METHOD LexerBaan::Fold(Sci_PositionU startPos, Sci_Position length, int
styler.SetLevel(lineCurrent, levelPrev | flagsNext); styler.SetLevel(lineCurrent, levelPrev | flagsNext);
} }
LexerModule lmBaan(SCLEX_BAAN, LexerBaan::LexerFactoryBaan, "baan", baanWordLists); extern const LexerModule lmBaan(SCLEX_BAAN, LexerBaan::LexerFactoryBaan, "baan", baanWordLists);

View File

@ -611,6 +611,7 @@ void SCI_METHOD LexerBash::Lex(Sci_PositionU startPos, Sci_Position length, int
bool Quoted = false; // true if Quote in ('\'','"','`') bool Quoted = false; // true if Quote in ('\'','"','`')
bool Escaped = false; // backslash in delimiter, common in configure script bool Escaped = false; // backslash in delimiter, common in configure script
bool Indent = false; // indented delimiter (for <<-) bool Indent = false; // indented delimiter (for <<-)
int BackslashCount = 0;
int DelimiterLength = 0; // strlen(Delimiter) int DelimiterLength = 0; // strlen(Delimiter)
char Delimiter[HERE_DELIM_MAX]{}; // the Delimiter char Delimiter[HERE_DELIM_MAX]{}; // the Delimiter
HereDocCls() noexcept = default; HereDocCls() noexcept = default;
@ -831,6 +832,7 @@ void SCI_METHOD LexerBash::Lex(Sci_PositionU startPos, Sci_Position length, int
HereDoc.Quote = sc.chNext; HereDoc.Quote = sc.chNext;
HereDoc.Quoted = false; HereDoc.Quoted = false;
HereDoc.Escaped = false; HereDoc.Escaped = false;
HereDoc.BackslashCount = 0;
HereDoc.DelimiterLength = 0; HereDoc.DelimiterLength = 0;
HereDoc.Delimiter[HereDoc.DelimiterLength] = '\0'; HereDoc.Delimiter[HereDoc.DelimiterLength] = '\0';
if (sc.chNext == '\'' || sc.chNext == '\"') { // a quoted here-doc delimiter (' or ") if (sc.chNext == '\'' || sc.chNext == '\"') { // a quoted here-doc delimiter (' or ")
@ -858,22 +860,21 @@ void SCI_METHOD LexerBash::Lex(Sci_PositionU startPos, Sci_Position length, int
} else if (HereDoc.State == 1) { // collect the delimiter } else if (HereDoc.State == 1) { // collect the delimiter
// * if single quoted, there's no escape // * if single quoted, there's no escape
// * if double quoted, there are \\ and \" escapes // * if double quoted, there are \\ and \" escapes
if ((HereDoc.Quote == '\'' && sc.ch != HereDoc.Quote) || if (HereDoc.Quoted && sc.ch == HereDoc.Quote && (HereDoc.BackslashCount & 1) == 0) { // closing quote => end of delimiter
(HereDoc.Quoted && sc.ch != HereDoc.Quote && sc.ch != '\\') || sc.ForwardSetState(SCE_SH_DEFAULT | insideCommand);
(HereDoc.Quote != '\'' && sc.chPrev == '\\') || } else if (sc.ch == '\\' && HereDoc.Quote != '\'') {
(setHereDoc2.Contains(sc.ch))) {
HereDoc.Append(sc.ch);
} else if (HereDoc.Quoted && sc.ch == HereDoc.Quote) { // closing quote => end of delimiter
sc.ForwardSetState(SCE_SH_DEFAULT);
} else if (sc.ch == '\\') {
HereDoc.Escaped = true; HereDoc.Escaped = true;
if (HereDoc.Quoted && sc.chNext != HereDoc.Quote && sc.chNext != '\\') { HereDoc.BackslashCount += 1;
if ((HereDoc.BackslashCount & 1) == 0 || (HereDoc.Quoted && !AnyOf(sc.chNext, '\"', '\\'))) {
// in quoted prefixes only \ and the quote eat the escape // in quoted prefixes only \ and the quote eat the escape
HereDoc.Append(sc.ch); HereDoc.Append(sc.ch);
} else { } else {
// skip escape prefix // skip escape prefix
} }
} else if (!HereDoc.Quoted) { } else if (HereDoc.Quoted || setHereDoc2.Contains(sc.ch) || (sc.ch > 32 && sc.ch < 127 && (HereDoc.BackslashCount & 1) != 0)) {
HereDoc.BackslashCount = 0;
HereDoc.Append(sc.ch);
} else {
sc.SetState(SCE_SH_DEFAULT | insideCommand); sc.SetState(SCE_SH_DEFAULT | insideCommand);
} }
if (HereDoc.DelimiterLength >= HERE_DELIM_MAX - 1) { // force blowup if (HereDoc.DelimiterLength >= HERE_DELIM_MAX - 1) { // force blowup
@ -1287,4 +1288,4 @@ void SCI_METHOD LexerBash::Fold(Sci_PositionU startPos_, Sci_Position length, in
styler.SetLevel(lineCurrent, levelPrev | flagsNext); styler.SetLevel(lineCurrent, levelPrev | flagsNext);
} }
LexerModule lmBash(SCLEX_BASH, LexerBash::LexerFactoryBash, "bash", bashWordListDesc); extern const LexerModule lmBash(SCLEX_BASH, LexerBash::LexerFactoryBash, "bash", bashWordListDesc);

View File

@ -566,8 +566,8 @@ void SCI_METHOD LexerBasic::Fold(Sci_PositionU startPos, Sci_Position length, in
} }
} }
LexerModule lmBlitzBasic(SCLEX_BLITZBASIC, LexerBasic::LexerFactoryBlitzBasic, "blitzbasic", blitzbasicWordListDesc); extern const LexerModule lmBlitzBasic(SCLEX_BLITZBASIC, LexerBasic::LexerFactoryBlitzBasic, "blitzbasic", blitzbasicWordListDesc);
LexerModule lmPureBasic(SCLEX_PUREBASIC, LexerBasic::LexerFactoryPureBasic, "purebasic", purebasicWordListDesc); extern const LexerModule lmPureBasic(SCLEX_PUREBASIC, LexerBasic::LexerFactoryPureBasic, "purebasic", purebasicWordListDesc);
LexerModule lmFreeBasic(SCLEX_FREEBASIC, LexerBasic::LexerFactoryFreeBasic, "freebasic", freebasicWordListDesc); extern const LexerModule lmFreeBasic(SCLEX_FREEBASIC, LexerBasic::LexerFactoryFreeBasic, "freebasic", freebasicWordListDesc);

View File

@ -643,4 +643,4 @@ const char *const batchWordListDesc[] = {
} }
LexerModule lmBatch(SCLEX_BATCH, ColouriseBatchDoc, "batch", nullptr, batchWordListDesc); extern const LexerModule lmBatch(SCLEX_BATCH, ColouriseBatchDoc, "batch", nullptr, batchWordListDesc);

View File

@ -299,7 +299,7 @@ static const char * const BibTeXWordLists[] = {
}; };
LexerModule lmBibTeX(SCLEX_BIBTEX, ColorizeBibTeX, "bib", 0, BibTeXWordLists); extern const LexerModule lmBibTeX(SCLEX_BIBTEX, ColorizeBibTeX, "bib", 0, BibTeXWordLists);
// Entry Names // Entry Names
// article, book, booklet, conference, inbook, // article, book, booklet, conference, inbook,

View File

@ -231,4 +231,4 @@ static const char * const bullantWordListDesc[] = {
0 0
}; };
LexerModule lmBullant(SCLEX_BULLANT, ColouriseBullantDoc, "bullant", 0, bullantWordListDesc); extern const LexerModule lmBullant(SCLEX_BULLANT, ColouriseBullantDoc, "bullant", 0, bullantWordListDesc);

View File

@ -407,4 +407,4 @@ void SCI_METHOD LexerCIL::Fold(Sci_PositionU startPos, Sci_Position length,
} }
} }
LexerModule lmCIL(SCLEX_CIL, LexerCIL::LexerFactoryCIL, "cil", cilWordListDesc); extern const LexerModule lmCIL(SCLEX_CIL, LexerCIL::LexerFactoryCIL, "cil", cilWordListDesc);

View File

@ -677,7 +677,7 @@ static const char * const rgWordListDescriptions[] = {
}; };
// Case Sensitive Clarion Language Lexer // Case Sensitive Clarion Language Lexer
LexerModule lmClw(SCLEX_CLW, ColouriseClarionDocSensitive, "clarion", FoldClarionDoc, rgWordListDescriptions); extern const LexerModule lmClw(SCLEX_CLW, ColouriseClarionDocSensitive, "clarion", FoldClarionDoc, rgWordListDescriptions);
// Case Insensitive Clarion Language Lexer // Case Insensitive Clarion Language Lexer
LexerModule lmClwNoCase(SCLEX_CLWNOCASE, ColouriseClarionDocInsensitive, "clarionnocase", FoldClarionDoc, rgWordListDescriptions); extern const LexerModule lmClwNoCase(SCLEX_CLWNOCASE, ColouriseClarionDocInsensitive, "clarionnocase", FoldClarionDoc, rgWordListDescriptions);

View File

@ -384,4 +384,4 @@ static const char * const COBOLWordListDesc[] = {
0 0
}; };
LexerModule lmCOBOL(SCLEX_COBOL, ColouriseCOBOLDoc, "COBOL", FoldCOBOLDoc, COBOLWordListDesc); extern const LexerModule lmCOBOL(SCLEX_COBOL, ColouriseCOBOLDoc, "COBOL", FoldCOBOLDoc, COBOLWordListDesc);

View File

@ -1841,5 +1841,5 @@ bool LexerCPP::EvaluateExpression(const std::string &expr, const SymbolTable &pr
return !isFalse; return !isFalse;
} }
LexerModule lmCPP(SCLEX_CPP, LexerCPP::LexerFactoryCPP, "cpp", cppWordLists); extern const LexerModule lmCPP(SCLEX_CPP, LexerCPP::LexerFactoryCPP, "cpp", cppWordLists);
LexerModule lmCPPNoCase(SCLEX_CPPNOCASE, LexerCPP::LexerFactoryCPPInsensitive, "cppnocase", cppWordLists); extern const LexerModule lmCPPNoCase(SCLEX_CPPNOCASE, LexerCPP::LexerFactoryCPPInsensitive, "cppnocase", cppWordLists);

View File

@ -567,4 +567,4 @@ static const char * const cssWordListDesc[] = {
0 0
}; };
LexerModule lmCss(SCLEX_CSS, ColouriseCssDoc, "css", FoldCSSDoc, cssWordListDesc); extern const LexerModule lmCss(SCLEX_CSS, ColouriseCssDoc, "css", FoldCSSDoc, cssWordListDesc);

View File

@ -326,4 +326,4 @@ static const char * const camlWordListDesc[] = {
0 0
}; };
LexerModule lmCaml(SCLEX_CAML, ColouriseCamlDoc, "caml", FoldCamlDoc, camlWordListDesc); extern const LexerModule lmCaml(SCLEX_CAML, ColouriseCamlDoc, "caml", FoldCamlDoc, camlWordListDesc);

View File

@ -456,4 +456,4 @@ static const char * const cmakeWordLists[] = {
0, 0,
0,}; 0,};
LexerModule lmCmake(SCLEX_CMAKE, ColouriseCmakeDoc, "cmake", FoldCmakeDoc, cmakeWordLists); extern const LexerModule lmCmake(SCLEX_CMAKE, ColouriseCmakeDoc, "cmake", FoldCmakeDoc, cmakeWordLists);

View File

@ -491,4 +491,4 @@ static const char *const csWordLists[] = {
0, 0,
}; };
LexerModule lmCoffeeScript(SCLEX_COFFEESCRIPT, ColouriseCoffeeScriptDoc, "coffeescript", FoldCoffeeScriptDoc, csWordLists); extern const LexerModule lmCoffeeScript(SCLEX_COFFEESCRIPT, ColouriseCoffeeScriptDoc, "coffeescript", FoldCoffeeScriptDoc, csWordLists);

View File

@ -190,4 +190,4 @@ static const char * const confWordListDesc[] = {
0 0
}; };
LexerModule lmConf(SCLEX_CONF, ColouriseConfDoc, "conf", 0, confWordListDesc); extern const LexerModule lmConf(SCLEX_CONF, ColouriseConfDoc, "conf", 0, confWordListDesc);

View File

@ -224,4 +224,4 @@ static const char * const cronWordListDesc[] = {
0 0
}; };
LexerModule lmNncrontab(SCLEX_NNCRONTAB, ColouriseNncrontabDoc, "nncrontab", 0, cronWordListDesc); extern const LexerModule lmNncrontab(SCLEX_NNCRONTAB, ColouriseNncrontabDoc, "nncrontab", 0, cronWordListDesc);

View File

@ -212,4 +212,4 @@ static const char * const csoundWordListDesc[] = {
0 0
}; };
LexerModule lmCsound(SCLEX_CSOUND, ColouriseCsoundDoc, "csound", FoldCsoundInstruments, csoundWordListDesc); extern const LexerModule lmCsound(SCLEX_CSOUND, ColouriseCsoundDoc, "csound", FoldCsoundInstruments, csoundWordListDesc);

View File

@ -568,4 +568,4 @@ void SCI_METHOD LexerD::Fold(Sci_PositionU startPos, Sci_Position length, int in
} }
} }
LexerModule lmD(SCLEX_D, LexerD::LexerFactoryD, "d", dWordLists); extern const LexerModule lmD(SCLEX_D, LexerD::LexerFactoryD, "d", dWordLists);

View File

@ -233,4 +233,4 @@ static const char * const DMAPWordLists[] = {
0, 0,
}; };
/***************************************/ /***************************************/
LexerModule lmDMAP(SCLEX_DMAP, ColouriseDMAPDoc, "DMAP", FoldDMAPDoc, DMAPWordLists); extern const LexerModule lmDMAP(SCLEX_DMAP, ColouriseDMAPDoc, "DMAP", FoldDMAPDoc, DMAPWordLists);

View File

@ -364,4 +364,4 @@ void SCI_METHOD LexerDMIS::Fold(Sci_PositionU startPos, Sci_Position lengthDoc,
} }
LexerModule lmDMIS(SCLEX_DMIS, LexerDMIS::LexerFactoryDMIS, "DMIS", DMISWordListDesc); extern const LexerModule lmDMIS(SCLEX_DMIS, LexerDMIS::LexerFactoryDMIS, "DMIS", DMISWordListDesc);

View File

@ -608,4 +608,4 @@ static const char * const dataflexWordListDesc[] = {
0 0
}; };
LexerModule lmDataflex(SCLEX_DATAFLEX, ColouriseDataFlexDoc, "dataflex", FoldDataFlexDoc, dataflexWordListDesc); extern const LexerModule lmDataflex(SCLEX_DATAFLEX, ColouriseDataFlexDoc, "dataflex", FoldDataFlexDoc, dataflexWordListDesc);

View File

@ -152,4 +152,4 @@ const char *const emptyWordListDesc[] = {
} }
LexerModule lmDiff(SCLEX_DIFF, ColouriseDiffDoc, "diff", FoldDiffDoc, emptyWordListDesc); extern const LexerModule lmDiff(SCLEX_DIFF, ColouriseDiffDoc, "diff", FoldDiffDoc, emptyWordListDesc);

View File

@ -513,7 +513,7 @@ static const char * const EclWordListDesc[] = {
0 0
}; };
LexerModule lmECL( extern const LexerModule lmECL(
SCLEX_ECL, SCLEX_ECL,
ColouriseEclDoc, ColouriseEclDoc,
"ecl", "ecl",

View File

@ -128,7 +128,7 @@ protected:
std::string m_lastPropertyValue; std::string m_lastPropertyValue;
}; };
LexerModule lmEDIFACT(SCLEX_EDIFACT, LexerEDIFACT::Factory, "edifact"); extern const LexerModule lmEDIFACT(SCLEX_EDIFACT, LexerEDIFACT::Factory, "edifact");
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////

View File

@ -274,4 +274,4 @@ static const char * const ESCRIPTWordLists[] = {
0, 0,
}; };
LexerModule lmESCRIPT(SCLEX_ESCRIPT, ColouriseESCRIPTDoc, "escript", FoldESCRIPTDoc, ESCRIPTWordLists); extern const LexerModule lmESCRIPT(SCLEX_ESCRIPT, ColouriseESCRIPTDoc, "escript", FoldESCRIPTDoc, ESCRIPTWordLists);

View File

@ -238,5 +238,5 @@ static const char * const eiffelWordListDesc[] = {
0 0
}; };
LexerModule lmEiffel(SCLEX_EIFFEL, ColouriseEiffelDoc, "eiffel", FoldEiffelDocIndent, eiffelWordListDesc); extern const LexerModule lmEiffel(SCLEX_EIFFEL, ColouriseEiffelDoc, "eiffel", FoldEiffelDocIndent, eiffelWordListDesc);
LexerModule lmEiffelkw(SCLEX_EIFFELKW, ColouriseEiffelDoc, "eiffelkw", FoldEiffelDocKeyWords, eiffelWordListDesc); extern const LexerModule lmEiffelkw(SCLEX_EIFFELKW, ColouriseEiffelDoc, "eiffelkw", FoldEiffelDocKeyWords, eiffelWordListDesc);

View File

@ -623,7 +623,7 @@ static const char * const erlangWordListDesc[] = {
0 0
}; };
LexerModule lmErlang( extern const LexerModule lmErlang(
SCLEX_ERLANG, SCLEX_ERLANG,
ColouriseErlangDoc, ColouriseErlangDoc,
"erlang", "erlang",

View File

@ -428,4 +428,4 @@ const char *const emptyWordListDesc[] = {
} }
LexerModule lmErrorList(SCLEX_ERRORLIST, ColouriseErrorListDoc, "errorlist", nullptr, emptyWordListDesc); extern const LexerModule lmErrorList(SCLEX_ERRORLIST, ColouriseErrorListDoc, "errorlist", nullptr, emptyWordListDesc);

View File

@ -766,4 +766,4 @@ void FoldLexicalGroup(LexAccessor &styler, int &levelNext, const Sci_Position li
} }
} // namespace } // namespace
LexerModule lmFSharp(SCLEX_FSHARP, LexerFSharp::LexerFactoryFSharp, "fsharp", fsharpWordLists); extern const LexerModule lmFSharp(SCLEX_FSHARP, LexerFSharp::LexerFactoryFSharp, "fsharp", fsharpWordLists);

View File

@ -352,4 +352,4 @@ static const char * const FSWordListDesc[] = {
0 0
}; };
LexerModule lmFlagShip(SCLEX_FLAGSHIP, ColouriseFlagShipDoc, "flagship", FoldFlagShipDoc, FSWordListDesc); extern const LexerModule lmFlagShip(SCLEX_FLAGSHIP, ColouriseFlagShipDoc, "flagship", FoldFlagShipDoc, FSWordListDesc);

View File

@ -166,6 +166,6 @@ static const char * const forthWordLists[] = {
0, 0,
}; };
LexerModule lmForth(SCLEX_FORTH, ColouriseForthDoc, "forth", FoldForthDoc, forthWordLists); extern const LexerModule lmForth(SCLEX_FORTH, ColouriseForthDoc, "forth", FoldForthDoc, forthWordLists);

View File

@ -720,5 +720,5 @@ static void FoldFortranDocFixFormat(Sci_PositionU startPos, Sci_Position length,
FoldFortranDoc(startPos, length, initStyle,styler, true); FoldFortranDoc(startPos, length, initStyle,styler, true);
} }
/***************************************/ /***************************************/
LexerModule lmFortran(SCLEX_FORTRAN, ColouriseFortranDocFreeFormat, "fortran", FoldFortranDocFreeFormat, FortranWordLists); extern const LexerModule lmFortran(SCLEX_FORTRAN, ColouriseFortranDocFreeFormat, "fortran", FoldFortranDocFreeFormat, FortranWordLists);
LexerModule lmF77(SCLEX_F77, ColouriseFortranDocFixFormat, "f77", FoldFortranDocFixFormat, FortranWordLists); extern const LexerModule lmF77(SCLEX_F77, ColouriseFortranDocFixFormat, "f77", FoldFortranDocFixFormat, FortranWordLists);

View File

@ -259,7 +259,7 @@ static const char * const GAPWordListDesc[] = {
0 0
}; };
LexerModule lmGAP( extern const LexerModule lmGAP(
SCLEX_GAP, SCLEX_GAP,
ColouriseGAPDoc, ColouriseGAPDoc,
"gap", "gap",

View File

@ -768,5 +768,5 @@ void SCI_METHOD LexerGDScript::Fold(Sci_PositionU startPos, Sci_Position length,
//styler.SetLevel(lineCurrent, indentCurrent); //styler.SetLevel(lineCurrent, indentCurrent);
} }
LexerModule lmGDScript(SCLEX_GDSCRIPT, LexerGDScript::LexerFactoryGDScript, "gdscript", extern const LexerModule lmGDScript(SCLEX_GDSCRIPT, LexerGDScript::LexerFactoryGDScript, "gdscript",
gdscriptWordListDesc); gdscriptWordListDesc);

View File

@ -309,7 +309,7 @@ static const char * const gui4cliWordListDesc[] = {
}; };
// Declare language & pass our function pointers to Scintilla // Declare language & pass our function pointers to Scintilla
LexerModule lmGui4Cli(SCLEX_GUI4CLI, ColouriseGui4CliDoc, "gui4cli", FoldGui4Cli, gui4cliWordListDesc); extern const LexerModule lmGui4Cli(SCLEX_GUI4CLI, ColouriseGui4CliDoc, "gui4cli", FoldGui4Cli, gui4cliWordListDesc);
#undef debug #undef debug

View File

@ -1042,12 +1042,12 @@ const char * const tagsThatDoNotFold[] = {
class LexerHTML : public DefaultLexer { class LexerHTML : public DefaultLexer {
bool isXml; bool isXml;
bool isPHPScript; bool isPHPScript;
WordList keywords; WordList keywordsHTML;
WordList keywords2; WordList keywordsJS;
WordList keywords3; WordList keywordsVB;
WordList keywords4; WordList keywordsPy;
WordList keywords5; WordList keywordsPHP;
WordList keywords6; // SGML (DTD) keywords WordList keywordsSGML; // SGML (DTD) keywords
OptionsHTML options; OptionsHTML options;
OptionSetHTML osHTML; OptionSetHTML osHTML;
std::set<std::string> nonFoldingTags; std::set<std::string> nonFoldingTags;
@ -1109,7 +1109,9 @@ public:
subStyles.Free(); subStyles.Free();
} }
void SCI_METHOD SetIdentifiers(int style, const char *identifiers) override { void SCI_METHOD SetIdentifiers(int style, const char *identifiers) override {
subStyles.SetIdentifiers(style, identifiers); const int styleBase = subStyles.BaseStyle(style);
const bool lowerCase = AnyOf(styleBase, SCE_H_TAG, SCE_H_ATTRIBUTE, SCE_HB_WORD);
subStyles.SetIdentifiers(style, identifiers, lowerCase);
} }
int SCI_METHOD DistanceToSecondaryStyles() override { int SCI_METHOD DistanceToSecondaryStyles() override {
return 0; return 0;
@ -1138,31 +1140,34 @@ Sci_Position SCI_METHOD LexerHTML::PropertySet(const char *key, const char *val)
Sci_Position SCI_METHOD LexerHTML::WordListSet(int n, const char *wl) { Sci_Position SCI_METHOD LexerHTML::WordListSet(int n, const char *wl) {
WordList *wordListN = nullptr; WordList *wordListN = nullptr;
bool lowerCase = false;
switch (n) { switch (n) {
case 0: case 0:
wordListN = &keywords; wordListN = &keywordsHTML;
lowerCase = true;
break; break;
case 1: case 1:
wordListN = &keywords2; wordListN = &keywordsJS;
break; break;
case 2: case 2:
wordListN = &keywords3; wordListN = &keywordsVB;
lowerCase = true;
break; break;
case 3: case 3:
wordListN = &keywords4; wordListN = &keywordsPy;
break; break;
case 4: case 4:
wordListN = &keywords5; wordListN = &keywordsPHP;
break; break;
case 5: case 5:
wordListN = &keywords6; wordListN = &keywordsSGML;
break; break;
default: default:
break; break;
} }
Sci_Position firstModification = -1; Sci_Position firstModification = -1;
if (wordListN) { if (wordListN) {
if (wordListN->Set(wl)) { if (wordListN->Set(wl, lowerCase)) {
firstModification = 0; firstModification = 0;
} }
} }
@ -1552,7 +1557,7 @@ void SCI_METHOD LexerHTML::Lex(Sci_PositionU startPos, Sci_Position length, int
if (ch != '%' && ch != '$' && ch != '/') { if (ch != '%' && ch != '$' && ch != '/') {
i += makoBlockType.length(); i += makoBlockType.length();
visibleChars += makoBlockType.length(); visibleChars += makoBlockType.length();
if (keywords4.InList(makoBlockType)) if (keywordsPy.InList(makoBlockType))
styler.ColourTo(i, SCE_HP_WORD); styler.ColourTo(i, SCE_HP_WORD);
else else
styler.ColourTo(i, SCE_H_TAGUNKNOWN); styler.ColourTo(i, SCE_H_TAGUNKNOWN);
@ -1705,7 +1710,7 @@ void SCI_METHOD LexerHTML::Lex(Sci_PositionU startPos, Sci_Position length, int
styler.GetStartSegment(), i - 1, aspScript); styler.GetStartSegment(), i - 1, aspScript);
} }
if (state == SCE_HP_WORD) { if (state == SCE_HP_WORD) {
classifyWordHTPy(styler.GetStartSegment(), i - 1, keywords4, classifierPython, styler, prevWord, inScriptType, isMako); classifyWordHTPy(styler.GetStartSegment(), i - 1, keywordsPy, classifierPython, styler, prevWord, inScriptType, isMako);
} else { } else {
styler.ColourTo(i - 1, StateToPrint); styler.ColourTo(i - 1, StateToPrint);
} }
@ -1738,7 +1743,7 @@ void SCI_METHOD LexerHTML::Lex(Sci_PositionU startPos, Sci_Position length, int
styler.GetStartSegment(), i - 1, aspScript); styler.GetStartSegment(), i - 1, aspScript);
} }
if (state == SCE_HP_WORD) { if (state == SCE_HP_WORD) {
classifyWordHTPy(styler.GetStartSegment(), i - 1, keywords4, classifierPython, styler, prevWord, inScriptType, isMako); classifyWordHTPy(styler.GetStartSegment(), i - 1, keywordsPy, classifierPython, styler, prevWord, inScriptType, isMako);
} else { } else {
styler.ColourTo(i - 1, StateToPrint); styler.ColourTo(i - 1, StateToPrint);
} }
@ -1766,16 +1771,16 @@ void SCI_METHOD LexerHTML::Lex(Sci_PositionU startPos, Sci_Position length, int
// Bounce out of any ASP mode // Bounce out of any ASP mode
switch (state) { switch (state) {
case SCE_HJ_WORD: case SCE_HJ_WORD:
classifyWordHTJS(styler.GetStartSegment(), i - 1, keywords2, classifierJavaScript, classifierJavaScriptServer, styler, inScriptType); classifyWordHTJS(styler.GetStartSegment(), i - 1, keywordsJS, classifierJavaScript, classifierJavaScriptServer, styler, inScriptType);
break; break;
case SCE_HB_WORD: case SCE_HB_WORD:
classifyWordHTVB(styler.GetStartSegment(), i - 1, keywords3, classifierBasic, styler, inScriptType); classifyWordHTVB(styler.GetStartSegment(), i - 1, keywordsVB, classifierBasic, styler, inScriptType);
break; break;
case SCE_HP_WORD: case SCE_HP_WORD:
classifyWordHTPy(styler.GetStartSegment(), i - 1, keywords4, classifierPython, styler, prevWord, inScriptType, isMako); classifyWordHTPy(styler.GetStartSegment(), i - 1, keywordsPy, classifierPython, styler, prevWord, inScriptType, isMako);
break; break;
case SCE_HPHP_WORD: case SCE_HPHP_WORD:
classifyWordHTPHP(styler.GetStartSegment(), i - 1, keywords5, classifierPHP, styler); classifyWordHTPHP(styler.GetStartSegment(), i - 1, keywordsPHP, classifierPHP, styler);
break; break;
case SCE_H_XCCOMMENT: case SCE_H_XCCOMMENT:
styler.ColourTo(i - 1, state); styler.ColourTo(i - 1, state);
@ -1881,7 +1886,7 @@ void SCI_METHOD LexerHTML::Lex(Sci_PositionU startPos, Sci_Position length, int
styler.ColourTo(i - 2, StateToPrint); styler.ColourTo(i - 2, StateToPrint);
state = SCE_H_SGML_COMMENT; state = SCE_H_SGML_COMMENT;
} else if (!issgmlwordchar(ch)) { } else if (!issgmlwordchar(ch)) {
if (isWordHSGML(styler.GetStartSegment(), i - 1, keywords6, styler)) { if (isWordHSGML(styler.GetStartSegment(), i - 1, keywordsSGML, styler)) {
styler.ColourTo(i - 1, StateToPrint); styler.ColourTo(i - 1, StateToPrint);
state = SCE_H_SGML_1ST_PARAM; state = SCE_H_SGML_1ST_PARAM;
} else { } else {
@ -2006,7 +2011,7 @@ void SCI_METHOD LexerHTML::Lex(Sci_PositionU startPos, Sci_Position length, int
case SCE_H_TAGUNKNOWN: case SCE_H_TAGUNKNOWN:
if (!setTagContinue.Contains(ch) && !((ch == '/') && (chPrev == '<'))) { if (!setTagContinue.Contains(ch) && !((ch == '/') && (chPrev == '<'))) {
int eClass = classifyTagHTML(styler.GetStartSegment(), int eClass = classifyTagHTML(styler.GetStartSegment(),
i - 1, keywords, classifierTags, styler, tagDontFold, caseSensitive, isXml, allowScripts, nonFoldingTags, lastTag); i - 1, keywordsHTML, classifierTags, styler, tagDontFold, caseSensitive, isXml, allowScripts, nonFoldingTags, lastTag);
if (eClass == SCE_H_SCRIPT || eClass == SCE_H_COMMENT) { if (eClass == SCE_H_SCRIPT || eClass == SCE_H_COMMENT) {
if (!tagClosing) { if (!tagClosing) {
inScriptType = eNonHtmlScript; inScriptType = eNonHtmlScript;
@ -2060,7 +2065,7 @@ void SCI_METHOD LexerHTML::Lex(Sci_PositionU startPos, Sci_Position length, int
break; break;
case SCE_H_ATTRIBUTE: case SCE_H_ATTRIBUTE:
if (!setAttributeContinue.Contains(ch)) { if (!setAttributeContinue.Contains(ch)) {
isLanguageType = classifyAttribHTML(inScriptType, styler.GetStartSegment(), i - 1, keywords, classifierAttributes, styler, lastTag); isLanguageType = classifyAttribHTML(inScriptType, styler.GetStartSegment(), i - 1, keywordsHTML, classifierAttributes, styler, lastTag);
if (ch == '>') { if (ch == '>') {
styler.ColourTo(i, SCE_H_TAG); styler.ColourTo(i, SCE_H_TAG);
if (inScriptType == eNonHtmlScript) { if (inScriptType == eNonHtmlScript) {
@ -2239,7 +2244,7 @@ void SCI_METHOD LexerHTML::Lex(Sci_PositionU startPos, Sci_Position length, int
break; break;
case SCE_HJ_WORD: case SCE_HJ_WORD:
if (!IsAWordChar(ch)) { if (!IsAWordChar(ch)) {
classifyWordHTJS(styler.GetStartSegment(), i - 1, keywords2, classifyWordHTJS(styler.GetStartSegment(), i - 1, keywordsJS,
classifierJavaScript, classifierJavaScriptServer, styler, inScriptType); classifierJavaScript, classifierJavaScriptServer, styler, inScriptType);
//styler.ColourTo(i - 1, eHTJSKeyword); //styler.ColourTo(i - 1, eHTJSKeyword);
state = SCE_HJ_DEFAULT; state = SCE_HJ_DEFAULT;
@ -2366,7 +2371,7 @@ void SCI_METHOD LexerHTML::Lex(Sci_PositionU startPos, Sci_Position length, int
break; break;
case SCE_HB_WORD: case SCE_HB_WORD:
if (!IsAWordChar(ch)) { if (!IsAWordChar(ch)) {
state = classifyWordHTVB(styler.GetStartSegment(), i - 1, keywords3, classifierBasic, styler, inScriptType); state = classifyWordHTVB(styler.GetStartSegment(), i - 1, keywordsVB, classifierBasic, styler, inScriptType);
if (state == SCE_HB_DEFAULT) { if (state == SCE_HB_DEFAULT) {
if (ch == '\"') { if (ch == '\"') {
state = SCE_HB_STRING; state = SCE_HB_STRING;
@ -2450,7 +2455,7 @@ void SCI_METHOD LexerHTML::Lex(Sci_PositionU startPos, Sci_Position length, int
break; break;
case SCE_HP_WORD: case SCE_HP_WORD:
if (!IsAWordChar(ch)) { if (!IsAWordChar(ch)) {
classifyWordHTPy(styler.GetStartSegment(), i - 1, keywords4, classifierPython, styler, prevWord, inScriptType, isMako); classifyWordHTPy(styler.GetStartSegment(), i - 1, keywordsPy, classifierPython, styler, prevWord, inScriptType, isMako);
state = SCE_HP_DEFAULT; state = SCE_HP_DEFAULT;
if (ch == '#') { if (ch == '#') {
state = SCE_HP_COMMENTLINE; state = SCE_HP_COMMENTLINE;
@ -2524,7 +2529,7 @@ void SCI_METHOD LexerHTML::Lex(Sci_PositionU startPos, Sci_Position length, int
///////////// start - PHP state handling ///////////// start - PHP state handling
case SCE_HPHP_WORD: case SCE_HPHP_WORD:
if (!IsPhpWordChar(ch)) { if (!IsPhpWordChar(ch)) {
classifyWordHTPHP(styler.GetStartSegment(), i - 1, keywords5, classifierPHP, styler); classifyWordHTPHP(styler.GetStartSegment(), i - 1, keywordsPHP, classifierPHP, styler);
if (ch == '/' && chNext == '*') { if (ch == '/' && chNext == '*') {
i++; i++;
state = SCE_HPHP_COMMENT; state = SCE_HPHP_COMMENT;
@ -2726,17 +2731,17 @@ void SCI_METHOD LexerHTML::Lex(Sci_PositionU startPos, Sci_Position length, int
switch (state) { switch (state) {
case SCE_HJ_WORD: case SCE_HJ_WORD:
classifyWordHTJS(styler.GetStartSegment(), lengthDoc - 1, keywords2, classifyWordHTJS(styler.GetStartSegment(), lengthDoc - 1, keywordsJS,
classifierJavaScript, classifierJavaScriptServer, styler, inScriptType); classifierJavaScript, classifierJavaScriptServer, styler, inScriptType);
break; break;
case SCE_HB_WORD: case SCE_HB_WORD:
classifyWordHTVB(styler.GetStartSegment(), lengthDoc - 1, keywords3, classifierBasic, styler, inScriptType); classifyWordHTVB(styler.GetStartSegment(), lengthDoc - 1, keywordsVB, classifierBasic, styler, inScriptType);
break; break;
case SCE_HP_WORD: case SCE_HP_WORD:
classifyWordHTPy(styler.GetStartSegment(), lengthDoc - 1, keywords4, classifierPython, styler, prevWord, inScriptType, isMako); classifyWordHTPy(styler.GetStartSegment(), lengthDoc - 1, keywordsPy, classifierPython, styler, prevWord, inScriptType, isMako);
break; break;
case SCE_HPHP_WORD: case SCE_HPHP_WORD:
classifyWordHTPHP(styler.GetStartSegment(), lengthDoc - 1, keywords5, classifierPHP, styler); classifyWordHTPHP(styler.GetStartSegment(), lengthDoc - 1, keywordsPHP, classifierPHP, styler);
break; break;
default: default:
StateToPrint = statePrintForState(state, inScriptType); StateToPrint = statePrintForState(state, inScriptType);
@ -2753,6 +2758,6 @@ void SCI_METHOD LexerHTML::Lex(Sci_PositionU startPos, Sci_Position length, int
styler.Flush(); styler.Flush();
} }
LexerModule lmHTML(SCLEX_HTML, LexerHTML::LexerFactoryHTML, "hypertext", htmlWordListDesc); extern const LexerModule lmHTML(SCLEX_HTML, LexerHTML::LexerFactoryHTML, "hypertext", htmlWordListDesc);
LexerModule lmXML(SCLEX_XML, LexerHTML::LexerFactoryXML, "xml", htmlWordListDesc); extern const LexerModule lmXML(SCLEX_XML, LexerHTML::LexerFactoryXML, "xml", htmlWordListDesc);
LexerModule lmPHPSCRIPT(SCLEX_PHPSCRIPT, LexerHTML::LexerFactoryPHPScript, "phpscript", phpscriptWordListDesc); extern const LexerModule lmPHPSCRIPT(SCLEX_PHPSCRIPT, LexerHTML::LexerFactoryPHPScript, "phpscript", phpscriptWordListDesc);

View File

@ -1115,5 +1115,5 @@ void SCI_METHOD LexerHaskell::Fold(Sci_PositionU startPos, Sci_Position length,
//styler.SetLevel(lineCurrent, indentCurrent); //styler.SetLevel(lineCurrent, indentCurrent);
} }
LexerModule lmHaskell(SCLEX_HASKELL, LexerHaskell::LexerFactoryHaskell, "haskell", haskellWordListDesc); extern const LexerModule lmHaskell(SCLEX_HASKELL, LexerHaskell::LexerFactoryHaskell, "haskell", haskellWordListDesc);
LexerModule lmLiterateHaskell(SCLEX_LITERATEHASKELL, LexerHaskell::LexerFactoryLiterateHaskell, "literatehaskell", haskellWordListDesc); extern const LexerModule lmLiterateHaskell(SCLEX_LITERATEHASKELL, LexerHaskell::LexerFactoryLiterateHaskell, "literatehaskell", haskellWordListDesc);

View File

@ -1043,6 +1043,6 @@ static void ColouriseTEHexDoc(Sci_PositionU startPos, Sci_Position length, int i
sc.Complete(); sc.Complete();
} }
LexerModule lmSrec(SCLEX_SREC, ColouriseSrecDoc, "srec", 0, NULL); extern const LexerModule lmSrec(SCLEX_SREC, ColouriseSrecDoc, "srec", 0, NULL);
LexerModule lmIHex(SCLEX_IHEX, ColouriseIHexDoc, "ihex", FoldIHexDoc, NULL); extern const LexerModule lmIHex(SCLEX_IHEX, ColouriseIHexDoc, "ihex", FoldIHexDoc, NULL);
LexerModule lmTEHex(SCLEX_TEHEX, ColouriseTEHexDoc, "tehex", 0, NULL); extern const LexerModule lmTEHex(SCLEX_TEHEX, ColouriseTEHexDoc, "tehex", 0, NULL);

View File

@ -516,4 +516,4 @@ void SCI_METHOD LexerHollywood::Fold(Sci_PositionU startPos, Sci_Position length
styler.SetLevel(lineCurrent, levelPrev | flagsNext); styler.SetLevel(lineCurrent, levelPrev | flagsNext);
} }
LexerModule lmHollywood(SCLEX_HOLLYWOOD, LexerHollywood::LexerFactoryHollywood, "hollywood", hollywoodWordListDesc); extern const LexerModule lmHollywood(SCLEX_HOLLYWOOD, LexerHollywood::LexerFactoryHollywood, "hollywood", hollywoodWordListDesc);

View File

@ -71,4 +71,4 @@ static void FoldIndentDoc(Sci_PositionU startPos, Sci_Position length, int /* in
} }
} }
LexerModule lmIndent(SCLEX_INDENT, ColouriseIndentDoc, "indent", FoldIndentDoc); extern const LexerModule lmIndent(SCLEX_INDENT, ColouriseIndentDoc, "indent", FoldIndentDoc);

View File

@ -375,4 +375,4 @@ static void FoldInnoDoc(Sci_PositionU startPos, Sci_Position length, int, WordLi
} }
} }
LexerModule lmInno(SCLEX_INNOSETUP, ColouriseInnoDoc, "inno", FoldInnoDoc, innoWordListDesc); extern const LexerModule lmInno(SCLEX_INNOSETUP, ColouriseInnoDoc, "inno", FoldInnoDoc, innoWordListDesc);

View File

@ -35,7 +35,9 @@
using namespace Scintilla; using namespace Scintilla;
using namespace Lexilla; using namespace Lexilla;
static const char *const JSONWordListDesc[] = { namespace {
const char *const JSONWordListDesc[] = {
"JSON Keywords", "JSON Keywords",
"JSON-LD Keywords", "JSON-LD Keywords",
0 0
@ -497,7 +499,9 @@ void SCI_METHOD LexerJSON::Fold(Sci_PositionU startPos,
} }
} }
LexerModule lmJSON(SCLEX_JSON, }
extern const LexerModule lmJSON(SCLEX_JSON,
LexerJSON::LexerFactoryJSON, LexerJSON::LexerFactoryJSON,
"json", "json",
JSONWordListDesc); JSONWordListDesc);

View File

@ -1259,4 +1259,4 @@ void SCI_METHOD LexerJulia::Fold(Sci_PositionU startPos, Sci_Position length, in
} }
} }
LexerModule lmJulia(SCLEX_JULIA, LexerJulia::LexerFactoryJulia, "julia", juliaWordLists); extern const LexerModule lmJulia(SCLEX_JULIA, LexerJulia::LexerFactoryJulia, "julia", juliaWordLists);

View File

@ -470,5 +470,5 @@ static const char *const kvircWordListDesc[] = {
/* Registering functions and wordlists */ /* Registering functions and wordlists */
LexerModule lmKVIrc(SCLEX_KVIRC, ColouriseKVIrcDoc, "kvirc", FoldKVIrcDoc, extern const LexerModule lmKVIrc(SCLEX_KVIRC, ColouriseKVIrcDoc, "kvirc", FoldKVIrcDoc,
kvircWordListDesc); kvircWordListDesc);

View File

@ -133,5 +133,5 @@ static void ColouriseKixDoc(Sci_PositionU startPos, Sci_Position length, int ini
} }
LexerModule lmKix(SCLEX_KIX, ColouriseKixDoc, "kix"); extern const LexerModule lmKix(SCLEX_KIX, ColouriseKixDoc, "kix");

View File

@ -560,4 +560,4 @@ static const char *const emptyWordListDesc[] = {
0 0
}; };
LexerModule lmLatex(SCLEX_LATEX, LexerLaTeX::LexerFactoryLaTeX, "latex", emptyWordListDesc); extern const LexerModule lmLatex(SCLEX_LATEX, LexerLaTeX::LexerFactoryLaTeX, "latex", emptyWordListDesc);

View File

@ -283,4 +283,4 @@ static const char * const lispWordListDesc[] = {
0 0
}; };
LexerModule lmLISP(SCLEX_LISP, ColouriseLispDoc, "lisp", FoldLispDoc, lispWordListDesc); extern const LexerModule lmLISP(SCLEX_LISP, ColouriseLispDoc, "lisp", FoldLispDoc, lispWordListDesc);

View File

@ -213,4 +213,4 @@ static const char * const loutWordLists[] = {
0, 0,
}; };
LexerModule lmLout(SCLEX_LOUT, ColouriseLoutDoc, "lout", FoldLoutDoc, loutWordLists); extern const LexerModule lmLout(SCLEX_LOUT, ColouriseLoutDoc, "lout", FoldLoutDoc, loutWordLists);

View File

@ -643,4 +643,4 @@ void LexerLua::Fold(Sci_PositionU startPos_, Sci_Position length, int initStyle,
} }
LexerModule lmLua(SCLEX_LUA, LexerLua::LexerFactoryLua, "lua", luaWordListDesc); extern const LexerModule lmLua(SCLEX_LUA, LexerLua::LexerFactoryLua, "lua", luaWordListDesc);

View File

@ -182,5 +182,5 @@ static const char * const MMIXALWordListDesc[] = {
0 0
}; };
LexerModule lmMMIXAL(SCLEX_MMIXAL, ColouriseMMIXALDoc, "mmixal", 0, MMIXALWordListDesc); extern const LexerModule lmMMIXAL(SCLEX_MMIXAL, ColouriseMMIXALDoc, "mmixal", 0, MMIXALWordListDesc);

View File

@ -189,4 +189,4 @@ static const char * const emptyWordListDesc[] = {
0 0
}; };
LexerModule lmLot(SCLEX_LOT, ColourizeLotDoc, "lot", FoldLotDoc, emptyWordListDesc); extern const LexerModule lmLot(SCLEX_LOT, ColourizeLotDoc, "lot", FoldLotDoc, emptyWordListDesc);

View File

@ -367,4 +367,4 @@ static const char * const sqlWordListDesc[] = {
0, 0,
}; };
LexerModule lmMSSQL(SCLEX_MSSQL, ColouriseMSSQLDoc, "mssql", FoldMSSQLDoc, sqlWordListDesc); extern const LexerModule lmMSSQL(SCLEX_MSSQL, ColouriseMSSQLDoc, "mssql", FoldMSSQLDoc, sqlWordListDesc);

View File

@ -444,6 +444,6 @@ static void FoldMagikDoc(Sci_PositionU startPos, Sci_Position length, int,
/** /**
* Injecting the module * Injecting the module
*/ */
LexerModule lmMagikSF( extern const LexerModule lmMagikSF(
SCLEX_MAGIK, ColouriseMagikDoc, "magiksf", FoldMagikDoc, magikWordListDesc); SCLEX_MAGIK, ColouriseMagikDoc, "magiksf", FoldMagikDoc, magikWordListDesc);

View File

@ -140,4 +140,4 @@ static const char *const emptyWordListDesc[] = {
nullptr nullptr
}; };
LexerModule lmMake(SCLEX_MAKEFILE, ColouriseMakeDoc, "makefile", nullptr, emptyWordListDesc); extern const LexerModule lmMake(SCLEX_MAKEFILE, ColouriseMakeDoc, "makefile", nullptr, emptyWordListDesc);

View File

@ -483,4 +483,4 @@ static void ColorizeMarkdownDoc(Sci_PositionU startPos, Sci_Position length, int
sc.Complete(); sc.Complete();
} }
LexerModule lmMarkdown(SCLEX_MARKDOWN, ColorizeMarkdownDoc, "markdown"); extern const LexerModule lmMarkdown(SCLEX_MARKDOWN, ColorizeMarkdownDoc, "markdown");

View File

@ -523,6 +523,6 @@ static const char * const octaveWordListDesc[] = {
0 0
}; };
LexerModule lmMatlab(SCLEX_MATLAB, ColouriseMatlabDoc, "matlab", FoldMatlabDoc, matlabWordListDesc); extern const LexerModule lmMatlab(SCLEX_MATLAB, ColouriseMatlabDoc, "matlab", FoldMatlabDoc, matlabWordListDesc);
LexerModule lmOctave(SCLEX_OCTAVE, ColouriseOctaveDoc, "octave", FoldOctaveDoc, octaveWordListDesc); extern const LexerModule lmOctave(SCLEX_OCTAVE, ColouriseOctaveDoc, "octave", FoldOctaveDoc, octaveWordListDesc);

View File

@ -222,4 +222,4 @@ static void ColouriseMaximaDoc(Sci_PositionU startPos, Sci_Position length, int
} }
} }
LexerModule lmMaxima(SCLEX_MAXIMA, ColouriseMaximaDoc, "maxima", 0, 0); extern const LexerModule lmMaxima(SCLEX_MAXIMA, ColouriseMaximaDoc, "maxima", 0, 0);

View File

@ -401,4 +401,4 @@ static void FoldMetapostDoc(Sci_PositionU startPos, Sci_Position length, int, Wo
} }
LexerModule lmMETAPOST(SCLEX_METAPOST, ColouriseMETAPOSTDoc, "metapost", FoldMetapostDoc, metapostWordListDesc); extern const LexerModule lmMETAPOST(SCLEX_METAPOST, ColouriseMETAPOSTDoc, "metapost", FoldMetapostDoc, metapostWordListDesc);

View File

@ -742,5 +742,5 @@ static const char *const modulaWordListDesc[] =
0 0
}; };
LexerModule lmModula( SCLEX_MODULA, ColouriseModulaDoc, "modula", FoldModulaDoc, extern const LexerModule lmModula( SCLEX_MODULA, ColouriseModulaDoc, "modula", FoldModulaDoc,
modulaWordListDesc); modulaWordListDesc);

View File

@ -574,4 +574,4 @@ static const char * const mysqlWordListDesc[] = {
0 0
}; };
LexerModule lmMySQL(SCLEX_MYSQL, ColouriseMySQLDoc, "mysql", FoldMySQLDoc, mysqlWordListDesc); extern const LexerModule lmMySQL(SCLEX_MYSQL, ColouriseMySQLDoc, "mysql", FoldMySQLDoc, mysqlWordListDesc);

View File

@ -811,4 +811,4 @@ void SCI_METHOD LexerNim::Fold(Sci_PositionU startPos, Sci_Position length, int,
} }
} }
LexerModule lmNim(SCLEX_NIM, LexerNim::LexerFactoryNim, "nim", nimWordListDesc); extern const LexerModule lmNim(SCLEX_NIM, LexerNim::LexerFactoryNim, "nim", nimWordListDesc);

View File

@ -431,5 +431,5 @@ static const char * const nimrodWordListDesc[] = {
0 0
}; };
LexerModule lmNimrod(SCLEX_NIMROD, ColouriseNimrodDoc, "nimrod", FoldNimrodDoc, extern const LexerModule lmNimrod(SCLEX_NIMROD, ColouriseNimrodDoc, "nimrod", FoldNimrodDoc,
nimrodWordListDesc); nimrodWordListDesc);

View File

@ -663,5 +663,5 @@ static const char * const nsisWordLists[] = {
0, }; 0, };
LexerModule lmNsis(SCLEX_NSIS, ColouriseNsisDoc, "nsis", FoldNsisDoc, nsisWordLists); extern const LexerModule lmNsis(SCLEX_NSIS, ColouriseNsisDoc, "nsis", FoldNsisDoc, nsisWordLists);

View File

@ -38,4 +38,4 @@ static void ColouriseNullDoc(Sci_PositionU startPos, Sci_Position length, int, W
} }
} }
LexerModule lmNull(SCLEX_NULL, ColouriseNullDoc, "null"); extern const LexerModule lmNull(SCLEX_NULL, ColouriseNullDoc, "null");

View File

@ -546,4 +546,4 @@ static const char * const oscriptWordListDesc[] = {
0 0
}; };
LexerModule lmOScript(SCLEX_OSCRIPT, ColouriseOScriptDoc, "oscript", FoldOScriptDoc, oscriptWordListDesc); extern const LexerModule lmOScript(SCLEX_OSCRIPT, ColouriseOScriptDoc, "oscript", FoldOScriptDoc, oscriptWordListDesc);

View File

@ -595,4 +595,4 @@ static void ColouriseObjCDocSensitive(Sci_PositionU startPos, Sci_Position lengt
ColouriseObjCDoc(startPos, length, initStyle, keywordlists, styler, true); ColouriseObjCDoc(startPos, length, initStyle, keywordlists, styler, true);
} }
LexerModule lmObjC(SCLEX_OBJC, ColouriseObjCDocSensitive, "objc", FoldObjCDoc, cppWordLists); extern const LexerModule lmObjC(SCLEX_OBJC, ColouriseObjCDocSensitive, "objc", FoldObjCDoc, cppWordLists);

View File

@ -523,4 +523,4 @@ static const char * const opalWordListDesc[] = {
0 0
}; };
LexerModule lmOpal(SCLEX_OPAL, ColouriseOpalDoc, "opal", NULL, opalWordListDesc); extern const LexerModule lmOpal(SCLEX_OPAL, ColouriseOpalDoc, "opal", NULL, opalWordListDesc);

View File

@ -363,4 +363,4 @@ static const char * const pbWordListDesc[] = {
0 0
}; };
LexerModule lmPB(SCLEX_POWERBASIC, ColourisePBDoc, "powerbasic", FoldPBDoc, pbWordListDesc); extern const LexerModule lmPB(SCLEX_POWERBASIC, ColourisePBDoc, "powerbasic", FoldPBDoc, pbWordListDesc);

View File

@ -200,4 +200,4 @@ static const char *const plmWordListDesc[] = {
0 0
}; };
LexerModule lmPLM(SCLEX_PLM, ColourisePlmDoc, "PL/M", FoldPlmDoc, plmWordListDesc); extern const LexerModule lmPLM(SCLEX_PLM, ColourisePlmDoc, "PL/M", FoldPlmDoc, plmWordListDesc);

View File

@ -211,4 +211,4 @@ static const char *const poWordListDesc[] = {
0 0
}; };
LexerModule lmPO(SCLEX_PO, ColourisePODoc, "po", FoldPODoc, poWordListDesc); extern const LexerModule lmPO(SCLEX_PO, ColourisePODoc, "po", FoldPODoc, poWordListDesc);

View File

@ -317,4 +317,4 @@ static const char * const povWordLists[] = {
0, 0,
}; };
LexerModule lmPOV(SCLEX_POV, ColourisePovDoc, "pov", FoldPovDoc, povWordLists); extern const LexerModule lmPOV(SCLEX_POV, ColourisePovDoc, "pov", FoldPovDoc, povWordLists);

View File

@ -333,4 +333,4 @@ static const char * const psWordListDesc[] = {
0 0
}; };
LexerModule lmPS(SCLEX_PS, ColourisePSDoc, "ps", FoldPSDoc, psWordListDesc); extern const LexerModule lmPS(SCLEX_PS, ColourisePSDoc, "ps", FoldPSDoc, psWordListDesc);

View File

@ -613,4 +613,4 @@ static const char * const pascalWordListDesc[] = {
0 0
}; };
LexerModule lmPascal(SCLEX_PASCAL, ColourisePascalDoc, "pascal", FoldPascalDoc, pascalWordListDesc); extern const LexerModule lmPascal(SCLEX_PASCAL, ColourisePascalDoc, "pascal", FoldPascalDoc, pascalWordListDesc);

View File

@ -1898,4 +1898,4 @@ void SCI_METHOD LexerPerl::Fold(Sci_PositionU startPos, Sci_Position length, int
} }
LexerModule lmPerl(SCLEX_PERL, LexerPerl::LexerFactoryPerl, "perl", perlWordListDesc); extern const LexerModule lmPerl(SCLEX_PERL, LexerPerl::LexerFactoryPerl, "perl", perlWordListDesc);

View File

@ -626,6 +626,6 @@ static void ColourisePowerProDocWrapper(Sci_PositionU startPos, Sci_Position len
ColourisePowerProDoc(startPos, length, initStyle, keywordlists, styler, false); ColourisePowerProDoc(startPos, length, initStyle, keywordlists, styler, false);
} }
LexerModule lmPowerPro(SCLEX_POWERPRO, ColourisePowerProDocWrapper, "powerpro", FoldPowerProDoc, powerProWordLists); extern const LexerModule lmPowerPro(SCLEX_POWERPRO, ColourisePowerProDocWrapper, "powerpro", FoldPowerProDoc, powerProWordLists);

View File

@ -290,5 +290,5 @@ static const char *const powershellWordLists[] = {
0 0
}; };
LexerModule lmPowerShell(SCLEX_POWERSHELL, ColourisePowerShellDoc, "powershell", FoldPowerShellDoc, powershellWordLists); extern const LexerModule lmPowerShell(SCLEX_POWERSHELL, ColourisePowerShellDoc, "powershell", FoldPowerShellDoc, powershellWordLists);

View File

@ -48,12 +48,6 @@ using namespace Lexilla;
namespace { namespace {
// Use an unnamed namespace to protect the functions and classes from name conflicts // Use an unnamed namespace to protect the functions and classes from name conflicts
bool IsSpaceEquiv(int state) {
return (state == SCE_ABL_COMMENT ||
state == SCE_ABL_LINECOMMENT ||
state == SCE_ABL_DEFAULT);
}
void highlightTaskMarker(StyleContext &sc, LexAccessor &styler, WordList &markerList){ void highlightTaskMarker(StyleContext &sc, LexAccessor &styler, WordList &markerList){
if ((isoperator(sc.chPrev) || IsASpace(sc.chPrev)) && markerList.Length()) { if ((isoperator(sc.chPrev) || IsASpace(sc.chPrev)) && markerList.Length()) {
const int lengthMarker = 50; const int lengthMarker = 50;
@ -221,19 +215,11 @@ Sci_Position SCI_METHOD LexerABL::WordListSet(int n, const char *wl) {
return firstModification; return firstModification;
} }
#if defined(__clang__)
#if __has_warning("-Wunused-but-set-variable")
// Disable warning for visibleChars
#pragma clang diagnostic ignored "-Wunused-but-set-variable"
#endif
#endif
void SCI_METHOD LexerABL::Lex(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess) { void SCI_METHOD LexerABL::Lex(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess) {
LexAccessor styler(pAccess); LexAccessor styler(pAccess);
setWordStart = CharacterSet(CharacterSet::setAlpha, "_", 0x80, true); setWordStart = CharacterSet(CharacterSet::setAlpha, "_", 0x80, true);
int visibleChars = 0;
int visibleChars1 = 0; int visibleChars1 = 0;
int styleBeforeTaskMarker = SCE_ABL_DEFAULT; int styleBeforeTaskMarker = SCE_ABL_DEFAULT;
bool continuationLine = false; bool continuationLine = false;
@ -252,10 +238,15 @@ void SCI_METHOD LexerABL::Lex(Sci_PositionU startPos, Sci_Position length, int i
} }
} }
// Initialize the block comment /* */ nesting level if lexing is starting inside
// a block comment.
if (initStyle == SCE_ABL_COMMENT && lineCurrent > 0) {
commentNestingLevel = styler.GetLineState(lineCurrent - 1);
}
// Look back to set variables that are actually invisible secondary states. The reason to avoid formal states is to cut down on state's bits // Look back to set variables that are actually invisible secondary states. The reason to avoid formal states is to cut down on state's bits
if (startPos > 0) { if (startPos > 0) {
Sci_Position back = startPos; Sci_Position back = startPos;
bool checkCommentNestingLevel = (initStyle == SCE_ABL_COMMENT);
bool checkIsSentenceStart = (initStyle == SCE_ABL_DEFAULT || initStyle == SCE_ABL_IDENTIFIER); bool checkIsSentenceStart = (initStyle == SCE_ABL_DEFAULT || initStyle == SCE_ABL_IDENTIFIER);
char ch; char ch;
char st; char st;
@ -264,14 +255,14 @@ void SCI_METHOD LexerABL::Lex(Sci_PositionU startPos, Sci_Position length, int i
char chPrev_2; char chPrev_2;
char chPrev_3; char chPrev_3;
while (back >= 0 && (checkCommentNestingLevel || checkIsSentenceStart)) { while (back >= 0 && checkIsSentenceStart) {
ch = styler.SafeGetCharAt(back); ch = styler.SafeGetCharAt(back);
styler.Flush(); // looking at styles so need to flush styler.Flush(); // looking at styles so need to flush
st = styler.StyleAt(back); st = styler.StyleAt(back);
chPrev = styler.SafeGetCharAt(back-1); chPrev = styler.SafeGetCharAt(back-1);
// isSentenceStart is a non-visible state, used to identify where statements and preprocessor declerations can start // isSentenceStart is a non-visible state, used to identify where statements and preprocessor declerations can start
if (checkIsSentenceStart && st != SCE_ABL_COMMENT && st != SCE_ABL_LINECOMMENT && st != SCE_ABL_CHARACTER && st != SCE_ABL_STRING ) { if (st != SCE_ABL_COMMENT && st != SCE_ABL_LINECOMMENT && st != SCE_ABL_CHARACTER && st != SCE_ABL_STRING ) {
chPrev_1 = styler.SafeGetCharAt(back-2); chPrev_1 = styler.SafeGetCharAt(back-2);
chPrev_2 = styler.SafeGetCharAt(back-3); chPrev_2 = styler.SafeGetCharAt(back-3);
chPrev_3 = styler.SafeGetCharAt(back-4); chPrev_3 = styler.SafeGetCharAt(back-4);
@ -288,20 +279,6 @@ void SCI_METHOD LexerABL::Lex(Sci_PositionU startPos, Sci_Position length, int i
isSentenceStart = false; isSentenceStart = false;
} }
} }
// commentNestingLevel is a non-visible state, used to identify the nesting level of a comment
if (checkCommentNestingLevel) {
if (chPrev == '/' && ch == '*') {
commentNestingLevel++;
// eat the '/' so we don't miscount a */ if we see /*/*
--back;
}
if (chPrev == '*' && ch == '/') {
commentNestingLevel--;
// eat the '*' so we don't miscount a /* if we see */*/
--back;
}
}
--back; --back;
} }
} }
@ -310,14 +287,26 @@ void SCI_METHOD LexerABL::Lex(Sci_PositionU startPos, Sci_Position length, int i
Sci_Position lineEndNext = styler.LineEnd(lineCurrent); Sci_Position lineEndNext = styler.LineEnd(lineCurrent);
for (; sc.More();) { for (; sc.More();) {
if (sc.atLineStart) { if (sc.atLineStart) {
visibleChars = 0;
visibleChars1 = 0; visibleChars1 = 0;
} }
if (sc.atLineEnd) { if (sc.atLineEnd) {
lineCurrent++; // Update the line state, so it can be seen by next line
lineEndNext = styler.LineEnd(lineCurrent); if (sc.state == SCE_ABL_COMMENT) {
// Inside a block comment; store the nesting level
styler.SetLineState(lineCurrent, commentNestingLevel);
}
else {
// Not inside a block comment; nesting level is 0
styler.SetLineState(lineCurrent, 0);
}
lineCurrent++;
lineEndNext = styler.LineEnd(lineCurrent);
} }
// Handle line continuation generically. // Handle line continuation generically.
if (sc.ch == '~') { if (sc.ch == '~') {
if (static_cast<Sci_Position>((sc.currentPos+1)) >= lineEndNext) { if (static_cast<Sci_Position>((sc.currentPos+1)) >= lineEndNext) {
@ -494,9 +483,6 @@ void SCI_METHOD LexerABL::Lex(Sci_PositionU startPos, Sci_Position length, int i
if (!IsASpace(sc.ch)) { if (!IsASpace(sc.ch)) {
visibleChars1++; visibleChars1++;
} }
if (!IsASpace(sc.ch) && !IsSpaceEquiv(sc.state)) {
visibleChars++;
}
continuationLine = false; continuationLine = false;
sc.Forward(); sc.Forward();
} }
@ -575,4 +561,4 @@ void SCI_METHOD LexerABL::Fold(Sci_PositionU startPos, Sci_Position length, int
} }
} }
LexerModule lmProgress(SCLEX_PROGRESS, LexerABL::LexerFactoryABL, "abl", ablWordLists); extern const LexerModule lmProgress(SCLEX_PROGRESS, LexerABL::LexerFactoryABL, "abl", ablWordLists);

View File

@ -170,4 +170,4 @@ const char *const emptyWordListDesc[] = {
} }
LexerModule lmProps(SCLEX_PROPERTIES, ColourisePropsDoc, "props", FoldPropsDoc, emptyWordListDesc); extern const LexerModule lmProps(SCLEX_PROPERTIES, ColourisePropsDoc, "props", FoldPropsDoc, emptyWordListDesc);

View File

@ -1086,5 +1086,5 @@ void SCI_METHOD LexerPython::Fold(Sci_PositionU startPos, Sci_Position length, i
} }
LexerModule lmPython(SCLEX_PYTHON, LexerPython::LexerFactoryPython, "python", extern const LexerModule lmPython(SCLEX_PYTHON, LexerPython::LexerFactoryPython, "python",
pythonWordListDesc); pythonWordListDesc);

View File

@ -347,4 +347,4 @@ const char * const RWordLists[] = {
} }
LexerModule lmR(SCLEX_R, ColouriseRDoc, "r", FoldRDoc, RWordLists); extern const LexerModule lmR(SCLEX_R, ColouriseRDoc, "r", FoldRDoc, RWordLists);

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