aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ExternalLexer.cxx40
-rw-r--r--src/ExternalLexer.h2
-rw-r--r--src/ScintillaBase.cxx41
-rw-r--r--src/ScintillaBase.h5
4 files changed, 36 insertions, 52 deletions
diff --git a/src/ExternalLexer.cxx b/src/ExternalLexer.cxx
index eae5806ee..748789ed0 100644
--- a/src/ExternalLexer.cxx
+++ b/src/ExternalLexer.cxx
@@ -39,7 +39,6 @@ int nextLanguage = SCLEX_AUTOMATIC + 1;
typedef int (EXT_LEXER_DECL *GetLexerCountFn)();
typedef void (EXT_LEXER_DECL *GetLexerNameFn)(unsigned int Index, char *name, int buflength);
typedef LexerFactoryFunction(EXT_LEXER_DECL *GetLexerFactoryFunction)(unsigned int Index);
-typedef LexerFactoryFunction5(EXT_LEXER_DECL *GetLexerFactoryFunction5)(unsigned int Index);
/// Generic function to convert from a void* to a function pointer.
/// This avoids undefined and conditionally defined behaviour.
@@ -55,17 +54,15 @@ T FunctionPointer(void *function) noexcept {
class ExternalLexerModule : public LexerModule {
protected:
GetLexerFactoryFunction fneFactory;
- GetLexerFactoryFunction5 fneFactory5;
std::string name;
public:
ExternalLexerModule(int language_, LexerFunction fnLexer_,
const char *languageName_=nullptr, LexerFunction fnFolder_=nullptr) :
LexerModule(language_, fnLexer_, nullptr, fnFolder_),
- fneFactory(nullptr), fneFactory5(nullptr), name(languageName_){
+ fneFactory(nullptr), name(languageName_){
languageName = name.c_str();
}
void SetExternal(GetLexerFactoryFunction fFactory, int index) noexcept;
- void SetExternal(GetLexerFactoryFunction5 fFactory, int index) noexcept;
};
/// LexerLibrary exists for every External Lexer DLL, contains ExternalLexerModules.
@@ -73,7 +70,7 @@ class LexerLibrary {
std::unique_ptr<DynamicLibrary> lib;
std::vector<std::unique_ptr<ExternalLexerModule>> modules;
public:
- explicit LexerLibrary(const char *moduleName_, bool iLexer5=false);
+ explicit LexerLibrary(const char *moduleName_);
~LexerLibrary();
std::string moduleName;
@@ -87,7 +84,7 @@ public:
static LexerManager *GetInstance();
static void DeleteInstance() noexcept;
- void Load(const char *path, bool iLexer5=false);
+ void Load(const char *path);
void Clear() noexcept;
private:
@@ -114,18 +111,13 @@ void ExternalLexerModule::SetExternal(GetLexerFactoryFunction fFactory, int inde
fnFactory = fFactory(index);
}
-void ExternalLexerModule::SetExternal(GetLexerFactoryFunction5 fFactory5, int index) noexcept {
- fneFactory5 = fFactory5;
- fnFactory5 = fFactory5(index);
-}
-
//------------------------------------------
//
// LexerLibrary
//
//------------------------------------------
-LexerLibrary::LexerLibrary(const char *moduleName_, bool iLexer5) {
+LexerLibrary::LexerLibrary(const char *moduleName_) {
// Load the DLL
lib.reset(DynamicLibrary::Load(moduleName_));
if (lib->IsValid()) {
@@ -135,14 +127,9 @@ LexerLibrary::LexerLibrary(const char *moduleName_, bool iLexer5) {
if (GetLexerCount) {
// Find functions in the DLL
GetLexerNameFn GetLexerName = FunctionPointer<GetLexerNameFn>(lib->FindFunction("GetLexerName"));
- GetLexerFactoryFunction fnFactory = nullptr;
- GetLexerFactoryFunction5 fnFactory5 = nullptr;
- if (!iLexer5)
- fnFactory = FunctionPointer<GetLexerFactoryFunction>(lib->FindFunction("GetLexerFactory"));
- else
- fnFactory5 = FunctionPointer<GetLexerFactoryFunction5>(lib->FindFunction("GetLexerFactory"));
-
- if (!GetLexerName || (!fnFactory && !fnFactory5)) {
+ GetLexerFactoryFunction fnFactory = FunctionPointer<GetLexerFactoryFunction>(lib->FindFunction("GetLexerFactory"));
+
+ if (!GetLexerName || !fnFactory) {
return;
}
@@ -164,10 +151,7 @@ LexerLibrary::LexerLibrary(const char *moduleName_, bool iLexer5) {
// The external lexer needs to know how to call into its DLL to
// do its lexing and folding, we tell it here.
- if (!iLexer5)
- lex->SetExternal(fnFactory, i);
- else
- lex->SetExternal(fnFactory5, i);
+ lex->SetExternal(fnFactory, i);
}
}
}
@@ -202,12 +186,12 @@ LexerManager::~LexerManager() {
Clear();
}
-void LexerManager::Load(const char *path, bool iLexer5) {
+void LexerManager::Load(const char *path) {
for (const std::unique_ptr<LexerLibrary> &ll : libraries) {
if (ll->moduleName == path)
return;
}
- libraries.push_back(Sci::make_unique<LexerLibrary>(path, iLexer5));
+ libraries.push_back(Sci::make_unique<LexerLibrary>(path));
}
void LexerManager::Clear() noexcept {
@@ -230,8 +214,8 @@ LMMinder minder;
namespace Scintilla {
-void ExternalLexerLoad(const char *path, bool iLexer5) {
- LexerManager::GetInstance()->Load(path, iLexer5);
+void ExternalLexerLoad(const char *path) {
+ LexerManager::GetInstance()->Load(path);
}
}
diff --git a/src/ExternalLexer.h b/src/ExternalLexer.h
index 736b91531..d0a615e31 100644
--- a/src/ExternalLexer.h
+++ b/src/ExternalLexer.h
@@ -10,7 +10,7 @@
namespace Scintilla {
-void ExternalLexerLoad(const char *path, bool iLexer5=false);
+void ExternalLexerLoad(const char *path);
}
diff --git a/src/ScintillaBase.cxx b/src/ScintillaBase.cxx
index 92d8577a8..082cb82d5 100644
--- a/src/ScintillaBase.cxx
+++ b/src/ScintillaBase.cxx
@@ -23,13 +23,17 @@
#include "ILexer.h"
#include "Scintilla.h"
+#ifdef SCI_LEXER
#include "SciLexer.h"
+#endif
#include "PropSetSimple.h"
#include "CharacterCategory.h"
+#ifdef SCI_LEXER
#include "LexerModule.h"
#include "Catalogue.h"
+#endif
#include "Position.h"
#include "UniqueString.h"
@@ -57,7 +61,9 @@
#include "AutoComplete.h"
#include "ScintillaBase.h"
+#ifdef SCI_LEXER
#include "ExternalLexer.h"
+#endif
using namespace Scintilla;
@@ -542,6 +548,8 @@ void ScintillaBase::RightButtonDownWithModifiers(Point pt, unsigned int curTime,
Editor::RightButtonDownWithModifiers(pt, curTime, modifiers);
}
+#ifdef SCI_LEXER
+
namespace Scintilla {
class LexState : public LexInterface {
@@ -553,7 +561,6 @@ 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;
@@ -562,10 +569,8 @@ 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();
@@ -608,15 +613,6 @@ LexState::~LexState() {
}
}
-void LexState::SetInstance(ILexer *instance_) {
- if (instance) {
- instance->Release();
- instance = nullptr;
- }
- instance = instance_;
- pdoc->LexerChanged();
-}
-
LexState *ScintillaBase::DocumentLexState() {
if (!pdoc->GetLexInterface()) {
pdoc->SetLexInterface(Sci::make_unique<LexState>(pdoc));
@@ -845,7 +841,10 @@ 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());
@@ -854,11 +853,14 @@ 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) {
@@ -1056,6 +1058,7 @@ 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;
@@ -1063,14 +1066,6 @@ 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));
@@ -1107,11 +1102,9 @@ 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);
+ ExternalLexerLoad(ConstCharPtrFromSPtr(lParam));
break;
-#endif
case SCI_PRIVATELEXERCALL:
return reinterpret_cast<sptr_t>(
@@ -1183,6 +1176,8 @@ 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 fcb1c9796..a558922bc 100644
--- a/src/ScintillaBase.h
+++ b/src/ScintillaBase.h
@@ -10,7 +10,10 @@
namespace Scintilla {
+#ifdef SCI_LEXER
class LexState;
+#endif
+
/**
*/
class ScintillaBase : public Editor, IListBoxDelegate {
@@ -41,10 +44,12 @@ protected:
int maxListWidth; /// Maximum width of list, in average character widths
int multiAutoCMode; /// Mode for autocompleting when multiple selections are present
+#if 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.