1
// Scintilla source code edit control
2
/** @file LexerModule.h
3
** Colourise for particular languages.
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.
18
typedef void (*LexerFunction)(unsigned int startPos, int lengthDoc, int initStyle,
19
WordList *keywordlists[], Accessor &styler);
20
typedef ILexer *(*LexerFactoryFunction)();
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.
30
LexerFunction fnLexer;
31
LexerFunction fnFolder;
32
LexerFactoryFunction fnFactory;
33
const char * const * wordListDescriptions;
37
const char *languageName;
38
LexerModule(int language_,
39
LexerFunction fnLexer_,
40
const char *languageName_=0,
41
LexerFunction fnFolder_=0,
42
const char * const wordListDescriptions_[] = NULL,
44
LexerModule(int language_,
45
LexerFactoryFunction fnFactory_,
46
const char *languageName_,
47
const char * const wordListDescriptions_[] = NULL,
49
virtual ~LexerModule() {
51
int GetLanguage() const { return language; }
53
// -1 is returned if no WordList information is available
54
int GetNumWordLists() const;
55
const char *GetWordListDescription(int index) const;
57
int GetStyleBitsNeeded() const;
59
ILexer *Create() const;
61
virtual void Lex(unsigned int startPos, int length, int initStyle,
62
WordList *keywordlists[], Accessor &styler) const;
63
virtual void Fold(unsigned int startPos, int length, int initStyle,
64
WordList *keywordlists[], Accessor &styler) const;
66
friend class Catalogue;
69
inline int Maximum(int a, int b) {
70
return (a > b) ? a : b;
73
// Shut up annoying Visual C++ warnings:
75
#pragma warning(disable: 4244 4309 4514 4710)