1 // Scintilla source code edit control
2 /** @file Catalogue.cxx
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.
16 #include "Scintilla.h"
19 #include "LexerModule.h"
20 #include "Catalogue.h"
22 using namespace Scintilla
;
24 static std::vector
<LexerModule
*> lexerCatalogue
;
25 static int nextLanguage
= SCLEX_AUTOMATIC
+1;
27 const LexerModule
*Catalogue::Find(int language
) {
28 Scintilla_LinkLexers();
29 for (const LexerModule
*lm
: lexerCatalogue
) {
30 if (lm
->GetLanguage() == language
) {
37 const LexerModule
*Catalogue::Find(const char *languageName
) {
38 Scintilla_LinkLexers();
40 for (const LexerModule
*lm
: lexerCatalogue
) {
41 if (lm
->languageName
&& (0 == strcmp(lm
->languageName
, languageName
))) {
49 void Catalogue::AddLexerModule(LexerModule
*plm
) {
50 if (plm
->GetLanguage() == SCLEX_AUTOMATIC
) {
51 plm
->language
= nextLanguage
;
54 lexerCatalogue
.push_back(plm
);
57 // To add or remove a lexer, add or remove its file and run LexGen.py.
59 // Force a reference to all of the Scintilla lexers so that the linker will
60 // not remove the code of the lexers.
61 int Scintilla_LinkLexers() {
63 static int initialised
= 0;
68 // Shorten the code that declares a lexer and ensures it is linked in by calling a method.
69 #define LINK_LEXER(lexer) extern LexerModule lexer; Catalogue::AddLexerModule(&lexer);
71 //++Autogenerated -- run scripts/LexGen.py to regenerate
72 //**\(\tLINK_LEXER(\*);\n\)
88 LINK_LEXER(lmBlitzBasic
);
89 LINK_LEXER(lmBullant
);
92 LINK_LEXER(lmClwNoCase
);
95 LINK_LEXER(lmCoffeeScript
);
98 LINK_LEXER(lmCPPNoCase
);
106 LINK_LEXER(lmEDIFACT
);
107 LINK_LEXER(lmEiffel
);
108 LINK_LEXER(lmEiffelkw
);
109 LINK_LEXER(lmErlang
);
110 LINK_LEXER(lmErrorList
);
111 LINK_LEXER(lmESCRIPT
);
113 LINK_LEXER(lmFlagShip
);
115 LINK_LEXER(lmFortran
);
116 LINK_LEXER(lmFreeBasic
);
118 LINK_LEXER(lmGui4Cli
);
119 LINK_LEXER(lmHaskell
);
122 LINK_LEXER(lmIndent
);
129 LINK_LEXER(lmLiterateHaskell
);
133 LINK_LEXER(lmMagikSF
);
135 LINK_LEXER(lmMarkdown
);
136 LINK_LEXER(lmMatlab
);
137 LINK_LEXER(lmMETAPOST
);
138 LINK_LEXER(lmMMIXAL
);
139 LINK_LEXER(lmModula
);
142 LINK_LEXER(lmNimrod
);
143 LINK_LEXER(lmNncrontab
);
146 LINK_LEXER(lmOctave
);
148 LINK_LEXER(lmOScript
);
149 LINK_LEXER(lmPascal
);
152 LINK_LEXER(lmPHPSCRIPT
);
156 LINK_LEXER(lmPowerPro
);
157 LINK_LEXER(lmPowerShell
);
158 LINK_LEXER(lmProgress
);
161 LINK_LEXER(lmPureBasic
);
162 LINK_LEXER(lmPython
);
165 LINK_LEXER(lmRegistry
);
168 LINK_LEXER(lmScriptol
);
169 LINK_LEXER(lmSmalltalk
);
172 LINK_LEXER(lmSpecman
);
184 LINK_LEXER(lmTxt2tags
);
186 LINK_LEXER(lmVBScript
);
187 LINK_LEXER(lmVerilog
);
189 LINK_LEXER(lmVisualProlog
);
193 //--Autogenerated -- end of automatically generated section