]>
git.saurik.com Git - wxWidgets.git/blob - contrib/src/stc/scintilla/src/KeyWords.cxx
1ffc4fb5f89e73cb59b1c917c840481d46f48b12
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"
22 const LexerModule
*LexerModule::base
= 0;
23 int LexerModule::nextLanguage
= SCLEX_AUTOMATIC
+1;
25 LexerModule::LexerModule(int language_
,
26 LexerFunction fnLexer_
,
27 const char *languageName_
,
28 LexerFunction fnFolder_
,
29 const char * const wordListDescriptions_
[],
34 wordListDescriptions(wordListDescriptions_
),
35 styleBits(styleBits_
),
36 languageName(languageName_
) {
39 if (language
== SCLEX_AUTOMATIC
) {
40 language
= nextLanguage
;
45 int LexerModule::GetNumWordLists() const {
46 if (wordListDescriptions
== NULL
) {
51 while (wordListDescriptions
[numWordLists
]) {
59 const char *LexerModule::GetWordListDescription(int index
) const {
60 static const char *emptyStr
= "";
62 PLATFORM_ASSERT(index
< GetNumWordLists());
63 if (index
>= GetNumWordLists()) {
66 return wordListDescriptions
[index
];
70 int LexerModule::GetStyleBitsNeeded() const {
74 const LexerModule
*LexerModule::Find(int language
) {
75 const LexerModule
*lm
= base
;
77 if (lm
->language
== language
) {
85 const LexerModule
*LexerModule::Find(const char *languageName
) {
87 const LexerModule
*lm
= base
;
89 if (lm
->languageName
&& 0 == strcmp(lm
->languageName
, languageName
)) {
98 void LexerModule::Lex(unsigned int startPos
, int lengthDoc
, int initStyle
,
99 WordList
*keywordlists
[], Accessor
&styler
) const {
101 fnLexer(startPos
, lengthDoc
, initStyle
, keywordlists
, styler
);
104 void LexerModule::Fold(unsigned int startPos
, int lengthDoc
, int initStyle
,
105 WordList
*keywordlists
[], Accessor
&styler
) const {
107 int lineCurrent
= styler
.GetLine(startPos
);
108 // Move back one line in case deletion wrecked current line fold state
109 if (lineCurrent
> 0) {
111 int newStartPos
= styler
.LineStart(lineCurrent
);
112 lengthDoc
+= startPos
- newStartPos
;
113 startPos
= newStartPos
;
116 initStyle
= styler
.StyleAt(startPos
- 1);
119 fnFolder(startPos
, lengthDoc
, initStyle
, keywordlists
, styler
);
123 // Alternative historical name for Scintilla_LinkLexers
124 int wxForceScintillaLexers(void) {
125 return Scintilla_LinkLexers();
128 // To add or remove a lexer, add or remove its file and run LexGen.py.
130 // Force a reference to all of the Scintilla lexers so that the linker will
131 // not remove the code of the lexers.
132 int Scintilla_LinkLexers() {
133 static int forcer
= 0;
135 // Shorten the code that declares a lexer and ensures it is linked in by calling a method.
136 #define LINK_LEXER(lexer) extern LexerModule lexer; forcer += lexer.GetLanguage();
138 //++Autogenerated -- run src/LexGen.py to regenerate
139 //**\(\tLINK_LEXER(\*);\n\)
150 LINK_LEXER(lmBlitzBasic
);
151 LINK_LEXER(lmBullant
);
154 LINK_LEXER(lmClwNoCase
);
157 LINK_LEXER(lmCPPNoCase
);
158 LINK_LEXER(lmCsound
);
161 LINK_LEXER(lmEiffel
);
162 LINK_LEXER(lmEiffelkw
);
163 LINK_LEXER(lmErlang
);
164 LINK_LEXER(lmErrorList
);
165 LINK_LEXER(lmESCRIPT
);
167 LINK_LEXER(lmFlagShip
);
169 LINK_LEXER(lmFortran
);
170 LINK_LEXER(lmFreeBasic
);
171 LINK_LEXER(lmGui4Cli
);
172 LINK_LEXER(lmHaskell
);
181 LINK_LEXER(lmMatlab
);
182 LINK_LEXER(lmMETAPOST
);
183 LINK_LEXER(lmMMIXAL
);
185 LINK_LEXER(lmNncrontab
);
188 LINK_LEXER(lmOctave
);
189 LINK_LEXER(lmPascal
);
193 LINK_LEXER(lmPHPSCRIPT
);
197 LINK_LEXER(lmPureBasic
);
198 LINK_LEXER(lmPython
);
201 LINK_LEXER(lmScriptol
);
202 LINK_LEXER(lmSmalltalk
);
203 LINK_LEXER(lmSpecman
);
209 LINK_LEXER(lmVBScript
);
210 LINK_LEXER(lmVerilog
);
215 //--Autogenerated -- end of automatically generated section