aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorNeil <nyamatongwe@gmail.com>2019-12-31 15:50:48 +1100
committerNeil <nyamatongwe@gmail.com>2019-12-31 15:50:48 +1100
commitf142d93df48c3b9e07edd25425627ddeeb071520 (patch)
treef7b50820c0c62966e7a384ec8e5a6e689db44c39 /src
parent431daa97eb571282cdbc9c787098ad17f811e924 (diff)
downloadscintilla-mirror-f142d93df48c3b9e07edd25425627ddeeb071520.tar.gz
Move collection of modules from Catalogue.cxx to CatalogueModules.h so it can
be reused.
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() {