]>
git.saurik.com Git - wxWidgets.git/blob - src/stc/scintilla/src/KeyWords.cxx
29538d57b5aa7dbcfbb20648bc64e39cda7a9d78
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.
19 #include "Scintilla.h"
23 using namespace Scintilla
;
26 const LexerModule
*LexerModule::base
= 0;
27 int LexerModule::nextLanguage
= SCLEX_AUTOMATIC
+1;
29 LexerModule::LexerModule(int language_
,
30 LexerFunction fnLexer_
,
31 const char *languageName_
,
32 LexerFunction fnFolder_
,
33 const char * const wordListDescriptions_
[],
38 wordListDescriptions(wordListDescriptions_
),
39 styleBits(styleBits_
),
40 languageName(languageName_
) {
43 if (language
== SCLEX_AUTOMATIC
) {
44 language
= nextLanguage
;
49 int LexerModule::GetNumWordLists() const {
50 if (wordListDescriptions
== NULL
) {
55 while (wordListDescriptions
[numWordLists
]) {
63 const char *LexerModule::GetWordListDescription(int index
) const {
64 static const char *emptyStr
= "";
66 PLATFORM_ASSERT(index
< GetNumWordLists());
67 if (index
>= GetNumWordLists()) {
70 return wordListDescriptions
[index
];
74 int LexerModule::GetStyleBitsNeeded() const {
78 const LexerModule
*LexerModule::Find(int language
) {
79 const LexerModule
*lm
= base
;
81 if (lm
->language
== language
) {
89 const LexerModule
*LexerModule::Find(const char *languageName
) {
91 const LexerModule
*lm
= base
;
93 if (lm
->languageName
&& 0 == strcmp(lm
->languageName
, languageName
)) {
102 void LexerModule::Lex(unsigned int startPos
, int lengthDoc
, int initStyle
,
103 WordList
*keywordlists
[], Accessor
&styler
) const {
105 fnLexer(startPos
, lengthDoc
, initStyle
, keywordlists
, styler
);
108 void LexerModule::Fold(unsigned int startPos
, int lengthDoc
, int initStyle
,
109 WordList
*keywordlists
[], Accessor
&styler
) const {
111 int lineCurrent
= styler
.GetLine(startPos
);
112 // Move back one line in case deletion wrecked current line fold state
113 if (lineCurrent
> 0) {
115 int newStartPos
= styler
.LineStart(lineCurrent
);
116 lengthDoc
+= startPos
- newStartPos
;
117 startPos
= newStartPos
;
120 initStyle
= styler
.StyleAt(startPos
- 1);
123 fnFolder(startPos
, lengthDoc
, initStyle
, keywordlists
, styler
);
127 // Alternative historical name for Scintilla_LinkLexers
128 int wxForceScintillaLexers(void) {
129 return Scintilla_LinkLexers();
132 // To add or remove a lexer, add or remove its file and run LexGen.py.
134 // Force a reference to all of the Scintilla lexers so that the linker will
135 // not remove the code of the lexers.
136 int Scintilla_LinkLexers() {
137 static int forcer
= 0;
139 // Shorten the code that declares a lexer and ensures it is linked in by calling a method.
140 #define LINK_LEXER(lexer) extern LexerModule lexer; forcer += lexer.GetLanguage();
142 //++Autogenerated -- run src/LexGen.py to regenerate
143 //**\(\tLINK_LEXER(\*);\n\)
144 LINK_LEXER(lmAbaqus
);
156 LINK_LEXER(lmBlitzBasic
);
157 LINK_LEXER(lmBullant
);
160 LINK_LEXER(lmClwNoCase
);
164 LINK_LEXER(lmCPPNoCase
);
165 LINK_LEXER(lmCsound
);
169 LINK_LEXER(lmEiffel
);
170 LINK_LEXER(lmEiffelkw
);
171 LINK_LEXER(lmErlang
);
172 LINK_LEXER(lmErrorList
);
173 LINK_LEXER(lmESCRIPT
);
175 LINK_LEXER(lmFlagShip
);
177 LINK_LEXER(lmFortran
);
178 LINK_LEXER(lmFreeBasic
);
180 LINK_LEXER(lmGui4Cli
);
181 LINK_LEXER(lmHaskell
);
191 LINK_LEXER(lmMatlab
);
192 LINK_LEXER(lmMETAPOST
);
193 LINK_LEXER(lmMMIXAL
);
195 LINK_LEXER(lmNncrontab
);
198 LINK_LEXER(lmOctave
);
200 LINK_LEXER(lmPascal
);
204 LINK_LEXER(lmPHPSCRIPT
);
207 LINK_LEXER(lmProgress
);
210 LINK_LEXER(lmPureBasic
);
211 LINK_LEXER(lmPython
);
215 LINK_LEXER(lmScriptol
);
216 LINK_LEXER(lmSmalltalk
);
217 LINK_LEXER(lmSpecman
);
224 LINK_LEXER(lmVBScript
);
225 LINK_LEXER(lmVerilog
);
230 //--Autogenerated -- end of automatically generated section