diff options
author | Roberto Raggi <roberto.raggi@nokia.com> | 2012-05-08 13:21:52 +0200 |
---|---|---|
committer | Roberto Raggi <roberto.raggi@nokia.com> | 2012-05-08 13:24:48 +0200 |
commit | 6f3022a3d4fc469a5234f454e245239b908e19b0 (patch) | |
tree | 212a0c6c1c69b55905deb99fd34e3e867cee7af1 /qv4syntaxchecker_p.h | |
parent | 08c29dabd8686c044be2d92a8222c0ca0193f0ec (diff) |
Added a simple syntax checker.
Diffstat (limited to 'qv4syntaxchecker_p.h')
-rw-r--r-- | qv4syntaxchecker_p.h | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/qv4syntaxchecker_p.h b/qv4syntaxchecker_p.h new file mode 100644 index 0000000000..508e9f8abb --- /dev/null +++ b/qv4syntaxchecker_p.h @@ -0,0 +1,33 @@ +#ifndef QV4SYNTAXCHECKER_P_H +#define QV4SYNTAXCHECKER_P_H + +#include <private/qqmljslexer_p.h> +#include <private/qqmljsengine_p.h> + +#include <QtCore/QVector> +#include <QtCore/QString> +#include <QtCore/QList> + +namespace QQmlJS { + +class SyntaxChecker: Lexer +{ +public: + SyntaxChecker(); + + QString text() const; + void clearText(); + void appendText(const QString &text); + + bool canEvaluate(); + +private: + Engine m_engine; + QVector<int> m_stateStack; + QList<int> m_tokens; + QString m_code; +}; + +} // end of QQmlJS namespace + +#endif // QV4SYNTAXCHECKER_P_H |