1 | // Scintilla source code edit control |
2 | /** @file LexerBase.h |
3 | ** A simple lexer with no state. |
4 | **/ |
5 | // Copyright 1998-2010 by Neil Hodgson <neilh@scintilla.org> |
6 | // The License.txt file describes the conditions under which this software may be distributed. |
7 | |
8 | #ifndef LEXERBASE_H |
9 | #define LEXERBASE_H |
10 | |
11 | namespace Lexilla { |
12 | |
13 | // A simple lexer with no state |
14 | class LexerBase : public Scintilla::ILexer5 { |
15 | protected: |
16 | const LexicalClass *lexClasses; |
17 | size_t nClasses; |
18 | PropSetSimple props; |
19 | enum {numWordLists=KEYWORDSET_MAX+1}; |
20 | WordList *keyWordLists[numWordLists+1]; |
21 | public: |
22 | LexerBase(const LexicalClass *lexClasses_=nullptr, size_t nClasses_=0); |
23 | virtual ~LexerBase(); |
24 | void SCI_METHOD Release() override; |
25 | int SCI_METHOD Version() const override; |
26 | const char * SCI_METHOD PropertyNames() override; |
27 | int SCI_METHOD PropertyType(const char *name) override; |
28 | const char * SCI_METHOD DescribeProperty(const char *name) override; |
29 | Sci_Position SCI_METHOD PropertySet(const char *key, const char *val) override; |
30 | const char * SCI_METHOD DescribeWordListSets() override; |
31 | Sci_Position SCI_METHOD WordListSet(int n, const char *wl) override; |
32 | void SCI_METHOD Lex(Sci_PositionU startPos, Sci_Position lengthDoc, int initStyle, Scintilla::IDocument *pAccess) override = 0; |
33 | void SCI_METHOD Fold(Sci_PositionU startPos, Sci_Position lengthDoc, int initStyle, Scintilla::IDocument *pAccess) override = 0; |
34 | void * SCI_METHOD PrivateCall(int operation, void *pointer) override; |
35 | int SCI_METHOD LineEndTypesSupported() override; |
36 | int SCI_METHOD AllocateSubStyles(int styleBase, int numberStyles) override; |
37 | int SCI_METHOD SubStylesStart(int styleBase) override; |
38 | int SCI_METHOD SubStylesLength(int styleBase) override; |
39 | int SCI_METHOD StyleFromSubStyle(int subStyle) override; |
40 | int SCI_METHOD PrimaryStyleFromStyle(int style) override; |
41 | void SCI_METHOD FreeSubStyles() override; |
42 | void SCI_METHOD SetIdentifiers(int style, const char *identifiers) override; |
43 | int SCI_METHOD DistanceToSecondaryStyles() override; |
44 | const char * SCI_METHOD GetSubStyleBases() override; |
45 | int SCI_METHOD NamedStyles() override; |
46 | const char * SCI_METHOD NameOfStyle(int style) override; |
47 | const char * SCI_METHOD TagsOfStyle(int style) override; |
48 | const char * SCI_METHOD DescriptionOfStyle(int style) override; |
49 | // ILexer5 methods |
50 | const char * SCI_METHOD GetName() override; |
51 | int SCI_METHOD GetIdentifier() override; |
52 | const char *SCI_METHOD PropertyGet(const char *key) override; |
53 | }; |
54 | |
55 | } |
56 | |
57 | #endif |
58 | |