forked from qt-creator/qt-creator
ScriptConsole: Move from Debugger to QmlJSTools
The console is now a part of qmljstools plugin. The console appears as an output pane. A dummy QScriptEngine evaluates expressions when a declarative debug session is not in progress. During a debug session, the expressions are evaluated by the debug services. Task-Number: QTCREATORBUG-7402 Change-Id: Ic2eeac44fb335c706be03b89f8672b0356efe984 Reviewed-by: Christiaan Janssen <christiaan.janssen@digia.com> Reviewed-by: hjk <qthjk@ovi.com>
This commit is contained in:
40
src/plugins/qmljstools/qmljsinterpreter.h
Normal file
40
src/plugins/qmljstools/qmljsinterpreter.h
Normal file
@@ -0,0 +1,40 @@
|
||||
#ifndef QMLJSINTERPRETER_H
|
||||
#define QMLJSINTERPRETER_H
|
||||
|
||||
#include <qmljs/parser/qmljslexer_p.h>
|
||||
#include <qmljs/parser/qmljsengine_p.h>
|
||||
|
||||
#include <QVector>
|
||||
#include <QString>
|
||||
#include <QList>
|
||||
|
||||
namespace QmlJSTools {
|
||||
namespace Internal {
|
||||
|
||||
class QmlJSInterpreter: QmlJS::Lexer
|
||||
{
|
||||
public:
|
||||
QmlJSInterpreter()
|
||||
: Lexer(&m_engine),
|
||||
m_stateStack(128)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void clearText() { m_code.clear(); }
|
||||
void appendText(const QString &text) { m_code += text; }
|
||||
|
||||
QString code() const { return m_code; }
|
||||
bool canEvaluate();
|
||||
|
||||
private:
|
||||
QmlJS::Engine m_engine;
|
||||
QVector<int> m_stateStack;
|
||||
QList<int> m_tokens;
|
||||
QString m_code;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace QmlJSTools
|
||||
|
||||
#endif // QMLJSINTERPRETER_H
|
||||
Reference in New Issue
Block a user