insilmaril@436: /**************************************************************************** insilmaril@436: ** insilmaril@436: ** Copyright (C) 2005-2006 Trolltech ASA. All rights reserved. insilmaril@436: ** insilmaril@436: ** This file is part of the example classes of the Qt Toolkit. insilmaril@436: ** insilmaril@436: ** This file may be used under the terms of the GNU General Public insilmaril@436: ** License version 2.0 as published by the Free Software Foundation insilmaril@436: ** and appearing in the file LICENSE.GPL included in the packaging of insilmaril@436: ** this file. Please review the following information to ensure GNU insilmaril@436: ** General Public Licensing requirements will be met: insilmaril@436: ** http://www.trolltech.com/products/qt/opensource.html insilmaril@436: ** insilmaril@436: ** If you are unsure which license is appropriate for your use, please insilmaril@436: ** review the following information: insilmaril@436: ** http://www.trolltech.com/products/qt/licensing.html or contact the insilmaril@436: ** sales department at sales@trolltech.com. insilmaril@436: ** insilmaril@436: ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE insilmaril@436: ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. insilmaril@436: ** insilmaril@436: ****************************************************************************/ insilmaril@436: insilmaril@436: #ifndef HIGHLIGHTER_H insilmaril@436: #define HIGHLIGHTER_H insilmaril@436: insilmaril@436: #include insilmaril@436: insilmaril@436: #include insilmaril@436: #include insilmaril@436: insilmaril@436: class QTextDocument; insilmaril@436: insilmaril@436: class Highlighter : public QSyntaxHighlighter insilmaril@436: { insilmaril@436: Q_OBJECT insilmaril@436: insilmaril@436: public: insilmaril@436: Highlighter(QTextDocument *parent = 0); insilmaril@436: insilmaril@436: protected: insilmaril@436: void highlightBlock(const QString &text); insilmaril@436: insilmaril@436: private: insilmaril@436: struct HighlightingRule insilmaril@436: { insilmaril@436: QRegExp pattern; insilmaril@436: QTextCharFormat format; insilmaril@436: }; insilmaril@436: QVector highlightingRules; insilmaril@436: insilmaril@436: QRegExp commentStartExpression; insilmaril@436: QRegExp commentEndExpression; insilmaril@436: insilmaril@436: QTextCharFormat keywordFormat; insilmaril@436: QTextCharFormat classFormat; insilmaril@436: QTextCharFormat singleLineCommentFormat; insilmaril@436: QTextCharFormat multiLineCommentFormat; insilmaril@436: QTextCharFormat quotationFormat; insilmaril@436: QTextCharFormat functionFormat; insilmaril@436: }; insilmaril@436: insilmaril@436: #endif