summaryrefslogtreecommitdiff
path: root/src/highlighter.h
blob: 043c34e587bd12dd7ea5c779acbec01e9959cd2b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#ifndef HIGHLIGHTER_H_
#define HIGHLIGHTER_H_

#include <QSyntaxHighlighter>

class Highlighter : public QSyntaxHighlighter
{
public:
	enum state_e {NORMAL=-1,QUOTE,COMMENT};
	QHash<QString, QTextCharFormat> formatMap;
	QTextCharFormat errorFormat, commentFormat, quoteFormat;
	Highlighter(QTextDocument *parent);
	void highlightBlock(const QString &text);
	void highlightError(int error_pos);
	void unhighlightLastError();
private:
	QTextBlock lastErrorBlock;
	int errorPos = -1;
	bool errorState = false;
	QStringList separators;
};

#endif
contact: Jan Huwald // Impressum