Bump GEANY_API_VERSION for langType rename
[geany-mirror.git] / scintilla / lexlib / LexerModule.h
blob356ff27e901f78232f4a53dd700d908791fe81e4
1 // Scintilla source code edit control
2 /** @file LexerModule.h
3 ** Colourise for particular languages.
4 **/
5 // Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
6 // The License.txt file describes the conditions under which this software may be distributed.
8 #ifndef LEXERMODULE_H
9 #define LEXERMODULE_H
11 #ifdef SCI_NAMESPACE
12 namespace Scintilla {
13 #endif
15 class Accessor;
16 class WordList;
18 typedef void (*LexerFunction)(Sci_PositionU startPos, Sci_Position lengthDoc, int initStyle,
19 WordList *keywordlists[], Accessor &styler);
20 typedef ILexer *(*LexerFactoryFunction)();
22 /**
23 * A LexerModule is responsible for lexing and folding a particular language.
24 * The class maintains a list of LexerModules which can be searched to find a
25 * module appropriate to a particular language.
27 class LexerModule {
28 protected:
29 int language;
30 LexerFunction fnLexer;
31 LexerFunction fnFolder;
32 LexerFactoryFunction fnFactory;
33 const char * const * wordListDescriptions;
35 public:
36 const char *languageName;
37 LexerModule(int language_,
38 LexerFunction fnLexer_,
39 const char *languageName_=0,
40 LexerFunction fnFolder_=0,
41 const char * const wordListDescriptions_[] = NULL);
42 LexerModule(int language_,
43 LexerFactoryFunction fnFactory_,
44 const char *languageName_,
45 const char * const wordListDescriptions_[] = NULL);
46 virtual ~LexerModule() {
48 int GetLanguage() const { return language; }
50 // -1 is returned if no WordList information is available
51 int GetNumWordLists() const;
52 const char *GetWordListDescription(int index) const;
54 ILexer *Create() const;
56 virtual void Lex(Sci_PositionU startPos, Sci_Position length, int initStyle,
57 WordList *keywordlists[], Accessor &styler) const;
58 virtual void Fold(Sci_PositionU startPos, Sci_Position length, int initStyle,
59 WordList *keywordlists[], Accessor &styler) const;
61 friend class Catalogue;
64 inline int Maximum(int a, int b) {
65 return (a > b) ? a : b;
68 // Shut up annoying Visual C++ warnings:
69 #ifdef _MSC_VER
70 #pragma warning(disable: 4244 4309 4456 4457)
71 #endif
73 // Turn off shadow warnings for lexers as may be maintained by others
74 #if defined(__GNUC__)
75 #pragma GCC diagnostic ignored "-Wshadow"
76 #endif
78 #ifdef SCI_NAMESPACE
80 #endif
82 #endif