1 | // Scintilla source code edit control |
2 | /** @file DefaultLexer.h |
3 | ** A lexer base class with default empty implementations of methods. |
4 | ** For lexers that do not support all features so do not need real implementations. |
5 | ** Does have real implementation for style metadata. |
6 | **/ |
7 | // Copyright 2017 by Neil Hodgson <neilh@scintilla.org> |
8 | // The License.txt file describes the conditions under which this software may be distributed. |
9 | |
10 | #ifndef DEFAULTLEXER_H |
11 | #define DEFAULTLEXER_H |
12 | |
13 | namespace Lexilla { |
14 | |
15 | // A simple lexer with no state |
16 | class DefaultLexer : public Scintilla::ILexer5 { |
17 | const char *languageName; |
18 | int language; |
19 | const LexicalClass *lexClasses; |
20 | size_t nClasses; |
21 | public: |
22 | DefaultLexer(const char *languageName_, int language_, |
23 | const LexicalClass *lexClasses_ = nullptr, size_t nClasses_ = 0); |
24 | virtual ~DefaultLexer(); |
25 | void SCI_METHOD Release() override; |
26 | int SCI_METHOD Version() const override; |
27 | const char * SCI_METHOD PropertyNames() override; |
28 | int SCI_METHOD PropertyType(const char *name) override; |
29 | const char * SCI_METHOD DescribeProperty(const char *name) override; |
30 | Sci_Position SCI_METHOD PropertySet(const char *key, const char *val) override; |
31 | const char * SCI_METHOD DescribeWordListSets() override; |
32 | Sci_Position SCI_METHOD WordListSet(int n, const char *wl) override; |
33 | void SCI_METHOD Lex(Sci_PositionU startPos, Sci_Position lengthDoc, int initStyle, Scintilla::IDocument *pAccess) override = 0; |
34 | void SCI_METHOD Fold(Sci_PositionU startPos, Sci_Position lengthDoc, int initStyle, Scintilla::IDocument *pAccess) override; |
35 | void * SCI_METHOD PrivateCall(int operation, void *pointer) override; |
36 | int SCI_METHOD LineEndTypesSupported() override; |
37 | int SCI_METHOD AllocateSubStyles(int styleBase, int numberStyles) override; |
38 | int SCI_METHOD SubStylesStart(int styleBase) override; |
39 | int SCI_METHOD SubStylesLength(int styleBase) override; |
40 | int SCI_METHOD StyleFromSubStyle(int subStyle) override; |
41 | int SCI_METHOD PrimaryStyleFromStyle(int style) override; |
42 | void SCI_METHOD FreeSubStyles() override; |
43 | void SCI_METHOD SetIdentifiers(int style, const char *identifiers) override; |
44 | int SCI_METHOD DistanceToSecondaryStyles() override; |
45 | const char * SCI_METHOD GetSubStyleBases() override; |
46 | int SCI_METHOD NamedStyles() override; |
47 | const char * SCI_METHOD NameOfStyle(int style) override; |
48 | const char * SCI_METHOD TagsOfStyle(int style) override; |
49 | const char * SCI_METHOD DescriptionOfStyle(int style) override; |
50 | // ILexer5 methods |
51 | const char * SCI_METHOD GetName() override; |
52 | int SCI_METHOD GetIdentifier() override; |
53 | }; |
54 | |
55 | } |
56 | |
57 | #endif |
58 | |