1 // Scintilla source code edit control
3 ** Colourise for particular languages.
5 // Copyright 1998-2002 by Neil Hodgson <neilh@scintilla.org>
6 // The License.txt file describes the conditions under which this software may be distributed.
18 #include "Scintilla.h"
21 #include "LexerModule.h"
22 #include "Catalogue.h"
25 using namespace Scintilla
;
28 static std::vector
<LexerModule
*> lexerCatalogue
;
29 static int nextLanguage
= SCLEX_AUTOMATIC
+1;
31 const LexerModule
*Catalogue::Find(int language
) {
32 Scintilla_LinkLexers();
33 for (std::vector
<LexerModule
*>::iterator it
=lexerCatalogue
.begin();
34 it
!= lexerCatalogue
.end(); ++it
) {
35 if ((*it
)->GetLanguage() == language
) {
42 const LexerModule
*Catalogue::Find(const char *languageName
) {
43 Scintilla_LinkLexers();
45 for (std::vector
<LexerModule
*>::iterator it
=lexerCatalogue
.begin();
46 it
!= lexerCatalogue
.end(); ++it
) {
47 if ((*it
)->languageName
&& (0 == strcmp((*it
)->languageName
, languageName
))) {
55 void Catalogue::AddLexerModule(LexerModule
*plm
) {
56 if (plm
->GetLanguage() == SCLEX_AUTOMATIC
) {
57 plm
->language
= nextLanguage
;
60 lexerCatalogue
.push_back(plm
);
63 // Alternative historical name for Scintilla_LinkLexers
64 int wxForceScintillaLexers(void) {
65 return Scintilla_LinkLexers();
68 // To add or remove a lexer, add or remove its file and run LexGen.py.
70 // Force a reference to all of the Scintilla lexers so that the linker will
71 // not remove the code of the lexers.
72 int Scintilla_LinkLexers() {
74 static int initialised
= 0;
79 // Shorten the code that declares a lexer and ensures it is linked in by calling a method.
80 #define LINK_LEXER(lexer) extern LexerModule lexer; Catalogue::AddLexerModule(&lexer);
82 //++Autogenerated -- run src/LexGen.py to regenerate
83 //**\(\tLINK_LEXER(\*);\n\)
99 LINK_LEXER(lmFortran
);
100 LINK_LEXER(lmFreeBasic
);
101 LINK_LEXER(lmHaskell
);
107 LINK_LEXER(lmMarkdown
);
108 // We use Octave instead of Matlab
111 LINK_LEXER(lmOctave
);
112 LINK_LEXER(lmPascal
);
116 LINK_LEXER(lmPython
);
121 LINK_LEXER(lmTxt2tags
);
122 LINK_LEXER(lmVerilog
);
127 //--Autogenerated -- end of automatically generated section