#ifndef HIGHLIGHTER_H_ #define HIGHLIGHTER_H_ #include #include #include class Highlighter : public QSyntaxHighlighter { public: enum state_e {NORMAL=-1,QUOTE,COMMENT}; QHash tokenFormats; QTextCharFormat errorFormat; Highlighter(QTextDocument *parent); void highlightBlock(const QString &text); void highlightError(int error_pos); void unhighlightLastError(); void assignFormatsToTokens(const QString &); private: QTextBlock lastErrorBlock; int errorPos; bool errorState; QMap tokentypes; QMap typeformats; int lastDocumentPos(); void portable_rehighlightBlock( const QTextBlock &text ); }; #endif