diff --git a/src/libs/libs.pro b/src/libs/libs.pro
index f87e023c1281875070d6b98c5e751283bc132d84..13a651498de19ae5502707a1d2e94cd51baa42ef 100644
--- a/src/libs/libs.pro
+++ b/src/libs/libs.pro
@@ -7,4 +7,5 @@ SUBDIRS   = \
     extensionsystem \
     utils \
     utils/process_stub.pro \
-    cplusplus
+    cplusplus \
+    qml
diff --git a/src/libs/qml/qml-lib.pri b/src/libs/qml/qml-lib.pri
new file mode 100644
index 0000000000000000000000000000000000000000..7cc149eadc8fe292c3aeb018d9958d31db5e4b78
--- /dev/null
+++ b/src/libs/qml/qml-lib.pri
@@ -0,0 +1,25 @@
+contains(CONFIG, dll) {
+    DEFINES += QML_BUILD_LIB
+} else {
+    DEFINES += QML_BUILD_STATIC_LIB
+}
+
+INCLUDEPATH += $$PWD
+
+include($$PWD/../../shared/qml/qml.pri)
+include($$PWD/../../shared/qscripthighlighter/qscripthighlighter.pri)
+
+##contains(QT, gui) {
+##HEADERS += \
+##    $$PWD/Nothing.h
+##
+##SOURCES += \
+##    $$PWD/Nothing.cpp
+##}
+
+#HEADERS += \
+#    $$PWD/qmlsymbol.h
+
+#SOURCES += \
+#    $$PWD/qmlsymbol.cpp
+
diff --git a/src/libs/qml/qml.pri b/src/libs/qml/qml.pri
new file mode 100644
index 0000000000000000000000000000000000000000..91edd02f937690a9fc7c9484037d204c105d757b
--- /dev/null
+++ b/src/libs/qml/qml.pri
@@ -0,0 +1,3 @@
+INCLUDEPATH += $$PWD/../../shared
+DEPENDPATH += $$PWD/../../shared
+LIBS *= -l$$qtLibraryTarget(Qml)
diff --git a/src/libs/qml/qml.pro b/src/libs/qml/qml.pro
new file mode 100644
index 0000000000000000000000000000000000000000..6d865048843c615d7acccaa28b56e96c9cb28610
--- /dev/null
+++ b/src/libs/qml/qml.pro
@@ -0,0 +1,9 @@
+TEMPLATE = lib
+CONFIG += dll
+TARGET = Qml
+DEFINES += QML_BUILD_LIB QT_CREATOR
+
+unix:QMAKE_CXXFLAGS_DEBUG += -O3
+
+include(../../qtcreatorlibrary.pri)
+include(qml-lib.pri)
diff --git a/src/plugins/qmleditor/parser/qmljsglobal_p.h b/src/plugins/qmleditor/parser/qmljsglobal_p.h
deleted file mode 100644
index 99bb19fd248906d5d767280e01a4ac7746562de7..0000000000000000000000000000000000000000
--- a/src/plugins/qmleditor/parser/qmljsglobal_p.h
+++ /dev/null
@@ -1,14 +0,0 @@
-#ifndef QMLJSGLOBAL_P_H
-#define QMLJSGLOBAL_P_H
-
-#include <QtCore/qglobal.h>
-
-#ifdef QT_CREATOR
-#define QT_QML_BEGIN_NAMESPACE
-#define QT_QML_END_NAMESPACE
-#else // !QT_CREATOR
-#define QT_QML_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
-#define QT_QML_END_NAMESPACE QT_END_NAMESPACE
-#endif // QT_CREATOR
-
-#endif // QMLJSGLOBAL_P_H
diff --git a/src/plugins/qmleditor/qmlcodecompletion.cpp b/src/plugins/qmleditor/qmlcodecompletion.cpp
index 7b6bf6a295631a39b8f32ad8468522bd80ae9621..6ee377ccb09dc86d9922a842a328a6d9b1d91ac4 100644
--- a/src/plugins/qmleditor/qmlcodecompletion.cpp
+++ b/src/plugins/qmleditor/qmlcodecompletion.cpp
@@ -1,12 +1,42 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** Commercial Usage
+**
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
+**
+** GNU Lesser General Public License Usage
+**
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://qt.nokia.com/contact.
+**
+**************************************************************************/
+
 #include "qmlcodecompletion.h"
 #include "qmleditor.h"
 #include "qmlmodelmanagerinterface.h"
 #include "qmlexpressionundercursor.h"
 #include "qmllookupcontext.h"
 #include "qmlresolveexpression.h"
-#include "qmlsymbol.h"
 
+#include <qml/qmlsymbol.h>
 #include <texteditor/basetexteditor.h>
+
 #include <QtDebug>
 
 using namespace QmlEditor;
diff --git a/src/plugins/qmleditor/qmlcodeformatter.cpp b/src/plugins/qmleditor/qmlcodeformatter.cpp
deleted file mode 100644
index 5920447eca86deb27eb6feb4b8d43eb18aef43c7..0000000000000000000000000000000000000000
--- a/src/plugins/qmleditor/qmlcodeformatter.cpp
+++ /dev/null
@@ -1,92 +0,0 @@
-#include "qmlcodeformatter.h"
-#include "qmljsast_p.h"
-
-using namespace QmlEditor::Internal;
-using namespace QmlJS;
-using namespace QmlJS::AST;
-
-QmlCodeFormatter::QmlCodeFormatter()
-{
-}
-
-QmlCodeFormatter::~QmlCodeFormatter()
-{
-}
-
-bool QmlCodeFormatter::visit(QmlJS::AST::UiProgram *ast)
-{
-    Node::accept(ast->imports, this);
-
-    if (ast->imports && ast->members)
-        newline();
-
-    Node::accept(ast->members, this);
-
-    return false;
-}
-
-QString QmlCodeFormatter::operator()(QmlJS::AST::UiProgram *ast, const QString &originalSource, const QList<QmlJS::AST::SourceLocation> & /* comments */, int start, int end)
-{
-    m_result.clear();
-    m_result.reserve(originalSource.length() * 2);
-    m_originalSource = originalSource;
-    m_start = start;
-    m_end = end;
-
-    Node::acceptChild(ast, this);
-
-    return m_result;
-}
-
-bool QmlCodeFormatter::visit(UiImport *ast)
-{
-    append("import ");
-    append(ast->fileNameToken);
-
-    if (ast->versionToken.isValid()) {
-        append(' ');
-        append(ast->versionToken);
-    }
-
-    if (ast->asToken.isValid()) {
-        append(" as ");
-        append(ast->importIdToken);
-    }
-
-    if (ast->semicolonToken.isValid())
-        append(';');
-
-    newline();
-
-    return false;
-}
-
-bool QmlCodeFormatter::visit(UiObjectDefinition *ast)
-{
-    indent();
-    Node::accept(ast->qualifiedTypeNameId, this);
-    append(' ');
-    Node::accept(ast->initializer, this);
-    newline();
-
-    return false;
-}
-
-bool QmlCodeFormatter::visit(QmlJS::AST::UiQualifiedId *ast)
-{
-    for (UiQualifiedId *it = ast; it; it = it->next) {
-        append(it->name->asString());
-
-        if (it->next)
-            append('.');
-    }
-
-    return false;
-}
-
-bool QmlCodeFormatter::visit(QmlJS::AST::UiObjectInitializer *ast)
-{
-    append(ast->lbraceToken.offset, ast->rbraceToken.end() - ast->lbraceToken.offset);
-
-    return false;
-}
diff --git a/src/plugins/qmleditor/qmlcodeformatter.h b/src/plugins/qmleditor/qmlcodeformatter.h
deleted file mode 100644
index 0cdc2d1e9f47b7b2bd91a27ce9e093972d2b4ae1..0000000000000000000000000000000000000000
--- a/src/plugins/qmleditor/qmlcodeformatter.h
+++ /dev/null
@@ -1,82 +0,0 @@
-#ifndef QMLCODEFORMATTER_H
-#define QMLCODEFORMATTER_H
-
-#include <QString>
-
-#include "qmljsastfwd_p.h"
-#include "qmljsastvisitor_p.h"
-#include "qmljsengine_p.h"
-
-namespace QmlEditor {
-namespace Internal {
-
-class QmlCodeFormatter: protected QmlJS::AST::Visitor
-{
-public:
-    QmlCodeFormatter();
-    ~QmlCodeFormatter();
-
-    QString operator()(QmlJS::AST::UiProgram *ast, const QString &originalSource, const QList<QmlJS::AST::SourceLocation> &comments, int start = -1, int end = -1);
-
-protected:
-    virtual bool visit(QmlJS::AST::UiProgram *ast);
-//    virtual bool visit(UiImportList *ast);
-    virtual bool visit(QmlJS::AST::UiImport *ast);
-//    virtual bool visit(UiPublicMember *ast);
-//    virtual bool visit(UiSourceElement *ast);
-    virtual bool visit(QmlJS::AST::UiObjectDefinition *ast);
-    virtual bool visit(QmlJS::AST::UiObjectInitializer *ast);
-//    virtual bool visit(UiObjectBinding *ast);
-//    virtual bool visit(UiScriptBinding *ast);
-//    virtual bool visit(UiArrayBinding *ast);
-//    virtual bool visit(UiObjectMemberList *ast);
-//    virtual bool visit(UiArrayMemberList *ast);
-    virtual bool visit(QmlJS::AST::UiQualifiedId *ast);
-//    virtual bool visit(UiSignature *ast);
-//    virtual bool visit(UiFormalList *ast);
-//    virtual bool visit(UiFormal *ast);
-//
-//    virtual void endVisit(UiProgram *ast);
-//    virtual void endVisit(UiImport *ast);
-//    virtual void endVisit(UiPublicMember *ast);
-//    virtual void endVisit(UiSourceElement *ast);
-//    virtual void endVisit(UiObjectDefinition *ast);
-//    virtual void endVisit(UiObjectInitializer *ast);
-//    virtual void endVisit(UiObjectBinding *ast);
-//    virtual void endVisit(UiScriptBinding *ast);
-//    virtual void endVisit(UiArrayBinding *ast);
-//    virtual void endVisit(UiObjectMemberList *ast);
-//    virtual void endVisit(UiArrayMemberList *ast);
-//    virtual void endVisit(UiQualifiedId *ast);
-//    virtual void endVisit(UiSignature *ast);
-//    virtual void endVisit(UiFormalList *ast);
-//    virtual void endVisit(UiFormal *ast);
-
-private:
-    void append(char c) { m_result += c; }
-    void append(const char *s) { m_result += s; }
-    void append(const QString &s) { m_result += s; }
-    void append(const QmlJS::AST::SourceLocation &loc) { m_result += textAt(loc); }
-    void append(int pos, int len) { append(textAt(pos, len)); }
-
-    QString textAt(const QmlJS::AST::SourceLocation &loc) const
-    { return textAt(loc.offset, loc.length); }
-
-    QString textAt(int pos, int len) const
-    { return m_originalSource.mid(pos, len); }
-
-    void indent() { if (m_indentDepth) append(QString(' ', m_indentDepth)); }
-    void newline() { append('\n'); }
-
-private:
-    QString m_result;
-    QString m_originalSource;
-    int m_start;
-    int m_end;
-    unsigned m_indentDepth;
-};
-
-} // namespace Internal
-} // namespace QmlEditor
-
-#endif // QMLCODEFORMATTER_H
diff --git a/src/plugins/qmleditor/qmleditor.cpp b/src/plugins/qmleditor/qmleditor.cpp
index 498c2e4cd5ed7bde0897680ce97b10fb4bdd7f3b..ab312bc2588177961def0dd1cf7415e38666b6b6 100644
--- a/src/plugins/qmleditor/qmleditor.cpp
+++ b/src/plugins/qmleditor/qmleditor.cpp
@@ -31,18 +31,17 @@
 #include "qmleditorconstants.h"
 #include "qmlhighlighter.h"
 #include "qmleditorplugin.h"
-#include "qmldocument.h"
 #include "qmlmodelmanager.h"
 
-#include "qmljsastvisitor_p.h"
-#include "qmljsast_p.h"
-#include "qmljsengine_p.h"
 #include "qmlexpressionundercursor.h"
 #include "qmllookupcontext.h"
 #include "qmlresolveexpression.h"
-#include "rewriter_p.h"
 
-#include "idcollector.h"
+#include <qml/parser/qmljsastvisitor_p.h>
+#include <qml/parser/qmljsast_p.h>
+#include <qml/parser/qmljsengine_p.h>
+#include <qml/qmldocument.h>
+#include <qml/qmlidcollector.h>
 
 #include <coreplugin/icore.h>
 #include <coreplugin/actionmanager/actionmanager.h>
@@ -54,6 +53,7 @@
 #include <texteditor/texteditorconstants.h>
 #include <texteditor/texteditorsettings.h>
 
+#include <utils/changeset.h>
 #include <utils/uncommentselection.h>
 
 #include <QtCore/QTimer>
@@ -572,16 +572,14 @@ void ScriptEditor::renameIdUnderCursor()
                                                 QLineEdit::Normal,
                                                 id, &ok);
     if (ok) {
-        TextWriter writer;
-
-        QString code = toPlainText();
+        Utils::ChangeSet changeSet;
 
         foreach (const AST::SourceLocation &loc, m_ids.value(id)) {
-            writer.replace(loc.offset, loc.length, newId);
+            changeSet.replace(loc.offset, loc.length, newId);
         }
 
         QTextCursor tc = textCursor();
-        writer.write(&tc);
+        changeSet.apply(&tc);
     }
 }
 
diff --git a/src/plugins/qmleditor/qmleditor.h b/src/plugins/qmleditor/qmleditor.h
index 7afd46008d263a66f8ea9746def2f82dfbedec3a..90af86fe9c71c0be4ffc4e41c240f26436e0ab98 100644
--- a/src/plugins/qmleditor/qmleditor.h
+++ b/src/plugins/qmleditor/qmleditor.h
@@ -30,13 +30,10 @@
 #ifndef QMLEDITORW_H
 #define QMLEDITORW_H
 
+#include <qml/qmldocument.h>
+#include <qscripthighlighter/qscriptincrementalscanner.h>
 #include <texteditor/basetexteditor.h>
 
-#include "qmljsastfwd_p.h"
-#include "qmljsengine_p.h"
-#include "qmldocument.h"
-#include "qscriptincrementalscanner.h"
-
 QT_BEGIN_NAMESPACE
 class QComboBox;
 class QTimer;
diff --git a/src/plugins/qmleditor/qmleditor.pro b/src/plugins/qmleditor/qmleditor.pro
index 8f71e4ffc61498c039c3722ca153b40c902b5977..14af44fb6693527e7e1d3ce043f95c4ffc4651d3 100644
--- a/src/plugins/qmleditor/qmleditor.pro
+++ b/src/plugins/qmleditor/qmleditor.pro
@@ -2,48 +2,43 @@ TEMPLATE = lib
 TARGET = QmlEditor
 include(../../qtcreatorplugin.pri)
 include(qmleditor_dependencies.pri)
-include(parser/parser.pri)
-include(rewriter/rewriter.pri)
+
 CONFIG += help
-DEFINES += QMLEDITOR_LIBRARY \
+DEFINES += \
+    QMLEDITOR_LIBRARY \
     QT_CREATOR
-INCLUDEPATH += parser \
-    rewriter
-HEADERS += qmleditor.h \
+
+HEADERS += \
+    qmlcodecompletion.h \
+    qmleditor.h \
+    qmleditor_global.h \
+    qmleditoractionhandler.h \
+    qmleditorconstants.h \
     qmleditorfactory.h \
     qmleditorplugin.h \
+    qmlexpressionundercursor.h \
+    qmlfilewizard.h \
     qmlhighlighter.h \
-    qmleditoractionhandler.h \
-    qmlcodecompletion.h \
-    qmleditorconstants.h \
     qmlhoverhandler.h \
-    qmldocument.h \
-    qmlmodelmanagerinterface.h \
-    qmleditor_global.h \
-    qmlmodelmanager.h \
-    qmlcodeformatter.h \
-    idcollector.h \
-    qmlexpressionundercursor.h \
     qmllookupcontext.h \
-    qmlresolveexpression.h \
-    qmlsymbol.h \
-    qmlfilewizard.h
-SOURCES += qmleditor.cpp \
+    qmlmodelmanager.h \
+    qmlmodelmanagerinterface.h \
+    qmlresolveexpression.h
+
+SOURCES += \
+    qmlcodecompletion.cpp \
+    qmleditor.cpp \
+    qmleditoractionhandler.cpp \
     qmleditorfactory.cpp \
     qmleditorplugin.cpp \
+    qmlexpressionundercursor.cpp \
+    qmlfilewizard.cpp \
     qmlhighlighter.cpp \
-    qmleditoractionhandler.cpp \
-    qmlcodecompletion.cpp \
     qmlhoverhandler.cpp \
-    qmldocument.cpp \
-    qmlmodelmanagerinterface.cpp \
-    qmlmodelmanager.cpp \
-    qmlcodeformatter.cpp \
-    idcollector.cpp \
-    qmlexpressionundercursor.cpp \
     qmllookupcontext.cpp \
-    qmlresolveexpression.cpp \
-    qmlsymbol.cpp \
-    qmlfilewizard.cpp
+    qmlmodelmanager.cpp \
+    qmlmodelmanagerinterface.cpp \
+    qmlresolveexpression.cpp
+
 RESOURCES += qmleditor.qrc
 OTHER_FILES += QmlEditor.pluginspec
diff --git a/src/plugins/qmleditor/qmleditor_dependencies.pri b/src/plugins/qmleditor/qmleditor_dependencies.pri
index 885ef8bc1ec42923a7088a33cc324191f823421e..0075f51fe88091c365c8f064f820c4c14f702793 100644
--- a/src/plugins/qmleditor/qmleditor_dependencies.pri
+++ b/src/plugins/qmleditor/qmleditor_dependencies.pri
@@ -1,6 +1,6 @@
 include(../../plugins/coreplugin/coreplugin.pri)
 include(../../plugins/texteditor/texteditor.pri)
 include(../../plugins/help/help.pri)
-include(../../shared/qscripthighlighter/qscripthighlighter.pri)
 include(../../shared/indenter/indenter.pri)
-
+include(../../libs/qml/qml.pri)
+include(../../libs/utils/utils.pri)
diff --git a/src/plugins/qmleditor/qmleditorplugin.cpp b/src/plugins/qmleditor/qmleditorplugin.cpp
index 4c4239576f0740ef97011d0c19eeb59700d6b412..8e1441f7c5f559ed1fb539b6df9b36ae15085301 100644
--- a/src/plugins/qmleditor/qmleditorplugin.cpp
+++ b/src/plugins/qmleditor/qmleditorplugin.cpp
@@ -29,7 +29,7 @@
 
 #include "qmleditorplugin.h"
 
-#include "qscripthighlighter.h"
+#include "qmlhighlighter.h"
 #include "qmleditor.h"
 #include "qmleditorconstants.h"
 #include "qmleditorfactory.h"
diff --git a/src/plugins/qmleditor/qmlexpressionundercursor.cpp b/src/plugins/qmleditor/qmlexpressionundercursor.cpp
index 2c7ee0b3bad157ca77e2de6b959be6f281f12f7e..5fd7c5031f34c850c5296bef8d0ee28962ea3ac5 100644
--- a/src/plugins/qmleditor/qmlexpressionundercursor.cpp
+++ b/src/plugins/qmleditor/qmlexpressionundercursor.cpp
@@ -1,13 +1,14 @@
-#include <QDebug>
-
-#include "qmljsast_p.h"
-#include "qmljsastvisitor_p.h"
-#include "qmljsengine_p.h"
-#include "qmljslexer_p.h"
-#include "qmljsnodepool_p.h"
-#include "qmljsparser_p.h"
 #include "qmlexpressionundercursor.h"
 
+#include <qml/parser/qmljsast_p.h>
+#include <qml/parser/qmljsastvisitor_p.h>
+#include <qml/parser/qmljsengine_p.h>
+#include <qml/parser/qmljslexer_p.h>
+#include <qml/parser/qmljsnodepool_p.h>
+#include <qml/parser/qmljsparser_p.h>
+
+#include <QDebug>
+
 using namespace QmlJS;
 using namespace QmlJS::AST;
 
diff --git a/src/plugins/qmleditor/qmlexpressionundercursor.h b/src/plugins/qmleditor/qmlexpressionundercursor.h
index 28e8d87d64fd79d4e091ce0de44ca435290d0306..9468190580650d9f370061663d470afaed5b44f6 100644
--- a/src/plugins/qmleditor/qmlexpressionundercursor.h
+++ b/src/plugins/qmleditor/qmlexpressionundercursor.h
@@ -1,14 +1,15 @@
 #ifndef QMLEXPRESSIONUNDERCURSOR_H
 #define QMLEXPRESSIONUNDERCURSOR_H
 
+
+#include <qml/parser/qmljsastfwd_p.h>
+#include <qml/qmldocument.h>
+#include <qml/qmlsymbol.h>
+
 #include <QStack>
 #include <QTextBlock>
 #include <QTextCursor>
 
-#include "qmldocument.h"
-#include "qmljsastfwd_p.h"
-#include "qmlsymbol.h"
-
 namespace QmlJS {
     class Engine;
     class NodePool;
diff --git a/src/plugins/qmleditor/qmlhighlighter.h b/src/plugins/qmleditor/qmlhighlighter.h
index 8c7df6c11d5035f09eb7ef407c9a222d04b68ff2..d265b0e722978fe37aaac63d122c10b6a88877c3 100644
--- a/src/plugins/qmleditor/qmlhighlighter.h
+++ b/src/plugins/qmleditor/qmlhighlighter.h
@@ -30,7 +30,7 @@
 #ifndef QMLSYNTAXHIGHLIGHTER_H
 #define QMLSYNTAXHIGHLIGHTER_H
 
-#include "qscripthighlighter.h"
+#include <qscripthighlighter/qscripthighlighter.h>
 #include <texteditor/basetexteditor.h>
 
 namespace QmlEditor {
diff --git a/src/plugins/qmleditor/qmlhoverhandler.cpp b/src/plugins/qmleditor/qmlhoverhandler.cpp
index 4c155a571fbdeb29e12838566a72971ab2ce7f4f..a23e660766919e5279a26508345545a50c633499 100644
--- a/src/plugins/qmleditor/qmlhoverhandler.cpp
+++ b/src/plugins/qmleditor/qmlhoverhandler.cpp
@@ -32,15 +32,15 @@
 #include "qmlhoverhandler.h"
 #include "qmllookupcontext.h"
 #include "qmlresolveexpression.h"
-#include "qmlsymbol.h"
 
 #include <coreplugin/icore.h>
 #include <coreplugin/uniqueidmanager.h>
 #include <coreplugin/editormanager/editormanager.h>
+#include <debugger/debuggerconstants.h>
 #include <extensionsystem/pluginmanager.h>
+#include <qml/qmlsymbol.h>
 #include <texteditor/itexteditor.h>
 #include <texteditor/basetexteditor.h>
-#include <debugger/debuggerconstants.h>
 
 #include <QtCore/QDebug>
 #include <QtCore/QDir>
diff --git a/src/plugins/qmleditor/qmllookupcontext.cpp b/src/plugins/qmleditor/qmllookupcontext.cpp
index 5bbc044899b4004a94ead2c39d813a1da637f34a..d5869c0bfcbfb2a7ee08887cb38d8f3b3308066a 100644
--- a/src/plugins/qmleditor/qmllookupcontext.cpp
+++ b/src/plugins/qmleditor/qmllookupcontext.cpp
@@ -1,11 +1,12 @@
-#include <QDebug>
-#include "qmljsast_p.h"
-#include "qmljsengine_p.h"
-
 #include "qmlexpressionundercursor.h"
 #include "qmllookupcontext.h"
 #include "qmlresolveexpression.h"
 
+#include <qml/parser/qmljsast_p.h>
+#include <qml/parser/qmljsengine_p.h>
+
+#include <QDebug>
+
 using namespace QmlEditor;
 using namespace QmlEditor::Internal;
 using namespace QmlJS;
diff --git a/src/plugins/qmleditor/qmllookupcontext.h b/src/plugins/qmleditor/qmllookupcontext.h
index d1c64dc7112669479a6d1fee1f2ab6392c534031..32b508a3cc766a9f9687890e2de1b8902f939851 100644
--- a/src/plugins/qmleditor/qmllookupcontext.h
+++ b/src/plugins/qmleditor/qmllookupcontext.h
@@ -1,11 +1,11 @@
 #ifndef QMLLOOKUPCONTEXT_H
 #define QMLLOOKUPCONTEXT_H
 
-#include <QStack>
+#include <qml/parser/qmljsastvisitor_p.h>
+#include <qml/qmldocument.h>
+#include <qml/qmlsymbol.h>
 
-#include "qmldocument.h"
-#include "qmljsastvisitor_p.h"
-#include "qmlsymbol.h"
+#include <QStack>
 
 namespace QmlEditor {
 namespace Internal {
diff --git a/src/plugins/qmleditor/qmlmodelmanager.h b/src/plugins/qmleditor/qmlmodelmanager.h
index cada51871d167abdf58821c62e6bf1a9f78a69d3..d4a2b8d05c45d278c4fb2977c2db48c18e7941b5 100644
--- a/src/plugins/qmleditor/qmlmodelmanager.h
+++ b/src/plugins/qmleditor/qmlmodelmanager.h
@@ -30,13 +30,14 @@
 #ifndef QMLMODELMANAGER_H
 #define QMLMODELMANAGER_H
 
+#include "qmlmodelmanagerinterface.h"
+
+#include <qml/qmldocument.h>
+
 #include <QFuture>
 #include <QFutureSynchronizer>
 #include <QMutex>
 
-#include "qmldocument.h"
-#include "qmlmodelmanagerinterface.h"
-
 namespace Core {
 class ICore;
 }
diff --git a/src/plugins/qmleditor/qmlmodelmanagerinterface.h b/src/plugins/qmleditor/qmlmodelmanagerinterface.h
index f348b30bc9cbc630c9ca9c86040cbbfd6be5da31..3599f44672bacc9fcc32eac9afe8411f02c47502 100644
--- a/src/plugins/qmleditor/qmlmodelmanagerinterface.h
+++ b/src/plugins/qmleditor/qmlmodelmanagerinterface.h
@@ -30,12 +30,13 @@
 #ifndef QMLMODELMANAGERINTERFACE_H
 #define QMLMODELMANAGERINTERFACE_H
 
+#include "qmleditor_global.h"
+
 #include <QObject>
 #include <QStringList>
 #include <QSharedPointer>
 
-#include <qmleditor/qmleditor_global.h>
-#include <qmleditor/qmldocument.h>
+#include <qml/qmldocument.h>
 
 namespace QmlEditor {
 
diff --git a/src/plugins/qmleditor/qmlresolveexpression.cpp b/src/plugins/qmleditor/qmlresolveexpression.cpp
index 1b464147aa7dedab9f8fb3893b61d7556b8cb9e8..1c798cd58f94b7ed8cee2b79695b52c290f3fa26 100644
--- a/src/plugins/qmleditor/qmlresolveexpression.cpp
+++ b/src/plugins/qmleditor/qmlresolveexpression.cpp
@@ -1,7 +1,8 @@
-#include "qmljsast_p.h"
-#include "qmljsengine_p.h"
 #include "qmlresolveexpression.h"
 
+#include <qml/parser/qmljsast_p.h>
+#include <qml/parser/qmljsengine_p.h>
+
 using namespace QmlEditor;
 using namespace QmlEditor::Internal;
 using namespace QmlJS;
diff --git a/src/plugins/qmleditor/qmlresolveexpression.h b/src/plugins/qmleditor/qmlresolveexpression.h
index 41e44e8853112ae35d3dec4cc2e3ee20bc48b4c4..6030f1c29c7f666c5e70139c8e4aa70b01ed9ebe 100644
--- a/src/plugins/qmleditor/qmlresolveexpression.h
+++ b/src/plugins/qmleditor/qmlresolveexpression.h
@@ -1,9 +1,10 @@
 #ifndef QMLRESOLVEEXPRESSION_H
 #define QMLRESOLVEEXPRESSION_H
 
-#include "qmljsastvisitor_p.h"
 #include "qmllookupcontext.h"
-#include "qmlsymbol.h"
+
+#include <qml/parser/qmljsastvisitor_p.h>
+#include <qml/qmlsymbol.h>
 
 namespace QmlEditor {
 namespace Internal {
diff --git a/src/plugins/qmleditor/rewriter/rewriter.cpp b/src/plugins/qmleditor/rewriter/rewriter.cpp
deleted file mode 100644
index f872ca3d3899335f10393bac5cd6f8136df619f1..0000000000000000000000000000000000000000
--- a/src/plugins/qmleditor/rewriter/rewriter.cpp
+++ /dev/null
@@ -1,96 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtDeclarative module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file.  Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain
-** additional rights. These rights are described in the Nokia Qt LGPL
-** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file.  Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "rewriter_p.h"
-#include "qmljsast_p.h"
-
-QT_QML_BEGIN_NAMESPACE
-
-using namespace QmlJS;
-
-void Rewriter::replace(const AST::SourceLocation &loc, const QString &text)
-{ replace(loc.offset, loc.length, text); }
-
-void Rewriter::remove(const AST::SourceLocation &loc)
-{ return replace(loc.offset, loc.length, QString()); }
-
-void Rewriter::remove(const AST::SourceLocation &firstLoc, const AST::SourceLocation &lastLoc)
-{ return replace(firstLoc.offset, lastLoc.offset + lastLoc.length - firstLoc.offset, QString()); }
-
-void Rewriter::insertTextBefore(const AST::SourceLocation &loc, const QString &text)
-{ replace(loc.offset, 0, text); }
-
-void Rewriter::insertTextAfter(const AST::SourceLocation &loc, const QString &text)
-{ replace(loc.offset + loc.length, 0, text); }
-
-void Rewriter::replace(int offset, int length, const QString &text)
-{ textWriter.replace(offset, length, text); }
-
-void Rewriter::insertText(int offset, const QString &text)
-{ replace(offset, 0, text); }
-
-void Rewriter::removeText(int offset, int length)
-{ replace(offset, length, QString()); }
-
-QString Rewriter::textAt(const AST::SourceLocation &loc) const
-{ return _code.mid(loc.offset, loc.length); }
-
-QString Rewriter::textAt(const AST::SourceLocation &firstLoc, const AST::SourceLocation &lastLoc) const
-{ return _code.mid(firstLoc.offset, lastLoc.offset + lastLoc.length - firstLoc.offset); }
-
-void Rewriter::accept(QmlJS::AST::Node *node)
-{ QmlJS::AST::Node::acceptChild(node, this); }
-
-void Rewriter::moveTextBefore(const AST::SourceLocation &firstLoc,
-                              const AST::SourceLocation &lastLoc,
-                              const AST::SourceLocation &loc)
-{
-    textWriter.move(firstLoc.offset, lastLoc.offset + lastLoc.length - firstLoc.offset, loc.offset);
-}
-
-void Rewriter::moveTextAfter(const AST::SourceLocation &firstLoc,
-                             const AST::SourceLocation &lastLoc,
-                             const AST::SourceLocation &loc)
-{
-    textWriter.move(firstLoc.offset, lastLoc.offset + lastLoc.length - firstLoc.offset, loc.offset + loc.length);
-}
-
-QT_QML_END_NAMESPACE
diff --git a/src/plugins/qmleditor/rewriter/rewriter.pri b/src/plugins/qmleditor/rewriter/rewriter.pri
deleted file mode 100644
index de3c2985bc761c4b4aa71deb7c4fd6e2cc12cd6e..0000000000000000000000000000000000000000
--- a/src/plugins/qmleditor/rewriter/rewriter.pri
+++ /dev/null
@@ -1,9 +0,0 @@
-
-INCLUDEPATH += $$PWD
-HEADERS += $$PWD/textwriter_p.h
-SOURCES += $$PWD/textwriter.cpp
-
-!no_ast_rewriter {
-    HEADERS += $$PWD/rewriter_p.h
-    SOURCES += $$PWD/rewriter.cpp
-}
diff --git a/src/plugins/qmleditor/rewriter/rewriter_p.h b/src/plugins/qmleditor/rewriter/rewriter_p.h
deleted file mode 100644
index 04d183f7e76fd71cd99d82c32e6a160ef90a9d22..0000000000000000000000000000000000000000
--- a/src/plugins/qmleditor/rewriter/rewriter_p.h
+++ /dev/null
@@ -1,151 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtDeclarative module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file.  Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain
-** additional rights. These rights are described in the Nokia Qt LGPL
-** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file.  Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef REWRITER_H
-#define REWRITER_H
-
-#include <QtCore/QList>
-#include <QtCore/QString>
-
-#include "textwriter_p.h"
-#include "qmljsastvisitor_p.h"
-
-QT_BEGIN_HEADER
-QT_QML_BEGIN_NAMESPACE
-
-namespace QmlJS {
-
-////////////////////////////////////////////////////////////////////////////////
-// Replacement
-////////////////////////////////////////////////////////////////////////////////
-class Replacement
-{
-	int _offset;
-	int _length;
-	QString _text;
-
-public:
-	Replacement(int offset = 0, int length = 0, const QString &text = QString())
-		: _offset(offset), _length(length), _text(text)
-	{ }
-
-	bool isNull() const { return _offset == _length; }
-	operator bool() const { return ! isNull(); }
-
-	int offset() const { return _offset; }
-	int length() const { return _length; }
-	QString text() const { return _text; }
-};
-
-
-
-////////////////////////////////////////////////////////////////////////////////
-// Rewriter
-////////////////////////////////////////////////////////////////////////////////
-class Rewriter: public AST::Visitor
-{
-protected:
-	TextWriter textWriter;
-public:
-	//
-	// Token based API
-	//
-
-	/// Returns the text of the token at the given \a location.
-	QString textAt(const AST::SourceLocation &location) const;
-
-	QString textAt(const AST::SourceLocation &firstLoc,
-				   const AST::SourceLocation &lastLoc) const;
-
-	/// Replace the token at \a loc with the given \a text.
-	void replace(const AST::SourceLocation &loc, const QString &text);
-
-	/// Remove the token at the given \a location.
-	void remove(const AST::SourceLocation &location);
-
-	/// Remove all tokens in the range [\a firstLoc, \a lastLoc].
-	void remove(const AST::SourceLocation &firstLoc, const AST::SourceLocation &lastLoc);
-
-	/// Insert \a text before the token at the given \a location.
-	void insertTextBefore(const AST::SourceLocation &location, const QString &text);
-
-	/// Insert \a text after the token at the given \a location.
-	void insertTextAfter(const AST::SourceLocation &loc, const QString &text);
-
-	void moveTextBefore(const AST::SourceLocation &firstLoc,
-						const AST::SourceLocation &lastLoc,
-						const AST::SourceLocation &loc);
-
-	void moveTextAfter(const AST::SourceLocation &firstLoc,
-					   const AST::SourceLocation &lastLoc,
-					   const AST::SourceLocation &loc);
-
-	//
-	// low-level offset based API
-	//
-	void replace(int offset, int length, const QString &text);
-	void insertText(int offset, const QString &text);
-	void removeText(int offset, int length);
-
-	/// Visit the given \a node.
-	void accept(AST::Node *node);
-
-	/// Returns the original unchanged source code.
-	QString code() const { return _code; }
-
-	/// Returns the list of replacements.
-	QList<Replacement> replacementList() const { return _replacementList; }
-
-protected:
-	/// \internal
-	void setCode(const QString &code) { _code = code; }
-
-private:
-	QString _code;
-	QList<Replacement> _replacementList;
-};
-
-} // end of namespace QmlJS
-
-QT_QML_END_NAMESPACE
-QT_END_HEADER
-
-#endif // REWRITER_H
diff --git a/src/plugins/qmleditor/rewriter/textwriter.cpp b/src/plugins/qmleditor/rewriter/textwriter.cpp
deleted file mode 100644
index 9fe86316ababb3f3ec78a819385ff9d9117fa44c..0000000000000000000000000000000000000000
--- a/src/plugins/qmleditor/rewriter/textwriter.cpp
+++ /dev/null
@@ -1,217 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtDeclarative module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file.  Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain
-** additional rights. These rights are described in the Nokia Qt LGPL
-** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file.  Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "textwriter_p.h"
-
-QT_QML_BEGIN_NAMESPACE
-
-using namespace QmlJS;
-
-TextWriter::TextWriter()
-        :string(0), cursor(0)
-{
-}
-
-static bool overlaps(int posA, int lengthA, int posB, int lengthB) {
-    return (posA < posB + lengthB && posA + lengthA > posB + lengthB)
-            || (posA < posB && posA + lengthA > posB);
-}
-
-bool TextWriter::hasOverlap(int pos, int length)
-{
-    {
-        QListIterator<Replace> i(replaceList);
-        while (i.hasNext()) {
-            const Replace &cmd = i.next();
-            if (overlaps(pos, length, cmd.pos, cmd.length))
-                return true;
-        }
-    }
-    {
-        QListIterator<Move> i(moveList);
-        while (i.hasNext()) {
-            const Move &cmd = i.next();
-            if (overlaps(pos, length, cmd.pos, cmd.length))
-                return true;
-        }
-        return false;
-    }
-}
-
-bool TextWriter::hasMoveInto(int pos, int length)
-{
-    QListIterator<Move> i(moveList);
-    while (i.hasNext()) {
-        const Move &cmd = i.next();
-        if (cmd.to >= pos && cmd.to < pos + length)
-            return true;
-    }
-    return false;
-}
-
-void TextWriter::replace(int pos, int length, const QString &replacement)
-{
-    Q_ASSERT(!hasOverlap(pos, length));
-    Q_ASSERT(!hasMoveInto(pos, length));
-
-    Replace cmd;
-    cmd.pos = pos;
-    cmd.length = length;
-    cmd.replacement = replacement;
-    replaceList += cmd;
-}
-
-void TextWriter::move(int pos, int length, int to)
-{
-    Q_ASSERT(!hasOverlap(pos, length));
-
-    Move cmd;
-    cmd.pos = pos;
-    cmd.length = length;
-    cmd.to = to;
-    moveList += cmd;
-}
-
-void TextWriter::doReplace(const Replace &replace)
-{
-    int diff = replace.replacement.size() - replace.length;
-    {
-        QMutableListIterator<Replace> i(replaceList);
-        while (i.hasNext()) {
-            Replace &c = i.next();
-            if (replace.pos < c.pos)
-                c.pos += diff;
-            else if (replace.pos + replace.length < c.pos + c.length)
-                c.length += diff;
-        }
-    }
-    {
-        QMutableListIterator<Move> i(moveList);
-        while (i.hasNext()) {
-            Move &c = i.next();
-            if (replace.pos < c.pos)
-                c.pos += diff;
-            else if (replace.pos + replace.length < c.pos + c.length)
-                c.length += diff;
-
-            if (replace.pos < c.to)
-                c.to += diff;
-        }
-    }
-
-    if (string) {
-        string->replace(replace.pos, replace.length, replace.replacement);
-    } else if (cursor) {
-        cursor->setPosition(replace.pos);
-        cursor->setPosition(replace.pos + replace.length, QTextCursor::KeepAnchor);
-        cursor->insertText(replace.replacement);
-    }
-}
-
-void TextWriter::doMove(const Move &move)
-{
-    QString text;
-    if (string) {
-        text = string->mid(move.pos, move.length);
-    } else if (cursor) {
-        cursor->setPosition(move.pos);
-        cursor->setPosition(move.pos + move.length, QTextCursor::KeepAnchor);
-        text = cursor->selectedText();
-    }
-
-    Replace cut;
-    cut.pos = move.pos;
-    cut.length = move.length;
-    Replace paste;
-    paste.pos = move.to;
-    paste.length = 0;
-    paste.replacement = text;
-
-    replaceList.append(cut);
-    replaceList.append(paste);
-
-    Replace cmd;
-    while (!replaceList.isEmpty()) {
-        cmd = replaceList.first();
-        replaceList.removeFirst();
-        doReplace(cmd);
-    }
-}
-
-void TextWriter::write(QString *s)
-{
-    string = s;
-    write_helper();
-    string = 0;
-}
-
-void TextWriter::write(QTextCursor *textCursor)
-{
-    cursor = textCursor;
-    write_helper();
-    cursor = 0;
-}
-
-void TextWriter::write_helper()
-{
-    if (cursor)
-        cursor->beginEditBlock();
-    {
-        Replace cmd;
-        while (!replaceList.isEmpty()) {
-            cmd = replaceList.first();
-            replaceList.removeFirst();
-            doReplace(cmd);
-        }
-    }
-    {
-        Move cmd;
-        while (!moveList.isEmpty()) {
-            cmd = moveList.first();
-            moveList.removeFirst();
-            doMove(cmd);
-        }
-    }
-    if (cursor)
-        cursor->endEditBlock();
-}
-
-QT_QML_END_NAMESPACE
diff --git a/src/plugins/qmleditor/rewriter/textwriter_p.h b/src/plugins/qmleditor/rewriter/textwriter_p.h
deleted file mode 100644
index d14059a8e93938298bacf50aba8b54a56064fb25..0000000000000000000000000000000000000000
--- a/src/plugins/qmleditor/rewriter/textwriter_p.h
+++ /dev/null
@@ -1,101 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtDeclarative module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file.  Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain
-** additional rights. These rights are described in the Nokia Qt LGPL
-** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file.  Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef TEXTWRITER_H
-#define TEXTWRITER_H
-
-#include <QtCore/QString>
-#include <QtCore/QList>
-#include <QtGui/QTextCursor>
-
-#include "qmljsglobal_p.h"
-
-QT_BEGIN_HEADER
-QT_QML_BEGIN_NAMESPACE
-
-namespace QmlJS {
-
-class TextWriter
-{
-	QString *string;
-	QTextCursor *cursor;
-
-	struct Replace {
-		int pos;
-		int length;
-		QString replacement;
-	};
-
-	QList<Replace> replaceList;
-
-	struct Move {
-		int pos;
-		int length;
-		int to;
-	};
-
-	QList<Move> moveList;
-
-	bool hasOverlap(int pos, int length);
-	bool hasMoveInto(int pos, int length);
-
-	void doReplace(const Replace &replace);
-	void doMove(const Move &move);
-
-	void write_helper();
-
-public:
-	TextWriter();
-
-	void replace(int pos, int length, const QString &replacement);
-	void move(int pos, int length, int to);
-
-	void write(QString *s);
-	void write(QTextCursor *textCursor);
-
-};
-
-} // end of namespace QmlJS
-
-QT_QML_END_NAMESPACE
-QT_END_HEADER
-
-#endif // TEXTWRITER_H
diff --git a/src/plugins/qmlprojectmanager/qmltaskmanager.h b/src/plugins/qmlprojectmanager/qmltaskmanager.h
index 0f952610765fd96f71d1d8194ea8e1d58bc00af7..2cf4e52ae094171bc9a1fb1a073cc844fc19e222 100644
--- a/src/plugins/qmlprojectmanager/qmltaskmanager.h
+++ b/src/plugins/qmlprojectmanager/qmltaskmanager.h
@@ -2,9 +2,9 @@
 #define QMLTASKMANAGER_H
 
 #include <projectexplorer/taskwindow.h>
-#include <qmleditor/qmldocument.h>
-#include <QtCore/QObject>
+#include <qml/qmldocument.h>
 
+#include <QtCore/QObject>
 
 namespace QmlProjectManager {
 namespace Internal {
diff --git a/src/plugins/qmleditor/parser/parser.pri b/src/shared/qml/parser/parser.pri
similarity index 100%
rename from src/plugins/qmleditor/parser/parser.pri
rename to src/shared/qml/parser/parser.pri
diff --git a/src/plugins/qmleditor/parser/qmljs.g b/src/shared/qml/parser/qmljs.g
similarity index 99%
rename from src/plugins/qmleditor/parser/qmljs.g
rename to src/shared/qml/parser/qmljs.g
index c5b2764cda5417c0bf6a418780ba4e1b97122996..70cf06a2f6ba82356cb30c691d13fa1c63283a22 100644
--- a/src/plugins/qmleditor/parser/qmljs.g
+++ b/src/shared/qml/parser/qmljs.g
@@ -105,7 +105,7 @@
 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
 ** Contact: Qt Software Information (qt-info@nokia.com)
 **
-** This file is part of the QtScript module of the Qt Toolkit.
+** This file is part of the QtDeclarative module of the Qt Toolkit.
 **
 ** $QT_BEGIN_LICENSE:LGPL$
 ** No Commercial Usage
@@ -159,7 +159,7 @@
 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
 ** Contact: Qt Software Information (qt-info@nokia.com)
 **
-** This file is part of the QtScript module of the Qt Toolkit.
+** This file is part of the QtDeclarative module of the Qt Toolkit.
 **
 ** $QT_BEGIN_LICENSE:LGPL$
 ** No Commercial Usage
diff --git a/src/plugins/qmleditor/parser/qmljsast.cpp b/src/shared/qml/parser/qmljsast.cpp
similarity index 94%
rename from src/plugins/qmleditor/parser/qmljsast.cpp
rename to src/shared/qml/parser/qmljsast.cpp
index 4c45bc89d9eeee28410dab67608575e68f1d430a..6986bd2fabe327f4f740bee4171badc4d8331b93 100644
--- a/src/plugins/qmleditor/parser/qmljsast.cpp
+++ b/src/shared/qml/parser/qmljsast.cpp
@@ -1,16 +1,17 @@
 /****************************************************************************
 **
 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
 **
-** This file is part of the QtScript module of the Qt Toolkit.
+** This file is part of the QtDeclarative module of the Qt Toolkit.
 **
 ** $QT_BEGIN_LICENSE:LGPL$
 ** No Commercial Usage
 ** This file contains pre-release code and may not be distributed.
 ** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
 **
 ** GNU Lesser General Public License Usage
 ** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -20,21 +21,20 @@
 ** ensure the GNU Lesser General Public License version 2.1 requirements
 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
 **
-** In addition, as a special exception, Nokia gives you certain
-** additional rights. These rights are described in the Nokia Qt LGPL
-** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** In addition, as a special exception, Nokia gives you certain additional
+** rights.  These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
 **
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file.  Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
 **
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at qt-sales@nokia.com.
 ** $QT_END_LICENSE$
 **
 ****************************************************************************/
diff --git a/src/plugins/qmleditor/parser/qmljsast_p.h b/src/shared/qml/parser/qmljsast_p.h
similarity index 98%
rename from src/plugins/qmleditor/parser/qmljsast_p.h
rename to src/shared/qml/parser/qmljsast_p.h
index ef8a66bd949f62bd345cc35f1db73109becd8411..76c409e07b528bb52f4c4fa2c287459cca23b973 100644
--- a/src/plugins/qmleditor/parser/qmljsast_p.h
+++ b/src/shared/qml/parser/qmljsast_p.h
@@ -1,7 +1,8 @@
 /****************************************************************************
 **
 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
 **
 ** This file is part of the QtDeclarative module of the Qt Toolkit.
 **
@@ -9,8 +10,8 @@
 ** No Commercial Usage
 ** This file contains pre-release code and may not be distributed.
 ** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
 **
 ** GNU Lesser General Public License Usage
 ** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -20,21 +21,20 @@
 ** ensure the GNU Lesser General Public License version 2.1 requirements
 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
 **
-** In addition, as a special exception, Nokia gives you certain
-** additional rights. These rights are described in the Nokia Qt LGPL
-** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** In addition, as a special exception, Nokia gives you certain additional
+** rights.  These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
 **
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file.  Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
 **
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at qt-sales@nokia.com.
 ** $QT_END_LICENSE$
 **
 ****************************************************************************/
@@ -118,7 +118,7 @@ _T1 cast(_T2 *ast)
     return 0;
 }
 
-class Node
+class QML_PARSER_EXPORT Node
 {
 public:
     enum Kind {
@@ -2653,7 +2653,7 @@ public:
     { kind = K; }
 
     virtual SourceLocation firstSourceLocation() const
-    { return lbracketToken; }
+    { return qualifiedId->identifierToken; }
 
     virtual SourceLocation lastSourceLocation() const
     { return rbracketToken; }
diff --git a/src/plugins/qmleditor/parser/qmljsastfwd_p.h b/src/shared/qml/parser/qmljsastfwd_p.h
similarity index 80%
rename from src/plugins/qmleditor/parser/qmljsastfwd_p.h
rename to src/shared/qml/parser/qmljsastfwd_p.h
index fcb97ad870a70e37dd43c92c91f764779e7cc416..b558a23ddb30a9c080ae44463b43f51c19dec6ba 100644
--- a/src/plugins/qmleditor/parser/qmljsastfwd_p.h
+++ b/src/shared/qml/parser/qmljsastfwd_p.h
@@ -1,16 +1,17 @@
 /****************************************************************************
 **
 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
 **
-** This file is part of the QtScript module of the Qt Toolkit.
+** This file is part of the QtDeclarative module of the Qt Toolkit.
 **
 ** $QT_BEGIN_LICENSE:LGPL$
 ** No Commercial Usage
 ** This file contains pre-release code and may not be distributed.
 ** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
 **
 ** GNU Lesser General Public License Usage
 ** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -20,21 +21,20 @@
 ** ensure the GNU Lesser General Public License version 2.1 requirements
 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
 **
-** In addition, as a special exception, Nokia gives you certain
-** additional rights. These rights are described in the Nokia Qt LGPL
-** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** In addition, as a special exception, Nokia gives you certain additional
+** rights.  These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
 **
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file.  Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
 **
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at qt-sales@nokia.com.
 ** $QT_END_LICENSE$
 **
 ****************************************************************************/
diff --git a/src/plugins/qmleditor/parser/qmljsastvisitor.cpp b/src/shared/qml/parser/qmljsastvisitor.cpp
similarity index 52%
rename from src/plugins/qmleditor/parser/qmljsastvisitor.cpp
rename to src/shared/qml/parser/qmljsastvisitor.cpp
index d3a1d5306824446887c6601aefc70dd660f37b5a..1290c89241de42d77b745e1bf578a4bb920757fc 100644
--- a/src/plugins/qmleditor/parser/qmljsastvisitor.cpp
+++ b/src/shared/qml/parser/qmljsastvisitor.cpp
@@ -1,16 +1,17 @@
 /****************************************************************************
 **
 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
 **
-** This file is part of the QtScript module of the Qt Toolkit.
+** This file is part of the QtDeclarative module of the Qt Toolkit.
 **
 ** $QT_BEGIN_LICENSE:LGPL$
 ** No Commercial Usage
 ** This file contains pre-release code and may not be distributed.
 ** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
 **
 ** GNU Lesser General Public License Usage
 ** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -20,21 +21,20 @@
 ** ensure the GNU Lesser General Public License version 2.1 requirements
 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
 **
-** In addition, as a special exception, Nokia gives you certain
-** additional rights. These rights are described in the Nokia Qt LGPL
-** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** In addition, as a special exception, Nokia gives you certain additional
+** rights.  These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
 **
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file.  Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
 **
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at qt-sales@nokia.com.
 ** $QT_END_LICENSE$
 **
 ****************************************************************************/
diff --git a/src/plugins/qmleditor/parser/qmljsastvisitor_p.h b/src/shared/qml/parser/qmljsastvisitor_p.h
similarity index 91%
rename from src/plugins/qmleditor/parser/qmljsastvisitor_p.h
rename to src/shared/qml/parser/qmljsastvisitor_p.h
index eea492a057214090e378ae0cc2bf7f910d4a416a..1b50bcc58b11b14350647bce5e318ded1ad78ff0 100644
--- a/src/plugins/qmleditor/parser/qmljsastvisitor_p.h
+++ b/src/shared/qml/parser/qmljsastvisitor_p.h
@@ -1,16 +1,17 @@
 /****************************************************************************
 **
 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
 **
-** This file is part of the QtScript module of the Qt Toolkit.
+** This file is part of the QtDeclarative module of the Qt Toolkit.
 **
 ** $QT_BEGIN_LICENSE:LGPL$
 ** No Commercial Usage
 ** This file contains pre-release code and may not be distributed.
 ** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
 **
 ** GNU Lesser General Public License Usage
 ** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -20,21 +21,20 @@
 ** ensure the GNU Lesser General Public License version 2.1 requirements
 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
 **
-** In addition, as a special exception, Nokia gives you certain
-** additional rights. These rights are described in the Nokia Qt LGPL
-** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** In addition, as a special exception, Nokia gives you certain additional
+** rights.  These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
 **
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file.  Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
 **
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at qt-sales@nokia.com.
 ** $QT_END_LICENSE$
 **
 ****************************************************************************/
@@ -60,7 +60,7 @@ QT_QML_BEGIN_NAMESPACE
 
 namespace QmlJS { namespace AST {
 
-class Visitor
+class QML_PARSER_EXPORT Visitor
 {
 public:
     Visitor();
diff --git a/src/plugins/qmleditor/parser/qmljsengine_p.cpp b/src/shared/qml/parser/qmljsengine_p.cpp
similarity index 83%
rename from src/plugins/qmleditor/parser/qmljsengine_p.cpp
rename to src/shared/qml/parser/qmljsengine_p.cpp
index 32068c032050cbfe8140f797c27ef5fa50513dcd..cee90a3b81961a2aa3e2939b2ee5272d077ae118 100644
--- a/src/plugins/qmleditor/parser/qmljsengine_p.cpp
+++ b/src/shared/qml/parser/qmljsengine_p.cpp
@@ -1,7 +1,8 @@
 /****************************************************************************
 **
 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
 **
 ** This file is part of the QtDeclarative module of the Qt Toolkit.
 **
@@ -9,8 +10,8 @@
 ** No Commercial Usage
 ** This file contains pre-release code and may not be distributed.
 ** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
 **
 ** GNU Lesser General Public License Usage
 ** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -20,21 +21,20 @@
 ** ensure the GNU Lesser General Public License version 2.1 requirements
 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
 **
-** In addition, as a special exception, Nokia gives you certain
-** additional rights. These rights are described in the Nokia Qt LGPL
-** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** In addition, as a special exception, Nokia gives you certain additional
+** rights.  These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
 **
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file.  Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
 **
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at qt-sales@nokia.com.
 ** $QT_END_LICENSE$
 **
 ****************************************************************************/
diff --git a/src/plugins/qmleditor/parser/qmljsengine_p.h b/src/shared/qml/parser/qmljsengine_p.h
similarity index 77%
rename from src/plugins/qmleditor/parser/qmljsengine_p.h
rename to src/shared/qml/parser/qmljsengine_p.h
index 8627a9902431e310e748a44a65016e95d1c98770..46beabb3edac533d23c007cbae8c00463621ade6 100644
--- a/src/plugins/qmleditor/parser/qmljsengine_p.h
+++ b/src/shared/qml/parser/qmljsengine_p.h
@@ -1,7 +1,8 @@
 /****************************************************************************
 **
 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
 **
 ** This file is part of the QtDeclarative module of the Qt Toolkit.
 **
@@ -9,8 +10,8 @@
 ** No Commercial Usage
 ** This file contains pre-release code and may not be distributed.
 ** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
 **
 ** GNU Lesser General Public License Usage
 ** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -20,21 +21,20 @@
 ** ensure the GNU Lesser General Public License version 2.1 requirements
 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
 **
-** In addition, as a special exception, Nokia gives you certain
-** additional rights. These rights are described in the Nokia Qt LGPL
-** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** In addition, as a special exception, Nokia gives you certain additional
+** rights.  These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
 **
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file.  Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
 **
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at qt-sales@nokia.com.
 ** $QT_END_LICENSE$
 **
 ****************************************************************************/
@@ -62,7 +62,7 @@
 QT_QML_BEGIN_NAMESPACE
 
 namespace QmlJS {
-class NameId
+class QML_PARSER_EXPORT NameId
 {
     QString _text;
 
@@ -101,7 +101,7 @@ class NodePool;
 
 namespace Ecma {
 
-class RegExp
+class QML_PARSER_EXPORT RegExp
 {
 public:
     enum RegExpFlag {
@@ -117,7 +117,7 @@ public:
 
 } // end of namespace Ecma
 
-class DiagnosticMessage
+class QML_PARSER_EXPORT DiagnosticMessage
 {
 public:
     enum Kind { Warning, Error };
@@ -139,7 +139,7 @@ public:
     QString message;
 };
 
-class Engine
+class QML_PARSER_EXPORT Engine
 {
     Lexer *_lexer;
     NodePool *_nodePool;
diff --git a/src/shared/qml/parser/qmljsglobal_p.h b/src/shared/qml/parser/qmljsglobal_p.h
new file mode 100644
index 0000000000000000000000000000000000000000..59762ff965f46debf4ab8a62617de4354576ad7b
--- /dev/null
+++ b/src/shared/qml/parser/qmljsglobal_p.h
@@ -0,0 +1,64 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtDeclarative module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights.  These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#ifndef QMLJSGLOBAL_P_H
+#define QMLJSGLOBAL_P_H
+
+#include <QtCore/qglobal.h>
+
+#ifdef QT_CREATOR
+#  define QT_QML_BEGIN_NAMESPACE
+#  define QT_QML_END_NAMESPACE
+
+#  ifdef QML_BUILD_LIB
+#    define QML_PARSER_EXPORT Q_DECL_EXPORT
+#  elif QML_BUILD_STATIC_LIB
+#    define QML_PARSER_EXPORT
+#  else
+#    define QML_PARSER_EXPORT Q_DECL_IMPORT
+#  endif // QML_BUILD_LIB
+
+#else // !QT_CREATOR
+#  define QT_QML_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
+#  define QT_QML_END_NAMESPACE QT_END_NAMESPACE
+#  define QML_PARSER_EXPORT
+#endif // QT_CREATOR
+
+#endif // QMLJSGLOBAL_P_H
diff --git a/src/plugins/qmleditor/parser/qmljsgrammar.cpp b/src/shared/qml/parser/qmljsgrammar.cpp
similarity index 97%
rename from src/plugins/qmleditor/parser/qmljsgrammar.cpp
rename to src/shared/qml/parser/qmljsgrammar.cpp
index 2b92b8225bc70a9f12baf80c050c8941681156c3..b8c656020ee17b90d6ad870c570b59e43dcde17e 100644
--- a/src/plugins/qmleditor/parser/qmljsgrammar.cpp
+++ b/src/shared/qml/parser/qmljsgrammar.cpp
@@ -2,7 +2,8 @@
 /****************************************************************************
 **
 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
 **
 ** This file is part of the QtDeclarative module of the Qt Toolkit.
 **
@@ -10,8 +11,8 @@
 ** No Commercial Usage
 ** This file contains pre-release code and may not be distributed.
 ** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
 **
 ** GNU Lesser General Public License Usage
 ** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -21,21 +22,20 @@
 ** ensure the GNU Lesser General Public License version 2.1 requirements
 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
 **
-** In addition, as a special exception, Nokia gives you certain
-** additional rights. These rights are described in the Nokia Qt LGPL
-** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** In addition, as a special exception, Nokia gives you certain additional
+** rights.  These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
 **
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file.  Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
 **
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at qt-sales@nokia.com.
 ** $QT_END_LICENSE$
 **
 ****************************************************************************/
diff --git a/src/plugins/qmleditor/parser/qmljsgrammar_p.h b/src/shared/qml/parser/qmljsgrammar_p.h
similarity index 82%
rename from src/plugins/qmleditor/parser/qmljsgrammar_p.h
rename to src/shared/qml/parser/qmljsgrammar_p.h
index 20d7188f4518ee7b59721288b82019fb3cc16460..d607e8ddf33cb5bc6d2d7a0a77a343755ad2a0ed 100644
--- a/src/plugins/qmleditor/parser/qmljsgrammar_p.h
+++ b/src/shared/qml/parser/qmljsgrammar_p.h
@@ -2,7 +2,8 @@
 /****************************************************************************
 **
 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
 **
 ** This file is part of the QtDeclarative module of the Qt Toolkit.
 **
@@ -10,8 +11,8 @@
 ** No Commercial Usage
 ** This file contains pre-release code and may not be distributed.
 ** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
 **
 ** GNU Lesser General Public License Usage
 ** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -21,21 +22,20 @@
 ** ensure the GNU Lesser General Public License version 2.1 requirements
 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
 **
-** In addition, as a special exception, Nokia gives you certain
-** additional rights. These rights are described in the Nokia Qt LGPL
-** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** In addition, as a special exception, Nokia gives you certain additional
+** rights.  These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
 **
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file.  Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
 **
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at qt-sales@nokia.com.
 ** $QT_END_LICENSE$
 **
 ****************************************************************************/
diff --git a/src/plugins/qmleditor/parser/qmljslexer.cpp b/src/shared/qml/parser/qmljslexer.cpp
similarity index 97%
rename from src/plugins/qmleditor/parser/qmljslexer.cpp
rename to src/shared/qml/parser/qmljslexer.cpp
index 2c03c2149704f04f2cab3ccf8d4cd38f2242c496..d316f93bda381f350afb040a48d261323bc93050 100644
--- a/src/plugins/qmleditor/parser/qmljslexer.cpp
+++ b/src/shared/qml/parser/qmljslexer.cpp
@@ -1,7 +1,8 @@
 /****************************************************************************
 **
 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
 **
 ** This file is part of the QtDeclarative module of the Qt Toolkit.
 **
@@ -9,8 +10,8 @@
 ** No Commercial Usage
 ** This file contains pre-release code and may not be distributed.
 ** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
 **
 ** GNU Lesser General Public License Usage
 ** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -20,21 +21,20 @@
 ** ensure the GNU Lesser General Public License version 2.1 requirements
 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
 **
-** In addition, as a special exception, Nokia gives you certain
-** additional rights. These rights are described in the Nokia Qt LGPL
-** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** In addition, as a special exception, Nokia gives you certain additional
+** rights.  These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
 **
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file.  Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
 **
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at qt-sales@nokia.com.
 ** $QT_END_LICENSE$
 **
 ****************************************************************************/
diff --git a/src/plugins/qmleditor/parser/qmljslexer_p.h b/src/shared/qml/parser/qmljslexer_p.h
similarity index 85%
rename from src/plugins/qmleditor/parser/qmljslexer_p.h
rename to src/shared/qml/parser/qmljslexer_p.h
index 50f7c4b279d4be7e7ef59eac39d4f745c8cfe26a..3ff2ec952006cd3eaa430c129ae86d146b48c938 100644
--- a/src/plugins/qmleditor/parser/qmljslexer_p.h
+++ b/src/shared/qml/parser/qmljslexer_p.h
@@ -1,16 +1,17 @@
 /****************************************************************************
 **
 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
 **
-** This file is part of the QtScript module of the Qt Toolkit.
+** This file is part of the QtDeclarative module of the Qt Toolkit.
 **
 ** $QT_BEGIN_LICENSE:LGPL$
 ** No Commercial Usage
 ** This file contains pre-release code and may not be distributed.
 ** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
 **
 ** GNU Lesser General Public License Usage
 ** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -20,21 +21,20 @@
 ** ensure the GNU Lesser General Public License version 2.1 requirements
 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
 **
-** In addition, as a special exception, Nokia gives you certain
-** additional rights. These rights are described in the Nokia Qt LGPL
-** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** In addition, as a special exception, Nokia gives you certain additional
+** rights.  These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
 **
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file.  Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
 **
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at qt-sales@nokia.com.
 ** $QT_END_LICENSE$
 **
 ****************************************************************************/
@@ -64,7 +64,7 @@ namespace QmlJS {
 class Engine;
 class NameId;
 
-class Lexer
+class QML_PARSER_EXPORT Lexer
 {
 public:
     Lexer(Engine *eng, bool tokenizeComments = false);
diff --git a/src/plugins/qmleditor/parser/qmljsmemorypool_p.h b/src/shared/qml/parser/qmljsmemorypool_p.h
similarity index 76%
rename from src/plugins/qmleditor/parser/qmljsmemorypool_p.h
rename to src/shared/qml/parser/qmljsmemorypool_p.h
index 70e77371127320cc5c9c24e301401453a37c9199..de8d09753f01c177ee0cddc4765d32a491ef067b 100644
--- a/src/plugins/qmleditor/parser/qmljsmemorypool_p.h
+++ b/src/shared/qml/parser/qmljsmemorypool_p.h
@@ -1,7 +1,8 @@
 /****************************************************************************
 **
 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
 **
 ** This file is part of the QtDeclarative module of the Qt Toolkit.
 **
@@ -9,8 +10,8 @@
 ** No Commercial Usage
 ** This file contains pre-release code and may not be distributed.
 ** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
 **
 ** GNU Lesser General Public License Usage
 ** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -20,21 +21,20 @@
 ** ensure the GNU Lesser General Public License version 2.1 requirements
 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
 **
-** In addition, as a special exception, Nokia gives you certain
-** additional rights. These rights are described in the Nokia Qt LGPL
-** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** In addition, as a special exception, Nokia gives you certain additional
+** rights.  These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
 **
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file.  Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
 **
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at qt-sales@nokia.com.
 ** $QT_END_LICENSE$
 **
 ****************************************************************************/
@@ -63,7 +63,7 @@ QT_QML_BEGIN_NAMESPACE
 
 namespace QmlJS {
 
-class MemoryPool : public QSharedData
+class QML_PARSER_EXPORT MemoryPool : public QSharedData
 {
 public:
     enum { maxBlockCount = -1 };
diff --git a/src/plugins/qmleditor/parser/qmljsnodepool_p.h b/src/shared/qml/parser/qmljsnodepool_p.h
similarity index 77%
rename from src/plugins/qmleditor/parser/qmljsnodepool_p.h
rename to src/shared/qml/parser/qmljsnodepool_p.h
index dfe3bac46522d1b596e5ea0c70d22f16ac717403..e685be3c94529e721bac8bbd2af18a5444dc6aaf 100644
--- a/src/plugins/qmleditor/parser/qmljsnodepool_p.h
+++ b/src/shared/qml/parser/qmljsnodepool_p.h
@@ -1,7 +1,8 @@
 /****************************************************************************
 **
 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
 **
 ** This file is part of the QtDeclarative module of the Qt Toolkit.
 **
@@ -9,8 +10,8 @@
 ** No Commercial Usage
 ** This file contains pre-release code and may not be distributed.
 ** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
 **
 ** GNU Lesser General Public License Usage
 ** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -20,21 +21,20 @@
 ** ensure the GNU Lesser General Public License version 2.1 requirements
 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
 **
-** In addition, as a special exception, Nokia gives you certain
-** additional rights. These rights are described in the Nokia Qt LGPL
-** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** In addition, as a special exception, Nokia gives you certain additional
+** rights.  These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
 **
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file.  Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
 **
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at qt-sales@nokia.com.
 ** $QT_END_LICENSE$
 **
 ****************************************************************************/
@@ -106,7 +106,7 @@ inline NodeType *makeAstNode(MemoryPool *storage, Arg1 arg1, Arg2 arg2, Arg3 arg
     return node;
 }
 
-class NodePool : public MemoryPool
+class QML_PARSER_EXPORT NodePool : public MemoryPool
 {
 public:
     NodePool(const QString &fileName, Engine *engine);
diff --git a/src/plugins/qmleditor/parser/qmljsparser.cpp b/src/shared/qml/parser/qmljsparser.cpp
similarity index 97%
rename from src/plugins/qmleditor/parser/qmljsparser.cpp
rename to src/shared/qml/parser/qmljsparser.cpp
index fb0080a08f04ca19d5e8024777a7ed50beda2025..453503bd0b2ee27e0ae13b49a159cf818c9c8f5d 100644
--- a/src/plugins/qmleditor/parser/qmljsparser.cpp
+++ b/src/shared/qml/parser/qmljsparser.cpp
@@ -3,16 +3,17 @@
 /****************************************************************************
 **
 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
 **
-** This file is part of the QtScript module of the Qt Toolkit.
+** This file is part of the QtDeclarative module of the Qt Toolkit.
 **
 ** $QT_BEGIN_LICENSE:LGPL$
 ** No Commercial Usage
 ** This file contains pre-release code and may not be distributed.
 ** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
 **
 ** GNU Lesser General Public License Usage
 ** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -22,21 +23,20 @@
 ** ensure the GNU Lesser General Public License version 2.1 requirements
 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
 **
-** In addition, as a special exception, Nokia gives you certain
-** additional rights. These rights are described in the Nokia Qt LGPL
-** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** In addition, as a special exception, Nokia gives you certain additional
+** rights.  These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
 **
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file.  Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
 **
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at qt-sales@nokia.com.
 ** $QT_END_LICENSE$
 **
 ****************************************************************************/
@@ -1749,7 +1749,7 @@ case 337: {
         token_buffer[1].loc   = yylloc  = location(lexer);
 
         if (t_action(errorState, yytoken)) {
-            const QString msg = qApp->translate("QmlParser", "Unexpected token '%1'").arg(QLatin1String(spell[token_buffer[0].token]));
+            const QString msg = qApp->translate("QmlParser", "Unexpected token `%1'").arg(QLatin1String(spell[token_buffer[0].token]));
             diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, token_buffer[0].loc, msg));
 
             action = errorState;
@@ -1777,7 +1777,7 @@ case 337: {
         for (int *tk = tokens; *tk != EOF_SYMBOL; ++tk) {
             int a = t_action(errorState, *tk);
             if (a > 0 && t_action(a, yytoken)) {
-                const QString msg = qApp->translate("QmlParser", "Expected token '%1'").arg(QLatin1String(spell[*tk]));
+                const QString msg = qApp->translate("QmlParser", "Expected token `%1'").arg(QLatin1String(spell[*tk]));
                 diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, token_buffer[0].loc, msg));
 
                 yytoken = *tk;
@@ -1800,7 +1800,7 @@ case 337: {
 
             int a = t_action(errorState, tk);
             if (a > 0 && t_action(a, yytoken)) {
-                const QString msg = qApp->translate("QmlParser", "Expected token '%1'").arg(QLatin1String(spell[tk]));
+                const QString msg = qApp->translate("QmlParser", "Expected token `%1'").arg(QLatin1String(spell[tk]));
                 diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, token_buffer[0].loc, msg));
 
                 yytoken = tk;
diff --git a/src/plugins/qmleditor/parser/qmljsparser_p.h b/src/shared/qml/parser/qmljsparser_p.h
similarity index 84%
rename from src/plugins/qmleditor/parser/qmljsparser_p.h
rename to src/shared/qml/parser/qmljsparser_p.h
index b35bec32b38da836e117dc6afaa4d3d9ee240f63..2cefb5cd16415bda4bb16f64879a935bdd6f55f5 100644
--- a/src/plugins/qmleditor/parser/qmljsparser_p.h
+++ b/src/shared/qml/parser/qmljsparser_p.h
@@ -3,16 +3,17 @@
 /****************************************************************************
 **
 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
 **
-** This file is part of the QtScript module of the Qt Toolkit.
+** This file is part of the QtDeclarative module of the Qt Toolkit.
 **
 ** $QT_BEGIN_LICENSE:LGPL$
 ** No Commercial Usage
 ** This file contains pre-release code and may not be distributed.
 ** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
 **
 ** GNU Lesser General Public License Usage
 ** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -22,21 +23,20 @@
 ** ensure the GNU Lesser General Public License version 2.1 requirements
 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
 **
-** In addition, as a special exception, Nokia gives you certain
-** additional rights. These rights are described in the Nokia Qt LGPL
-** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** In addition, as a special exception, Nokia gives you certain additional
+** rights.  These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
 **
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file.  Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
 **
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at qt-sales@nokia.com.
 ** $QT_END_LICENSE$
 **
 ****************************************************************************/
@@ -75,7 +75,7 @@ namespace QmlJS {
 class Engine;
 class NameId;
 
-class Parser: protected QmlJSGrammar
+class QML_PARSER_EXPORT Parser: protected QmlJSGrammar
 {
 public:
     union Value {
diff --git a/src/shared/qml/qml.pri b/src/shared/qml/qml.pri
new file mode 100644
index 0000000000000000000000000000000000000000..2fa888667294bc0cb660dd39a4ed09e39b847de5
--- /dev/null
+++ b/src/shared/qml/qml.pri
@@ -0,0 +1,17 @@
+include(parser/parser.pri)
+
+DEPENDPATH += $$PWD
+INCLUDEPATH *= $$PWD/..
+
+HEADERS += \
+    $$PWD/qml_global.h \
+    $$PWD/qmlidcollector.h \
+    $$PWD/qmldocument.h \
+    $$PWD/qmlsymbol.h
+
+SOURCES += \
+    $$PWD/qmlidcollector.cpp \
+    $$PWD/qmldocument.cpp \
+    $$PWD/qmlsymbol.cpp
+
+
diff --git a/src/shared/qml/qml_global.h b/src/shared/qml/qml_global.h
new file mode 100644
index 0000000000000000000000000000000000000000..05649d7e336d47fa829434946880df7970c99051
--- /dev/null
+++ b/src/shared/qml/qml_global.h
@@ -0,0 +1,14 @@
+#ifndef QML_GLOBAL_H
+#define QML_GLOBAL_H
+
+#include <QtCore/qglobal.h>
+
+#if defined(QML_BUILD_LIB)
+#  define QML_EXPORT Q_DECL_EXPORT
+#elif defined(QML_BUILD_STATIC_LIB)
+#  define QML_EXPORT
+#else
+#  define QML_EXPORT Q_DECL_IMPORT
+#endif
+
+#endif // QML_GLOBAL_H
diff --git a/src/plugins/qmleditor/qmldocument.cpp b/src/shared/qml/qmldocument.cpp
similarity index 98%
rename from src/plugins/qmleditor/qmldocument.cpp
rename to src/shared/qml/qmldocument.cpp
index 13cbe2895e59b659bfda4777965bd159a14348d5..a71152119fd949aebc24fb685bd3f77f2e4230ab 100644
--- a/src/plugins/qmleditor/qmldocument.cpp
+++ b/src/shared/qml/qmldocument.cpp
@@ -27,7 +27,7 @@
 **
 **************************************************************************/
 
-#include "idcollector.h"
+#include "qmlidcollector.h"
 #include "qmldocument.h"
 #include "qmljsast_p.h"
 #include "qmljslexer_p.h"
@@ -114,7 +114,7 @@ bool QmlDocument::parse()
             if (iter->member)
                 _symbols.append(new QmlSymbolFromFile(_fileName, iter->member));
 
-         Internal::IdCollector collect;
+         Internal::QmlIdCollector collect;
         _ids = collect(this);
     }
 
diff --git a/src/plugins/qmleditor/qmldocument.h b/src/shared/qml/qmldocument.h
similarity index 93%
rename from src/plugins/qmleditor/qmldocument.h
rename to src/shared/qml/qmldocument.h
index 4f9420ebaaefccbb86ff53aa2795fc0eecff6a9e..5797d7299e5430008ff07e0f40b8c02bb93fbaad 100644
--- a/src/plugins/qmleditor/qmldocument.h
+++ b/src/shared/qml/qmldocument.h
@@ -35,13 +35,13 @@
 #include <QtCore/QSharedPointer>
 #include <QtCore/QString>
 
-#include <qmleditor/qmleditor_global.h>
-#include <qmleditor/parser/qmljsengine_p.h>
-#include <qmleditor/qmlsymbol.h>
+#include "parser/qmljsengine_p.h"
+#include "qml_global.h"
+#include "qmlsymbol.h"
 
 namespace QmlEditor {
 
-class QMLEDITOR_EXPORT QmlDocument
+class QML_EXPORT QmlDocument
 {
 public:
     typedef QSharedPointer<QmlDocument> Ptr;
@@ -91,7 +91,7 @@ private:
     QmlSymbol::List _symbols;
 };
 
-class QMLEDITOR_EXPORT Snapshot: public QMap<QString, QmlDocument::Ptr>
+class QML_EXPORT Snapshot: public QMap<QString, QmlDocument::Ptr>
 {
 public:
     Snapshot();
diff --git a/src/plugins/qmleditor/idcollector.cpp b/src/shared/qml/qmlidcollector.cpp
similarity index 78%
rename from src/plugins/qmleditor/idcollector.cpp
rename to src/shared/qml/qmlidcollector.cpp
index c98019587f336ee605b9c2aa202f776455960ae2..a06ae2dde355396bdb3ebb8fcae3a326e9543422 100644
--- a/src/plugins/qmleditor/idcollector.cpp
+++ b/src/shared/qml/qmlidcollector.cpp
@@ -1,6 +1,6 @@
 #include <QDebug>
 
-#include "idcollector.h"
+#include "qmlidcollector.h"
 #include "qmljsast_p.h"
 #include "qmljsengine_p.h"
 
@@ -9,7 +9,7 @@ using namespace QmlJS::AST;
 using namespace QmlEditor;
 using namespace QmlEditor::Internal;
 
-QMap<QString, QmlIdSymbol*> IdCollector::operator()(QmlDocument *doc)
+QMap<QString, QmlIdSymbol*> QmlIdCollector::operator()(QmlDocument *doc)
 {
     _doc = doc;
     _ids.clear();
@@ -20,7 +20,7 @@ QMap<QString, QmlIdSymbol*> IdCollector::operator()(QmlDocument *doc)
     return _ids;
 }
 
-bool IdCollector::visit(UiArrayBinding *ast)
+bool QmlIdCollector::visit(UiArrayBinding *ast)
 {
     QmlSymbolFromFile *oldSymbol = switchSymbol(ast);
     Node::accept(ast->members, this);
@@ -28,7 +28,7 @@ bool IdCollector::visit(UiArrayBinding *ast)
     return false;
 }
 
-bool IdCollector::visit(QmlJS::AST::UiObjectBinding *ast)
+bool QmlIdCollector::visit(QmlJS::AST::UiObjectBinding *ast)
 {
     QmlSymbolFromFile *oldSymbol = switchSymbol(ast);
     Node::accept(ast->initializer, this);
@@ -36,7 +36,7 @@ bool IdCollector::visit(QmlJS::AST::UiObjectBinding *ast)
     return false;
 }
 
-bool IdCollector::visit(QmlJS::AST::UiObjectDefinition *ast)
+bool QmlIdCollector::visit(QmlJS::AST::UiObjectDefinition *ast)
 {
     QmlSymbolFromFile *oldSymbol = switchSymbol(ast);
     Node::accept(ast->initializer, this);
@@ -44,7 +44,7 @@ bool IdCollector::visit(QmlJS::AST::UiObjectDefinition *ast)
     return false;
 }
 
-bool IdCollector::visit(QmlJS::AST::UiScriptBinding *ast)
+bool QmlIdCollector::visit(QmlJS::AST::UiScriptBinding *ast)
 {
     if (!(ast->qualifiedId->next) && ast->qualifiedId->name->asString() == "id")
         if (ExpressionStatement *e = cast<ExpressionStatement*>(ast->statement))
@@ -55,7 +55,7 @@ bool IdCollector::visit(QmlJS::AST::UiScriptBinding *ast)
     return false;
 }
 
-QmlSymbolFromFile *IdCollector::switchSymbol(QmlJS::AST::UiObjectMember *node)
+QmlSymbolFromFile *QmlIdCollector::switchSymbol(QmlJS::AST::UiObjectMember *node)
 {
     QmlSymbolFromFile *newSymbol = 0;
 
@@ -77,7 +77,7 @@ QmlSymbolFromFile *IdCollector::switchSymbol(QmlJS::AST::UiObjectMember *node)
     return oldSymbol;
 }
 
-void IdCollector::addId(const QString &id, QmlJS::AST::UiScriptBinding *ast)
+void QmlIdCollector::addId(const QString &id, QmlJS::AST::UiScriptBinding *ast)
 {
     if (!_ids.contains(id) && _currentSymbol) {
         QmlSymbolFromFile *symbol = _currentSymbol->findMember(ast);
diff --git a/src/plugins/qmleditor/idcollector.h b/src/shared/qml/qmlidcollector.h
similarity index 75%
rename from src/plugins/qmleditor/idcollector.h
rename to src/shared/qml/qmlidcollector.h
index 8a02b4c355fbea0aef5d79c353ab09b7495fb66d..0e8c88df3b6a7280375ea1a02981e4604b8e12e9 100644
--- a/src/plugins/qmleditor/idcollector.h
+++ b/src/shared/qml/qmlidcollector.h
@@ -1,19 +1,19 @@
-#ifndef IDCOLLECTOR_H
-#define IDCOLLECTOR_H
+#ifndef QMLIDCOLLECTOR_H
+#define QMLIDCOLLECTOR_H
 
 #include <QMap>
 #include <QPair>
 #include <QStack>
 #include <QString>
 
-#include "qmldocument.h"
-#include "qmljsastvisitor_p.h"
-#include "qmlsymbol.h"
+#include <qml/parser/qmljsastvisitor_p.h>
+#include <qml/qmldocument.h>
+#include <qml/qmlsymbol.h>
 
 namespace QmlEditor {
 namespace Internal {
 
-class IdCollector: protected QmlJS::AST::Visitor
+class QML_EXPORT QmlIdCollector: protected QmlJS::AST::Visitor
 {
 public:
     QMap<QString, QmlIdSymbol*> operator()(QmlDocument *doc);
@@ -37,4 +37,4 @@ private:
 } // namespace Internal
 } // namespace QmlEditor
 
-#endif // IDCOLLECTOR_H
+#endif // QMLIDCOLLECTOR_H
diff --git a/src/plugins/qmleditor/qmlsymbol.cpp b/src/shared/qml/qmlsymbol.cpp
similarity index 100%
rename from src/plugins/qmleditor/qmlsymbol.cpp
rename to src/shared/qml/qmlsymbol.cpp
diff --git a/src/plugins/qmleditor/qmlsymbol.h b/src/shared/qml/qmlsymbol.h
similarity index 89%
rename from src/plugins/qmleditor/qmlsymbol.h
rename to src/shared/qml/qmlsymbol.h
index 4b9f213be68fbb7994c248798924d2717e7e4ed6..159badf0bbbf27faee1bc0835784542f8829ac91 100644
--- a/src/plugins/qmleditor/qmlsymbol.h
+++ b/src/shared/qml/qmlsymbol.h
@@ -4,11 +4,12 @@
 #include <QList>
 #include <QString>
 
-#include <qmleditor/parser/qmljsastfwd_p.h>
+#include <qml/parser/qmljsastfwd_p.h>
+#include <qml/qml_global.h>
 
 namespace QmlEditor {
 
-class QmlSymbol
+class QML_EXPORT QmlSymbol
 {
 public:
     typedef QList<QmlSymbol*> List;
@@ -33,7 +34,7 @@ protected:
     List _members;
 };
 
-class QmlBuildInSymbol: public QmlSymbol
+class QML_EXPORT QmlBuildInSymbol: public QmlSymbol
 {
 public:
     QmlBuildInSymbol(const QString &name): _name(name) {}
@@ -51,7 +52,7 @@ private:
     QString _name;
 };
 
-class QmlSymbolFromFile: public QmlSymbol
+class QML_EXPORT QmlSymbolFromFile: public QmlSymbol
 {
 public:
     QmlSymbolFromFile(const QString &fileName, QmlJS::AST::UiObjectMember *node);
@@ -81,7 +82,7 @@ private:
     QList<QmlJS::AST::Node*> todo;
 };
 
-class QmlIdSymbol: public QmlSymbolFromFile
+class QML_EXPORT QmlIdSymbol: public QmlSymbolFromFile
 {
 public:
     QmlIdSymbol(const QString &fileName, QmlJS::AST::UiScriptBinding *idNode, QmlSymbolFromFile *parentNode);
@@ -107,7 +108,7 @@ private:
     QmlSymbolFromFile *_parentNode;
 };
 
-class QmlPropertyDefinitionSymbol: public QmlSymbolFromFile
+class QML_EXPORT QmlPropertyDefinitionSymbol: public QmlSymbolFromFile
 {
 public:
     QmlPropertyDefinitionSymbol(const QString &fileName, QmlJS::AST::UiPublicMember *propertyNode);
diff --git a/src/shared/qscripthighlighter/qscripthighlighter.h b/src/shared/qscripthighlighter/qscripthighlighter.h
index 9d654e9c553a8a0fe5edaf95041079c18fdb7623..082def595508db216b55fc759ea8a2defb0cb242 100644
--- a/src/shared/qscripthighlighter/qscripthighlighter.h
+++ b/src/shared/qscripthighlighter/qscripthighlighter.h
@@ -30,7 +30,8 @@
 #ifndef QSCRIPTSYNTAXHIGHLIGHTER_H
 #define QSCRIPTSYNTAXHIGHLIGHTER_H
 
-#include "qscriptincrementalscanner.h"
+#include <qscripthighlighter/qscripthighlighter_global.h>
+#include <qscripthighlighter/qscriptincrementalscanner.h>
 
 #include <QtCore/QVector>
 #include <QtCore/QSet>
@@ -38,7 +39,7 @@
 
 namespace SharedTools {
 
-class QScriptHighlighter : public QSyntaxHighlighter
+class QSCRIPTHIGHLIGHTER_EXPORT QScriptHighlighter : public QSyntaxHighlighter
 {
     Q_OBJECT
 public:
diff --git a/src/shared/qscripthighlighter/qscripthighlighter.pri b/src/shared/qscripthighlighter/qscripthighlighter.pri
index 785c7863db43d6088eb65734609dbff75970c090..a6c88c508fac7db5b48977cb70dee4b70b1dcd36 100644
--- a/src/shared/qscripthighlighter/qscripthighlighter.pri
+++ b/src/shared/qscripthighlighter/qscripthighlighter.pri
@@ -1,4 +1,11 @@
-INCLUDEPATH *= $$PWD
+INCLUDEPATH *= $$PWD $$PWD/..
 
-SOURCES += $$PWD/qscripthighlighter.cpp $$PWD/qscriptincrementalscanner.cpp
-HEADERS += $$PWD/qscripthighlighter.h $$PWD/qscriptincrementalscanner.h
+DEFINES += QSCRIPTHIGHLIGHTER_BUILD_LIB
+
+SOURCES += $$PWD/qscriptincrementalscanner.cpp
+HEADERS += $$PWD/qscriptincrementalscanner.h $$PWD/qscripthighlighter_global.h
+
+contains(QT, gui) {
+    SOURCES += $$PWD/qscripthighlighter.cpp
+    HEADERS += $$PWD/qscripthighlighter.h
+}
diff --git a/src/shared/qscripthighlighter/qscripthighlighter_global.h b/src/shared/qscripthighlighter/qscripthighlighter_global.h
new file mode 100644
index 0000000000000000000000000000000000000000..f697006cd0b9cb2486b71291c59d44f9597e0f28
--- /dev/null
+++ b/src/shared/qscripthighlighter/qscripthighlighter_global.h
@@ -0,0 +1,12 @@
+#ifndef QSCRIPTHIGHLIGHTER_GLOBAL_H
+#define QSCRIPTHIGHLIGHTER_GLOBAL_H
+
+#include <QtCore/QtGlobal>
+
+#ifdef QSCRIPTHIGHLIGHTER_BUILD_LIB
+#  define QSCRIPTHIGHLIGHTER_EXPORT Q_DECL_EXPORT
+#else // !QSCRIPTHIGHLIGHTER
+#  define QSCRIPTHIGHLIGHTER_EXPORT Q_DECL_IMPORT
+#endif // QSCRIPTHIGHLIGHTER
+
+#endif // QSCRIPTHIGHLIGHTER_GLOBAL_H
diff --git a/src/shared/qscripthighlighter/qscriptincrementalscanner.h b/src/shared/qscripthighlighter/qscriptincrementalscanner.h
index 253417d5214a8d19ec5da00a40c12dc5905570d9..bde626d692e45f8eae9d1df8270fbb3612c7b8ac 100644
--- a/src/shared/qscripthighlighter/qscriptincrementalscanner.h
+++ b/src/shared/qscripthighlighter/qscriptincrementalscanner.h
@@ -1,13 +1,15 @@
 #ifndef QSCRIPTINCREMENTALSCANNER_H
 #define QSCRIPTINCREMENTALSCANNER_H
 
+#include <qscripthighlighter/qscripthighlighter_global.h>
+
 #include <QtCore/QList>
 #include <QtCore/QSet>
 #include <QtCore/QString>
 
 namespace SharedTools {
 
-class QScriptIncrementalScanner
+class QSCRIPTHIGHLIGHTER_EXPORT QScriptIncrementalScanner
 {
 public: