diff --git a/highlighter.h b/highlighter.h new file mode 100644 index 0000000000000000000000000000000000000000..a1dc0749a14b854fb8e57400b5abd47710e22fa3 --- /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