aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--doc/ScintillaDoc.html11
-rw-r--r--doc/ScintillaHistory.html11
-rw-r--r--include/Scintilla.h1
-rw-r--r--include/Scintilla.iface3
-rw-r--r--src/ScintillaBase.cxx49
-rw-r--r--src/ScintillaBase.h5
-rw-r--r--win32/DepGen.py3
-rw-r--r--win32/deps.mak9
-rw-r--r--win32/makefile18
-rw-r--r--win32/nmdeps.mak9
-rw-r--r--win32/scintilla.mak14
11 files changed, 108 insertions, 25 deletions
diff --git a/doc/ScintillaDoc.html b/doc/ScintillaDoc.html
index b3fe1e553..e9f3471c0 100644
--- a/doc/ScintillaDoc.html
+++ b/doc/ScintillaDoc.html
@@ -6857,6 +6857,7 @@ sptr_t CallScintilla(unsigned int iMessage, uptr_t wParam, sptr_t lParam){
<a class="message" href="#SCI_SETLEXERLANGUAGE">SCI_SETLEXERLANGUAGE(&lt;unused&gt;, const char
*language)</a><br />
<a class="message" href="#SCI_GETLEXERLANGUAGE">SCI_GETLEXERLANGUAGE(&lt;unused&gt;, char *language) &rarr; int</a><br />
+ <a class="message" href="#SCI_SETILEXER">SCI_SETILEXER(bool iLexer5, pointer lexer)</a><br />
<a class="message" href="#SCI_LOADLEXERLIBRARY">SCI_LOADLEXERLIBRARY(bool iLexer5, const char
*path)</a><br />
<a class="message" href="#SCI_COLOURISE">SCI_COLOURISE(position start, position end)</a><br />
@@ -6907,7 +6908,15 @@ sptr_t CallScintilla(unsigned int iMessage, uptr_t wParam, sptr_t lParam){
<code>Lex*.cxx</code> file and search for <code>LexerModule</code>. The third argument in the
<code>LexerModule</code> constructor is the name to use.</p>
- <p>To test if your lexer assignment worked, use <a class="seealso"
+ <p class="provisional"><b id="SCI_SETILEXER">SCI_SETILEXER(bool iLexer5, pointer lexer)</b><br />
+ <code>SCI_SETILEXER</code> allows setting a lexer as an <code>ILexer*</code>.
+ The lexer may be implemented by an application or a shared library such as Lexilla.
+ <code>iLexer5</code> indicates whether or not the library contains Scintilla lexers that implement
+ the ILexer5 interface defined in Scintilla 4.3+ (e.g. Lexilla). The default is to assume lexers
+ implement the ILexer interface defined in Scintilla 3.x. This flag must be set explicitly and
+ cannot be inferred.</p>
+
+ <p>To test if your lexer assignment worked, use <a class="message"
href="#SCI_GETLEXER"><code>SCI_GETLEXER</code></a> before and after setting the new lexer to
see if the lexer number changed.</p>
diff --git a/doc/ScintillaHistory.html b/doc/ScintillaHistory.html
index 0f515ca91..ecc299dcd 100644
--- a/doc/ScintillaHistory.html
+++ b/doc/ScintillaHistory.html
@@ -564,6 +564,17 @@
Released 9 May 2020.
</li>
<li>
+ SCI_SETILEXER implemented to use lexers from Lexilla or other sources.
+ </li>
+ </ul>
+ <h3>
+ <a href="https://sourceforge.net/projects/scintilla/files/scintilla/3.20.0/scintilla3200.zip/download">Release 3.20.0</a>
+ </h3>
+ <ul>
+ <li>
+ Released 9 May 2020.
+ </li>
+ <li>
ILexerWithIdentity interface defined provisionally to support potential use of Lexilla.
The details of this interface may change before being stabilised in Scintilla 5.0.
</li>
diff --git a/include/Scintilla.h b/include/Scintilla.h
index cea4983e3..c2d289bab 100644
--- a/include/Scintilla.h
+++ b/include/Scintilla.h
@@ -1041,6 +1041,7 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SCI_NAMEOFSTYLE 4030
#define SCI_TAGSOFSTYLE 4031
#define SCI_DESCRIPTIONOFSTYLE 4032
+#define SCI_SETILEXER 4033
#define SC_MOD_NONE 0x0
#define SC_MOD_INSERTTEXT 0x1
#define SC_MOD_DELETETEXT 0x2
diff --git a/include/Scintilla.iface b/include/Scintilla.iface
index 05a0ed2ce..a3354de40 100644
--- a/include/Scintilla.iface
+++ b/include/Scintilla.iface
@@ -2963,6 +2963,9 @@ fun int TagsOfStyle=4031(int style, stringresult tags)
# Result is NUL-terminated.
fun int DescriptionOfStyle=4032(int style, stringresult description)
+# Set the lexer from an ILexer*.
+set void SetILexer=4033(, pointer ilexer)
+
# Notifications
# Type of modification and the action which caused the modification.
# These are defined as a bit mask to make it easy to specify which notifications are wanted.
diff --git a/src/ScintillaBase.cxx b/src/ScintillaBase.cxx
index 09736d9f7..af1a6f52e 100644
--- a/src/ScintillaBase.cxx
+++ b/src/ScintillaBase.cxx
@@ -23,9 +23,7 @@
#include "ILexer.h"
#include "Scintilla.h"
-#ifdef SCI_LEXER
#include "SciLexer.h"
-#endif
#include "PropSetSimple.h"
#include "CharacterCategory.h"
@@ -61,9 +59,7 @@
#include "AutoComplete.h"
#include "ScintillaBase.h"
-#ifdef SCI_LEXER
#include "ExternalLexer.h"
-#endif
using namespace Scintilla;
@@ -548,8 +544,6 @@ void ScintillaBase::RightButtonDownWithModifiers(Point pt, unsigned int curTime,
Editor::RightButtonDownWithModifiers(pt, curTime, modifiers);
}
-#ifdef SCI_LEXER
-
namespace Scintilla {
class LexState : public LexInterface {
@@ -561,6 +555,7 @@ public:
int lexLanguage;
explicit LexState(Document *pdoc_);
+ void SetInstance(ILexer *instance_);
// Deleted so LexState objects can not be copied.
LexState(const LexState &) = delete;
LexState(LexState &&) = delete;
@@ -569,8 +564,10 @@ public:
~LexState() override;
void SetLexer(uptr_t wParam);
void SetLexerLanguage(const char *languageName);
+
const char *DescribeWordListSets();
void SetWordList(int n, const char *wl);
+ int GetIdentifier() const;
const char *GetName() const;
void *PrivateCall(int operation, void *pointer);
const char *PropertyNames();
@@ -609,8 +606,25 @@ LexState::LexState(Document *pdoc_) : LexInterface(pdoc_) {
LexState::~LexState() {
if (instance) {
instance->Release();
+ LexillaLexer *iLexer5 = dynamic_cast<LexillaLexer *>(instance);
+ if (iLexer5) {
+ delete iLexer5;
+ }
+ instance = nullptr;
+ }
+}
+
+void LexState::SetInstance(ILexer *instance_) {
+ if (instance) {
+ instance->Release();
+ LexillaLexer *iLexer5 = dynamic_cast<LexillaLexer *>(instance);
+ if (iLexer5) {
+ delete iLexer5;
+ }
instance = nullptr;
}
+ instance = instance_;
+ pdoc->LexerChanged();
}
LexState *ScintillaBase::DocumentLexState() {
@@ -624,6 +638,10 @@ void LexState::SetLexerModule(const LexerModule *lex) {
if (lex != lexCurrent) {
if (instance) {
instance->Release();
+ LexillaLexer *iLexer5 = dynamic_cast<LexillaLexer *>(instance);
+ if (iLexer5) {
+ delete iLexer5;
+ }
instance = nullptr;
}
interfaceVersion = lvOriginal;
@@ -841,10 +859,7 @@ const char *LexState::DescriptionOfStyle(int style) {
}
}
-#endif
-
void ScintillaBase::NotifyStyleToNeeded(Sci::Position endStyleNeeded) {
-#ifdef SCI_LEXER
if (DocumentLexState()->lexLanguage != SCLEX_CONTAINER) {
const Sci::Line lineEndStyled =
pdoc->SciLineFromPosition(pdoc->GetEndStyled());
@@ -853,14 +868,11 @@ void ScintillaBase::NotifyStyleToNeeded(Sci::Position endStyleNeeded) {
DocumentLexState()->Colourise(endStyled, endStyleNeeded);
return;
}
-#endif
Editor::NotifyStyleToNeeded(endStyleNeeded);
}
void ScintillaBase::NotifyLexerChanged(Document *, void *) {
-#ifdef SCI_LEXER
vs.EnsureStyle(0xff);
-#endif
}
sptr_t ScintillaBase::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
@@ -1058,7 +1070,6 @@ sptr_t ScintillaBase::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lPara
displayPopupMenu = static_cast<int>(wParam);
break;
-#ifdef SCI_LEXER
case SCI_SETLEXER:
DocumentLexState()->SetLexer(static_cast<int>(wParam));
break;
@@ -1066,6 +1077,14 @@ sptr_t ScintillaBase::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lPara
case SCI_GETLEXER:
return DocumentLexState()->lexLanguage;
+ case SCI_SETILEXER:
+ if (wParam == 0) {
+ DocumentLexState()->SetInstance(reinterpret_cast<ILexer *>(lParam));
+ } else {
+ DocumentLexState()->SetInstance(new LexillaLexer(reinterpret_cast<ILexer5 *>(lParam)));
+ }
+ return 0;
+
case SCI_COLOURISE:
if (DocumentLexState()->lexLanguage == SCLEX_CONTAINER) {
pdoc->ModifiedAt(static_cast<Sci::Position>(wParam));
@@ -1102,9 +1121,11 @@ sptr_t ScintillaBase::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lPara
case SCI_GETLEXERLANGUAGE:
return StringResult(lParam, DocumentLexState()->GetName());
+#ifdef SCI_LEXER
case SCI_LOADLEXERLIBRARY:
ExternalLexerLoad(ConstCharPtrFromSPtr(lParam), wParam != 0);
break;
+#endif
case SCI_PRIVATELEXERCALL:
return reinterpret_cast<sptr_t>(
@@ -1176,8 +1197,6 @@ sptr_t ScintillaBase::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lPara
return StringResult(lParam, DocumentLexState()->
DescriptionOfStyle(static_cast<int>(wParam)));
-#endif
-
default:
return Editor::WndProc(iMessage, wParam, lParam);
}
diff --git a/src/ScintillaBase.h b/src/ScintillaBase.h
index e922ab057..fcb1c9796 100644
--- a/src/ScintillaBase.h
+++ b/src/ScintillaBase.h
@@ -10,10 +10,7 @@
namespace Scintilla {
-#ifdef SCI_LEXER
class LexState;
-#endif
-
/**
*/
class ScintillaBase : public Editor, IListBoxDelegate {
@@ -44,12 +41,10 @@ protected:
int maxListWidth; /// Maximum width of list, in average character widths
int multiAutoCMode; /// Mode for autocompleting when multiple selections are present
-#ifdef SCI_LEXER
LexState *DocumentLexState();
void SetLexer(uptr_t wParam);
void SetLexerLanguage(const char *languageName);
void Colourise(int start, int end);
-#endif
ScintillaBase();
// Deleted so ScintillaBase objects can not be copied.
diff --git a/win32/DepGen.py b/win32/DepGen.py
index c255574b0..6196720e2 100644
--- a/win32/DepGen.py
+++ b/win32/DepGen.py
@@ -22,6 +22,9 @@ def Generate():
# Add ScintillaBaseL as the same as ScintillaBase
deps = Dependencies.InsertSynonym(deps, "ScintillaBase.o", "ScintillaBaseL.o")
+ # Add CatalogueL as the same as Catalogue
+ deps = Dependencies.InsertSynonym(deps, "Catalogue.o", "CatalogueL.o")
+
Dependencies.UpdateDependencies("../win32/deps.mak", deps, topComment)
# Create the dependencies file for MSVC
diff --git a/win32/deps.mak b/win32/deps.mak
index 3dbe89399..4b921238c 100644
--- a/win32/deps.mak
+++ b/win32/deps.mak
@@ -96,6 +96,15 @@ Catalogue.o: \
../lexlib/LexerModule.h \
../lexlib/CatalogueModules.h \
../src/Catalogue.h
+CatalogueL.o: \
+ ../src/Catalogue.cxx \
+ ../include/ILexer.h \
+ ../include/Sci_Position.h \
+ ../include/Scintilla.h \
+ ../include/SciLexer.h \
+ ../lexlib/LexerModule.h \
+ ../lexlib/CatalogueModules.h \
+ ../src/Catalogue.h
CellBuffer.o: \
../src/CellBuffer.cxx \
../include/Platform.h \
diff --git a/win32/makefile b/win32/makefile
index 1b5ce451b..0bb3d0d8f 100644
--- a/win32/makefile
+++ b/win32/makefile
@@ -117,6 +117,7 @@ SRC_OBJS = \
MarginView.o \
PerLine.o \
PositionCache.o \
+ PropSetSimple.o \
RESearch.o \
RunStyles.o \
Selection.o \
@@ -129,13 +130,12 @@ SRC_OBJS = \
# Required by lexers
LEXLIB_OBJS = \
Accessor.o \
- Catalogue.o \
+ CatalogueL.o \
DefaultLexer.o \
ExternalLexer.o \
LexerBase.o \
LexerModule.o \
LexerSimple.o \
- PropSetSimple.o \
StyleContext.o \
WordList.o
@@ -152,12 +152,18 @@ SCILEX_OBJS=\
COMPONENT_OBJS = \
$(SRC_OBJS) \
+ Accessor.o \
+ Catalogue.o \
HanjaDic.o \
+ LexerBase.o \
+ LexerModule.o \
+ LexerSimple.o \
PlatWin.o \
ScintillaBase.o \
ScintillaDLL.o \
ScintillaWin.o \
- ScintRes.o
+ ScintRes.o \
+ WordList.o
LEXCOMPONENT_OBJS = \
$(SCILEX_OBJS) \
@@ -180,6 +186,12 @@ include deps.mak
ScintillaBaseL.o:
$(CXX) $(CXX_ALL_FLAGS) $(CXXFLAGS) -D SCI_LEXER -c $< -o $@
+Catalogue.o: Catalogue.cxx
+ $(CXX) $(CXX_ALL_FLAGS) $(CXXFLAGS) -D SCI_LEXER -D SCI_EMPTYCATALOGUE -c $< -o $@
+
+CatalogueL.o: Catalogue.cxx
+ $(CXX) $(CXX_ALL_FLAGS) $(CXXFLAGS) -D SCI_LEXER -c $< -o $@
+
ScintRes.o: ScintRes.rc
$(WINDRES) ScintRes.rc $@
diff --git a/win32/nmdeps.mak b/win32/nmdeps.mak
index 79cc0ab45..8a886b517 100644
--- a/win32/nmdeps.mak
+++ b/win32/nmdeps.mak
@@ -96,6 +96,15 @@ $(DIR_O)/Catalogue.obj: \
../lexlib/LexerModule.h \
../lexlib/CatalogueModules.h \
../src/Catalogue.h
+$(DIR_O)/CatalogueL.obj: \
+ ../src/Catalogue.cxx \
+ ../include/ILexer.h \
+ ../include/Sci_Position.h \
+ ../include/Scintilla.h \
+ ../include/SciLexer.h \
+ ../lexlib/LexerModule.h \
+ ../lexlib/CatalogueModules.h \
+ ../src/Catalogue.h
$(DIR_O)/CellBuffer.obj: \
../src/CellBuffer.cxx \
../include/Platform.h \
diff --git a/win32/scintilla.mak b/win32/scintilla.mak
index f9b0a4bdf..d446bb262 100644
--- a/win32/scintilla.mak
+++ b/win32/scintilla.mak
@@ -230,7 +230,7 @@ LEX_OBJS=\
# Required by lexers
LEXLIB_OBJS = \
$(DIR_O)\Accessor.obj \
- $(DIR_O)\Catalogue.obj \
+ $(DIR_O)\CatalogueL.obj \
$(DIR_O)\ExternalLexer.obj \
$(DIR_O)\DefaultLexer.obj \
$(DIR_O)\LexerBase.obj \
@@ -250,11 +250,17 @@ SCILEX_OBJS = \
$(DIR_O)\ScintillaWin.obj
COMPONENT_OBJS = \
+ $(DIR_O)\Accessor.obj \
+ $(DIR_O)\Catalogue.obj \
$(DIR_O)\HanjaDic.obj \
+ $(DIR_O)\LexerBase.obj \
+ $(DIR_O)\LexerModule.obj \
+ $(DIR_O)\LexerSimple.obj \
$(DIR_O)\PlatWin.obj \
$(DIR_O)\ScintillaBase.obj \
$(DIR_O)\ScintillaDLL.obj \
$(DIR_O)\ScintillaWin.obj \
+ $(DIR_O)\WordList.obj \
$(SRC_OBJS)
LEXCOMPONENT_OBJS = \
@@ -288,6 +294,12 @@ $(LIBSCI): $(SCILEX_OBJS)
$(DIR_O)\ScintillaBaseL.obj: ..\src\ScintillaBase.cxx
$(CXX) $(CXXFLAGS) -DSCI_LEXER -c $(NAME)$@ ..\src\ScintillaBase.cxx
+$(DIR_O)\CatalogueL.obj: ..\src\Catalogue.cxx
+ $(CXX) $(CXXFLAGS) -DSCI_LEXER -c $(NAME)$@ ..\src\Catalogue.cxx
+
+$(DIR_O)\Catalogue.obj: ..\src\Catalogue.cxx
+ $(CXX) $(CXXFLAGS) -DSCI_LEXER -DSCI_EMPTYCATALOGUE -c $(NAME)$@ ..\src\Catalogue.cxx
+
# Dependencies
!IF EXISTS(nmdeps.mak)