1// Scintilla source code edit control
2/** @file ILexer.h
3 ** Interface between Scintilla and lexers.
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 ILEXER_H
9#define ILEXER_H
10
11#include "Sci_Position.h"
12
13namespace Scintilla {
14
15enum { dvRelease4=2 };
16
17class IDocument {
18public:
19 virtual int SCI_METHOD Version() const = 0;
20 virtual void SCI_METHOD SetErrorStatus(int status) = 0;
21 virtual Sci_Position SCI_METHOD Length() const = 0;
22 virtual void SCI_METHOD GetCharRange(char *buffer, Sci_Position position, Sci_Position lengthRetrieve) const = 0;
23 virtual char SCI_METHOD StyleAt(Sci_Position position) const = 0;
24 virtual Sci_Position SCI_METHOD LineFromPosition(Sci_Position position) const = 0;
25 virtual Sci_Position SCI_METHOD LineStart(Sci_Position line) const = 0;
26 virtual int SCI_METHOD GetLevel(Sci_Position line) const = 0;
27 virtual int SCI_METHOD SetLevel(Sci_Position line, int level) = 0;
28 virtual int SCI_METHOD GetLineState(Sci_Position line) const = 0;
29 virtual int SCI_METHOD SetLineState(Sci_Position line, int state) = 0;
30 virtual void SCI_METHOD StartStyling(Sci_Position position) = 0;
31 virtual bool SCI_METHOD SetStyleFor(Sci_Position length, char style) = 0;
32 virtual bool SCI_METHOD SetStyles(Sci_Position length, const char *styles) = 0;
33 virtual void SCI_METHOD DecorationSetCurrentIndicator(int indicator) = 0;
34 virtual void SCI_METHOD DecorationFillRange(Sci_Position position, int value, Sci_Position fillLength) = 0;
35 virtual void SCI_METHOD ChangeLexerState(Sci_Position start, Sci_Position end) = 0;
36 virtual int SCI_METHOD CodePage() const = 0;
37 virtual bool SCI_METHOD IsDBCSLeadByte(char ch) const = 0;
38 virtual const char * SCI_METHOD BufferPointer() = 0;
39 virtual int SCI_METHOD GetLineIndentation(Sci_Position line) = 0;
40 virtual Sci_Position SCI_METHOD LineEnd(Sci_Position line) const = 0;
41 virtual Sci_Position SCI_METHOD GetRelativePosition(Sci_Position positionStart, Sci_Position characterOffset) const = 0;
42 virtual int SCI_METHOD GetCharacterAndWidth(Sci_Position position, Sci_Position *pWidth) const = 0;
43};
44
45enum { lvRelease4=2, lvRelease5=3 };
46
47class ILexer4 {
48public:
49 virtual int SCI_METHOD Version() const = 0;
50 virtual void SCI_METHOD Release() = 0;
51 virtual const char * SCI_METHOD PropertyNames() = 0;
52 virtual int SCI_METHOD PropertyType(const char *name) = 0;
53 virtual const char * SCI_METHOD DescribeProperty(const char *name) = 0;
54 virtual Sci_Position SCI_METHOD PropertySet(const char *key, const char *val) = 0;
55 virtual const char * SCI_METHOD DescribeWordListSets() = 0;
56 virtual Sci_Position SCI_METHOD WordListSet(int n, const char *wl) = 0;
57 virtual void SCI_METHOD Lex(Sci_PositionU startPos, Sci_Position lengthDoc, int initStyle, IDocument *pAccess) = 0;
58 virtual void SCI_METHOD Fold(Sci_PositionU startPos, Sci_Position lengthDoc, int initStyle, IDocument *pAccess) = 0;
59 virtual void * SCI_METHOD PrivateCall(int operation, void *pointer) = 0;
60 virtual int SCI_METHOD LineEndTypesSupported() = 0;
61 virtual int SCI_METHOD AllocateSubStyles(int styleBase, int numberStyles) = 0;
62 virtual int SCI_METHOD SubStylesStart(int styleBase) = 0;
63 virtual int SCI_METHOD SubStylesLength(int styleBase) = 0;
64 virtual int SCI_METHOD StyleFromSubStyle(int subStyle) = 0;
65 virtual int SCI_METHOD PrimaryStyleFromStyle(int style) = 0;
66 virtual void SCI_METHOD FreeSubStyles() = 0;
67 virtual void SCI_METHOD SetIdentifiers(int style, const char *identifiers) = 0;
68 virtual int SCI_METHOD DistanceToSecondaryStyles() = 0;
69 virtual const char * SCI_METHOD GetSubStyleBases() = 0;
70 virtual int SCI_METHOD NamedStyles() = 0;
71 virtual const char * SCI_METHOD NameOfStyle(int style) = 0;
72 virtual const char * SCI_METHOD TagsOfStyle(int style) = 0;
73 virtual const char * SCI_METHOD DescriptionOfStyle(int style) = 0;
74};
75
76class ILexer5 : public ILexer4 {
77public:
78 virtual const char * SCI_METHOD GetName() = 0;
79 virtual int SCI_METHOD GetIdentifier() = 0;
80 virtual const char * SCI_METHOD PropertyGet(const char *key) = 0;
81};
82
83}
84
85#endif
86