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\)
96 LINK_LEXER(lmBlitzBasic
);
97 LINK_LEXER(lmBullant
);
100 LINK_LEXER(lmClwNoCase
);
105 LINK_LEXER(lmCPPNoCase
);
106 LINK_LEXER(lmCsound
);
110 LINK_LEXER(lmEiffel
);
111 LINK_LEXER(lmEiffelkw
);
112 LINK_LEXER(lmErlang
);
113 LINK_LEXER(lmErrorList
);
114 LINK_LEXER(lmESCRIPT
);
116 LINK_LEXER(lmFlagShip
);
118 LINK_LEXER(lmFortran
);
119 LINK_LEXER(lmFreeBasic
);
121 LINK_LEXER(lmGui4Cli
);
122 LINK_LEXER(lmHaskell
);
131 LINK_LEXER(lmMagikSF
);
133 LINK_LEXER(lmMarkdown
);
134 LINK_LEXER(lmMatlab
);
135 LINK_LEXER(lmMETAPOST
);
136 LINK_LEXER(lmMMIXAL
);
137 LINK_LEXER(lmModula
);
140 LINK_LEXER(lmNimrod
);
141 LINK_LEXER(lmNncrontab
);
144 LINK_LEXER(lmOctave
);
146 LINK_LEXER(lmPascal
);
149 LINK_LEXER(lmPHPSCRIPT
);
153 LINK_LEXER(lmPowerPro
);
154 LINK_LEXER(lmPowerShell
);
155 LINK_LEXER(lmProgress
);
158 LINK_LEXER(lmPureBasic
);
159 LINK_LEXER(lmPython
);
163 LINK_LEXER(lmScriptol
);
164 LINK_LEXER(lmSmalltalk
);
167 LINK_LEXER(lmSpecman
);
175 LINK_LEXER(lmTxt2tags
);
177 LINK_LEXER(lmVBScript
);
178 LINK_LEXER(lmVerilog
);
183 //--Autogenerated -- end of automatically generated section