summaryrefslogtreecommitdiff
path: root/src/highlighter.h
diff options
context:
space:
mode:
authordon bright <hugh.m.bright@gmail.com>2013-01-28 02:42:20 (GMT)
committerdon bright <hugh.m.bright@gmail.com>2013-01-28 02:42:20 (GMT)
commit1e64dddf1ea30282c89de7f35854a68614234652 (patch)
tree165d37c1c66f6ff79d48c74794238b3f0bed09da /src/highlighter.h
parent5c779159c208ca3d88c88479ab29f9cd66574859 (diff)
parentd0856efe6da545693f9c50a8a2514a9f999ab5ef (diff)
Merge branch 'master' of github.com:openscad/openscad into issue159
Diffstat (limited to 'src/highlighter.h')
-rw-r--r--src/highlighter.h23
1 files changed, 15 insertions, 8 deletions
diff --git a/src/highlighter.h b/src/highlighter.h
index 1bd54d2..b4ffae8 100644
--- a/src/highlighter.h
+++ b/src/highlighter.h
@@ -2,20 +2,27 @@
#define HIGHLIGHTER_H_
#include <QSyntaxHighlighter>
-
-#ifdef _QCODE_EDIT_
-#include "qdocument.h"
-#endif
+#include <QTextFormat>
+#include <QHash>
class Highlighter : public QSyntaxHighlighter
{
public:
-#ifdef _QCODE_EDIT_
- Highlighter(QDocument *parent);
-#else
+ enum state_e {NORMAL=-1,QUOTE,COMMENT};
+ QHash<QString, QTextCharFormat> tokenFormats;
+ QTextCharFormat errorFormat, commentFormat, quoteFormat, numberFormat;
Highlighter(QTextDocument *parent);
-#endif
void highlightBlock(const QString &text);
+ void highlightError(int error_pos);
+ void unhighlightLastError();
+private:
+ QTextBlock lastErrorBlock;
+ int errorPos;
+ bool errorState;
+ QMap<QString,QStringList> tokentypes;
+ QMap<QString,QTextCharFormat> typeformats;
+ int lastDocumentPos();
+ void portable_rehighlightBlock( const QTextBlock &text );
};
#endif
contact: Jan Huwald // Impressum