From f19bc6dacf8e94d654d39aac436d9f84958739d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=95=D0=B3=D0=BE=D1=80=20=D0=93=D0=B0=D0=BB=D0=BA=D0=B8?= =?UTF-8?q?=D0=BD?= Date: Wed, 13 Jan 2021 19:24:28 +0000 Subject: [PATCH] Add new file --- highlighter.h | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 highlighter.h diff --git a/highlighter.h b/highlighter.h new file mode 100644 index 0000000..a1dc074 --- /dev/null +++ b/highlighter.h @@ -0,0 +1,50 @@ +#ifndef HIGHLIGHTER_H +#define HIGHLIGHTER_H + +#include +#include +#include +#include +#include +#include +#include +#include + +class Highlighter : public QSyntaxHighlighter +{ +public: + explicit Highlighter(QString, QObject *parent = 0); + bool setExtension(const QString&); +//protected: + void highlightBlock(const QString&) override; + +private: + QString xml_filename; + QRegExp current_extension; + + struct HighlightingRule + { + QRegExp pattern; + QTextCharFormat format; + }; + + struct HighlightLanguage + { + QVector highlightingRules; + + QRegExp commentStartExpression; + QRegExp commentEndExpression; + + QTextCharFormat keywordFormat; + QTextCharFormat classFormat; + QTextCharFormat singleLineCommentFormat; + QTextCharFormat multiLineCommentFormat; + QTextCharFormat quotationFormat; + QTextCharFormat functionFormat; + QTextCharFormat preprocFormat; + }; + + QHash languagesContainer; +}; + +#endif // HIGHLIGHTER_H \ No newline at end of file -- GitLab