syntaxhighlighter.h 777 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. #ifndef SYNTAXHIGHLIGHTER_H
  2. #define SYNTAXHIGHLIGHTER_H
  3. #include <QSyntaxHighlighter>
  4. class SyntaxHighlighter :
  5. public QSyntaxHighlighter
  6. {
  7. Q_OBJECT
  8. public:
  9. SyntaxHighlighter(QTextDocument *parent = 0);
  10. protected:
  11. void highlightBlock(const QString &text) override;
  12. private:
  13. /*struct HighlightingRule
  14. {
  15. QRegularExpression pattern;
  16. QTextCharFormat format;
  17. };
  18. QVector<HighlightingRule> highlightingRules;
  19. QRegularExpression commentStartExpression;
  20. QRegularExpression commentEndExpression;*/
  21. /**
  22. * @brief color per loop level
  23. */
  24. std::vector<QTextCharFormat> levelColor;
  25. QTextCharFormat comment;
  26. QTextCharFormat error;
  27. bool isBfChar(const QChar& c);
  28. };
  29. #endif // SYNTAXHIGHLIGHTER_H