diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/Catalogue.cxx | 5 | ||||
| -rw-r--r-- | src/ExternalLexer.cxx | 6 |
2 files changed, 5 insertions, 6 deletions
diff --git a/src/Catalogue.cxx b/src/Catalogue.cxx index 97548f95e..b5a4dde4c 100644 --- a/src/Catalogue.cxx +++ b/src/Catalogue.cxx @@ -24,7 +24,6 @@ using namespace Scintilla; static std::vector<LexerModule *> lexerCatalogue; -static int nextLanguage = SCLEX_AUTOMATIC+1; const LexerModule *Catalogue::Find(int language) { Scintilla_LinkLexers(); @@ -49,10 +48,6 @@ const LexerModule *Catalogue::Find(const char *languageName) { } void Catalogue::AddLexerModule(LexerModule *plm) { - if (plm->GetLanguage() == SCLEX_AUTOMATIC) { - plm->language = nextLanguage; - nextLanguage++; - } lexerCatalogue.push_back(plm); } diff --git a/src/ExternalLexer.cxx b/src/ExternalLexer.cxx index 81e01b179..c6a505007 100644 --- a/src/ExternalLexer.cxx +++ b/src/ExternalLexer.cxx @@ -34,6 +34,8 @@ using namespace Scintilla; namespace { +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); @@ -137,7 +139,9 @@ LexerLibrary::LexerLibrary(const char *moduleName_) { // Assign a buffer for the lexer name. char lexname[100] = ""; GetLexerName(i, lexname, sizeof(lexname)); - ExternalLexerModule *lex = new ExternalLexerModule(SCLEX_AUTOMATIC, nullptr, lexname, nullptr); + ExternalLexerModule *lex = new ExternalLexerModule(nextLanguage, nullptr, lexname, nullptr); + nextLanguage++; + // This is storing a second reference to lex in the Catalogue as well as in modules. // TODO: Should use std::shared_ptr or similar to ensure allocation safety. Catalogue::AddLexerModule(lex); |
