-
Notifications
You must be signed in to change notification settings - Fork 1
/
TextMateAnnotator.h
41 lines (30 loc) · 1.08 KB
/
TextMateAnnotator.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
// TextMateAnnotator.h
#ifndef TextMateAnnotator_h
#define TextMateAnnotator_h
#include "TextAnnotator.h"
#include "TextMatePattern.h"
#include "TextMateTokenRun.h"
#include <vector>
class Document;
class TextStyleRegistry;
class TextMateAnnotator : public TextAnnotator
{
public:
TextMateAnnotator( const Document&, TextStyleRegistry& );
void SetLanguageFile( const char* path );
virtual void TextChanged( CharChange );
virtual void SelectionChanged( size_t start, size_t end );
virtual void GetClasses ( TextStyleRuns&, size_t start, size_t count );
virtual void GetSquiggles ( CharRanges&, size_t start, size_t count );
virtual void GetHighlights( CharRanges&, size_t start, size_t count );
private:
void AddTokensUpTo( size_t offset, uint32_t style );
void AddTokens( const TextMateRegex* regex, const TextMateCaptures&, uint32_t style, size_t offset );
void Tokenize( const char* docStart, const char* docEnd );
const Document& m_doc;
TextStyleRegistry& m_styleRegistry;
uint32_t m_defaultStyle;
TextMateLanguage m_language;
TextMateTokenRuns m_tokens;
};
#endif