aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/ExternalLexer.cxx
diff options
context:
space:
mode:
authorNeil <nyamatongwe@gmail.com>2019-12-13 12:07:44 +1100
committerNeil <nyamatongwe@gmail.com>2019-12-13 12:07:44 +1100
commitc22da1b953a641c5f420d3d4ca9093a2f74d209a (patch)
treec57d3d2c2a85c00352f8132ad3481fb9c0620831 /src/ExternalLexer.cxx
parent44613f75e63cf67cee55ac5fe8dad8ad35151165 (diff)
downloadscintilla-mirror-c22da1b953a641c5f420d3d4ca9093a2f74d209a.tar.gz
Backport: Move automatic numbering of external lexers from Catalogue to ExternalLexer.
This is preparing to move much of Catalogue into a header for reuse. Backport of changeset 7864:616ca0866c49.
Diffstat (limited to 'src/ExternalLexer.cxx')
-rw-r--r--src/ExternalLexer.cxx6
1 files changed, 5 insertions, 1 deletions
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);