00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef _STELSCRIPTSYNTAXHIGHLIGHTER_HPP_
00023 #define _STELSCRIPTSYNTAXHIGHLIGHTER_HPP_
00024
00025 #include <QSyntaxHighlighter>
00026 #include <QHash>
00027 #include <QTextCharFormat>
00028
00029 class QTextDocument;
00030
00031 class StelScriptSyntaxHighlighter : public QSyntaxHighlighter
00032 {
00033 Q_OBJECT
00034
00035 public:
00036 StelScriptSyntaxHighlighter(QTextDocument* parent=0);
00037
00038 protected:
00039 void highlightBlock(const QString &text);
00040
00041 private:
00042 struct HighlightingRule
00043 {
00044 QRegExp pattern;
00045 QTextCharFormat format;
00046 };
00047 QVector<HighlightingRule> highlightingRules;
00048
00049 QTextCharFormat keywordFormat;
00050 QTextCharFormat moduleFormat;
00051 QTextCharFormat singleLineCommentFormat;
00052 QTextCharFormat quotationFormat;
00053 QTextCharFormat functionFormat;
00054 };
00055
00056 #endif // _STELSCRIPTSYNTAXHIGHLIGHTER_HPP_
00057