diff options
author | don bright <hugh.m.bright@gmail.com> | 2013-01-12 20:05:10 (GMT) |
---|---|---|
committer | don bright <hugh.m.bright@gmail.com> | 2013-01-12 20:05:10 (GMT) |
commit | 3b7bc56bdeba2401f88afd46d3969bcc543796fd (patch) | |
tree | f68e4116b565f1b72802f6ea0b9b6455420e7f2b /src/highlighter.h | |
parent | 2834e4265b0ae8d336e9a578a2ae9daf4691a166 (diff) |
rewrite large bit of syntax highlighter, add 'manual' test instructions
Diffstat (limited to 'src/highlighter.h')
-rw-r--r-- | src/highlighter.h | 29 |
1 files changed, 10 insertions, 19 deletions
diff --git a/src/highlighter.h b/src/highlighter.h index a6e2dc3..043c34e 100644 --- a/src/highlighter.h +++ b/src/highlighter.h @@ -7,26 +7,17 @@ class Highlighter : public QSyntaxHighlighter { public: enum state_e {NORMAL=-1,QUOTE,COMMENT}; - enum mode_e {NORMAL_MODE, ERROR_MODE}; - mode_e mode; - - QStringList operators; - QStringList KeyWords; - QStringList Primitives3D; - QStringList Primitives2D; - QStringList Transforms; - QStringList Imports; - QTextCharFormat ErrorStyle; - QTextCharFormat OperatorStyle; - QTextCharFormat CommentStyle; - QTextCharFormat QuoteStyle; - QTextCharFormat KeyWordStyle; - QTextCharFormat PrimitiveStyle3D; - QTextCharFormat PrimitiveStyle2D; - QTextCharFormat TransformStyle; - QTextCharFormat ImportStyle; - Highlighter(QTextDocument *parent, mode_e mode); + QHash<QString, QTextCharFormat> formatMap; + QTextCharFormat errorFormat, commentFormat, quoteFormat; + Highlighter(QTextDocument *parent); void highlightBlock(const QString &text); + void highlightError(int error_pos); + void unhighlightLastError(); +private: + QTextBlock lastErrorBlock; + int errorPos = -1; + bool errorState = false; + QStringList separators; }; #endif |