-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathSQLHighlighter.h
More file actions
48 lines (35 loc) · 886 Bytes
/
SQLHighlighter.h
File metadata and controls
48 lines (35 loc) · 886 Bytes
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
42
43
44
45
46
47
48
// $Id: SQLHighlighter.h 20 2006-10-10 08:24:36Z tb $
// Copyright 2006 Timo Bingmann
//
// SQL syntax highlight plugin for QTextEdit
//
#ifndef _SQLHighlighter_H_
#define _SQLHighlighter_H_
#include <QtCore/QVector>
#include <QtCore/QRegExp>
#include <QtGui/QSyntaxHighlighter>
#include <QtGui/QTextCharFormat>
class SQLHighlighter : public QSyntaxHighlighter
{
Q_OBJECT
public:
SQLHighlighter(class QTextDocument *parent = NULL);
protected:
virtual void highlightBlock(const QString &text);
private:
struct Rule
{
QRegExp pattern;
QTextCharFormat format;
inline Rule()
{ }
inline Rule(QString p, QTextCharFormat f)
: pattern(p, Qt::CaseInsensitive), format(f)
{ }
};
QVector<Rule> rules;
QRegExp commentStartExpression;
QRegExp commentEndExpression;
QTextCharFormat commentFormat;
};
#endif // _SQLHighlighter_H_