diff options
author | Martin Jones <martin.jones@nokia.com> | 2009-05-28 03:25:52 (GMT) |
---|---|---|
committer | Martin Jones <martin.jones@nokia.com> | 2009-05-28 03:25:52 (GMT) |
commit | 4d9095f25332c5122c689db83f28fd487ab4e2c9 (patch) | |
tree | fcbf27ee3caea39c5c1046f9b528b6e516b204a0 /src | |
parent | d9e51611a2be361cb75b682c5552846b64e32df3 (diff) | |
parent | 4587282af7bfb9f6b1a8329651073bb4127c62b8 (diff) | |
download | Qt-4d9095f25332c5122c689db83f28fd487ab4e2c9.zip Qt-4d9095f25332c5122c689db83f28fd487ab4e2c9.tar.gz Qt-4d9095f25332c5122c689db83f28fd487ab4e2c9.tar.bz2 |
Merge branch 'kinetic-declarativeui' of git@scm.dev.nokia.troll.no:qt/kinetic into kinetic-declarativeui
Diffstat (limited to 'src')
27 files changed, 409 insertions, 1000 deletions
diff --git a/src/declarative/fx/qfxkeyactions.cpp b/src/declarative/fx/qfxkeyactions.cpp index 5a1fd7d..4aae74f 100644 --- a/src/declarative/fx/qfxkeyactions.cpp +++ b/src/declarative/fx/qfxkeyactions.cpp @@ -899,7 +899,7 @@ void QFxKeyActions::keyPressEvent(QKeyEvent *event) { Qt::Key key = (Qt::Key)event->key(); if (d->enabled && d->key(key)) { - QmlExpression b(qmlContext(this), d->action(key), this, false); + QmlExpression b(qmlContext(this), d->action(key), this); b.value(); event->accept(); } else { diff --git a/src/declarative/qml/parser/javascriptast_p.h b/src/declarative/qml/parser/javascriptast_p.h index b5fd922..23d59e5 100644 --- a/src/declarative/qml/parser/javascriptast_p.h +++ b/src/declarative/qml/parser/javascriptast_p.h @@ -61,8 +61,6 @@ QT_BEGIN_NAMESPACE #define JAVASCRIPT_DECLARE_AST_NODE(name) \ enum { K = Kind_##name }; -class NameId; - namespace QSOperator // ### rename { @@ -106,7 +104,9 @@ enum Op { } // namespace QSOperator -namespace JavaScript { namespace AST { +namespace JavaScript { +class NameId; +namespace AST { template <typename _T1, typename _T2> _T1 cast(_T2 *ast) diff --git a/src/declarative/qml/qml.pri b/src/declarative/qml/qml.pri index b6ac30e..c61200e 100644 --- a/src/declarative/qml/qml.pri +++ b/src/declarative/qml/qml.pri @@ -23,7 +23,8 @@ SOURCES += qml/qmlparser.cpp \ qml/qmlcompositetypemanager.cpp \ qml/qmlinfo.cpp \ qml/qmlerror.cpp \ - qml/qmlscriptparser.cpp + qml/qmlscriptparser.cpp \ + qml/qmlbasicscript.cpp HEADERS += qml/qmlparser_p.h \ qml/qmlinstruction_p.h \ @@ -61,7 +62,8 @@ HEADERS += qml/qmlparser_p.h \ qml/qmllist.h \ qml/qmldeclarativedata_p.h \ qml/qmlerror.h \ - qml/qmlscriptparser_p.h + qml/qmlscriptparser_p.h \ + qml/qmlbasicscript_p.h # for qtscript debugger QT += scripttools diff --git a/src/declarative/qml/script/qmlbasicscript.cpp b/src/declarative/qml/qmlbasicscript.cpp index 37a6678..3d74b37 100644 --- a/src/declarative/qml/script/qmlbasicscript.cpp +++ b/src/declarative/qml/qmlbasicscript.cpp @@ -9,9 +9,7 @@ ** ****************************************************************************/ -#include "qmlbasicscript.h" #include "qmlbasicscript_p.h" -#include "lexer.h" #include <QColor> #include <QDebug> #include <private/qmlengine_p.h> @@ -19,9 +17,39 @@ #include <QStack> #include <qfxperf.h> #include <private/qmlrefcount_p.h> - +#include <private/javascriptast_p.h> +#include <private/javascriptengine_p.h> QT_BEGIN_NAMESPACE + +struct ScriptInstruction { + enum { + Load, // fetch + Fetch, // fetch + + Add, // NA + Subtract, // NA + Multiply, // NA + Equals, // NA + And, // NA + + Int, // integer + Bool, // boolean + } type; + + union { + struct { + int idx; + } fetch; + struct { + int value; + } integer; + struct { + bool value; + } boolean; + }; +}; + DEFINE_BOOL_CONFIG_OPTION(scriptWarnings, QML_SCRIPT_WARNINGS); class QmlBasicScriptPrivate @@ -193,7 +221,7 @@ static QVariant fetch_value(QObject *o, int idx, int type) }; } -QVariant QmlBasicScriptNodeCache::value(const char *name) const +QVariant QmlBasicScriptNodeCache::value(const char *) const { //QFxPerfTimer<QFxPerf::BasicScriptValue> pt; switch(type) { @@ -220,29 +248,23 @@ QVariant QmlBasicScriptNodeCache::value(const char *name) const struct QmlBasicScriptCompiler { QmlBasicScriptCompiler() - : script(0), stateSize(0), src(0), idx(0) {} + : script(0), stateSize(0) {} QmlBasicScript *script; - QList<LexerToken> tokens; int stateSize; - const char *src; - int idx; - bool compile(); - bool compileExpr(); + bool compile(JavaScript::AST::Node *); + + bool compileExpression(JavaScript::AST::Node *); - bool parseFetch(); - bool parseName(); - bool parseConstant(); - void skipWhitespace(); + bool tryConstant(JavaScript::AST::Node *); + bool parseConstant(JavaScript::AST::Node *); + bool tryName(JavaScript::AST::Node *); + bool parseName(JavaScript::AST::Node *); + bool tryBinaryExpression(JavaScript::AST::Node *); + bool compileBinaryExpression(JavaScript::AST::Node *); QByteArray data; QList<ScriptInstruction> bytecode; - - QByteArray string(int, int); - Token token() const; - bool atEnd() const; - void adv(); - int index() const; }; /*! @@ -416,30 +438,18 @@ bool QmlBasicScript::isValid() const } /*! - Compile \a src and return true if the compilation is successful, otherwise + Compile \a v and return true if the compilation is successful, otherwise returns false. */ -bool QmlBasicScript::compile(const QByteArray &src) +bool QmlBasicScript::compile(const QmlParser::Variant &v) { - bool rv = compile(src.constData()); - return rv; -} + if (!v.asAST()) return false; -/*! - \overload - - Compile \a src and return true if the compilation is successful, otherwise - returns false. - */ -bool QmlBasicScript::compile(const char *src) -{ - if (!src) return false; + QByteArray expr = v.asScript().toLatin1(); + const char *src = expr.constData(); QmlBasicScriptCompiler bsc; bsc.script = this; - bsc.tokens = tokenize(src); - bsc.src = src; - // dumpTokens(src, bsc.tokens); if (d) { if (flags & QmlBasicScriptPrivate::OwnData) @@ -448,7 +458,7 @@ bool QmlBasicScript::compile(const char *src) flags = 0; } - if (bsc.compile()) { + if (bsc.compile(v.asAST())) { int len = ::strlen(src); flags = QmlBasicScriptPrivate::OwnData; int size = sizeof(QmlBasicScriptPrivate) + @@ -468,226 +478,148 @@ bool QmlBasicScript::compile(const char *src) return d != 0; } -void QmlBasicScriptCompiler::skipWhitespace() +bool QmlBasicScriptCompiler::compile(JavaScript::AST::Node *node) { - while(idx < tokens.count() && tokens.at(idx).token == WHITESPACE) - ++idx; + return compileExpression(node); } -bool QmlBasicScriptCompiler::compile() +using namespace JavaScript; +bool QmlBasicScriptCompiler::tryConstant(JavaScript::AST::Node *node) { - if (!compileExpr()) - return false; - - skipWhitespace(); - - if (atEnd()) + if (node->kind == AST::Node::Kind_TrueLiteral || + node->kind == AST::Node::Kind_FalseLiteral) return true; - int t = token(); - if (t != AND) - return false; - - adv(); - skipWhitespace(); - if (!compileExpr()) - return false; - - ScriptInstruction instr; - instr.type = ScriptInstruction::And; - bytecode.append(instr); + if (node->kind == AST::Node::Kind_NumericLiteral) { + AST::NumericLiteral *lit = static_cast<AST::NumericLiteral *>(node); - skipWhitespace(); + return lit->suffix == AST::NumericLiteral::noSuffix && + double(int(lit->value)) == lit->value; + } - return atEnd(); + return false; } -bool QmlBasicScriptCompiler::compileExpr() +bool QmlBasicScriptCompiler::parseConstant(JavaScript::AST::Node *node) { - /* - EXPRESSION := <NAME><OPERATOR>[<CONSTANT>|<NAME>] - */ - - if (!parseName()) - return false; - - skipWhitespace(); - - if (atEnd()) - return true; + ScriptInstruction instr; - int t = token(); - switch(t) { - case PLUS: - case MINUS: - /* - case LANGLE: - case RANGLE: - */ - case STAR: - case EQUALS: - break; - default: - return true; + if (node->kind == AST::Node::Kind_NumericLiteral) { + AST::NumericLiteral *lit = static_cast<AST::NumericLiteral *>(node); + instr.type = ScriptInstruction::Int; + instr.integer.value = int(lit->value); + } else { + instr.type = ScriptInstruction::Bool; + instr.boolean.value = node->kind == AST::Node::Kind_TrueLiteral; } - adv(); - - skipWhitespace(); - - if (!parseConstant() && - !parseName()) - return false; - ScriptInstruction instr; - switch(t) { - case PLUS: - instr.type = ScriptInstruction::Add; - break; - case MINUS: - instr.type = ScriptInstruction::Subtract; - break; - case STAR: - instr.type = ScriptInstruction::Multiply; - break; - case EQUALS: - instr.type = ScriptInstruction::Equals; - break; - default: - break; - } bytecode.append(instr); - skipWhitespace(); - return true; } -bool QmlBasicScriptCompiler::parseName() +bool QmlBasicScriptCompiler::tryName(JavaScript::AST::Node *node) { - skipWhitespace(); - - bool named = false; - bool seenchar = false; - bool seendot = false; - int namestart = -1; - bool pushed = false; - while(!atEnd()) { - int t = token(); - if (t == CHARACTER) { - named = true; - seendot = false; - seenchar = true; - namestart = index(); - adv(); - } else if (t == DIGIT) { - if (!seenchar) break; - adv(); - } else if (t == DOT) { - seendot = true; - if (namestart == -1) - break; - - seenchar = false; - QByteArray name = string(namestart, index() - 1); - int nref = data.count(); - data.append(name); - data.append('\0'); - ScriptInstruction instr; - if (pushed) - instr.type = ScriptInstruction::Fetch; - else - instr.type = ScriptInstruction::Load; - pushed = true; - instr.fetch.idx = nref; - bytecode.append(instr); - ++stateSize; - namestart = -1; - adv(); - } else { - break; - } - } - - if (namestart != -1) { - QByteArray name = string(namestart, index() - 1); - int nref = data.count(); - data.append(name); - data.append('\0'); - ScriptInstruction instr; - if (pushed) - instr.type = ScriptInstruction::Fetch; - else - instr.type = ScriptInstruction::Load; - pushed = true; - instr.fetch.idx = nref; - bytecode.append(instr); - ++stateSize; - } - - if (seendot) - return false; - else - return named; + return node->kind == AST::Node::Kind_IdentifierExpression || + node->kind == AST::Node::Kind_FieldMemberExpression; } -bool QmlBasicScriptCompiler::parseConstant() +bool QmlBasicScriptCompiler::parseName(AST::Node *node) { - switch(token()) { - case DIGIT: - { - ScriptInstruction instr; - instr.type = ScriptInstruction::Int; - instr.integer.value = string(index(), index()).toUInt(); - bytecode.append(instr); - adv(); - } - break; - case TOKEN_TRUE: - case TOKEN_FALSE: - { - ScriptInstruction instr; - instr.type = ScriptInstruction::Bool; - instr.boolean.value = (token() == TOKEN_TRUE); - bytecode.append(instr); - adv(); - } - break; + bool load = false; + + QString name; + if (node->kind == AST::Node::Kind_IdentifierExpression) { + name = static_cast<AST::IdentifierExpression *>(node)->name->asString(); + load = true; + } else if (node->kind == AST::Node::Kind_FieldMemberExpression) { + AST::FieldMemberExpression *expr = static_cast<AST::FieldMemberExpression *>(node); - default: + if (!parseName(expr->base)) + return false; + + name = expr->name->asString(); + } else { return false; } + int nref = data.count(); + data.append(name.toUtf8()); + data.append('\0'); + ScriptInstruction instr; + if (load) + instr.type = ScriptInstruction::Load; + else + instr.type = ScriptInstruction::Fetch; + instr.fetch.idx = nref; + bytecode.append(instr); + ++stateSize; + return true; } -bool QmlBasicScriptCompiler::atEnd() const +bool QmlBasicScriptCompiler::compileExpression(JavaScript::AST::Node *node) { - return idx >= tokens.count(); + if (tryBinaryExpression(node)) + return compileBinaryExpression(node); + else if (tryConstant(node)) + return parseConstant(node); + else if (tryName(node)) + return parseName(node); + else + return false; } -Token QmlBasicScriptCompiler::token() const +bool QmlBasicScriptCompiler::tryBinaryExpression(AST::Node *node) { - return tokens.at(idx).token; -} + if (node->kind == AST::Node::Kind_BinaryExpression) { + AST::BinaryExpression *expr = + static_cast<AST::BinaryExpression *>(node); -void QmlBasicScriptCompiler::adv() -{ - ++idx; + if (expr->op == QSOperator::Add || + expr->op == QSOperator::Sub || + expr->op == QSOperator::Equal || + expr->op == QSOperator::And || + expr->op == QSOperator::Mul) + return true; + } + return false; } -int QmlBasicScriptCompiler::index() const +bool QmlBasicScriptCompiler::compileBinaryExpression(AST::Node *node) { - return idx; -} + if (node->kind == AST::Node::Kind_BinaryExpression) { + AST::BinaryExpression *expr = + static_cast<AST::BinaryExpression *>(node); -QByteArray QmlBasicScriptCompiler::string(int from, int to) -{ - QByteArray rv; - for (int ii = from; ii <= to; ++ii) { - const LexerToken &token = tokens.at(ii); - rv.append(QByteArray(src + token.start, token.end - token.start + 1)); - } - return rv; + if (!compileExpression(expr->left)) return false; + if (!compileExpression(expr->right)) return false; + + ScriptInstruction instr; + switch (expr->op) { + case QSOperator::Add: + instr.type = ScriptInstruction::Add; + break; + case QSOperator::Sub: + instr.type = ScriptInstruction::Subtract; + break; + case QSOperator::Equal: + instr.type = ScriptInstruction::Equals; + break; + case QSOperator::And: + instr.type = ScriptInstruction::And; + break; + case QSOperator::Mul: + instr.type = ScriptInstruction::Multiply; + break; + default: + return false; + } + + bytecode.append(instr); + return true; + } + return false; } /*! diff --git a/src/declarative/qml/script/qmlbasicscript.h b/src/declarative/qml/qmlbasicscript_p.h index 5ef2148..1117e11 100644 --- a/src/declarative/qml/script/qmlbasicscript.h +++ b/src/declarative/qml/qmlbasicscript_p.h @@ -9,21 +9,18 @@ ** ****************************************************************************/ -#ifndef QMLBASICSCRIPT_H -#define QMLBASICSCRIPT_H +#ifndef QMLBASICSCRIPT_P_H +#define QMLBASICSCRIPT_P_H -#include "instructions.h" #include <QtCore/QList> #include <QtCore/QByteArray> -#include "lexer.h" #include <QtCore/QVariant> - +#include <private/qmlparser_p.h> QT_BEGIN_HEADER QT_BEGIN_NAMESPACE -QT_MODULE(Declarative) class QmlRefCount; class QmlContext; class QmlBasicScriptPrivate; @@ -41,8 +38,7 @@ public: QByteArray expression() const; - bool compile(const QByteArray &); - bool compile(const char *); + bool compile(const QmlParser::Variant &); bool isValid() const; void clear(); @@ -68,9 +64,41 @@ private: bool valid(QmlBasicScriptNodeCache &, QObject *); }; -#endif // QMLBASICSCRIPT_H +class QmlContextPrivate; +class QDebug; +class QmlBasicScriptNodeCache +{ +public: + QObject *object; + const QMetaObject *metaObject; + enum { Invalid, + Core, + Attached, + Signal, + SignalProperty, + Variant + } type; + union { + int core; + QObject *attached; + QmlContextPrivate *context; + }; + int coreType; + int contextIndex; + + bool isValid() const { return type != Invalid; } + bool isCore() const { return type == Core; } + bool isVariant() const { return type == Variant; } + void clear(); + QVariant value(const char *) const; +}; +QDebug operator<<(QDebug, const QmlBasicScriptNodeCache &); QT_END_NAMESPACE QT_END_HEADER + +#endif // QMLBASICSCRIPT_P_H + + diff --git a/src/declarative/qml/qmlbindablevalue.cpp b/src/declarative/qml/qmlbindablevalue.cpp index d5157b6..351e0bd 100644 --- a/src/declarative/qml/qmlbindablevalue.cpp +++ b/src/declarative/qml/qmlbindablevalue.cpp @@ -69,8 +69,8 @@ QmlBindableValue::QmlBindableValue(void *data, QmlRefCount *rc, QObject *obj, QO { } -QmlBindableValue::QmlBindableValue(const QString &str, QObject *obj, bool sse, QObject *parent) -: QmlPropertyValueSource(*new QmlBindableValuePrivate, parent), QmlExpression(QmlContext::activeContext(), str, obj, sse) +QmlBindableValue::QmlBindableValue(const QString &str, QObject *obj, QObject *parent) +: QmlPropertyValueSource(*new QmlBindableValuePrivate, parent), QmlExpression(QmlContext::activeContext(), str, obj) { } diff --git a/src/declarative/qml/qmlbindablevalue.h b/src/declarative/qml/qmlbindablevalue.h index c5bb97b..71a7051 100644 --- a/src/declarative/qml/qmlbindablevalue.h +++ b/src/declarative/qml/qmlbindablevalue.h @@ -63,7 +63,7 @@ class Q_DECLARATIVE_EXPORT QmlBindableValue : public QmlPropertyValueSource, Q_OBJECT public: QmlBindableValue(QObject *parent); - QmlBindableValue(const QString &, QObject *, bool = true, QObject *parent=0); + QmlBindableValue(const QString &, QObject *, QObject *parent=0); QmlBindableValue(void *, QmlRefCount *, QObject *, QObject *parent); ~QmlBindableValue(); diff --git a/src/declarative/qml/qmlcompiler.cpp b/src/declarative/qml/qmlcompiler.cpp index cce8109..75d01c2 100644 --- a/src/declarative/qml/qmlcompiler.cpp +++ b/src/declarative/qml/qmlcompiler.cpp @@ -46,7 +46,7 @@ #include <qmlpropertyvaluesource.h> #include <qmlcomponent.h> #include "private/qmetaobjectbuilder_p.h" -#include <qmlbasicscript.h> +#include "qmlbasicscript_p.h" #include <QColor> #include <QDebug> #include <QPointF> @@ -62,6 +62,7 @@ #include "private/qmlcustomparser_p_p.h" #include <private/qmlcontext_p.h> #include <private/qmlcomponent_p.h> +#include "parser/javascriptast_p.h" #include "qmlscriptparser_p.h" @@ -516,6 +517,7 @@ bool QmlCompiler::compile(QmlEngine *engine, } output = 0; + return !isError(); } @@ -542,7 +544,7 @@ void QmlCompiler::compileTree(Object *tree) def.type = QmlInstruction::SetDefault; output->bytecode << def; - optimizeExpressions(0, output->bytecode.count() - 1, 0); + finalizeComponent(0); } bool QmlCompiler::compileObject(Object *obj, int ctxt) @@ -588,6 +590,8 @@ bool QmlCompiler::compileObject(Object *obj, int ctxt) begin.begin.castValue = parserStatusCast; begin.line = obj->location.start.line; output->bytecode << begin; + + compileState.parserStatusCount++; } // Check if this is a custom parser type. Custom parser types allow @@ -688,9 +692,14 @@ bool QmlCompiler::compileComponent(Object *obj, int ctxt) if (!isValidId(val)) COMPILE_EXCEPTION("Invalid id property value"); - if (ids.contains(val)) + if (compileState.ids.contains(val)) COMPILE_EXCEPTION("id is not unique"); - ids.insert(val); + + IdReference reference; + reference.id = val; + reference.object = obj; + reference.instructionIdx = output->bytecode.count(); + compileState.ids.insert(val, reference); int pref = output->indexForString(val); QmlInstruction id; @@ -699,8 +708,6 @@ bool QmlCompiler::compileComponent(Object *obj, int ctxt) id.setId.value = pref; id.setId.save = -1; - savedTypes.insert(output->bytecode.count(), -1); - output->bytecode << id; } @@ -724,16 +731,16 @@ bool QmlCompiler::compileComponentFromRoot(Object *obj, int ctxt) init.line = obj->location.start.line; output->bytecode << init; - QSet<QString> oldIds = ids; - ids.clear(); + ComponentCompileState oldComponentCompileState = compileState; + compileState = ComponentCompileState(); if (obj) COMPILE_CHECK(compileObject(obj, ctxt)); - ids = oldIds; create.createComponent.count = output->bytecode.count() - count; - int inc = optimizeExpressions(count, count - 1 + create.createComponent.count, count); + int inc = finalizeComponent(count); create.createComponent.count += inc; + compileState = oldComponentCompileState; return true; } @@ -914,7 +921,7 @@ bool QmlCompiler::compileProperty(Property *prop, Object *obj, int ctxt) } else if (isAttachedPropertyName(prop->name)) { - COMPILE_CHECK(compileAttachedProperty(prop, obj, ctxt)); + COMPILE_CHECK(compileAttachedProperty(prop, ctxt)); } else if (prop->index == -1) { @@ -950,41 +957,43 @@ bool QmlCompiler::compileIdProperty(QmlParser::Property *prop, if (prop->values.count() > 1) COMPILE_EXCEPTION2(prop, "The object id may only be set once"); - if (prop->values.count() == 1) { - if (prop->values.at(0)->object) - COMPILE_EXCEPTION("Cannot assign an object as an id"); - QString val = prop->values.at(0)->primitive(); - if (!isValidId(val)) - COMPILE_EXCEPTION(val << "is not a valid id"); - if (ids.contains(val)) - COMPILE_EXCEPTION("id is not unique"); - ids.insert(val); + if (prop->values.at(0)->object) + COMPILE_EXCEPTION("Cannot assign an object as an id"); + QString val = prop->values.at(0)->primitive(); + if (!isValidId(val)) + COMPILE_EXCEPTION(val << "is not a valid id"); + if (compileState.ids.contains(val)) + COMPILE_EXCEPTION("id is not unique"); - int pref = output->indexForString(val); + int pref = output->indexForString(val); - if (prop->type == QVariant::String) { - QmlInstruction assign; - assign.type = QmlInstruction::StoreString; - assign.storeString.propertyIndex = prop->index; - assign.storeString.value = pref; - assign.line = prop->values.at(0)->location.start.line; - output->bytecode << assign; + if (prop->type == QVariant::String) { + QmlInstruction assign; + assign.type = QmlInstruction::StoreString; + assign.storeString.propertyIndex = prop->index; + assign.storeString.value = pref; + assign.line = prop->values.at(0)->location.start.line; + output->bytecode << assign; - prop->values.at(0)->type = Value::Id; - } else { - prop->values.at(0)->type = Value::Literal; - } + prop->values.at(0)->type = Value::Id; + } else { + prop->values.at(0)->type = Value::Literal; + } - QmlInstruction id; - id.type = QmlInstruction::SetId; - id.line = prop->values.at(0)->location.start.line; - id.setId.value = pref; - id.setId.save = -1; - savedTypes.insert(output->bytecode.count(), obj->type); - output->bytecode << id; + IdReference reference; + reference.id = val; + reference.object = obj; + reference.instructionIdx = output->bytecode.count(); + compileState.ids.insert(val, reference); - obj->id = val.toLatin1(); - } + QmlInstruction id; + id.type = QmlInstruction::SetId; + id.line = prop->values.at(0)->location.start.line; + id.setId.value = pref; + id.setId.save = -1; + output->bytecode << id; + + obj->id = val.toLatin1(); return true; } @@ -995,7 +1004,6 @@ bool QmlCompiler::compileIdProperty(QmlParser::Property *prop, // } // GridView is an attached property object. bool QmlCompiler::compileAttachedProperty(QmlParser::Property *prop, - QmlParser::Object *obj, int ctxt) { Q_ASSERT(prop->value); @@ -1117,7 +1125,7 @@ bool QmlCompiler::compileListProperty(QmlParser::Property *prop, COMPILE_EXCEPTION("Can only assign one binding to lists"); assignedBinding = true; - COMPILE_CHECK(compileBinding(v->value.asScript(), prop, ctxt, + COMPILE_CHECK(compileBinding(v->value, prop, ctxt, obj->metaObject(), v->location.start.line)); v->type = Value::PropertyBinding; @@ -1158,7 +1166,7 @@ bool QmlCompiler::compilePropertyAssignment(QmlParser::Property *prop, Value *v = prop->values.at(ii); if (v->object) { - COMPILE_CHECK(compilePropertyObjectAssignment(prop, obj, v, ctxt)); + COMPILE_CHECK(compilePropertyObjectAssignment(prop, v, ctxt)); } else { @@ -1172,7 +1180,6 @@ bool QmlCompiler::compilePropertyAssignment(QmlParser::Property *prop, // Compile assigning a single object instance to a regular property bool QmlCompiler::compilePropertyObjectAssignment(QmlParser::Property *prop, - QmlParser::Object *obj, QmlParser::Value *v, int ctxt) { @@ -1289,7 +1296,7 @@ bool QmlCompiler::compilePropertyLiteralAssignment(QmlParser::Property *prop, if (v->value.isScript()) { - COMPILE_CHECK(compileBinding(v->value.asScript(), prop, ctxt, + COMPILE_CHECK(compileBinding(v->value, prop, ctxt, obj->metaObject(), v->location.start.line)); @@ -1396,20 +1403,25 @@ bool QmlCompiler::compileDynamicMeta(QmlParser::Object *obj) return true; } -bool QmlCompiler::compileBinding(const QString &bind, QmlParser::Property *prop, +bool QmlCompiler::compileBinding(const QmlParser::Variant &bind, + QmlParser::Property *prop, int ctxt, const QMetaObject *mo, qint64 line) { Q_ASSERT(mo); Q_ASSERT(prop->index); + QMetaProperty mp = mo->property(prop->index); + if (!mp.isWritable() && !QmlMetaType::isList(prop->type)) + COMPILE_EXCEPTION2(prop, "Cannot assign binding to read-only property"); + QmlBasicScript bs; - bs.compile(bind.toLatin1()); + bs.compile(bind); int bref; if (bs.isValid()) { bref = output->indexForByteArray(QByteArray(bs.compileData(), bs.compileDataSize())); } else { - bref = output->indexForString(bind); + bref = output->indexForString(bind.asScript()); } QmlInstruction assign; @@ -1423,54 +1435,70 @@ bool QmlCompiler::compileBinding(const QString &bind, QmlParser::Property *prop, assign.assignBinding.property = prop->index; assign.assignBinding.value = bref; - QMetaProperty mp = mo->property(assign.assignBinding.property); - if (!mp.isWritable() && !QmlMetaType::isList(prop->type)) - COMPILE_EXCEPTION2(prop, "Cannot assign binding to read-only property"); assign.assignBinding.category = QmlMetaProperty::propertyCategory(mp); + BindingReference reference; + reference.expression = bind; + reference.property = prop; + reference.instructionIdx = output->bytecode.count(); + compileState.bindings << reference; - savedTypes.insert(output->bytecode.count(), prop->type); output->bytecode << assign; return true; } -int QmlCompiler::optimizeExpressions(int start, int end, int patch) +#if 0 + +#include <iostream> +#ifdef Q_CC_GNU +#include <cxxabi.h> +#endif + +//////////////////////////////////////////////////////////////////////////////// +// AST Dump +//////////////////////////////////////////////////////////////////////////////// +class Dump: protected JavaScript::AST::Visitor +{ + std::ostream &out; + int depth; + +public: + Dump(std::ostream &out) + : out(out), depth(-1) + { } + + void operator()(JavaScript::AST::Node *node) + { JavaScript::AST::Node::acceptChild(node, this); } + +protected: + virtual bool preVisit(JavaScript::AST::Node *node) + { + const char *name = typeid(*node).name(); +#ifdef Q_CC_GNU + name = abi::__cxa_demangle(name, 0, 0, 0) + 17; +#endif + std::cout << std::string(++depth, ' ') << name << std::endl; + return true; + } + + virtual void postVisit(JavaScript::AST::Node *) + { + --depth; + } +}; +#endif + +// Update the init instruction with final data, and optimize some simple +// bindings +int QmlCompiler::finalizeComponent(int patch) { - QHash<QString, int> ids; int saveCount = 0; int newInstrs = 0; - int bindingsCount = 0; - int parserStatusCount = 0; - for (int ii = start; ii <= end; ++ii) { - const QmlInstruction &instr = output->bytecode.at(ii); - - if (instr.type == QmlInstruction::CreateComponent) { - ii += instr.createComponent.count - 1; - continue; - } - - if (instr.type == QmlInstruction::SetId) { - QString id = output->primitives.at(instr.setId.value); - ids.insert(id, ii); - } - } - - for (int ii = start; ii <= end; ++ii) { - const QmlInstruction &instr = output->bytecode.at(ii); - - if (instr.type == QmlInstruction::CreateComponent) { - ii += instr.createComponent.count - 1; - continue; - } - - if (instr.type == QmlInstruction::StoreBinding || - instr.type == QmlInstruction::StoreCompiledBinding) { - ++bindingsCount; - } else if (instr.type == QmlInstruction::BeginObject) { - ++parserStatusCount; - } + for (int ii = 0; ii < compileState.bindings.count(); ++ii) { + const BindingReference &binding = compileState.bindings.at(ii); + QmlInstruction &instr = output->bytecode[binding.instructionIdx]; if (instr.type == QmlInstruction::StoreCompiledBinding) { QmlBasicScript s(output->datas.at(instr.assignBinding.value).constData()); @@ -1480,16 +1508,17 @@ int QmlCompiler::optimizeExpressions(int start, int end, int patch) if (!slt.at(0).isUpper()) continue; - if (ids.contains(slt) && + if (compileState.ids.contains(slt) && instr.assignBinding.category == QmlMetaProperty::Object) { - int id = ids[slt]; - int idType = savedTypes.value(id); - int storeType = savedTypes.value(ii); + IdReference reference = + compileState.ids[slt]; + + const QMetaObject *idMo = reference.object->metaObject(); + const QMetaObject *storeMo = QmlMetaType::rawMetaObjectForType(binding.property->type); - const QMetaObject *idMo = (idType == -1)?&QmlComponent::staticMetaObject:output->types.at(idType).metaObject(); - const QMetaObject *storeMo = - QmlMetaType::rawMetaObjectForType(storeType); + Q_ASSERT(idMo); + Q_ASSERT(storeMo); bool canAssign = false; while (!canAssign && idMo) { @@ -1504,19 +1533,19 @@ int QmlCompiler::optimizeExpressions(int start, int end, int patch) int saveId = -1; - if (output->bytecode.at(id).setId.save != -1) { - saveId = output->bytecode.at(id).setId.save; + int instructionIdx = reference.instructionIdx; + if (output->bytecode.at(instructionIdx).setId.save != -1) { + saveId = output->bytecode.at(instructionIdx).setId.save; } else { - output->bytecode[id].setId.save = saveCount; + output->bytecode[instructionIdx].setId.save = saveCount; saveId = saveCount; ++saveCount; } int prop = instr.assignBinding.property; - QmlInstruction &rwinstr = output->bytecode[ii]; - rwinstr.type = QmlInstruction::PushProperty; - rwinstr.pushProperty.property = prop; + instr.type = QmlInstruction::PushProperty; + instr.pushProperty.property = prop; QmlInstruction instr; instr.type = QmlInstruction::StoreStackObject; @@ -1531,8 +1560,9 @@ int QmlCompiler::optimizeExpressions(int start, int end, int patch) } output->bytecode[patch].init.dataSize = saveCount; - output->bytecode[patch].init.bindingsSize = bindingsCount; - output->bytecode[patch].init.parserStatusSize = parserStatusCount;; + output->bytecode[patch].init.bindingsSize = compileState.bindings.count(); + output->bytecode[patch].init.parserStatusSize = + compileState.parserStatusCount; return newInstrs; } diff --git a/src/declarative/qml/qmlcompiler_p.h b/src/declarative/qml/qmlcompiler_p.h index bc9e06c..b1963da 100644 --- a/src/declarative/qml/qmlcompiler_p.h +++ b/src/declarative/qml/qmlcompiler_p.h @@ -137,7 +137,6 @@ private: bool compileIdProperty(QmlParser::Property *prop, QmlParser::Object *obj); bool compileAttachedProperty(QmlParser::Property *prop, - QmlParser::Object *obj, int ctxt); bool compileNestedProperty(QmlParser::Property *prop, int ctxt); @@ -148,7 +147,6 @@ private: QmlParser::Object *obj, int ctxt); bool compilePropertyObjectAssignment(QmlParser::Property *prop, - QmlParser::Object *obj, QmlParser::Value *value, int ctxt); bool compilePropertyLiteralAssignment(QmlParser::Property *prop, @@ -160,17 +158,35 @@ private: QmlParser::Value *value); bool compileDynamicMeta(QmlParser::Object *obj); - bool compileBinding(const QString &, QmlParser::Property *prop, + bool compileBinding(const QmlParser::Variant &, QmlParser::Property *prop, int ctxt, const QMetaObject *, qint64); - int optimizeExpressions(int start, int end, int patch = -1); + int finalizeComponent(int patch); - QSet<QString> ids; + struct IdReference { + QString id; + QmlParser::Object *object; + int instructionIdx; + }; + + struct BindingReference { + QmlParser::Variant expression; + QmlParser::Property *property; + int instructionIdx; + }; + + struct ComponentCompileState + { + ComponentCompileState() : parserStatusCount(0) {} + QHash<QString, IdReference> ids; + int parserStatusCount; + QList<BindingReference> bindings; + }; + ComponentCompileState compileState; QList<QmlError> exceptions; QmlCompiledData *output; - QHash<int, int> savedTypes; }; QT_END_NAMESPACE diff --git a/src/declarative/qml/qmldom.cpp b/src/declarative/qml/qmldom.cpp index b689ec5..38436b4 100644 --- a/src/declarative/qml/qmldom.cpp +++ b/src/declarative/qml/qmldom.cpp @@ -1170,7 +1170,7 @@ QmlDomValue::Type QmlDomValue::type() const case QmlParser::Value::SignalExpression: return Literal; case QmlParser::Value::Id: - return Invalid; + return Literal; } return Invalid; } diff --git a/src/declarative/qml/qmlengine.cpp b/src/declarative/qml/qmlengine.cpp index 3db8d92..c67c220 100644 --- a/src/declarative/qml/qmlengine.cpp +++ b/src/declarative/qml/qmlengine.cpp @@ -820,15 +820,9 @@ QmlExpressionPrivate::QmlExpressionPrivate(QmlExpression *b, void *expr, QmlRefC { } -QmlExpressionPrivate::QmlExpressionPrivate(QmlExpression *b, const QString &expr, bool ssecompile) +QmlExpressionPrivate::QmlExpressionPrivate(QmlExpression *b, const QString &expr) : q(b), ctxt(0), expression(expr), sseData(0), proxy(0), me(0), trackChange(true), line(-1), id(0), log(0) { - if (ssecompile) { -#ifdef Q_ENABLE_PERFORMANCE_LOG - QFxPerfTimer<QFxPerf::BindCompile> pt; -#endif - sse.compile(expr.toLatin1()); - } } QmlExpressionPrivate::~QmlExpressionPrivate() @@ -863,19 +857,6 @@ QmlExpression::QmlExpression(QmlContext *ctxt, void *expr, d->me = me; } -/*! \internal */ -QmlExpression::QmlExpression(QmlContext *ctxt, const QString &expr, - QObject *me, bool ssecompile) -: d(new QmlExpressionPrivate(this, expr, ssecompile)) -{ - d->ctxt = ctxt; - if(ctxt && ctxt->engine()) - d->id = ctxt->engine()->d_func()->getUniqueId(); - if(ctxt) - ctxt->d_func()->childExpressions.insert(this); - d->me = me; -} - /*! Create a QmlExpression object. @@ -885,7 +866,7 @@ QmlExpression::QmlExpression(QmlContext *ctxt, const QString &expr, */ QmlExpression::QmlExpression(QmlContext *ctxt, const QString &expression, QObject *scope) -: d(new QmlExpressionPrivate(this, expression, true)) +: d(new QmlExpressionPrivate(this, expression)) { d->ctxt = ctxt; if(ctxt && ctxt->engine()) @@ -956,10 +937,7 @@ void QmlExpression::setExpression(const QString &expression) d->expression = expression; - if (d->expression.isEmpty()) - d->sse.clear(); - else - d->sse.compile(expression.toLatin1()); + d->sse.clear(); } /*! @@ -1245,13 +1223,7 @@ QmlExpressionObject::QmlExpressionObject(QObject *parent) the expression's execution. */ QmlExpressionObject::QmlExpressionObject(QmlContext *ctxt, const QString &expression, QObject *scope, QObject *parent) -: QObject(parent), QmlExpression(ctxt, expression, scope, true) -{ -} - -/*! \internal */ -QmlExpressionObject::QmlExpressionObject(QmlContext *ctxt, const QString &expr, QObject *scope, bool sse) -: QmlExpression(ctxt, expr, scope, sse) +: QObject(parent), QmlExpression(ctxt, expression, scope) { } diff --git a/src/declarative/qml/qmlengine_p.h b/src/declarative/qml/qmlengine_p.h index 0dc4736..89b0a4a 100644 --- a/src/declarative/qml/qmlengine_p.h +++ b/src/declarative/qml/qmlengine_p.h @@ -53,7 +53,7 @@ #include <private/qmlclassfactory_p.h> #include <private/qmlcompositetypemanager_p.h> #include <QtDeclarative/qml.h> -#include <QtDeclarative/qmlbasicscript.h> +#include <private/qmlbasicscript_p.h> #include <QtDeclarative/qmlcontext.h> #include <QtDeclarative/qmlengine.h> #include <QtDeclarative/qmlexpression.h> @@ -265,7 +265,7 @@ class QmlExpressionPrivate { public: QmlExpressionPrivate(QmlExpression *); - QmlExpressionPrivate(QmlExpression *, const QString &expr, bool); + QmlExpressionPrivate(QmlExpression *, const QString &expr); QmlExpressionPrivate(QmlExpression *, void *expr, QmlRefCount *rc); ~QmlExpressionPrivate(); diff --git a/src/declarative/qml/qmlexpression.h b/src/declarative/qml/qmlexpression.h index ea3b093..651fd9c 100644 --- a/src/declarative/qml/qmlexpression.h +++ b/src/declarative/qml/qmlexpression.h @@ -62,7 +62,6 @@ class Q_DECLARATIVE_EXPORT QmlExpression public: QmlExpression(); QmlExpression(QmlContext *, const QString &, QObject *); - QmlExpression(QmlContext *, const QString &, QObject *, bool); QmlExpression(QmlContext *, void *, QmlRefCount *rc, QObject *me); virtual ~QmlExpression(); @@ -101,7 +100,6 @@ class Q_DECLARATIVE_EXPORT QmlExpressionObject : public QObject, public: QmlExpressionObject(QObject *parent = 0); QmlExpressionObject(QmlContext *, const QString &, QObject *scope, QObject *parent = 0); - QmlExpressionObject(QmlContext *, const QString &, QObject *scope, bool); QmlExpressionObject(QmlContext *, void *, QmlRefCount *, QObject *); public Q_SLOTS: diff --git a/src/declarative/qml/qmlparser.cpp b/src/declarative/qml/qmlparser.cpp index c5d7092..f262b5d 100644 --- a/src/declarative/qml/qmlparser.cpp +++ b/src/declarative/qml/qmlparser.cpp @@ -52,7 +52,6 @@ #include <qml.h> #include "private/qmlcomponent_p.h" #include <qmlcomponent.h> -#include <qmlbasicscript.h> #include "private/qmetaobjectbuilder_p.h" #include <private/qmlvmemetaobject_p.h> #include <private/qmlcompiler_p.h> @@ -281,10 +280,14 @@ QmlParser::Variant::Variant(double v, const QString &asWritten) { } -QmlParser::Variant::Variant(const QString &v, Type type) -: t(type), s(v) +QmlParser::Variant::Variant(const QString &v) +: t(String), s(v) +{ +} + +QmlParser::Variant::Variant(const QString &v, JavaScript::AST::Node *n) +: t(Script), n(n), s(v) { - Q_ASSERT(type == String || type == Script); } QmlParser::Variant &QmlParser::Variant::operator=(const Variant &o) @@ -334,4 +337,12 @@ QString QmlParser::Variant::asScript() const } } +JavaScript::AST::Node *QmlParser::Variant::asAST() const +{ + if (type() == Script) + return n; + else + return 0; +} + QT_END_NAMESPACE diff --git a/src/declarative/qml/qmlparser_p.h b/src/declarative/qml/qmlparser_p.h index 721f1a8..cb9b540 100644 --- a/src/declarative/qml/qmlparser_p.h +++ b/src/declarative/qml/qmlparser_p.h @@ -55,6 +55,8 @@ QT_BEGIN_NAMESPACE QT_MODULE(Declarative) +namespace JavaScript { namespace AST { class Node; } } + /* XXX @@ -175,7 +177,8 @@ namespace QmlParser Variant(const Variant &); Variant(bool); Variant(double, const QString &asWritten=QString()); - Variant(const QString &, Type = String); + Variant(const QString &); + Variant(const QString &, JavaScript::AST::Node *); Variant &operator=(const Variant &); Type type() const; @@ -189,12 +192,14 @@ namespace QmlParser QString asString() const; double asNumber() const; QString asScript() const; + JavaScript::AST::Node *asAST() const; private: Type t; union { bool b; double d; + JavaScript::AST::Node *n; }; QString s; }; diff --git a/src/declarative/qml/qmlscriptparser.cpp b/src/declarative/qml/qmlscriptparser.cpp index 5c5b25e..b1ffc98 100644 --- a/src/declarative/qml/qmlscriptparser.cpp +++ b/src/declarative/qml/qmlscriptparser.cpp @@ -587,7 +587,7 @@ QmlParser::Variant ProcessAST::getVariant(AST::ExpressionNode *expr) if (lit->suffix == AST::NumericLiteral::noSuffix) return QmlParser::Variant(lit->value, asString(expr)); else - return QmlParser::Variant(asString(expr), QmlParser::Variant::Script); + return QmlParser::Variant(asString(expr), expr); } else { @@ -597,7 +597,7 @@ QmlParser::Variant ProcessAST::getVariant(AST::ExpressionNode *expr) } } - return QmlParser::Variant(asString(expr), QmlParser::Variant::Script); + return QmlParser::Variant(asString(expr), expr); } } @@ -620,8 +620,8 @@ bool ProcessAST::visit(AST::UiScriptBinding *node) if (AST::ExpressionStatement *stmt = AST::cast<AST::ExpressionStatement *>(node->statement)) { primitive = getVariant(stmt->expression); } else { // do binding - primitive = QmlParser::Variant(asString(node->statement), - QmlParser::Variant::Script); + primitive = QmlParser::Variant(asString(node->statement), + node->statement); } Value *v = new Value; @@ -716,33 +716,44 @@ bool ProcessAST::visit(AST::UiSourceElement *node) QmlScriptParser::QmlScriptParser() -: root(0) +: root(0), data(0) { } QmlScriptParser::~QmlScriptParser() { + clear(); } -bool QmlScriptParser::parse(const QByteArray &data, const QUrl &url) +class QmlScriptParserJsASTData +{ +public: + QmlScriptParserJsASTData(const QString &filename) + : nodePool(filename, &engine) {} + + Engine engine; + NodePool nodePool; +}; + +bool QmlScriptParser::parse(const QByteArray &qmldata, const QUrl &url) { #ifdef Q_ENABLE_PERFORMANCE_LOG QFxPerfTimer<QFxPerf::QmlParsing> pt; #endif + clear(); + const QString fileName = url.toString(); - QTextStream stream(data, QIODevice::ReadOnly); + QTextStream stream(qmldata, QIODevice::ReadOnly); const QString code = stream.readAll(); - Engine engine; - - NodePool nodePool(fileName, &engine); + data = new QmlScriptParserJsASTData(fileName); - Lexer lexer(&engine); + Lexer lexer(&data->engine); lexer.setCode(code, /*line = */ 1); - Parser parser(&engine); + Parser parser(&data->engine); if (! parser.parse() || !_errors.isEmpty()) { @@ -808,6 +819,11 @@ void QmlScriptParser::clear() _nameSpacePaths.clear(); _typeNames.clear(); _errors.clear(); + + if (data) { + delete data; + data = 0; + } } int QmlScriptParser::findOrCreateTypeId(const QString &name) diff --git a/src/declarative/qml/qmlscriptparser_p.h b/src/declarative/qml/qmlscriptparser_p.h index a9ffa47..3993194 100644 --- a/src/declarative/qml/qmlscriptparser_p.h +++ b/src/declarative/qml/qmlscriptparser_p.h @@ -54,6 +54,7 @@ QT_MODULE(Declarative) class QByteArray; +class QmlScriptParserJsASTData; class QmlScriptParser { public: @@ -98,6 +99,7 @@ public: QList<Import> _imports; QStringList _typeNames; QString _scriptFile; + QmlScriptParserJsASTData *data; }; QT_END_NAMESPACE diff --git a/src/declarative/qml/script/generator/generator.pro b/src/declarative/qml/script/generator/generator.pro deleted file mode 100644 index 1b2a4c7..0000000 --- a/src/declarative/qml/script/generator/generator.pro +++ /dev/null @@ -1,11 +0,0 @@ -###################################################################### -# Automatically generated by qmake (2.01a) Mon Apr 2 20:15:52 2007 -###################################################################### - -TEMPLATE = app -TARGET = -DEPENDPATH += . -INCLUDEPATH += . - -# Input -SOURCES += main.cpp diff --git a/src/declarative/qml/script/generator/main.cpp b/src/declarative/qml/script/generator/main.cpp deleted file mode 100644 index a841cbc..0000000 --- a/src/declarative/qml/script/generator/main.cpp +++ /dev/null @@ -1,135 +0,0 @@ -/**************************************************************************** -** -** This file is part of the $PACKAGE_NAME$. -** -** Copyright (C) $THISYEAR$ $COMPANY_NAME$. -** -** $QT_EXTENDED_DUAL_LICENSE$ -** -****************************************************************************/ - -#include <QList> -#include <QByteArray> - - -QT_BEGIN_NAMESPACE -struct Keyword { - const char *lexem; - const char *token; -}; - -struct State -{ - State(const char* token) : token(token) - { - ::memset(next, 0, sizeof(next)); - } - State(const State &other) : token(other.token) - { - ::memcpy(next, other.next, sizeof(next)); - } - State &operator=(const State &other) - { - token = other.token; - ::memcpy(next, other.next, sizeof(next)); - return *this; - } - - QByteArray token; - int next[128]; -}; - -Keyword keywords[] = -{ - {"<", "LANGLE" }, - {">", "RANGLE" }, - {"+", "PLUS" }, - {"-", "MINUS" }, - {"*", "STAR" }, - {"==", "EQUALS" }, - {"&&", "AND" }, - {".", "DOT"}, - {"true", "TOKEN_TRUE"}, - {"false", "TOKEN_FALSE"}, - {" ", "WHITESPACE"}, - {"\t", "WHITESPACE"}, - {0, 0} -}; - -bool is_character(char s) -{ - return (s >= 'a' && s <= 'z') || - (s >= 'A' && s <= 'Z') || - (s >= '0' && s <= '9') || - s == '_'; -} - -void newState(QList<State> &states, const char *token, const char *lexem) -{ - int state = 0; - bool character = is_character(*lexem); - - while(*lexem) { - int next = states[state].next[(int)*lexem]; - - if (!next) { - next = states.size(); - states += State(character?"CHARACTER":"INCOMPLETE"); - states[state].next[(int)*lexem] = next; - } - - state = next; - ++lexem; - character = character && is_character(*lexem); - } - - states[state].token = token; -} - -void newState(QList<State> &states, const char *token, char lexem) -{ - int next = states[0].next[(int)lexem]; - if (!next) { - next = states.size(); - states += State(token); - states[0].next[(int)lexem] = next; - } else { - states[next].token = token; - } -} - -int main() -{ - QList<State> states; - states += State("NOTOKEN"); - - // identifiers - for (int cc = 'a'; cc <= 'z'; ++cc) - newState(states, "CHARACTER", cc); - for (int cc = 'A'; cc <= 'Z'; ++cc) - newState(states, "CHARACTER", cc); - newState(states, "CHARACTER", '_'); - - // add digits - for (int cc = '0'; cc <= '9'; ++cc) - newState(states, "DIGIT", cc); - - // keywords - for (int ii = 0; keywords[ii].lexem; ++ii) - newState(states, keywords[ii].token, keywords[ii].lexem); - - ::printf("static const struct\n{\n" - " Token token;\n" - " char next[128];\n" - "} keywords[] = {\n"); - - for (int ii = 0; ii < states.size(); ++ii) { - printf("%s { %s, { ", ii?",\n":"", states[ii].token.data()); - for (int jj = 0; jj < 128; jj++) - printf("%s%d", jj?",":"", states[ii].next[jj]); - printf(" } }"); - } - - printf("\n};\n"); -} -QT_END_NAMESPACE diff --git a/src/declarative/qml/script/instructions.h b/src/declarative/qml/script/instructions.h deleted file mode 100644 index a21cbce..0000000 --- a/src/declarative/qml/script/instructions.h +++ /dev/null @@ -1,32 +0,0 @@ -#ifndef _INSTRUCTIONS_H_ -#define _INSTRUCTIONS_H_ - -struct ScriptInstruction { - enum { - Load, // fetch - Fetch, // fetch - - Add, // NA - Subtract, // NA - Multiply, // NA - Equals, // NA - And, // NA - - Int, // integer - Bool, // boolean - } type; - - union { - struct { - int idx; - } fetch; - struct { - int value; - } integer; - struct { - bool value; - } boolean; - }; -}; - -#endif // _INSTRUCTIONS_H_ diff --git a/src/declarative/qml/script/keywords.cpp b/src/declarative/qml/script/keywords.cpp deleted file mode 100644 index 4cde65b..0000000 --- a/src/declarative/qml/script/keywords.cpp +++ /dev/null @@ -1,89 +0,0 @@ -static const struct -{ - Token token; - char next[128]; -} keywords[] = { - { NOTOKEN, { 0,0,0,0,0,0,0,0,0,82,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,81,0,0,0,0,0,71,0,0,0,68,66,0,67,73,0,54,55,56,57,58,59,60,61,62,63,0,0,64,69,65,0,0,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,0,0,0,0,53,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,0,0,0,0,0 } }, - { CHARAC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0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } }, - { WHITESPACE, { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } }, - { WHITESPACE, { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } } -}; diff --git a/src/declarative/qml/script/lexer.cpp b/src/declarative/qml/script/lexer.cpp deleted file mode 100644 index d3ef935..0000000 --- a/src/declarative/qml/script/lexer.cpp +++ /dev/null @@ -1,139 +0,0 @@ -/**************************************************************************** -** -** This file is part of the $PACKAGE_NAME$. -** -** Copyright (C) $THISYEAR$ $COMPANY_NAME$. -** -** $QT_EXTENDED_DUAL_LICENSE$ -** -****************************************************************************/ - -#include <QByteArray> -#include "lexer.h" -#include "keywords.cpp" -#include <QDebug> - - -QT_BEGIN_NAMESPACE -QList<LexerToken> tokenize(const char *text) -{ - QList<LexerToken> rv; - - int lineNo = 0; - int charNo = 0; - int state = 0; - int tokenStart = 0; - bool other = false; - - const char *textprog = text; - - bool done = false; - while (!done) { - char textchar = *textprog; - done = !textchar; - - if (other) { - if (keywords[state].next[(int)textchar]) { - - // Do other token - LexerToken token; - token.token = OTHER; - token.start = tokenStart; - token.end = textprog - text - 1; - token.line = lineNo + 1; - token.offset = charNo - (token.end - token.start); - tokenStart = token.end + 1; - rv.append(token); - other = false; - - } else { - goto continue_loop; - } - } - - if (keywords[state].next[(int)textchar]) { - - state = keywords[state].next[(int)textchar]; - - } else if (0 == state || - keywords[state].token == INCOMPLETE) { - - other = true; - if (keywords[state].token == INCOMPLETE) { - state = 0; - continue; - } - - } else { - - // Token completed - Token tokenType = keywords[state].token; - bool tokenCollapsed = false; - if (tokenType == CHARACTER || - tokenType == DIGIT || - tokenType == WHITESPACE) { - - Token lastTokenType = - rv.isEmpty()?NOTOKEN:rv.last().token; - if (tokenType == lastTokenType) { - - rv.last().end = textprog - text - 1; - tokenStart = rv.last().end + 1; - - tokenCollapsed = true; - } - } - - if (!tokenCollapsed) { - LexerToken token; - token.token = keywords[state].token; - token.start = tokenStart; - token.end = textprog - text - 1; - token.line = lineNo + 1; - token.offset = charNo - (token.end - token.start); - tokenStart = token.end + 1; - rv.append(token); - } - - state = keywords[0].next[(int)textchar]; - if (0 == state) - other = true; - } - -continue_loop: - // Reset error reporting variables - if (textchar == '\n') { - ++lineNo; - charNo = 0; - } else { - charNo++; - } - - // Increment ptrs - ++textprog; - } - - if (other && ((textprog - text - 1) != tokenStart)) { - // Do other token - LexerToken token; - token.token = OTHER; - token.start = tokenStart; - token.end = textprog - text - 1; - token.line = lineNo + 1; - token.offset = charNo - (token.end - token.start); - tokenStart = token.end + 1; - rv.append(token); - other = false; - } - return rv; -} - -void dumpTokens(const char *text, const QList<LexerToken> &tokens) -{ - for (int ii = 0; ii < tokens.count(); ++ii) { - QByteArray ba(text + tokens.at(ii).start, tokens.at(ii).end - tokens.at(ii).start + 1); - qWarning() << tokens.at(ii).line << ":" << tokens.at(ii).offset << tokenToString(tokens.at(ii).token) << "(" << tokens.at(ii).start << "-" << tokens.at(ii).end << ")" << ba; - } -} - -QT_END_NAMESPACE diff --git a/src/declarative/qml/script/lexer.h b/src/declarative/qml/script/lexer.h deleted file mode 100644 index 9de4afd..0000000 --- a/src/declarative/qml/script/lexer.h +++ /dev/null @@ -1,54 +0,0 @@ -/**************************************************************************** -** -** This file is part of the $PACKAGE_NAME$. -** -** Copyright (C) $THISYEAR$ $COMPANY_NAME$. -** -** $QT_EXTENDED_DUAL_LICENSE$ -** -****************************************************************************/ - -#ifndef LEXER_H -#define LEXER_H - -#include <QtCore/QList> -#include "tokens.h" - - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Declarative) -struct LexerToken -{ - LexerToken() : token(NOTOKEN), start(-1), end(-1), line(-1), offset(-1) {} - LexerToken(const LexerToken &other) : token(other.token), - start(other.start), - end(other.end), - line(other.line), - offset(other.offset) {} - LexerToken &operator=(const LexerToken &other) { - token = other.token; - start = other.start; - end = other.end; - line = other.line; - offset = other.offset; - return *this; - } - - Token token; - int start; - int end; - int line; - int offset; -}; - -QList<LexerToken> tokenize(const char *text); -void dumpTokens(const char *text, const QList<LexerToken> &tokens); - - -QT_END_NAMESPACE - -QT_END_HEADER -#endif diff --git a/src/declarative/qml/script/qmlbasicscript_p.h b/src/declarative/qml/script/qmlbasicscript_p.h deleted file mode 100644 index 3b7e966..0000000 --- a/src/declarative/qml/script/qmlbasicscript_p.h +++ /dev/null @@ -1,53 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) -** -** This file is part of the $MODULE$ of the Qt Toolkit. -** -** $TROLLTECH_DUAL_LICENSE$ -** -****************************************************************************/ - -#ifndef QMLBASICSCRIPT_P_H -#define QMLBASICSCRIPT_P_H - -QT_BEGIN_NAMESPACE - -class QObject; -class QmlContextPrivate; -class QDebug; -class QByteArray; - -class QmlBasicScriptNodeCache -{ -public: - QObject *object; - const QMetaObject *metaObject; - enum { Invalid, - Core, - Attached, - Signal, - SignalProperty, - Variant - } type; - union { - int core; - QObject *attached; - QmlContextPrivate *context; - }; - int coreType; - int contextIndex; - - bool isValid() const { return type != Invalid; } - bool isCore() const { return type == Core; } - bool isVariant() const { return type == Variant; } - void clear(); - QVariant value(const char *) const; -}; - -QDebug operator<<(QDebug, const QmlBasicScriptNodeCache &); - -#endif // QMLBASICSCRIPT_P_H - -QT_END_NAMESPACE diff --git a/src/declarative/qml/script/script.pri b/src/declarative/qml/script/script.pri deleted file mode 100644 index 6c43efe..0000000 --- a/src/declarative/qml/script/script.pri +++ /dev/null @@ -1,11 +0,0 @@ -SOURCES += \ - qml/script/tokens.cpp \ - qml/script/lexer.cpp \ - qml/script/qmlbasicscript.cpp - -HEADERS += \ - qml/script/tokens.h \ - qml/script/lexer.h \ - qml/script/instructions.h \ - qml/script/qmlbasicscript.h \ - qml/script/qmlbasicscript_p.h diff --git a/src/declarative/qml/script/tokens.cpp b/src/declarative/qml/script/tokens.cpp deleted file mode 100644 index a2fb100..0000000 --- a/src/declarative/qml/script/tokens.cpp +++ /dev/null @@ -1,43 +0,0 @@ -/**************************************************************************** -** -** This file is part of the $PACKAGE_NAME$. -** -** Copyright (C) $THISYEAR$ $COMPANY_NAME$. -** -** $QT_EXTENDED_DUAL_LICENSE$ -** -****************************************************************************/ - -#include "tokens.h" - - -/*! - Returns a string representation of token \a tok. -*/ -const char *tokenToString(Token tok) -{ - switch(tok) { -#define CASE(X) case X: return #X; - CASE(NOTOKEN) - CASE(INCOMPLETE) - CASE(WHITESPACE) - CASE(LANGLE) - CASE(RANGLE) - CASE(PLUS) - CASE(MINUS) - CASE(STAR) - CASE(EQUALS) - CASE(DOT) - CASE(CHARACTER) - CASE(DIGIT) - CASE(OTHER) - CASE(AND) - case TOKEN_TRUE: - return "TRUE"; - case TOKEN_FALSE: - return "FALSE"; -#undef CASE - } - return 0; -} - diff --git a/src/declarative/qml/script/tokens.h b/src/declarative/qml/script/tokens.h deleted file mode 100644 index 753e40c..0000000 --- a/src/declarative/qml/script/tokens.h +++ /dev/null @@ -1,36 +0,0 @@ -/**************************************************************************** -** -** This file is part of the $PACKAGE_NAME$. -** -** Copyright (C) $THISYEAR$ $COMPANY_NAME$. -** -** $QT_EXTENDED_DUAL_LICENSE$ -** -****************************************************************************/ - -#ifndef TOKENS_H -#define TOKENS_H - -enum Token { - // Lexer tokens - NOTOKEN, - INCOMPLETE, - WHITESPACE, - LANGLE, - RANGLE, - PLUS, - MINUS, - STAR, - EQUALS, - AND, - DOT, - CHARACTER, - DIGIT, - TOKEN_TRUE, - TOKEN_FALSE, - OTHER -}; - -const char *tokenToString(Token); - -#endif |