diff options
Diffstat (limited to 'src/Catalogue.cxx')
-rw-r--r-- | src/Catalogue.cxx | 29 |
1 files changed, 10 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\) |