aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authornyamatongwe <unknown>2002-04-11 01:30:17 +0000
committernyamatongwe <unknown>2002-04-11 01:30:17 +0000
commit978fe14adbc03e5467b17a9658e053777623d0b6 (patch)
tree27f01c6e13eb03eee8bc92867750264a55d1a4a4 /src
parentd9b508dcd6358a42e33e5331f9613f6df2806b66 (diff)
downloadscintilla-mirror-978fe14adbc03e5467b17a9658e053777623d0b6.tar.gz
Uses macro to simplify lexer references.
Always compiles Scintilla_LinkLexers(). List of lexers automatically generated.
Diffstat (limited to 'src')
-rw-r--r--src/KeyWords.cxx120
1 files changed, 46 insertions, 74 deletions
diff --git a/src/KeyWords.cxx b/src/KeyWords.cxx
index e75fc9d01..611f73c8e 100644
--- a/src/KeyWords.cxx
+++ b/src/KeyWords.cxx
@@ -124,83 +124,55 @@ static void ColouriseNullDoc(unsigned int startPos, int length, int, WordList *[
LexerModule lmNull(SCLEX_NULL, ColouriseNullDoc, "null");
-#ifdef __vms
-#define LINK_LEXERS
-#endif
-
-#ifdef LINK_LEXERS
-
-// The following code forces a reference to all of the Scintilla lexers.
-// If we don't do something like this, then the linker tends to "optimize"
-// them away. (eric@sourcegear.com)
-
-// Taken from wxWindow's stc.cpp. Walter.
-
+// Alternative historical name for Scintilla_LinkLexers
int wxForceScintillaLexers(void) {
return Scintilla_LinkLexers();
}
+// Shorten the code that declares a lexer and ensures it is linked in by calling a method.
+#define LINK_LEXER(lexer) \
+ extern LexerModule lexer; \
+ lexer.GetLanguage();
+
+// To add or remove a lexer, add or remove its file and run LexGen.py.
+
+// Force a reference to all of the Scintilla lexers so that the linker will
+// not remove the code of the lexers.
int Scintilla_LinkLexers() {
- extern LexerModule lmAda;
- extern LexerModule lmAVE;
- extern LexerModule lmBaan;
- extern LexerModule lmBatch;
- extern LexerModule lmConf;
- extern LexerModule lmCPP;
- extern LexerModule lmDiff;
- extern LexerModule lmEiffel;
- extern LexerModule lmEiffelkw;
- extern LexerModule lmErrorList;
- extern LexerModule lmHTML;
- extern LexerModule lmLatex;
- extern LexerModule lmLISP;
- extern LexerModule lmLua;
- extern LexerModule lmMake;
- extern LexerModule lmMatlab;
- extern LexerModule lmPascal;
- extern LexerModule lmPerl;
- extern LexerModule lmProps;
- extern LexerModule lmPython;
- extern LexerModule lmRuby;
- extern LexerModule lmSQL;
- extern LexerModule lmVB;
- extern LexerModule lmXML;
- extern LexerModule lmBullant;
-
- if (
- &lmAda
- && &lmAVE
- && &lmBaan
- && &lmConf
- && &lmDiff
- && &lmLatex
- && &lmPascal
- && &lmCPP
- && &lmHTML
- && &lmXML
- && &lmProps
- && &lmErrorList
- && &lmMake
- && &lmMatlab
- && &lmBatch
- && &lmPerl
- && &lmPython
- && &lmSQL
- && &lmVB
- && &lmRuby
- && &lmEiffel
- && &lmEiffelkw
- && &lmLISP
- && &lmLua
- && &lmNull
- && &lmBullant
- )
- {
- return 1;
- }
- else
- {
- return 0;
- }
+//++Autogenerated -- run src/LexGen.py to regenerate
+//**\(\tLINK_LEXER(\*);\n\)
+ LINK_LEXER(lmAda);
+ LINK_LEXER(lmAVE);
+ LINK_LEXER(lmBaan);
+ LINK_LEXER(lmBullant);
+ LINK_LEXER(lmConf);
+ LINK_LEXER(lmCPP);
+ LINK_LEXER(lmTCL);
+ LINK_LEXER(lmNncrontab);
+ LINK_LEXER(lmEiffel);
+ LINK_LEXER(lmEiffelkw);
+ LINK_LEXER(lmHTML);
+ LINK_LEXER(lmXML);
+ LINK_LEXER(lmASP);
+ LINK_LEXER(lmPHP);
+ LINK_LEXER(lmLISP);
+ LINK_LEXER(lmLua);
+ LINK_LEXER(lmMatlab);
+ LINK_LEXER(lmBatch);
+ LINK_LEXER(lmDiff);
+ LINK_LEXER(lmProps);
+ LINK_LEXER(lmMake);
+ LINK_LEXER(lmErrorList);
+ LINK_LEXER(lmLatex);
+ LINK_LEXER(lmPascal);
+ LINK_LEXER(lmPerl);
+ LINK_LEXER(lmPython);
+ LINK_LEXER(lmRuby);
+ LINK_LEXER(lmSQL);
+ LINK_LEXER(lmVB);
+ LINK_LEXER(lmVBScript);
+
+//--Autogenerated -- end of automatically generated section
+
+ return 1;
}
-#endif