aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Catalogue.cxx29
-rw-r--r--src/ScintillaBase.cxx3
2 files changed, 13 insertions, 19 deletions
diff --git a/src/Catalogue.cxx b/src/Catalogue.cxx
index a6aed901d..d9e0172d5 100644
--- a/src/Catalogue.cxx
+++ b/src/Catalogue.cxx
@@ -19,36 +19,27 @@
#include "SciLexer.h"
#include "LexerModule.h"
+#include "CatalogueModules.h"
#include "Catalogue.h"
using namespace Scintilla;
-static std::vector<LexerModule *> lexerCatalogue;
+namespace {
+
+CatalogueModules catalogueDefault;
+
+}
const LexerModule *Catalogue::Find(int language) {
- Scintilla_LinkLexers();
- for (const LexerModule *lm : lexerCatalogue) {
- if (lm->GetLanguage() == language) {
- return lm;
- }
- }
- return nullptr;
+ return catalogueDefault.Find(language);
}
const LexerModule *Catalogue::Find(const char *languageName) {
- Scintilla_LinkLexers();
- if (languageName) {
- for (const LexerModule *lm : lexerCatalogue) {
- if (lm->languageName && (0 == strcmp(lm->languageName, languageName))) {
- return lm;
- }
- }
- }
- return nullptr;
+ return catalogueDefault.Find(languageName);
}
void Catalogue::AddLexerModule(LexerModule *plm) {
- lexerCatalogue.push_back(plm);
+ catalogueDefault.AddLexerModule(plm);
}
// To add or remove a lexer, add or remove its file and run LexGen.py.
@@ -63,7 +54,7 @@ int Scintilla_LinkLexers() {
initialised = 1;
// Shorten the code that declares a lexer and ensures it is linked in by calling a method.
-#define LINK_LEXER(lexer) extern LexerModule lexer; Catalogue::AddLexerModule(&lexer);
+#define LINK_LEXER(lexer) extern LexerModule lexer; catalogueDefault.AddLexerModule(&lexer);
//++Autogenerated -- run scripts/LexGen.py to regenerate
//**\(\tLINK_LEXER(\*);\n\)
diff --git a/src/ScintillaBase.cxx b/src/ScintillaBase.cxx
index c9eb18346..f165f92e2 100644
--- a/src/ScintillaBase.cxx
+++ b/src/ScintillaBase.cxx
@@ -73,6 +73,9 @@ ScintillaBase::ScintillaBase() {
listType = 0;
maxListWidth = 0;
multiAutoCMode = SC_MULTIAUTOC_ONCE;
+#ifdef SCI_LEXER
+ Scintilla_LinkLexers();
+#endif
}
ScintillaBase::~ScintillaBase() {