updated Scintilla to 2.29
[TortoiseGit.git] / ext / scintilla / src / Catalogue.cxx
blob6de53fc5978dfd7e62d2d657c1defb7e6b9f835a
1 // Scintilla source code edit control
2 /** @file KeyWords.cxx
3 ** Colourise for particular languages.
4 **/
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.
8 #include <stdlib.h>
9 #include <string.h>
10 #include <ctype.h>
11 #include <stdio.h>
12 #include <stdarg.h>
13 #include <assert.h>
15 #include <vector>
17 #include "ILexer.h"
18 #include "Scintilla.h"
19 #include "SciLexer.h"
21 #include "LexerModule.h"
22 #include "Catalogue.h"
24 #ifdef SCI_NAMESPACE
25 using namespace Scintilla;
26 #endif
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) {
36 return *it;
39 return 0;
42 const LexerModule *Catalogue::Find(const char *languageName) {
43 Scintilla_LinkLexers();
44 if (languageName) {
45 for (std::vector<LexerModule *>::iterator it=lexerCatalogue.begin();
46 it != lexerCatalogue.end(); ++it) {
47 if ((*it)->languageName && (0 == strcmp((*it)->languageName, languageName))) {
48 return *it;
52 return 0;
55 void Catalogue::AddLexerModule(LexerModule *plm) {
56 if (plm->GetLanguage() == SCLEX_AUTOMATIC) {
57 plm->language = nextLanguage;
58 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;
75 if (initialised)
76 return 0;
77 initialised = 1;
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\)
84 LINK_LEXER(lmA68k);
85 LINK_LEXER(lmAbaqus);
86 LINK_LEXER(lmAda);
87 LINK_LEXER(lmAns1);
88 LINK_LEXER(lmAPDL);
89 LINK_LEXER(lmAsm);
90 LINK_LEXER(lmASY);
91 LINK_LEXER(lmAU3);
92 LINK_LEXER(lmAVE);
93 LINK_LEXER(lmBaan);
94 LINK_LEXER(lmBash);
95 LINK_LEXER(lmBatch);
96 LINK_LEXER(lmBlitzBasic);
97 LINK_LEXER(lmBullant);
98 LINK_LEXER(lmCaml);
99 LINK_LEXER(lmClw);
100 LINK_LEXER(lmClwNoCase);
101 LINK_LEXER(lmCmake);
102 LINK_LEXER(lmCOBOL);
103 LINK_LEXER(lmConf);
104 LINK_LEXER(lmCPP);
105 LINK_LEXER(lmCPPNoCase);
106 LINK_LEXER(lmCsound);
107 LINK_LEXER(lmCss);
108 LINK_LEXER(lmD);
109 LINK_LEXER(lmDiff);
110 LINK_LEXER(lmEiffel);
111 LINK_LEXER(lmEiffelkw);
112 LINK_LEXER(lmErlang);
113 LINK_LEXER(lmErrorList);
114 LINK_LEXER(lmESCRIPT);
115 LINK_LEXER(lmF77);
116 LINK_LEXER(lmFlagShip);
117 LINK_LEXER(lmForth);
118 LINK_LEXER(lmFortran);
119 LINK_LEXER(lmFreeBasic);
120 LINK_LEXER(lmGAP);
121 LINK_LEXER(lmGui4Cli);
122 LINK_LEXER(lmHaskell);
123 LINK_LEXER(lmHTML);
124 LINK_LEXER(lmInno);
125 LINK_LEXER(lmKix);
126 LINK_LEXER(lmLatex);
127 LINK_LEXER(lmLISP);
128 LINK_LEXER(lmLot);
129 LINK_LEXER(lmLout);
130 LINK_LEXER(lmLua);
131 LINK_LEXER(lmMagikSF);
132 LINK_LEXER(lmMake);
133 LINK_LEXER(lmMarkdown);
134 LINK_LEXER(lmMatlab);
135 LINK_LEXER(lmMETAPOST);
136 LINK_LEXER(lmMMIXAL);
137 LINK_LEXER(lmModula);
138 LINK_LEXER(lmMSSQL);
139 LINK_LEXER(lmMySQL);
140 LINK_LEXER(lmNimrod);
141 LINK_LEXER(lmNncrontab);
142 LINK_LEXER(lmNsis);
143 LINK_LEXER(lmNull);
144 LINK_LEXER(lmOctave);
145 LINK_LEXER(lmOpal);
146 LINK_LEXER(lmPascal);
147 LINK_LEXER(lmPB);
148 LINK_LEXER(lmPerl);
149 LINK_LEXER(lmPHPSCRIPT);
150 LINK_LEXER(lmPLM);
151 LINK_LEXER(lmPo);
152 LINK_LEXER(lmPOV);
153 LINK_LEXER(lmPowerPro);
154 LINK_LEXER(lmPowerShell);
155 LINK_LEXER(lmProgress);
156 LINK_LEXER(lmProps);
157 LINK_LEXER(lmPS);
158 LINK_LEXER(lmPureBasic);
159 LINK_LEXER(lmPython);
160 LINK_LEXER(lmR);
161 LINK_LEXER(lmREBOL);
162 LINK_LEXER(lmRuby);
163 LINK_LEXER(lmScriptol);
164 LINK_LEXER(lmSmalltalk);
165 LINK_LEXER(lmSML);
166 LINK_LEXER(lmSorc);
167 LINK_LEXER(lmSpecman);
168 LINK_LEXER(lmSpice);
169 LINK_LEXER(lmSQL);
170 LINK_LEXER(lmTACL);
171 LINK_LEXER(lmTADS3);
172 LINK_LEXER(lmTAL);
173 LINK_LEXER(lmTCL);
174 LINK_LEXER(lmTeX);
175 LINK_LEXER(lmTxt2tags);
176 LINK_LEXER(lmVB);
177 LINK_LEXER(lmVBScript);
178 LINK_LEXER(lmVerilog);
179 LINK_LEXER(lmVHDL);
180 LINK_LEXER(lmXML);
181 LINK_LEXER(lmYAML);
183 //--Autogenerated -- end of automatically generated section
185 return 1;