summaryrefslogtreecommitdiff
path: root/src/highlighter.h
diff options
context:
space:
mode:
authorMarius Kintel <marius@kintel.net>2013-01-22 00:34:59 (GMT)
committerMarius Kintel <marius@kintel.net>2013-01-22 00:34:59 (GMT)
commit784b503f0dd57de2ac55836e07dd14e82800a593 (patch)
treee7e2c0dd9b5b253343a8946313080c0fce55d947 /src/highlighter.h
parent6ecf96b081626c512343fc1a8f7aa4a202ffaa86 (diff)
parent99a0b67cd4500b8f4410231b30fd67c0fa3aa4cb (diff)
Merge pull request #240 from openscad/colah_highlighter
Colah highlighter
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