fix build under newer KConfig by bump cmake min version

This commit is contained in:
Gary Wang 2024-09-04 19:01:58 +08:00
parent 727a2ec214
commit 9fb3681e3a
No known key found for this signature in database
GPG Key ID: 5D30A4F15EA78760
1022 changed files with 4414 additions and 1375 deletions

View File

@ -1,65 +0,0 @@
// Scintilla source code edit control
/** @file LexerNoExceptions.cxx
** A simple lexer with no state which does not throw exceptions so can be used in an external lexer.
**/
// Copyright 1998-2010 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
#include <cstdlib>
#include <cassert>
#include <string>
#include <string_view>
#include "ILexer.h"
#include "Scintilla.h"
#include "SciLexer.h"
#include "PropSetSimple.h"
#include "WordList.h"
#include "LexAccessor.h"
#include "Accessor.h"
#include "LexerModule.h"
#include "LexerBase.h"
#include "LexerNoExceptions.h"
using namespace Lexilla;
Sci_Position SCI_METHOD LexerNoExceptions::PropertySet(const char *key, const char *val) {
try {
return LexerBase::PropertySet(key, val);
} catch (...) {
// Should not throw into caller as may be compiled with different compiler or options
}
return -1;
}
Sci_Position SCI_METHOD LexerNoExceptions::WordListSet(int n, const char *wl) {
try {
return LexerBase::WordListSet(n, wl);
} catch (...) {
// Should not throw into caller as may be compiled with different compiler or options
}
return -1;
}
void SCI_METHOD LexerNoExceptions::Lex(Sci_PositionU startPos, Sci_Position lengthDoc, int initStyle, Scintilla::IDocument *pAccess) {
try {
Accessor astyler(pAccess, &props);
Lexer(startPos, lengthDoc, initStyle, pAccess, astyler);
astyler.Flush();
} catch (...) {
// Should not throw into caller as may be compiled with different compiler or options
pAccess->SetErrorStatus(SC_STATUS_FAILURE);
}
}
void SCI_METHOD LexerNoExceptions::Fold(Sci_PositionU startPos, Sci_Position lengthDoc, int initStyle, Scintilla::IDocument *pAccess) {
try {
Accessor astyler(pAccess, &props);
Folder(startPos, lengthDoc, initStyle, pAccess, astyler);
astyler.Flush();
} catch (...) {
// Should not throw into caller as may be compiled with different compiler or options
pAccess->SetErrorStatus(SC_STATUS_FAILURE);
}
}

View File

@ -1,28 +0,0 @@
// Scintilla source code edit control
/** @file LexerNoExceptions.h
** A simple lexer with no state.
**/
// Copyright 1998-2010 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
#ifndef LEXERNOEXCEPTIONS_H
#define LEXERNOEXCEPTIONS_H
namespace Lexilla {
// A simple lexer with no state
class LexerNoExceptions : public LexerBase {
public:
// TODO Also need to prevent exceptions in constructor and destructor
Sci_Position SCI_METHOD PropertySet(const char *key, const char *val) override;
Sci_Position SCI_METHOD WordListSet(int n, const char *wl) override;
void SCI_METHOD Lex(Sci_PositionU startPos, Sci_Position lengthDoc, int initStyle, Scintilla::IDocument *pAccess) override;
void SCI_METHOD Fold(Sci_PositionU startPos, Sci_Position lengthDoc, int initStyle, Scintilla::IDocument *) override;
virtual void Lexer(Sci_PositionU startPos, Sci_Position length, int initStyle, Scintilla::IDocument *pAccess, Accessor &styler) = 0;
virtual void Folder(Sci_PositionU startPos, Sci_Position length, int initStyle, Scintilla::IDocument *pAccess, Accessor &styler) = 0;
};
}
#endif

View File

@ -1,379 +0,0 @@
// Lexilla lexer library
/** @file Lexilla.cxx
** Lexer infrastructure.
** Provides entry points to shared library.
**/
// Copyright 2019 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
#include <cstring>
#include <vector>
#include <initializer_list>
#if defined(_WIN32)
#define EXPORT_FUNCTION __declspec(dllexport)
#define CALLING_CONVENTION __stdcall
#else
#define EXPORT_FUNCTION __attribute__((visibility("default")))
#define CALLING_CONVENTION
#endif
#include "ILexer.h"
#include "LexerModule.h"
#include "CatalogueModules.h"
using namespace Lexilla;
//++Autogenerated -- run lexilla/scripts/LexillaGen.py to regenerate
//**\(extern LexerModule \*;\n\)
extern LexerModule lmA68k;
extern LexerModule lmAbaqus;
extern LexerModule lmAda;
extern LexerModule lmAPDL;
extern LexerModule lmAs;
extern LexerModule lmAsciidoc;
extern LexerModule lmAsm;
extern LexerModule lmAsn1;
extern LexerModule lmASY;
extern LexerModule lmAU3;
extern LexerModule lmAVE;
extern LexerModule lmAVS;
extern LexerModule lmBaan;
extern LexerModule lmBash;
extern LexerModule lmBatch;
extern LexerModule lmBibTeX;
extern LexerModule lmBlitzBasic;
extern LexerModule lmBullant;
extern LexerModule lmCaml;
extern LexerModule lmCIL;
extern LexerModule lmClw;
extern LexerModule lmClwNoCase;
extern LexerModule lmCmake;
extern LexerModule lmCOBOL;
extern LexerModule lmCoffeeScript;
extern LexerModule lmConf;
extern LexerModule lmCPP;
extern LexerModule lmCPPNoCase;
extern LexerModule lmCsound;
extern LexerModule lmCss;
extern LexerModule lmD;
extern LexerModule lmDataflex;
extern LexerModule lmDiff;
extern LexerModule lmDMAP;
extern LexerModule lmDMIS;
extern LexerModule lmECL;
extern LexerModule lmEDIFACT;
extern LexerModule lmEiffel;
extern LexerModule lmEiffelkw;
extern LexerModule lmErlang;
extern LexerModule lmErrorList;
extern LexerModule lmESCRIPT;
extern LexerModule lmF77;
extern LexerModule lmFlagShip;
extern LexerModule lmForth;
extern LexerModule lmFortran;
extern LexerModule lmFreeBasic;
extern LexerModule lmFSharp;
extern LexerModule lmGAP;
extern LexerModule lmGDScript;
extern LexerModule lmGui4Cli;
extern LexerModule lmHaskell;
extern LexerModule lmHollywood;
extern LexerModule lmHTML;
extern LexerModule lmIHex;
extern LexerModule lmIndent;
extern LexerModule lmInno;
extern LexerModule lmJSON;
extern LexerModule lmJulia;
extern LexerModule lmKix;
extern LexerModule lmKVIrc;
extern LexerModule lmLatex;
extern LexerModule lmLISP;
extern LexerModule lmLiterateHaskell;
extern LexerModule lmLot;
extern LexerModule lmLout;
extern LexerModule lmLua;
extern LexerModule lmMagikSF;
extern LexerModule lmMake;
extern LexerModule lmMarkdown;
extern LexerModule lmMatlab;
extern LexerModule lmMaxima;
extern LexerModule lmMETAPOST;
extern LexerModule lmMMIXAL;
extern LexerModule lmModula;
extern LexerModule lmMSSQL;
extern LexerModule lmMySQL;
extern LexerModule lmNim;
extern LexerModule lmNimrod;
extern LexerModule lmNncrontab;
extern LexerModule lmNsis;
extern LexerModule lmNull;
extern LexerModule lmOctave;
extern LexerModule lmOpal;
extern LexerModule lmOScript;
extern LexerModule lmPascal;
extern LexerModule lmPB;
extern LexerModule lmPerl;
extern LexerModule lmPHPSCRIPT;
extern LexerModule lmPLM;
extern LexerModule lmPO;
extern LexerModule lmPOV;
extern LexerModule lmPowerPro;
extern LexerModule lmPowerShell;
extern LexerModule lmProgress;
extern LexerModule lmProps;
extern LexerModule lmPS;
extern LexerModule lmPureBasic;
extern LexerModule lmPython;
extern LexerModule lmR;
extern LexerModule lmRaku;
extern LexerModule lmREBOL;
extern LexerModule lmRegistry;
extern LexerModule lmRuby;
extern LexerModule lmRust;
extern LexerModule lmSAS;
extern LexerModule lmScriptol;
extern LexerModule lmSmalltalk;
extern LexerModule lmSML;
extern LexerModule lmSorc;
extern LexerModule lmSpecman;
extern LexerModule lmSpice;
extern LexerModule lmSQL;
extern LexerModule lmSrec;
extern LexerModule lmStata;
extern LexerModule lmSTTXT;
extern LexerModule lmTACL;
extern LexerModule lmTADS3;
extern LexerModule lmTAL;
extern LexerModule lmTCL;
extern LexerModule lmTCMD;
extern LexerModule lmTEHex;
extern LexerModule lmTeX;
extern LexerModule lmTxt2tags;
extern LexerModule lmVB;
extern LexerModule lmVBScript;
extern LexerModule lmVerilog;
extern LexerModule lmVHDL;
extern LexerModule lmVisualProlog;
extern LexerModule lmX12;
extern LexerModule lmXML;
extern LexerModule lmYAML;
//--Autogenerated -- end of automatically generated section
namespace {
CatalogueModules catalogueLexilla;
void AddEachLexer() {
if (catalogueLexilla.Count() > 0) {
return;
}
catalogueLexilla.AddLexerModules({
//++Autogenerated -- run scripts/LexillaGen.py to regenerate
//**\(\t\t&\*,\n\)
&lmA68k,
&lmAbaqus,
&lmAda,
&lmAPDL,
&lmAs,
&lmAsciidoc,
&lmAsm,
&lmAsn1,
&lmASY,
&lmAU3,
&lmAVE,
&lmAVS,
&lmBaan,
&lmBash,
&lmBatch,
&lmBibTeX,
&lmBlitzBasic,
&lmBullant,
&lmCaml,
&lmCIL,
&lmClw,
&lmClwNoCase,
&lmCmake,
&lmCOBOL,
&lmCoffeeScript,
&lmConf,
&lmCPP,
&lmCPPNoCase,
&lmCsound,
&lmCss,
&lmD,
&lmDataflex,
&lmDiff,
&lmDMAP,
&lmDMIS,
&lmECL,
&lmEDIFACT,
&lmEiffel,
&lmEiffelkw,
&lmErlang,
&lmErrorList,
&lmESCRIPT,
&lmF77,
&lmFlagShip,
&lmForth,
&lmFortran,
&lmFreeBasic,
&lmFSharp,
&lmGAP,
&lmGDScript,
&lmGui4Cli,
&lmHaskell,
&lmHollywood,
&lmHTML,
&lmIHex,
&lmIndent,
&lmInno,
&lmJSON,
&lmJulia,
&lmKix,
&lmKVIrc,
&lmLatex,
&lmLISP,
&lmLiterateHaskell,
&lmLot,
&lmLout,
&lmLua,
&lmMagikSF,
&lmMake,
&lmMarkdown,
&lmMatlab,
&lmMaxima,
&lmMETAPOST,
&lmMMIXAL,
&lmModula,
&lmMSSQL,
&lmMySQL,
&lmNim,
&lmNimrod,
&lmNncrontab,
&lmNsis,
&lmNull,
&lmOctave,
&lmOpal,
&lmOScript,
&lmPascal,
&lmPB,
&lmPerl,
&lmPHPSCRIPT,
&lmPLM,
&lmPO,
&lmPOV,
&lmPowerPro,
&lmPowerShell,
&lmProgress,
&lmProps,
&lmPS,
&lmPureBasic,
&lmPython,
&lmR,
&lmRaku,
&lmREBOL,
&lmRegistry,
&lmRuby,
&lmRust,
&lmSAS,
&lmScriptol,
&lmSmalltalk,
&lmSML,
&lmSorc,
&lmSpecman,
&lmSpice,
&lmSQL,
&lmSrec,
&lmStata,
&lmSTTXT,
&lmTACL,
&lmTADS3,
&lmTAL,
&lmTCL,
&lmTCMD,
&lmTEHex,
&lmTeX,
&lmTxt2tags,
&lmVB,
&lmVBScript,
&lmVerilog,
&lmVHDL,
&lmVisualProlog,
&lmX12,
&lmXML,
&lmYAML,
//--Autogenerated -- end of automatically generated section
});
}
}
extern "C" {
EXPORT_FUNCTION int CALLING_CONVENTION GetLexerCount() {
AddEachLexer();
return static_cast<int>(catalogueLexilla.Count());
}
EXPORT_FUNCTION void CALLING_CONVENTION GetLexerName(unsigned int index, char *name, int buflength) {
AddEachLexer();
*name = 0;
const char *lexerName = catalogueLexilla.Name(index);
if (static_cast<size_t>(buflength) > strlen(lexerName)) {
strcpy(name, lexerName);
}
}
EXPORT_FUNCTION LexerFactoryFunction CALLING_CONVENTION GetLexerFactory(unsigned int index) {
AddEachLexer();
return catalogueLexilla.Factory(index);
}
EXPORT_FUNCTION Scintilla::ILexer5 * CALLING_CONVENTION CreateLexer(const char *name) {
AddEachLexer();
for (size_t i = 0; i < catalogueLexilla.Count(); i++) {
const char *lexerName = catalogueLexilla.Name(i);
if (0 == strcmp(lexerName, name)) {
return catalogueLexilla.Create(i);
}
}
return nullptr;
}
EXPORT_FUNCTION const char * CALLING_CONVENTION LexerNameFromID(int identifier) {
AddEachLexer();
const LexerModule *pModule = catalogueLexilla.Find(identifier);
if (pModule) {
return pModule->languageName;
}
return nullptr;
}
EXPORT_FUNCTION const char * CALLING_CONVENTION GetLibraryPropertyNames() {
return "";
}
EXPORT_FUNCTION void CALLING_CONVENTION SetLibraryProperty(const char *, const char *) {
// Null implementation
}
EXPORT_FUNCTION const char * CALLING_CONVENTION GetNameSpace() {
return "lexilla";
}
}
// Not exported from binary as LexerModule must be built exactly the same as
// modules listed above
void AddStaticLexerModule(LexerModule *plm) {
AddEachLexer();
catalogueLexilla.AddLexerModule(plm);
}

View File

@ -1,3 +0,0 @@
lexer.*.vb=vb
lexer.vb.strings.multiline=1
keywords.*.vb=as dim or string

View File

@ -1 +0,0 @@
532

View File

@ -27,5 +27,5 @@ target_include_directories(${PROJECT_NAME}
PUBLIC PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/lexilla/include ${CMAKE_CURRENT_SOURCE_DIR}/lexilla/include
${CMAKE_CURRENT_SOURCE_DIR}/lexilla/lexlib ${CMAKE_CURRENT_SOURCE_DIR}/lexilla/lexlib
${CMAKE_CURRENT_SOURCE_DIR}/../scintilla550/scintilla/include ${CMAKE_CURRENT_SOURCE_DIR}/../scintilla552/scintilla/include
) )

View File

@ -2,7 +2,7 @@
## Source ## Source
The vendored Lexilla source code is fetched from their official website [^1]. Version is 5.3.2. All vendored code are inside the `scintilla` folder. The vendored Lexilla source code is fetched from their official website [^1]. Version is 5.4.0. All vendored code are inside the `scintilla` folder.
[^1]: https://www.scintilla.org/LexillaDownload.html [^1]: https://www.scintilla.org/LexillaDownload.html

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

@ -5,7 +5,7 @@ on: [push]
jobs: jobs:
build: build:
runs-on: macos-11 runs-on: macos-latest
strategy: strategy:
matrix: matrix:
@ -18,16 +18,16 @@ jobs:
(cd .. && wget --no-verbose https://www.scintilla.org/scintilla500.zip) (cd .. && wget --no-verbose https://www.scintilla.org/scintilla500.zip)
(cd .. && unzip scintilla500.zip) (cd .. && unzip scintilla500.zip)
- name: Unit Test - name: Unit Test
run: (cd test/unit && make DEBUG=1 CXX=${{matrix.cpp_compiler}} test) run: (cd test/unit && make DEBUG=1 CXX=${{matrix.cpp_compiler}} --jobs=$(getconf _NPROCESSORS_ONLN) test)
- name: Build Lexilla - name: Build Lexilla
run: (cd src && make DEBUG=1 CXX=${{matrix.cpp_compiler}}) run: (cd src && make DEBUG=1 CXX=${{matrix.cpp_compiler}} --jobs=$(getconf _NPROCESSORS_ONLN))
- uses: actions/upload-artifact@v4 - uses: actions/upload-artifact@v4
with: with:
name: liblexilla.dylib name: liblexilla.dylib
path: bin/liblexilla.dylib path: bin/liblexilla.dylib
- name: Test lexing and folding - name: Test lexing and folding
run: (cd test && make DEBUG=1 CXX=${{matrix.cpp_compiler}} test) run: (cd test && make DEBUG=1 CXX=${{matrix.cpp_compiler}} --jobs=$(getconf _NPROCESSORS_ONLN) test)
- name: CheckLexilla C Example - name: CheckLexilla C Example
run: (cd examples/CheckLexilla && make DEBUG=1 check) run: (cd examples/CheckLexilla && make DEBUG=1 --jobs=$(getconf _NPROCESSORS_ONLN) check)
- name: SimpleLexer Example - name: SimpleLexer Example
run: (cd examples/SimpleLexer && make DEBUG=1 CXX=${{matrix.cpp_compiler}} check) run: (cd examples/SimpleLexer && make DEBUG=1 CXX=${{matrix.cpp_compiler}} --jobs=$(getconf _NPROCESSORS_ONLN) check)

View File

@ -43,11 +43,11 @@ jobs:
- name: CheckLexilla C Example - name: CheckLexilla C Example
run: | run: |
cd examples/CheckLexilla cd examples/CheckLexilla
cl CheckLexilla.c -I ../../include -Fe: CheckLexilla cl -MP CheckLexilla.c -I ../../include -Fe: CheckLexilla
.\CheckLexilla.exe .\CheckLexilla.exe
cd ../.. cd ../..
- name: SimpleLexer Example - name: SimpleLexer Example
run: | run: |
cd examples/SimpleLexer cd examples/SimpleLexer
cl -std:c++17 -EHsc -LD -I ../../../scintilla/include -I ../../include -I ../../lexlib SimpleLexer.cxx ../../lexlib/*.cxx cl -MP -std:c++17 -EHsc -LD -I ../../../scintilla/include -I ../../include -I ../../lexlib SimpleLexer.cxx ../../lexlib/*.cxx
cd ../.. cd ../..

View File

@ -18,17 +18,17 @@ jobs:
(cd .. && wget --no-verbose https://www.scintilla.org/scintilla500.zip) (cd .. && wget --no-verbose https://www.scintilla.org/scintilla500.zip)
(cd .. && unzip scintilla500.zip) (cd .. && unzip scintilla500.zip)
- name: Unit Test - name: Unit Test
run: (cd test/unit && make DEBUG=1 CXX=${{matrix.cpp_compiler}} test) run: (cd test/unit && make DEBUG=1 CXX=${{matrix.cpp_compiler}} --jobs=$(getconf _NPROCESSORS_ONLN) test)
- name: Build Lexilla - name: Build Lexilla
run: (cd src && make DEBUG=1 CXX=${{matrix.cpp_compiler}}) run: (cd src && make DEBUG=1 CXX=${{matrix.cpp_compiler}} --jobs=$(getconf _NPROCESSORS_ONLN))
- uses: actions/upload-artifact@v4 - uses: actions/upload-artifact@v4
with: with:
name: liblexilla-${{matrix.cpp_compiler}}.so name: liblexilla-${{matrix.cpp_compiler}}.so
path: bin/liblexilla.so path: bin/liblexilla.so
overwrite: true overwrite: true
- name: Test lexing and folding - name: Test lexing and folding
run: (cd test && make DEBUG=1 CXX=${{matrix.cpp_compiler}} test) run: (cd test && make DEBUG=1 CXX=${{matrix.cpp_compiler}} --jobs=$(getconf _NPROCESSORS_ONLN) test)
- name: CheckLexilla C Example - name: CheckLexilla C Example
run: (cd examples/CheckLexilla && make DEBUG=1 check) run: (cd examples/CheckLexilla && make DEBUG=1 --jobs=$(getconf _NPROCESSORS_ONLN) check)
- name: SimpleLexer Example - name: SimpleLexer Example
run: (cd examples/SimpleLexer && make DEBUG=1 CXX=${{matrix.cpp_compiler}} check) run: (cd examples/SimpleLexer && make DEBUG=1 CXX=${{matrix.cpp_compiler}} --jobs=$(getconf _NPROCESSORS_ONLN) check)

View File

@ -11,6 +11,9 @@ useInitializationList
// produces same result on empty collections // produces same result on empty collections
useStlAlgorithm useStlAlgorithm
// Common for lexer object destructors
missingOverride
// Some non-explicit constructors are used for conversions or are private to lexers // Some non-explicit constructors are used for conversions or are private to lexers
noExplicitConstructor noExplicitConstructor
@ -153,7 +156,6 @@ constVariableReference:lexilla/lexers/LexTCL.cxx
invalidscanf:lexilla/lexers/LexTCMD.cxx invalidscanf:lexilla/lexers/LexTCMD.cxx
constParameterReference:lexilla/lexers/LexTeX.cxx constParameterReference:lexilla/lexers/LexTeX.cxx
variableScope:lexilla/lexers/LexTeX.cxx variableScope:lexilla/lexers/LexTeX.cxx
knownConditionTrueFalse:lexilla/lexers/LexTxt2tags.cxx
knownConditionTrueFalse:lexilla/lexers/LexVB.cxx knownConditionTrueFalse:lexilla/lexers/LexVB.cxx
constParameterReference:lexilla/lexers/LexVerilog.cxx constParameterReference:lexilla/lexers/LexVerilog.cxx
variableScope:lexilla/lexers/LexVerilog.cxx variableScope:lexilla/lexers/LexVerilog.cxx
@ -205,3 +207,9 @@ knownConditionTrueFalse:lexilla/test/unit/testCharacterSet.cxx
// cppcheck fails REQUIRE from Catch // cppcheck fails REQUIRE from Catch
comparisonOfFuncReturningBoolError:lexilla/test/unit/*.cxx comparisonOfFuncReturningBoolError:lexilla/test/unit/*.cxx
// cppcheck fails SECTION from Catch
syntaxError:lexilla/test/unit/*.cxx
// argv has a standardised type
constParameter:lexilla/examples/CheckLexilla/CheckLexilla.c

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="20240423" /> <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.2<br /> <font color="#FFCC99" size="3">Release version 5.4.0<br />
Site last modified April 23 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.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>
<li>Version 5.2.8 improves Python and R.</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/lexilla532.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/lexilla532.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.2 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/lexilla532.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/lexilla532.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,71 @@
</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>
<a href="https://www.scintilla.org/lexilla533.zip">Release 5.3.3</a>
</h3>
<ul>
<li>
Released 22 July 2024.
</li>
<li>
ASP: Control whether ASP is enabled for XML and HTML with
lexer.xml.allow.asp and lexer.html.allow.asp.
<a href="https://github.com/ScintillaOrg/lexilla/issues/252">Issue #252</a>.
</li>
<li>
JavaScript: Recognize regular expressions at start or after '&gt;' in JavaScript when lexer is cpp,
hypertext, or xml.
<a href="https://github.com/ScintillaOrg/lexilla/issues/250">Issue #250</a>,
<a href="https://sourceforge.net/p/scintilla/bugs/918/">Bug #918</a>.
</li>
<li>
JavaScript: Recognize initial #! 'shebang' line as a comment in standalone files.
<a href="https://github.com/ScintillaOrg/lexilla/issues/253">Issue #253</a>.
</li>
<li>
Lua: Fix non-ASCII identifiers joined with '.' or ':'.
<a href="https://github.com/ScintillaOrg/lexilla/issues/242">Issue #242</a>.
</li>
<li>
Lua: Fix folding for multi-line SCE_LUA_LITERALSTRING and SCE_LUA_COMMENT
when performed incrementally.
<a href="https://github.com/ScintillaOrg/lexilla/issues/247">Issue #247</a>.
</li>
<li>
PHP: Control whether PHP is enabled for XML and HTML with
lexer.xml.allow.php and lexer.html.allow.php.
<a href="https://github.com/ScintillaOrg/lexilla/issues/252">Issue #252</a>.
</li>
</ul>
<h3> <h3>
<a href="https://www.scintilla.org/lexilla532.zip">Release 5.3.2</a> <a href="https://www.scintilla.org/lexilla532.zip">Release 5.3.2</a>
</h3> </h3>

View File

Before

Width:  |  Height:  |  Size: 34 KiB

After

Width:  |  Height:  |  Size: 34 KiB

View File

Before

Width:  |  Height:  |  Size: 44 KiB

After

Width:  |  Height:  |  Size: 44 KiB

View File

@ -2,14 +2,15 @@
INCLUDES = -I ../../../scintilla/include -I ../../include -I ../../lexlib INCLUDES = -I ../../../scintilla/include -I ../../include -I ../../lexlib
BASE_FLAGS += --std=c++17 -shared BASE_FLAGS += --std=c++17
ifdef windir ifdef windir
SHAREDEXTENSION = dll SHAREDEXTENSION = dll
else else
ifeq ($(shell uname),Darwin) ifeq ($(shell uname),Darwin)
SHAREDEXTENSION = dylib SHAREDEXTENSION = dylib
BASE_FLAGS += -dynamiclib -arch arm64 -arch x86_64 BASE_FLAGS += -arch arm64 -arch x86_64
LINK_FLAGS += -dynamiclib
else else
BASE_FLAGS += -fPIC BASE_FLAGS += -fPIC
SHAREDEXTENSION = so SHAREDEXTENSION = so
@ -23,7 +24,14 @@ ifdef windir
endif endif
LIBRARY = SimpleLexer.$(SHAREDEXTENSION) LIBRARY = SimpleLexer.$(SHAREDEXTENSION)
LEXLIB = ../../lexlib/*.cxx
vpath %.cxx ../../lexlib
LEXLIB_SOURCES := $(sort $(notdir $(wildcard ../../lexlib/*.cxx)))
LEXLIB = $(LEXLIB_SOURCES:.cxx=.o)
%.o: %.cxx
$(CXX) $(INCLUDES) $(BASE_FLAGS) $(CPPFLAGS) $(CXXFLAGS) -c $< -o $@
all: $(LIBRARY) all: $(LIBRARY)
@ -34,5 +42,5 @@ check: $(LIBRARY)
clean: clean:
$(RM) *.o *obj *.lib *.exp $(LIBRARY) $(RM) *.o *obj *.lib *.exp $(LIBRARY)
$(LIBRARY): *.cxx $(LIBRARY): $(LEXLIB) *.cxx
$(CXX) $(INCLUDES) $(BASE_FLAGS) $(CPPFLAGS) $(CXXFLAGS) $^ $(LEXLIB) $(LIBS) $(LDLIBS) -o $@ $(CXX) $(INCLUDES) $(LINK_FLAGS) $(BASE_FLAGS) -shared $(CPPFLAGS) $(CXXFLAGS) $^ $(LIBS) $(LDLIBS) -o $@

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_AUTOMATIC 1000 #define SCLEX_AUTOMATIC 1000
#define SCE_P_DEFAULT 0 #define SCE_P_DEFAULT 0
#define SCE_P_COMMENTLINE 1 #define SCE_P_COMMENTLINE 1
@ -2058,6 +2059,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 */
#endif #endif

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

@ -791,7 +791,7 @@ void SCI_METHOD LexerCPP::Lex(Sci_PositionU startPos, Sci_Position length, int i
const StyleContext::Transform transform = caseSensitive ? const StyleContext::Transform transform = caseSensitive ?
StyleContext::Transform::none : StyleContext::Transform::lower; StyleContext::Transform::none : StyleContext::Transform::lower;
const CharacterSet setOKBeforeRE("([{=,:;!%^&*|?~+-"); const CharacterSet setOKBeforeRE("([{=,:;!%^&*|?~+-> ");
const CharacterSet setCouldBePostOp("+-"); const CharacterSet setCouldBePostOp("+-");
const CharacterSet setDoxygen(CharacterSet::setAlpha, "$@\\&<>#{}[]"); const CharacterSet setDoxygen(CharacterSet::setAlpha, "$@\\&<>#{}[]");
@ -890,6 +890,12 @@ void SCI_METHOD LexerCPP::Lex(Sci_PositionU startPos, Sci_Position length, int i
Sci_PositionU lineEndNext = styler.LineEnd(lineCurrent); Sci_PositionU lineEndNext = styler.LineEnd(lineCurrent);
if (sc.currentPos == 0 && sc.Match('#', '!')) {
// Shell Shebang at beginning of file
sc.SetState(SCE_C_COMMENTLINE);
sc.Forward();
}
for (; sc.More();) { for (; sc.More();) {
if (sc.atLineStart) { if (sc.atLineStart) {
@ -1835,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

@ -28,10 +28,12 @@
#include "LexerModule.h" #include "LexerModule.h"
/***************************************/ /***************************************/
#if defined(__clang__) && !defined(__APPLE__) #if defined(__clang__)
#if __has_warning("-Wunused-but-set-variable")
// Disable warning for numNonBlank // Disable warning for numNonBlank
#pragma clang diagnostic ignored "-Wunused-but-set-variable" #pragma clang diagnostic ignored "-Wunused-but-set-variable"
#endif #endif
#endif
using namespace Lexilla; using namespace Lexilla;
@ -231,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

@ -675,6 +675,30 @@ constexpr bool isPHPStringState(int state) noexcept {
(state == SCE_HPHP_COMPLEX_VARIABLE); (state == SCE_HPHP_COMPLEX_VARIABLE);
} }
enum class AllowPHP : int {
None, // No PHP
PHP, // <?php and <?=
Question, // <?
};
constexpr bool IsPHPEntryState(int state) noexcept {
return !(isPHPStringState(state) || IsScriptCommentState(state) || AnyOf(state, SCE_H_ASPAT, SCE_HPHP_COMMENT, SCE_HPHP_COMMENTLINE));
}
bool IsPHPStart(AllowPHP allowPHP, Accessor &styler, Sci_PositionU start) {
if (allowPHP == AllowPHP::None) {
return false;
}
if (allowPHP == AllowPHP::PHP) {
// Require <?php or <?=
constexpr std::string_view phpTag = "<?php";
constexpr std::string_view echoTag = "<?=";
const std::string tag = styler.GetRangeLowered(start, start + phpTag.length());
return (tag == phpTag) || (tag.substr(0, echoTag.length()) == echoTag);
}
return true;
}
Sci_Position FindPhpStringDelimiter(std::string &phpStringDelimiter, Sci_Position i, const Sci_Position lengthDoc, Accessor &styler, bool &isSimpleString) { Sci_Position FindPhpStringDelimiter(std::string &phpStringDelimiter, Sci_Position i, const Sci_Position lengthDoc, Accessor &styler, bool &isSimpleString) {
const Sci_Position beginning = i - 1; const Sci_Position beginning = i - 1;
bool isQuoted = false; bool isQuoted = false;
@ -722,8 +746,12 @@ struct OptionsHTML {
int aspDefaultLanguage = eScriptJS; int aspDefaultLanguage = eScriptJS;
bool caseSensitive = false; bool caseSensitive = false;
bool allowScripts = true; bool allowScripts = true;
AllowPHP allowPHPinXML = AllowPHP::Question;
AllowPHP allowPHPinHTML = AllowPHP::Question;
bool isMako = false; bool isMako = false;
bool isDjango = false; bool isDjango = false;
bool allowASPinXML = true;
bool allowASPinHTML = true;
bool fold = false; bool fold = false;
bool foldHTML = false; bool foldHTML = false;
bool foldHTMLPreprocessor = true; bool foldHTMLPreprocessor = true;
@ -767,12 +795,26 @@ struct OptionSetHTML : public OptionSet<OptionsHTML> {
DefineProperty("lexer.xml.allow.scripts", &OptionsHTML::allowScripts, DefineProperty("lexer.xml.allow.scripts", &OptionsHTML::allowScripts,
"Set to 0 to disable scripts in XML."); "Set to 0 to disable scripts in XML.");
DefineProperty("lexer.xml.allow.php", &OptionsHTML::allowPHPinXML,
"Set to 0 to disable PHP in XML, 1 to accept <?php and <?=, 2 to also accept <?."
"The default is 2.");
DefineProperty("lexer.html.allow.php", &OptionsHTML::allowPHPinHTML,
"Set to 0 to disable PHP in HTML, 1 to accept <?php and <?=, 2 to also accept <?."
"The default is 2.");
DefineProperty("lexer.html.mako", &OptionsHTML::isMako, DefineProperty("lexer.html.mako", &OptionsHTML::isMako,
"Set to 1 to enable the mako template language."); "Set to 1 to enable the mako template language.");
DefineProperty("lexer.html.django", &OptionsHTML::isDjango, DefineProperty("lexer.html.django", &OptionsHTML::isDjango,
"Set to 1 to enable the django template language."); "Set to 1 to enable the django template language.");
DefineProperty("lexer.xml.allow.asp", &OptionsHTML::allowASPinXML,
"Set to 0 to disable ASP in XML.");
DefineProperty("lexer.html.allow.asp", &OptionsHTML::allowASPinHTML,
"Set to 0 to disable ASP in HTML.");
DefineProperty("fold", &OptionsHTML::fold); DefineProperty("fold", &OptionsHTML::fold);
DefineProperty("fold.html", &OptionsHTML::foldHTML, DefineProperty("fold.html", &OptionsHTML::foldHTML,
@ -1000,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;
@ -1067,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;
@ -1096,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;
} }
} }
@ -1219,13 +1266,15 @@ void SCI_METHOD LexerHTML::Lex(Sci_PositionU startPos, Sci_Position length, int
const bool foldXmlAtTagOpen = isXml && fold && options.foldXmlAtTagOpen; const bool foldXmlAtTagOpen = isXml && fold && options.foldXmlAtTagOpen;
const bool caseSensitive = options.caseSensitive; const bool caseSensitive = options.caseSensitive;
const bool allowScripts = options.allowScripts; const bool allowScripts = options.allowScripts;
const AllowPHP allowPHP = isXml ? options.allowPHPinXML : options.allowPHPinHTML;
const bool isMako = options.isMako; const bool isMako = options.isMako;
const bool isDjango = options.isDjango; const bool isDjango = options.isDjango;
const bool allowASP = (isXml ? options.allowASPinXML : options.allowASPinHTML) && !isMako && !isDjango;
const CharacterSet setHTMLWord(CharacterSet::setAlphaNum, ".-_:!#", true); const CharacterSet setHTMLWord(CharacterSet::setAlphaNum, ".-_:!#", true);
const CharacterSet setTagContinue(CharacterSet::setAlphaNum, ".-_:!#[", true); const CharacterSet setTagContinue(CharacterSet::setAlphaNum, ".-_:!#[", true);
const CharacterSet setAttributeContinue(CharacterSet::setAlphaNum, ".-_:!#/", true); const CharacterSet setAttributeContinue(CharacterSet::setAlphaNum, ".-_:!#/", true);
// TODO: also handle + and - (except if they're part of ++ or --) and return keywords // TODO: also handle + and - (except if they're part of ++ or --) and return keywords
const CharacterSet setOKBeforeJSRE(CharacterSet::setNone, "([{=,:;!%^&*|?~"); const CharacterSet setOKBeforeJSRE(CharacterSet::setNone, "([{=,:;!%^&*|?~> ");
// Only allow [A-Za-z0-9.#-_:] in entities // Only allow [A-Za-z0-9.#-_:] in entities
const CharacterSet setEntity(CharacterSet::setAlphaNum, ".#-_:"); const CharacterSet setEntity(CharacterSet::setAlphaNum, ".#-_:");
@ -1447,13 +1496,7 @@ void SCI_METHOD LexerHTML::Lex(Sci_PositionU startPos, Sci_Position length, int
///////////////////////////////////// /////////////////////////////////////
// handle the start of PHP pre-processor = Non-HTML // handle the start of PHP pre-processor = Non-HTML
else if ((state != SCE_H_ASPAT) && else if ((ch == '<') && (chNext == '?') && IsPHPEntryState(state) && IsPHPStart(allowPHP, styler, i)) {
!isPHPStringState(state) &&
(state != SCE_HPHP_COMMENT) &&
(state != SCE_HPHP_COMMENTLINE) &&
(ch == '<') &&
(chNext == '?') &&
!IsScriptCommentState(state)) {
beforeLanguage = scriptLanguage; beforeLanguage = scriptLanguage;
scriptLanguage = segIsScriptingIndicator(styler, i + 2, i + 6, isXml ? eScriptXML : eScriptPHP); scriptLanguage = segIsScriptingIndicator(styler, i + 2, i + 6, isXml ? eScriptXML : eScriptPHP);
if ((scriptLanguage != eScriptPHP) && (isStringState(state) || (state==SCE_H_COMMENT))) continue; if ((scriptLanguage != eScriptPHP) && (isStringState(state) || (state==SCE_H_COMMENT))) continue;
@ -1514,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);
@ -1579,7 +1622,7 @@ void SCI_METHOD LexerHTML::Lex(Sci_PositionU startPos, Sci_Position length, int
} }
// handle the start of ASP pre-processor = Non-HTML // handle the start of ASP pre-processor = Non-HTML
else if (!isMako && !isDjango && !isCommentASPState(state) && (ch == '<') && (chNext == '%') && !isPHPStringState(state)) { else if ((ch == '<') && (chNext == '%') && allowASP && !isCommentASPState(state) && !isPHPStringState(state)) {
styler.ColourTo(i - 1, StateToPrint); styler.ColourTo(i - 1, StateToPrint);
beforePreProc = state; beforePreProc = state;
if (inScriptType == eNonHtmlScript) if (inScriptType == eNonHtmlScript)
@ -1667,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);
} }
@ -1700,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);
} }
@ -1728,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);
@ -1843,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 {
@ -1968,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;
@ -2022,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) {
@ -2201,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;
@ -2328,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;
@ -2412,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;
@ -2486,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;
@ -2688,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);
@ -2715,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

@ -39,8 +39,9 @@ namespace {
// return 1 for [[ or ]], returns >=2 for [=[ or ]=] and so on. // return 1 for [[ or ]], returns >=2 for [=[ or ]=] and so on.
// The maximum number of '=' characters allowed is 254. // The maximum number of '=' characters allowed is 254.
int LongDelimCheck(StyleContext &sc) { int LongDelimCheck(StyleContext &sc) {
constexpr int maximumEqualCharacters = 254;
int sep = 1; int sep = 1;
while (sc.GetRelative(sep) == '=' && sep < 0xFF) while (sc.GetRelative(sep) == '=' && sep <= maximumEqualCharacters)
sep++; sep++;
if (sc.GetRelative(sep) == sc.ch) if (sc.GetRelative(sep) == sc.ch)
return sep; return sep;
@ -115,11 +116,15 @@ public:
explicit LexerLua() : explicit LexerLua() :
DefaultLexer("lua", SCLEX_LUA, lexicalClasses, std::size(lexicalClasses)) { DefaultLexer("lua", SCLEX_LUA, lexicalClasses, std::size(lexicalClasses)) {
} }
LexerLua(const LexerLua &) = delete;
LexerLua(LexerLua &&) = delete;
LexerLua &operator=(const LexerLua &) = delete;
LexerLua &operator=(LexerLua &&) = delete;
~LexerLua() override = default; ~LexerLua() override = default;
void SCI_METHOD Release() noexcept override { void SCI_METHOD Release() noexcept override {
delete this; delete this;
} }
int SCI_METHOD Version() const noexcept override { [[nodiscard]] int SCI_METHOD Version() const noexcept override {
return lvRelease5; return lvRelease5;
} }
const char *SCI_METHOD PropertyNames() noexcept override { const char *SCI_METHOD PropertyNames() noexcept override {
@ -259,6 +264,7 @@ void LexerLua::Lex(Sci_PositionU startPos, Sci_Position length, int initStyle, I
// results of identifier/keyword matching // results of identifier/keyword matching
Sci_Position idenPos = 0; Sci_Position idenPos = 0;
Sci_Position idenStartCharWidth = 0;
Sci_Position idenWordPos = 0; Sci_Position idenWordPos = 0;
int idenStyle = SCE_LUA_IDENTIFIER; int idenStyle = SCE_LUA_IDENTIFIER;
bool foundGoto = false; bool foundGoto = false;
@ -315,22 +321,22 @@ void LexerLua::Lex(Sci_PositionU startPos, Sci_Position length, int initStyle, I
if (sc.ch == ':' && sc.chPrev == ':') { // :: <label> :: forward scan if (sc.ch == ':' && sc.chPrev == ':') { // :: <label> :: forward scan
sc.Forward(); sc.Forward();
Sci_Position ln = 0; Sci_Position ln = 0;
while (IsASpaceOrTab(sc.GetRelative(ln))) // skip over spaces/tabs while (IsASpaceOrTab(sc.GetRelativeChar(ln))) // skip over spaces/tabs
ln++; ln++;
const Sci_Position ws1 = ln; const Sci_Position ws1 = ln;
if (setWordStart.Contains(sc.GetRelative(ln))) { if (setWordStart.Contains(sc.GetRelativeChar(ln))) {
int c = 0; char cLabel = 0;
std::string s; std::string s;
while (setWord.Contains(c = sc.GetRelative(ln))) { // get potential label while (setWord.Contains(cLabel = sc.GetRelativeChar(ln))) { // get potential label
s.push_back(static_cast<char>(c)); s.push_back(cLabel);
ln++; ln++;
} }
const Sci_Position lbl = ln; const Sci_Position lbl = ln;
if (!keywords.InList(s)) { if (!keywords.InList(s)) {
while (IsASpaceOrTab(sc.GetRelative(ln))) // skip over spaces/tabs while (IsASpaceOrTab(sc.GetRelativeChar(ln))) // skip over spaces/tabs
ln++; ln++;
const Sci_Position ws2 = ln - lbl; const Sci_Position ws2 = ln - lbl;
if (sc.GetRelative(ln) == ':' && sc.GetRelative(ln + 1) == ':') { if (sc.GetRelativeChar(ln) == ':' && sc.GetRelativeChar(ln + 1) == ':') {
// final :: found, complete valid label construct // final :: found, complete valid label construct
sc.ChangeState(SCE_LUA_LABEL); sc.ChangeState(SCE_LUA_LABEL);
if (ws1) { if (ws1) {
@ -359,7 +365,7 @@ void LexerLua::Lex(Sci_PositionU startPos, Sci_Position length, int initStyle, I
sc.SetState(SCE_LUA_DEFAULT); sc.SetState(SCE_LUA_DEFAULT);
} }
} else if (sc.state == SCE_LUA_IDENTIFIER) { } else if (sc.state == SCE_LUA_IDENTIFIER) {
idenPos--; // commit already-scanned identifier/word parts idenPos -= idenStartCharWidth; // commit already-scanned identifier/word parts
if (idenWordPos > 0) { if (idenWordPos > 0) {
idenWordPos--; idenWordPos--;
sc.ChangeState(idenStyle); sc.ChangeState(idenStyle);
@ -449,17 +455,18 @@ void LexerLua::Lex(Sci_PositionU startPos, Sci_Position length, int initStyle, I
// set to a word style. The non-matched part is in identifier style. // set to a word style. The non-matched part is in identifier style.
std::string ident; std::string ident;
idenPos = 0; idenPos = 0;
idenStartCharWidth = sc.width;
idenWordPos = 0; idenWordPos = 0;
idenStyle = SCE_LUA_IDENTIFIER; idenStyle = SCE_LUA_IDENTIFIER;
foundGoto = false; foundGoto = false;
int cNext = 0; char cNext = 0;
do { do {
int c = 0; char cIdent = 0;
const Sci_Position idenPosOld = idenPos; const Sci_Position idenPosOld = idenPos;
std::string identSeg; std::string identSeg;
identSeg += static_cast<char>(sc.GetRelative(idenPos++)); identSeg += sc.GetRelativeChar(idenPos++);
while (setWord.Contains(c = sc.GetRelative(idenPos))) { while (setWord.Contains(cIdent = sc.GetRelativeChar(idenPos))) {
identSeg += static_cast<char>(c); identSeg += cIdent;
idenPos++; idenPos++;
} }
if (keywords.InList(identSeg) && (idenPosOld > 0)) { if (keywords.InList(identSeg) && (idenPosOld > 0)) {
@ -497,9 +504,9 @@ void LexerLua::Lex(Sci_PositionU startPos, Sci_Position length, int initStyle, I
} }
if (idenStyle == SCE_LUA_WORD) // keywords cannot mix if (idenStyle == SCE_LUA_WORD) // keywords cannot mix
break; break;
cNext = sc.GetRelative(idenPos + 1); cNext = sc.GetRelativeChar(idenPos + 1);
if ((c == '.' || c == ':') && setWordStart.Contains(cNext)) { if ((cIdent == '.' || cIdent == ':') && setWordStart.Contains(cNext)) {
ident += static_cast<char>(c); ident += cIdent;
idenPos++; idenPos++;
} else { } else {
cNext = 0; cNext = 0;
@ -570,14 +577,18 @@ void LexerLua::Fold(Sci_PositionU startPos_, Sci_Position length, int initStyle,
chNext = styler.SafeGetCharAt(i + 1); chNext = styler.SafeGetCharAt(i + 1);
const int stylePrev = style; const int stylePrev = style;
style = styleNext; style = styleNext;
styleNext = styler.StyleIndexAt(i + 1); if ((i + 1) < lengthDoc) {
// Only read styles that have been set, otherwise treat style as continuing
styleNext = styler.StyleIndexAt(i + 1);
}
const bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n'); const bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n');
if (style == SCE_LUA_WORD) { if (style == SCE_LUA_WORD) {
// Fixed list of folding words: if, do, function, repeat, end, until // Fixed list of folding words: if, do, function, repeat, end, until
// Must fix up next line with initial characters if any new words added. // Must fix up next line with initial characters if any new words added.
if ((style != stylePrev) && AnyOf(ch, 'i', 'd', 'f', 'e', 'r', 'u')) { if ((style != stylePrev) && AnyOf(ch, 'i', 'd', 'f', 'e', 'r', 'u')) {
constexpr Sci_Position maxFoldWord = 9; // "function"sv.length() + 1
std::string s; std::string s;
for (Sci_Position j = 0; j < 8; j++) { // 8 is length of longest: function for (Sci_Position j = 0; j < maxFoldWord; j++) {
if (!iswordchar(styler[i + j])) { if (!iswordchar(styler[i + j])) {
break; break;
} }
@ -632,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);

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