-
Notifications
You must be signed in to change notification settings - Fork 0
/
LuaHighlighter.h
60 lines (47 loc) · 1.45 KB
/
LuaHighlighter.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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
/*
* __
* __ /\ \__
* __ __ __/\_\ ___\ \ ,_\ __ _ __ ___ ___ ___ ___ ___
* /\ \/\ \/\ \/\ \ /' _ `\ \ \/ /'__`\\`'__\' __` __`\ / __`\ / __`\/' _ `\
* \ \ \_/ \_/ \ \ \/\ \/\ \ \ \_/\ __/ \ \//\ \/\ \/\ \/\ \L\ \\ \L\ \\ \/\ \
* \ \___x___/'\ \_\ \_\ \_\ \__\ \____\ \_\\ \_\ \_\ \_\ \____/ \____/ \_\ \_\
* \/__//__/ \/_/\/_/\/_/\/__/\/____/\/_/ \/_/\/_/\/_/\/___/ \/___/ \/_/\/_/
*
* Copyright (c) 2006 - 2012 Wintermoon Project
*
* http://wintermoon.sourceforge.net/
*
* % BEGIN_LICENSE %
* % END_LICENSE %
*
*/
/*
* This file is based on Qt example "Syntax Highlighter"
*/
#ifndef _LuaHighlighter_h
#define _LuaHighlighter_h
#include <QSyntaxHighlighter>
class LuaHighlighter : public QSyntaxHighlighter
{
public:
LuaHighlighter(QTextDocument *parent = 0);
protected:
void highlightBlock(const QString& text);
private:
Q_OBJECT
struct HighlightingRule
{
QRegExp pattern;
QTextCharFormat format;
};
QVector<HighlightingRule> highlightingRules;
QRegExp commentStartExpression;
QRegExp commentEndExpression;
QTextCharFormat keywordFormat;
QTextCharFormat classFormat;
QTextCharFormat singleLineCommentFormat;
QTextCharFormat multiLineCommentFormat;
QTextCharFormat quotationFormat;
QTextCharFormat functionFormat;
};
#endif