Started merging the JS and QML editor plug-ins.

This commit is contained in:
Erik Verbruggen
2010-01-15 17:20:03 +01:00
parent 898e84ceff
commit 96e31c2a0f
81 changed files with 243 additions and 11009 deletions

View File

@@ -25,14 +25,13 @@ SUBDIRS = plugin_coreplugin \
# plugin_helloworld \ # sample plugin
plugin_help \
# plugin_regexp \ # don't know what to do with this
plugin_qtscripteditor \
plugin_cpaster \
plugin_cmakeprojectmanager \
plugin_fakevim \
plugin_designer \
plugin_resourceeditor \
plugin_genericprojectmanager \
plugin_qmleditor \
plugin_qmljseditor \
plugin_qmlprojectmanager \
plugin_mercurial \
debugger/dumper.pro
@@ -154,10 +153,6 @@ plugin_resourceeditor.depends = plugin_coreplugin
plugin_regexp.subdir = regexp
plugin_regexp.depends = plugin_coreplugin
plugin_qtscripteditor.subdir = qtscripteditor
plugin_qtscripteditor.depends = plugin_texteditor
plugin_qtscripteditor.depends += plugin_coreplugin
plugin_cpaster.subdir = cpaster
plugin_cpaster.depends = plugin_texteditor
plugin_cpaster.depends += plugin_coreplugin
@@ -175,15 +170,15 @@ plugin_genericprojectmanager.depends += plugin_projectexplorer
plugin_genericprojectmanager.depends += plugin_cpptools
plugin_genericprojectmanager.depends += plugin_cppeditor
plugin_qmleditor.subdir = qmleditor
plugin_qmleditor.depends = plugin_texteditor
plugin_qmleditor.depends += plugin_coreplugin
plugin_qmljseditor.subdir = qmljseditor
plugin_qmljseditor.depends = plugin_texteditor
plugin_qmljseditor.depends += plugin_coreplugin
plugin_qmlprojectmanager.subdir = qmlprojectmanager
plugin_qmlprojectmanager.depends = plugin_texteditor
plugin_qmlprojectmanager.depends += plugin_projectexplorer
plugin_qmlprojectmanager.depends += plugin_help
plugin_qmlprojectmanager.depends += plugin_qmleditor
plugin_qmlprojectmanager.depends += plugin_qmljseditor
plugin_qmldesigner.subdir = qmldesigner
plugin_qmldesigner.depends = plugin_coreplugin

View File

@@ -14,7 +14,6 @@ SOURCES += \
$$PWD/firstdefinitionfinder.cpp \
$$PWD/moveobjectbeforeobjectvisitor.cpp
HEADERS += \
$$PWD/qmleditor_global.h \
$$PWD/qmlrewriter.h \
$$PWD/qmlrefactoring.h \
$$PWD/changeobjecttypevisitor.h \

View File

@@ -1,8 +0,0 @@
<?xml version="1.0"?>
<mime-info xmlns='http://www.freedesktop.org/standards/shared-mime-info'>
<mime-type type="application/x-qml">
<sub-class-of type="text/plain"/>
<comment>QML file</comment>
<glob pattern="*.qml"/>
</mime-type>
</mime-info>

View File

@@ -1,3 +0,0 @@
include(qmleditor_dependencies.pri)
LIBS *= -l$$qtLibraryTarget(QmlEditor)

View File

@@ -1,5 +0,0 @@
<RCC>
<qresource prefix="/qmleditor" >
<file>QmlEditor.mimetypes.xml</file>
</qresource>
</RCC>

View File

@@ -1,41 +0,0 @@
/**************************************************************************
**
** 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.
**
**************************************************************************/
#ifndef QMLEDITOR_GLOBAL_H
#define QMLEDITOR_GLOBAL_H
#include <QtGlobal>
#if defined(QMLEDITOR_LIBRARY)
# define QMLEDITOR_EXPORT Q_DECL_EXPORT
#else
# define QMLEDITOR_EXPORT Q_DECL_IMPORT
#endif
#endif // QMLEDITOR_GLOBAL_H

View File

@@ -1,5 +1,10 @@
<?xml version="1.0"?>
<mime-info xmlns='http://www.freedesktop.org/standards/shared-mime-info'>
<mime-type type="application/x-qml">
<sub-class-of type="text/plain"/>
<comment>QML file</comment>
<glob pattern="*.qml"/>
</mime-type>
<mime-type type="application/javascript">
<alias type="application/x-javascript"/>
<alias type="text/javascript"/>

View File

@@ -1,4 +1,4 @@
<plugin name="QmlEditor" version="1.3.80" compatVersion="1.3.80">
<plugin name="QmlJSEditor" version="1.3.80" compatVersion="1.3.80">
<vendor>Nokia Corporation</vendor>
<copyright>(C) 2008-2009 Nokia Corporation</copyright>
<license>
@@ -10,7 +10,7 @@ GNU Lesser General Public License Usage
Alternatively, this plugin may be used under the terms of the GNU Lesser General Public License version 2.1 as published by the Free Software Foundation. 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.
</license>
<description>Editor for QML.</description>
<description>Editor for QML and JavaScript.</description>
<url>http://qt.nokia.com</url>
<dependencyList>
<dependency name="Core" version="1.3.80"/>

View File

@@ -28,7 +28,7 @@
**************************************************************************/
#include "qmlcodecompletion.h"
#include "qmleditor.h"
#include "qmljseditor.h"
#include "qmlmodelmanagerinterface.h"
#include "qmlexpressionundercursor.h"
#include "qmllookupcontext.h"
@@ -39,8 +39,8 @@
#include <QtDebug>
using namespace QmlEditor;
using namespace QmlEditor::Internal;
using namespace QmlJSEditor;
using namespace QmlJSEditor::Internal;
QmlCodeCompletion::QmlCodeCompletion(QmlModelManagerInterface *modelManager, Qml::QmlTypeSystem *typeSystem, QObject *parent)
: TextEditor::ICompletionCollector(parent),
@@ -65,7 +65,7 @@ void QmlCodeCompletion::setCaseSensitivity(Qt::CaseSensitivity caseSensitivity)
bool QmlCodeCompletion::supportsEditor(TextEditor::ITextEditable *editor)
{
if (qobject_cast<QmlTextEditor *>(editor->widget()))
if (qobject_cast<QmlJSTextEditor *>(editor->widget()))
return true;
return false;
@@ -78,7 +78,7 @@ int QmlCodeCompletion::startCompletion(TextEditor::ITextEditable *editor)
{
m_editor = editor;
QmlTextEditor *edit = qobject_cast<QmlTextEditor *>(m_editor->widget());
QmlJSTextEditor *edit = qobject_cast<QmlJSTextEditor *>(m_editor->widget());
if (! edit)
return -1;

View File

@@ -37,7 +37,7 @@ namespace TextEditor {
class ITextEditable;
}
namespace QmlEditor {
namespace QmlJSEditor {
class QmlModelManagerInterface;
@@ -73,6 +73,6 @@ private:
} // end of namespace Internal
} // end of namespace QmlEditor
} // end of namespace QmlJSEditor
#endif // QMLCODECOMPLETION_H

View File

@@ -42,7 +42,7 @@ using namespace Qml;
using namespace QmlJS;
using namespace QmlJS::AST;
namespace QmlEditor {
namespace QmlJSEditor {
namespace Internal {
class PositionCalculator: protected Visitor
{
@@ -204,8 +204,8 @@ namespace QmlEditor {
}
}
using namespace QmlEditor;
using namespace QmlEditor::Internal;
using namespace QmlJSEditor;
using namespace QmlJSEditor::Internal;
QmlExpressionUnderCursor::QmlExpressionUnderCursor()
: _expressionNode(0),

View File

@@ -30,7 +30,6 @@
#ifndef QMLEXPRESSIONUNDERCURSOR_H
#define QMLEXPRESSIONUNDERCURSOR_H
#include <qmljs/parser/qmljsastfwd_p.h>
#include <qmljs/qmldocument.h>
#include <qmljs/qmlsymbol.h>
@@ -44,7 +43,7 @@ namespace QmlJS {
class NodePool;
}
namespace QmlEditor {
namespace QmlJSEditor {
namespace Internal {
class QmlExpressionUnderCursor
@@ -84,6 +83,6 @@ private:
};
} // namespace Internal
} // namespace QmlEditor
} // namespace QmlJSEditor
#endif // QMLEXPRESSIONUNDERCURSOR_H

View File

@@ -27,13 +27,13 @@
**
**************************************************************************/
#include "qmleditorconstants.h"
#include "qmljseditorconstants.h"
#include "qmlfilewizard.h"
#include <QtCore/QFileInfo>
#include <QtCore/QTextStream>
using namespace QmlEditor;
using namespace QmlJSEditor;
QmlFileWizard::QmlFileWizard(const BaseFileWizardParameters &parameters,
QObject *parent):
@@ -46,11 +46,11 @@ Core::GeneratedFiles QmlFileWizard::generateFilesFromPath(const QString &path,
QString * /*errorMessage*/) const
{
const QString mimeType = QLatin1String(Constants::QMLEDITOR_MIMETYPE);
const QString mimeType = QLatin1String(Constants::QMLJSEDITOR_MIMETYPE);
const QString fileName = Core::BaseFileWizard::buildFileName(path, name, preferredSuffix(mimeType));
Core::GeneratedFile file(fileName);
file.setEditorId(QLatin1String(Constants::C_QMLEDITOR_ID));
file.setEditorId(QLatin1String(Constants::C_QMLJSEDITOR_ID));
file.setContents(fileContents(fileName));
return Core::GeneratedFiles() << file;

View File

@@ -32,7 +32,7 @@
#include <coreplugin/basefilewizard.h>
namespace QmlEditor {
namespace QmlJSEditor {
class QmlFileWizard: public Core::StandardFileWizard
{
@@ -53,6 +53,6 @@ protected:
QString *errorMessage) const;
};
} // namespace QmlEditor
} // namespace QmlJSEditor
#endif // QMLFILEWIZARD_H

View File

@@ -31,8 +31,8 @@
#include <utils/qtcassert.h>
using namespace QmlEditor;
using namespace QmlEditor::Internal;
using namespace QmlJSEditor;
using namespace QmlJSEditor::Internal;
QmlHighlighter::QmlHighlighter(QTextDocument *parent) :
SharedTools::QScriptHighlighter(true, parent)

View File

@@ -33,7 +33,7 @@
#include <qscripthighlighter/qscripthighlighter.h>
#include <texteditor/basetexteditor.h>
namespace QmlEditor {
namespace QmlJSEditor {
namespace Internal {
// Highlighter for Scripts that stores
@@ -59,6 +59,6 @@ private:
};
} // namespace Internal
} // namespace QmlEditor
} // namespace QmlJSEditor
#endif // QMLSYNTAXHIGHLIGHTER_H

View File

@@ -27,7 +27,7 @@
**
**************************************************************************/
#include "qmleditor.h"
#include "qmljseditor.h"
#include "qmlexpressionundercursor.h"
#include "qmlhoverhandler.h"
#include "qmllookupcontext.h"
@@ -53,8 +53,8 @@
using namespace Core;
using namespace Qml;
using namespace QmlEditor;
using namespace QmlEditor::Internal;
using namespace QmlJSEditor;
using namespace QmlJSEditor::Internal;
QmlHoverHandler::QmlHoverHandler(QObject *parent)
: QObject(parent)
@@ -84,7 +84,7 @@ QmlHoverHandler::QmlHoverHandler(QObject *parent)
void QmlHoverHandler::editorOpened(IEditor *editor)
{
QmlEditorEditable *qmlEditor = qobject_cast<QmlEditorEditable *>(editor);
QmlJSEditorEditable *qmlEditor = qobject_cast<QmlJSEditorEditable *>(editor);
if (!qmlEditor)
return;
@@ -146,7 +146,7 @@ void QmlHoverHandler::updateHelpIdAndTooltip(TextEditor::ITextEditor *editor, in
if (!m_modelManager)
return;
QmlTextEditor *scriptEditor = qobject_cast<QmlTextEditor *>(editor->widget());
QmlJSTextEditor *scriptEditor = qobject_cast<QmlJSTextEditor *>(editor->widget());
if (!scriptEditor)
return;

View File

@@ -47,7 +47,7 @@ namespace TextEditor {
class ITextEditor;
}
namespace QmlEditor {
namespace QmlJSEditor {
namespace Internal {
class QmlHoverHandler : public QObject
@@ -76,6 +76,6 @@ private:
};
} // namespace Internal
} // namespace QmlEditor
} // namespace QmlJSEditor
#endif // QMLHOVERHANDLER_H

View File

@@ -27,10 +27,10 @@
**
**************************************************************************/
#include "qmleditor.h"
#include "qmleditorconstants.h"
#include "qmljseditor.h"
#include "qmljseditorconstants.h"
#include "qmlhighlighter.h"
#include "qmleditorplugin.h"
#include "qmljseditorplugin.h"
#include "qmlmodelmanager.h"
#include "qmlexpressionundercursor.h"
@@ -98,7 +98,7 @@ int blockStartState(const QTextBlock &block)
}
} // end of anonymous namespace
namespace QmlEditor {
namespace QmlJSEditor {
namespace Internal {
class FindIdDeclarations: protected Visitor
@@ -297,16 +297,16 @@ protected:
#endif
};
QmlEditorEditable::QmlEditorEditable(QmlTextEditor *editor)
QmlJSEditorEditable::QmlJSEditorEditable(QmlJSTextEditor *editor)
: BaseTextEditorEditable(editor)
{
Core::UniqueIDManager *uidm = Core::UniqueIDManager::instance();
m_context << uidm->uniqueIdentifier(QmlEditor::Constants::C_QMLEDITOR_ID);
m_context << uidm->uniqueIdentifier(QmlJSEditor::Constants::C_QMLJSEDITOR_ID);
m_context << uidm->uniqueIdentifier(TextEditor::Constants::C_TEXTEDITOR);
}
QmlTextEditor::QmlTextEditor(QWidget *parent) :
QmlJSTextEditor::QmlJSTextEditor(QWidget *parent) :
TextEditor::BaseTextEditor(parent),
m_methodCombo(0),
m_modelManager(0),
@@ -317,7 +317,7 @@ QmlTextEditor::QmlTextEditor(QWidget *parent) :
setMarksVisible(true);
setCodeFoldingSupported(true);
setCodeFoldingVisible(true);
setMimeType(QmlEditor::Constants::QMLEDITOR_MIMETYPE);
setMimeType(QmlJSEditor::Constants::QMLJSEDITOR_MIMETYPE);
m_updateDocumentTimer = new QTimer(this);
m_updateDocumentTimer->setInterval(UPDATE_DOCUMENT_DEFAULT_INTERVAL);
@@ -343,37 +343,37 @@ QmlTextEditor::QmlTextEditor(QWidget *parent) :
}
}
QmlTextEditor::~QmlTextEditor()
QmlJSTextEditor::~QmlJSTextEditor()
{
}
QList<Declaration> QmlTextEditor::declarations() const
QList<Declaration> QmlJSTextEditor::declarations() const
{ return m_declarations; }
Core::IEditor *QmlEditorEditable::duplicate(QWidget *parent)
Core::IEditor *QmlJSEditorEditable::duplicate(QWidget *parent)
{
QmlTextEditor *newEditor = new QmlTextEditor(parent);
QmlJSTextEditor *newEditor = new QmlJSTextEditor(parent);
newEditor->duplicateFrom(editor());
QmlEditorPlugin::instance()->initializeEditor(newEditor);
QmlJSEditorPlugin::instance()->initializeEditor(newEditor);
return newEditor->editableInterface();
}
QString QmlEditorEditable::id() const
QString QmlJSEditorEditable::id() const
{
return QLatin1String(QmlEditor::Constants::C_QMLEDITOR_ID);
return QLatin1String(QmlJSEditor::Constants::C_QMLJSEDITOR_ID);
}
QmlTextEditor::Context QmlEditorEditable::context() const
QmlJSTextEditor::Context QmlJSEditorEditable::context() const
{
return m_context;
}
void QmlTextEditor::updateDocument()
void QmlJSTextEditor::updateDocument()
{
m_updateDocumentTimer->start(UPDATE_DOCUMENT_DEFAULT_INTERVAL);
}
void QmlTextEditor::updateDocumentNow()
void QmlJSTextEditor::updateDocumentNow()
{
// ### move in the parser thread.
@@ -384,7 +384,7 @@ void QmlTextEditor::updateDocumentNow()
m_modelManager->updateSourceFiles(QStringList() << fileName);
}
void QmlTextEditor::onDocumentUpdated(Qml::QmlDocument::Ptr doc)
void QmlJSTextEditor::onDocumentUpdated(Qml::QmlDocument::Ptr doc)
{
if (file()->fileName() != doc->fileName())
return;
@@ -444,7 +444,7 @@ void QmlTextEditor::onDocumentUpdated(Qml::QmlDocument::Ptr doc)
setExtraSelections(CodeWarningsSelection, selections);
}
void QmlTextEditor::jumpToMethod(int index)
void QmlJSTextEditor::jumpToMethod(int index)
{
if (index) {
Declaration d = m_declarations.at(index - 1);
@@ -453,7 +453,7 @@ void QmlTextEditor::jumpToMethod(int index)
}
}
void QmlTextEditor::updateMethodBoxIndex()
void QmlJSTextEditor::updateMethodBoxIndex()
{
int line = 0, column = 0;
convertPosition(position(), &line, &column);
@@ -474,12 +474,12 @@ void QmlTextEditor::updateMethodBoxIndex()
updateUses();
}
void QmlTextEditor::updateUses()
void QmlJSTextEditor::updateUses()
{
m_updateUsesTimer->start();
}
void QmlTextEditor::updateUsesNow()
void QmlJSTextEditor::updateUsesNow()
{
if (document()->revision() != m_idsRevision) {
updateUses();
@@ -504,15 +504,15 @@ void QmlTextEditor::updateUsesNow()
setExtraSelections(CodeSemanticsSelection, selections);
}
void QmlTextEditor::updateMethodBoxToolTip()
void QmlJSTextEditor::updateMethodBoxToolTip()
{
}
void QmlTextEditor::updateFileName()
void QmlJSTextEditor::updateFileName()
{
}
void QmlTextEditor::renameIdUnderCursor()
void QmlJSTextEditor::renameIdUnderCursor()
{
const QString id = wordUnderCursor();
bool ok = false;
@@ -533,7 +533,7 @@ void QmlTextEditor::renameIdUnderCursor()
}
}
QStringList QmlTextEditor::keywords() const
QStringList QmlJSTextEditor::keywords() const
{
QStringList words;
@@ -543,7 +543,7 @@ QStringList QmlTextEditor::keywords() const
return words;
}
void QmlTextEditor::setFontSettings(const TextEditor::FontSettings &fs)
void QmlJSTextEditor::setFontSettings(const TextEditor::FontSettings &fs)
{
TextEditor::BaseTextEditor::setFontSettings(fs);
QmlHighlighter *highlighter = qobject_cast<QmlHighlighter*>(baseTextDocument()->syntaxHighlighter());
@@ -569,7 +569,7 @@ void QmlTextEditor::setFontSettings(const TextEditor::FontSettings &fs)
highlighter->rehighlight();
}
QString QmlTextEditor::wordUnderCursor() const
QString QmlJSTextEditor::wordUnderCursor() const
{
QTextCursor tc = textCursor();
tc.movePosition(QTextCursor::StartOfWord);
@@ -578,7 +578,7 @@ QString QmlTextEditor::wordUnderCursor() const
return word;
}
bool QmlTextEditor::isElectricCharacter(const QChar &ch) const
bool QmlJSTextEditor::isElectricCharacter(const QChar &ch) const
{
if (ch == QLatin1Char('}')
|| ch == QLatin1Char(']'))
@@ -586,7 +586,7 @@ bool QmlTextEditor::isElectricCharacter(const QChar &ch) const
return false;
}
bool QmlTextEditor::isClosingBrace(const QList<QScriptIncrementalScanner::Token> &tokens) const
bool QmlJSTextEditor::isClosingBrace(const QList<QScriptIncrementalScanner::Token> &tokens) const
{
if (tokens.size() == 1) {
@@ -598,7 +598,7 @@ bool QmlTextEditor::isClosingBrace(const QList<QScriptIncrementalScanner::Token>
return false;
}
void QmlTextEditor::indentBlock(QTextDocument *doc, QTextBlock block, QChar typedChar)
void QmlJSTextEditor::indentBlock(QTextDocument *doc, QTextBlock block, QChar typedChar)
{
TextEditor::TabSettings ts = tabSettings();
SharedTools::QScriptIndenter indenter;
@@ -609,14 +609,14 @@ void QmlTextEditor::indentBlock(QTextDocument *doc, QTextBlock block, QChar type
ts.indentLine(block, indent);
}
TextEditor::BaseTextEditorEditable *QmlTextEditor::createEditableInterface()
TextEditor::BaseTextEditorEditable *QmlJSTextEditor::createEditableInterface()
{
QmlEditorEditable *editable = new QmlEditorEditable(this);
QmlJSEditorEditable *editable = new QmlJSEditorEditable(this);
createToolBar(editable);
return editable;
}
void QmlTextEditor::createToolBar(QmlEditorEditable *editable)
void QmlJSTextEditor::createToolBar(QmlJSEditorEditable *editable)
{
m_methodCombo = new QComboBox;
m_methodCombo->setMinimumContentsLength(22);
@@ -639,7 +639,7 @@ void QmlTextEditor::createToolBar(QmlEditorEditable *editable)
toolBar->insertWidget(actions.first(), m_methodCombo);
}
TextEditor::BaseTextEditor::Link QmlTextEditor::findLinkAt(const QTextCursor &cursor, bool /*resolveTarget*/)
TextEditor::BaseTextEditor::Link QmlJSTextEditor::findLinkAt(const QTextCursor &cursor, bool /*resolveTarget*/)
{
Link link;
@@ -689,11 +689,11 @@ TextEditor::BaseTextEditor::Link QmlTextEditor::findLinkAt(const QTextCursor &cu
return link;
}
void QmlTextEditor::contextMenuEvent(QContextMenuEvent *e)
void QmlJSTextEditor::contextMenuEvent(QContextMenuEvent *e)
{
QMenu *menu = new QMenu();
if (Core::ActionContainer *mcontext = Core::ICore::instance()->actionManager()->actionContainer(QmlEditor::Constants::M_CONTEXT)) {
if (Core::ActionContainer *mcontext = Core::ICore::instance()->actionManager()->actionContainer(QmlJSEditor::Constants::M_CONTEXT)) {
QMenu *contextMenu = mcontext->menu();
foreach (QAction *action, contextMenu->actions())
menu->addAction(action);
@@ -713,7 +713,7 @@ void QmlTextEditor::contextMenuEvent(QContextMenuEvent *e)
menu->deleteLater();
}
void QmlTextEditor::unCommentSelection()
void QmlJSTextEditor::unCommentSelection()
{
Utils::unCommentSelection(this);
}
@@ -731,7 +731,7 @@ static bool isCompleteStringLiteral(const QStringRef &text)
return false;
}
bool QmlTextEditor::contextAllowsAutoParentheses(const QTextCursor &cursor, const QString &textToInsert) const
bool QmlJSTextEditor::contextAllowsAutoParentheses(const QTextCursor &cursor, const QString &textToInsert) const
{
QChar ch;
@@ -806,13 +806,13 @@ bool QmlTextEditor::contextAllowsAutoParentheses(const QTextCursor &cursor, cons
return true;
}
bool QmlTextEditor::isInComment(const QTextCursor &) const
bool QmlJSTextEditor::isInComment(const QTextCursor &) const
{
// ### implement me
return false;
}
QString QmlTextEditor::insertMatchingBrace(const QTextCursor &tc, const QString &text, const QChar &, int *skippedChars) const
QString QmlJSTextEditor::insertMatchingBrace(const QTextCursor &tc, const QString &text, const QChar &, int *skippedChars) const
{
if (text.length() != 1)
return QString();
@@ -857,10 +857,10 @@ QString QmlTextEditor::insertMatchingBrace(const QTextCursor &tc, const QString
return QString();
}
QString QmlTextEditor::insertParagraphSeparator(const QTextCursor &) const
QString QmlJSTextEditor::insertParagraphSeparator(const QTextCursor &) const
{
return QLatin1String("}\n");
}
} // namespace Internal
} // namespace QmlEditor
} // namespace QmlJSEditor

View File

@@ -27,8 +27,8 @@
**
**************************************************************************/
#ifndef QMLEDITORW_H
#define QMLEDITORW_H
#ifndef QMLJSEDITOR_H
#define QMLJSEDITOR_H
#include <qmljs/qmldocument.h>
#include <qscripthighlighter/qscriptincrementalscanner.h>
@@ -47,21 +47,21 @@ namespace Qml {
class QmlTypeSystem;
}
namespace QmlEditor {
namespace QmlJSEditor {
class QmlModelManagerInterface;
namespace Internal {
class QmlHighlighter;
class QmlTextEditor;
class QmlJSTextEditor;
class QmlEditorEditable : public TextEditor::BaseTextEditorEditable
class QmlJSEditorEditable : public TextEditor::BaseTextEditorEditable
{
Q_OBJECT
public:
QmlEditorEditable(QmlTextEditor *);
QmlJSEditorEditable(QmlJSTextEditor *);
QList<int> context() const;
bool duplicateSupported() const { return true; }
@@ -90,15 +90,15 @@ struct Declaration
{ }
};
class QmlTextEditor : public TextEditor::BaseTextEditor
class QmlJSTextEditor : public TextEditor::BaseTextEditor
{
Q_OBJECT
public:
typedef QList<int> Context;
QmlTextEditor(QWidget *parent = 0);
~QmlTextEditor();
QmlJSTextEditor(QWidget *parent = 0);
~QmlJSTextEditor();
QList<Declaration> declarations() const;
QStringList keywords() const;
@@ -132,7 +132,7 @@ private slots:
protected:
void contextMenuEvent(QContextMenuEvent *e);
TextEditor::BaseTextEditorEditable *createEditableInterface();
void createToolBar(QmlEditorEditable *editable);
void createToolBar(QmlJSEditorEditable *editable);
TextEditor::BaseTextEditor::Link findLinkAt(const QTextCursor &cursor, bool resolveTarget = true);
//// brace matching
@@ -164,6 +164,6 @@ private:
};
} // namespace Internal
} // namespace QmlEditor
} // namespace QmlJSEditor
#endif // QMLEDITORW_H
#endif // QMLJSEDITOR_H

View File

@@ -0,0 +1,3 @@
include(qmljseditor_dependencies.pri)
LIBS *= -l$$qtLibraryTarget(QmlJSEditor)

View File

@@ -1,7 +1,7 @@
TEMPLATE = lib
TARGET = QmlEditor
TARGET = QmlJSEditor
include(../../qtcreatorplugin.pri)
include(qmleditor_dependencies.pri)
include(qmljseditor_dependencies.pri)
include(../../shared/qscripthighlighter/qscripthighlighter.pri)
DEPENDPATH += ../../shared/qscripthighlighter
@@ -9,17 +9,17 @@ DEPENDPATH += ../../shared/qscripthighlighter
CONFIG += help
DEFINES += \
QMLEDITOR_LIBRARY \
QMLJSEDITOR_LIBRARY \
QT_CREATOR
HEADERS += \
qmlcodecompletion.h \
qmleditor.h \
qmleditor_global.h \
qmleditoractionhandler.h \
qmleditorconstants.h \
qmleditorfactory.h \
qmleditorplugin.h \
qmljseditor.h \
qmljseditor_global.h \
qmljseditoractionhandler.h \
qmljseditorconstants.h \
qmljseditorfactory.h \
qmljseditorplugin.h \
qmlexpressionundercursor.h \
qmlfilewizard.h \
qmlhighlighter.h \
@@ -31,10 +31,10 @@ HEADERS += \
SOURCES += \
qmlcodecompletion.cpp \
qmleditor.cpp \
qmleditoractionhandler.cpp \
qmleditorfactory.cpp \
qmleditorplugin.cpp \
qmljseditor.cpp \
qmljseditoractionhandler.cpp \
qmljseditorfactory.cpp \
qmljseditorplugin.cpp \
qmlexpressionundercursor.cpp \
qmlfilewizard.cpp \
qmlhighlighter.cpp \
@@ -44,5 +44,5 @@ SOURCES += \
qmlmodelmanagerinterface.cpp \
qmlresolveexpression.cpp
RESOURCES += qmleditor.qrc
OTHER_FILES += QmlEditor.pluginspec
RESOURCES += qmljseditor.qrc
OTHER_FILES += QmlJSEditor.pluginspec QmlJSEditor.mimetypes.xml

View File

@@ -0,0 +1,5 @@
<RCC>
<qresource prefix="/qmljseditor" >
<file>QmlJSEditor.mimetypes.xml</file>
</qresource>
</RCC>

View File

@@ -27,15 +27,15 @@
**
**************************************************************************/
#ifndef QMLEDITOR_GLOBAL_H
#define QMLEDITOR_GLOBAL_H
#ifndef QMLJSEDITOR_GLOBAL_H
#define QMLJSEDITOR_GLOBAL_H
#include <QtGlobal>
#if defined(QMLEDITOR_LIBRARY)
# define QMLEDITOR_EXPORT Q_DECL_EXPORT
#if defined(QMLJSEDITOR_LIBRARY)
# define QMLJSEDITOR_EXPORT Q_DECL_EXPORT
#else
# define QMLEDITOR_EXPORT Q_DECL_IMPORT
# define QMLJSEDITOR_EXPORT Q_DECL_IMPORT
#endif
#endif // QMLEDITOR_GLOBAL_H
#endif // QMLJSEDITOR_GLOBAL_H

View File

@@ -27,9 +27,9 @@
**
**************************************************************************/
#include "qmleditoractionhandler.h"
#include "qmleditorconstants.h"
#include "qmleditor.h"
#include "qmljseditoractionhandler.h"
#include "qmljseditorconstants.h"
#include "qmljseditor.h"
#include <coreplugin/icore.h>
#include <coreplugin/actionmanager/actionmanager.h>
@@ -39,20 +39,20 @@
#include <QtGui/QMainWindow>
#include <QtGui/QMessageBox>
namespace QmlEditor {
namespace QmlJSEditor {
namespace Internal {
QmlEditorActionHandler::QmlEditorActionHandler()
: TextEditor::TextEditorActionHandler(QLatin1String(QmlEditor::Constants::C_QMLEDITOR_ID),
QmlJSEditorActionHandler::QmlJSEditorActionHandler()
: TextEditor::TextEditorActionHandler(QLatin1String(QmlJSEditor::Constants::C_QMLJSEDITOR_ID),
Format)
{
}
void QmlEditorActionHandler::createActions()
void QmlJSEditorActionHandler::createActions()
{
TextEditor::TextEditorActionHandler::createActions();
}
} // namespace Internal
} // namespace QmlEditor
} // namespace QmlJSEditor

View File

@@ -32,20 +32,20 @@
#include <texteditor/texteditoractionhandler.h>
namespace QmlEditor {
namespace QmlJSEditor {
namespace Internal {
class QmlEditorActionHandler : public TextEditor::TextEditorActionHandler
class QmlJSEditorActionHandler : public TextEditor::TextEditorActionHandler
{
Q_OBJECT
public:
QmlEditorActionHandler();
QmlJSEditorActionHandler();
void createActions();
};
} // namespace Internal
} // namespace QmlEditor
} // namespace QmlJSEditor
#endif // QMLDITORACTIONHANDLER_H

View File

@@ -27,23 +27,23 @@
**
**************************************************************************/
#ifndef QMLEDITOR_CONSTANTS_H
#define QMLEDITOR_CONSTANTS_H
#ifndef QMLJSEDITOR_CONSTANTS_H
#define QMLJSEDITOR_CONSTANTS_H
#include <QtCore/QtGlobal>
namespace QmlEditor {
namespace QmlJSEditor {
namespace Constants {
const char * const M_CONTEXT = "QML Editor.ContextMenu";
const char * const RUN_SEP = "QmlEditor.Run.Separator";
const char * const C_QMLEDITOR_ID = "QMLProjectManager.QMLEditor";
const char * const C_QMLEDITOR_DISPLAY_NAME = QT_TRANSLATE_NOOP("OpenWith::Editors", "QML Editor");
const char * const TASK_INDEX = "QmlEditor.TaskIndex";
const char * const M_CONTEXT = "QML JS Editor.ContextMenu";
const char * const RUN_SEP = "QmlJSEditor.Run.Separator";
const char * const C_QMLJSEDITOR_ID = "QMLProjectManager.QMLJSEditor";
const char * const C_QMLJSEDITOR_DISPLAY_NAME = QT_TRANSLATE_NOOP("OpenWith::Editors", "QMLJS Editor");
const char * const TASK_INDEX = "QmlJSEditor.TaskIndex";
const char * const QMLEDITOR_MIMETYPE = "application/x-qml";
const char * const QMLJSEDITOR_MIMETYPE = "application/x-qml";
} // namespace Constants
} // namespace QmlEditor
} // namespace QmlJSEditor
#endif // QMLEDITOR_CONSTANTS_H
#endif // QMLJSEDITOR_CONSTANTS_H

View File

@@ -27,42 +27,42 @@
**
**************************************************************************/
#include "qmleditorfactory.h"
#include "qmleditor.h"
#include "qmleditoractionhandler.h"
#include "qmleditorconstants.h"
#include "qmleditorplugin.h"
#include "qmljseditorfactory.h"
#include "qmljseditor.h"
#include "qmljseditoractionhandler.h"
#include "qmljseditorconstants.h"
#include "qmljseditorplugin.h"
#include <coreplugin/editormanager/editormanager.h>
#include <QtCore/QFileInfo>
#include <QtCore/QDebug>
using namespace QmlEditor::Internal;
using namespace QmlEditor::Constants;
using namespace QmlJSEditor::Internal;
using namespace QmlJSEditor::Constants;
QmlEditorFactory::QmlEditorFactory(QObject *parent)
QmlJSEditorFactory::QmlJSEditorFactory(QObject *parent)
: Core::IEditorFactory(parent),
m_mimeTypes(QLatin1String(QmlEditor::Constants::QMLEDITOR_MIMETYPE))
m_mimeTypes(QLatin1String(QmlJSEditor::Constants::QMLJSEDITOR_MIMETYPE))
{
}
QmlEditorFactory::~QmlEditorFactory()
QmlJSEditorFactory::~QmlJSEditorFactory()
{
}
QString QmlEditorFactory::id() const
QString QmlJSEditorFactory::id() const
{
return QLatin1String(C_QMLEDITOR_ID);
return QLatin1String(C_QMLJSEDITOR_ID);
}
QString QmlEditorFactory::displayName() const
QString QmlJSEditorFactory::displayName() const
{
return tr(C_QMLEDITOR_DISPLAY_NAME);
return tr(C_QMLJSEDITOR_DISPLAY_NAME);
}
Core::IFile *QmlEditorFactory::open(const QString &fileName)
Core::IFile *QmlJSEditorFactory::open(const QString &fileName)
{
Core::IEditor *iface = Core::EditorManager::instance()->openEditor(fileName, id());
if (!iface) {
@@ -72,14 +72,14 @@ Core::IFile *QmlEditorFactory::open(const QString &fileName)
return iface->file();
}
Core::IEditor *QmlEditorFactory::createEditor(QWidget *parent)
Core::IEditor *QmlJSEditorFactory::createEditor(QWidget *parent)
{
QmlTextEditor *rc = new QmlTextEditor(parent);
QmlEditorPlugin::instance()->initializeEditor(rc);
QmlJSTextEditor *rc = new QmlJSTextEditor(parent);
QmlJSEditorPlugin::instance()->initializeEditor(rc);
return rc->editableInterface();
}
QStringList QmlEditorFactory::mimeTypes() const
QStringList QmlJSEditorFactory::mimeTypes() const
{
return m_mimeTypes;
}

View File

@@ -27,8 +27,8 @@
**
**************************************************************************/
#ifndef QMLEDITORFACTORY_H
#define QMLEDITORFACTORY_H
#ifndef QMLJSEDITORFACTORY_H
#define QMLJSEDITORFACTORY_H
#include <coreplugin/editormanager/ieditorfactory.h>
@@ -38,18 +38,18 @@ namespace TextEditor {
class TextEditorActionHandler;
}
namespace QmlEditor {
namespace QmlJSEditor {
namespace Internal {
class QmlEditorActionHandler;
class QmlJSEditorActionHandler;
class QmlEditorFactory : public Core::IEditorFactory
class QmlJSEditorFactory : public Core::IEditorFactory
{
Q_OBJECT
public:
QmlEditorFactory(QObject *parent);
~QmlEditorFactory();
QmlJSEditorFactory(QObject *parent);
~QmlJSEditorFactory();
virtual QStringList mimeTypes() const;
// IEditorFactory
@@ -63,6 +63,6 @@ private:
};
} // namespace Internal
} // namespace QmlEditor
} // namespace QmlJSEditor
#endif // QMLEDITORFACTORY_H
#endif // QMLJSEDITORFACTORY_H

View File

@@ -27,12 +27,12 @@
**
**************************************************************************/
#include "qmleditorplugin.h"
#include "qmljseditorplugin.h"
#include "qmlhighlighter.h"
#include "qmleditor.h"
#include "qmleditorconstants.h"
#include "qmleditorfactory.h"
#include "qmljseditor.h"
#include "qmljseditorconstants.h"
#include "qmljseditorfactory.h"
#include "qmlcodecompletion.h"
#include "qmlhoverhandler.h"
#include "qmlmodelmanager.h"
@@ -61,13 +61,13 @@
#include <QtCore/QCoreApplication>
#include <QtGui/QAction>
using namespace QmlEditor;
using namespace QmlEditor::Internal;
using namespace QmlEditor::Constants;
using namespace QmlJSEditor;
using namespace QmlJSEditor::Internal;
using namespace QmlJSEditor::Constants;
QmlEditorPlugin *QmlEditorPlugin::m_instance = 0;
QmlJSEditorPlugin *QmlJSEditorPlugin::m_instance = 0;
QmlEditorPlugin::QmlEditorPlugin() :
QmlJSEditorPlugin::QmlJSEditorPlugin() :
m_modelManager(0),
m_wizard(0),
m_editor(0),
@@ -77,17 +77,17 @@ QmlEditorPlugin::QmlEditorPlugin() :
m_instance = this;
}
QmlEditorPlugin::~QmlEditorPlugin()
QmlJSEditorPlugin::~QmlJSEditorPlugin()
{
removeObject(m_editor);
delete m_actionHandler;
m_instance = 0;
}
bool QmlEditorPlugin::initialize(const QStringList & /*arguments*/, QString *error_message)
bool QmlJSEditorPlugin::initialize(const QStringList & /*arguments*/, QString *error_message)
{
Core::ICore *core = Core::ICore::instance();
if (!core->mimeDatabase()->addMimeTypes(QLatin1String(":/qmleditor/QmlEditor.mimetypes.xml"), error_message))
if (!core->mimeDatabase()->addMimeTypes(QLatin1String(":/qmljseditor/QmlJSEditor.mimetypes.xml"), error_message))
return false;
m_modelManager = new QmlModelManager(this);
@@ -96,9 +96,9 @@ bool QmlEditorPlugin::initialize(const QStringList & /*arguments*/, QString *err
addAutoReleasedObject(typeSystem);
QList<int> context;
context<< core->uniqueIDManager()->uniqueIdentifier(QmlEditor::Constants::C_QMLEDITOR_ID);
context<< core->uniqueIDManager()->uniqueIdentifier(QmlJSEditor::Constants::C_QMLJSEDITOR_ID);
m_editor = new QmlEditorFactory(this);
m_editor = new QmlJSEditorFactory(this);
addObject(m_editor);
Core::BaseFileWizardParameters wizardParameters(Core::IWizard::FileWizard);
@@ -109,14 +109,14 @@ bool QmlEditorPlugin::initialize(const QStringList & /*arguments*/, QString *err
wizardParameters.setId(QLatin1String("Q.Qml"));
addAutoReleasedObject(new QmlFileWizard(wizardParameters, core));
m_actionHandler = new TextEditor::TextEditorActionHandler(QmlEditor::Constants::C_QMLEDITOR_ID,
m_actionHandler = new TextEditor::TextEditorActionHandler(QmlJSEditor::Constants::C_QMLJSEDITOR_ID,
TextEditor::TextEditorActionHandler::Format
| TextEditor::TextEditorActionHandler::UnCommentSelection
| TextEditor::TextEditorActionHandler::UnCollapseAll);
m_actionHandler->initializeActions();
Core::ActionManager *am = core->actionManager();
Core::ActionContainer *contextMenu= am->createMenu(QmlEditor::Constants::M_CONTEXT);
Core::ActionContainer *contextMenu= am->createMenu(QmlJSEditor::Constants::M_CONTEXT);
Core::Command *cmd = am->command(TextEditor::Constants::AUTO_INDENT_SELECTION);
contextMenu->addAction(cmd);
cmd = am->command(TextEditor::Constants::UN_COMMENT_SELECTION);
@@ -141,7 +141,7 @@ bool QmlEditorPlugin::initialize(const QStringList & /*arguments*/, QString *err
return true;
}
void QmlEditorPlugin::extensionsInitialized()
void QmlJSEditorPlugin::extensionsInitialized()
{
//
// Explicitly register qml.qch if located in creator directory.
@@ -166,7 +166,7 @@ void QmlEditorPlugin::extensionsInitialized()
helpManager->registerDocumentation(QStringList(qmlHelpFile));
}
void QmlEditorPlugin::initializeEditor(QmlEditor::Internal::QmlTextEditor *editor)
void QmlJSEditorPlugin::initializeEditor(QmlJSEditor::Internal::QmlJSTextEditor *editor)
{
QTC_ASSERT(m_instance, /**/);
@@ -179,4 +179,4 @@ void QmlEditorPlugin::initializeEditor(QmlEditor::Internal::QmlTextEditor *edito
TextEditor::Internal::CompletionSupport::instance(), SLOT(autoComplete(TextEditor::ITextEditable*, bool)));
}
Q_EXPORT_PLUGIN(QmlEditorPlugin)
Q_EXPORT_PLUGIN(QmlJSEditorPlugin)

View File

@@ -27,8 +27,8 @@
**
**************************************************************************/
#ifndef QMLEDITORPLUGIN_H
#define QMLEDITORPLUGIN_H
#ifndef QMLJSEDITORPLUGIN_H
#define QMLJSEDITORPLUGIN_H
#include <extensionsystem/iplugin.h>
@@ -36,45 +36,45 @@ namespace TextEditor {
class TextEditorActionHandler;
} // namespace TextEditor
namespace QmlEditor {
namespace QmlJSEditor {
class QmlModelManagerInterface;
class QmlFileWizard;
namespace Internal {
class QmlEditorFactory;
class QmlJSEditorFactory;
class QmlCodeCompletion;
class QmlTextEditor;
class QmlJSTextEditor;
class QmlEditorPlugin : public ExtensionSystem::IPlugin
class QmlJSEditorPlugin : public ExtensionSystem::IPlugin
{
Q_OBJECT
public:
QmlEditorPlugin();
virtual ~QmlEditorPlugin();
QmlJSEditorPlugin();
virtual ~QmlJSEditorPlugin();
// IPlugin
bool initialize(const QStringList &arguments, QString *errorMessage = 0);
void extensionsInitialized();
static QmlEditorPlugin *instance()
static QmlJSEditorPlugin *instance()
{ return m_instance; }
void initializeEditor(QmlTextEditor *editor);
void initializeEditor(QmlJSTextEditor *editor);
private:
static QmlEditorPlugin *m_instance;
static QmlJSEditorPlugin *m_instance;
QmlModelManagerInterface *m_modelManager;
QmlFileWizard *m_wizard;
QmlEditorFactory *m_editor;
QmlJSEditorFactory *m_editor;
TextEditor::TextEditorActionHandler *m_actionHandler;
QmlCodeCompletion *m_completion;
};
} // namespace Internal
} // namespace QmlEditor
} // namespace QmlJSEditor
#endif // QMLEDITORPLUGIN_H
#endif // QMLJSEDITORPLUGIN_H

View File

@@ -38,8 +38,8 @@
#include <QDebug>
using namespace Qml;
using namespace QmlEditor;
using namespace QmlEditor::Internal;
using namespace QmlJSEditor;
using namespace QmlJSEditor::Internal;
using namespace QmlJS;
using namespace QmlJS::AST;

View File

@@ -37,7 +37,7 @@
#include <QStack>
namespace QmlEditor {
namespace QmlJSEditor {
namespace Internal {
class QmlLookupContext
@@ -77,6 +77,6 @@ private:
};
} // namespace Internal
} // namespace QmlEditor
} // namespace QmlJSEditor
#endif // QMLLOOKUPCONTEXT_H

View File

@@ -38,13 +38,13 @@
#include <texteditor/itexteditor.h>
#include "qmleditorconstants.h"
#include "qmljseditorconstants.h"
#include "qmlmodelmanager.h"
#include <QtCore/QMetaType>
using namespace QmlEditor;
using namespace QmlEditor::Internal;
using namespace QmlJSEditor;
using namespace QmlJSEditor::Internal;
QmlModelManager::QmlModelManager(QObject *parent):
QmlModelManagerInterface(parent),
@@ -97,7 +97,7 @@ QFuture<void> QmlModelManager::refreshSourceFiles(const QStringList &sourceFiles
if (sourceFiles.count() > 1) {
m_core->progressManager()->addTask(result, tr("Indexing"),
QmlEditor::Constants::TASK_INDEX);
QmlJSEditor::Constants::TASK_INDEX);
}
return result;

View File

@@ -42,7 +42,7 @@ namespace Core {
class ICore;
}
namespace QmlEditor {
namespace QmlJSEditor {
namespace Internal {
class QmlModelManager: public QmlModelManagerInterface
@@ -83,6 +83,6 @@ private:
};
} // namespace Internal
} // namespace QmlEditor
} // namespace QmlJSEditor
#endif // QMLMODELMANAGER_H

View File

@@ -29,7 +29,7 @@
#include "qmlmodelmanagerinterface.h"
using namespace QmlEditor;
using namespace QmlJSEditor;
QmlModelManagerInterface::QmlModelManagerInterface(QObject *parent):
QObject(parent)

View File

@@ -30,24 +30,22 @@
#ifndef QMLMODELMANAGERINTERFACE_H
#define QMLMODELMANAGERINTERFACE_H
#include "qmleditor_global.h"
#include "qmljseditor_global.h"
#include <qmljs/qmldocument.h>
#include <qmljs/qmltypesystem.h>
#include <QObject>
#include <QStringList>
#include <QSharedPointer>
#include <qmljs/qmldocument.h>
#include <qmljs/qmltypesystem.h>
namespace Qml {
class Snapshot;
}
namespace QmlJSEditor {
namespace QmlEditor {
class QMLEDITOR_EXPORT QmlModelManagerInterface: public QObject
class QMLJSEDITOR_EXPORT QmlModelManagerInterface: public QObject
{
Q_OBJECT
@@ -62,6 +60,6 @@ signals:
void documentUpdated(Qml::QmlDocument::Ptr doc);
};
}
} // namespace QmlJSEditor
#endif // QMLMODELMANAGERINTERFACE_H

View File

@@ -33,8 +33,8 @@
#include <qmljs/parser/qmljsengine_p.h>
using namespace Qml;
using namespace QmlEditor;
using namespace QmlEditor::Internal;
using namespace QmlJSEditor;
using namespace QmlJSEditor::Internal;
using namespace QmlJS;
using namespace QmlJS::AST;

View File

@@ -35,7 +35,7 @@
#include <qmljs/parser/qmljsastvisitor_p.h>
#include <qmljs/qmlsymbol.h>
namespace QmlEditor {
namespace QmlJSEditor {
namespace Internal {
class QmlResolveExpression: protected QmlJS::AST::Visitor
@@ -61,6 +61,6 @@ private:
};
} // namespace Internal
} // namespace QmlEditor
} // namespace QmlJSEditor
#endif // QMLRESOLVEEXPRESSION_H

View File

@@ -15,7 +15,7 @@ Alternatively, this plugin may be used under the terms of the GNU Lesser General
<dependencyList>
<dependency name="ProjectExplorer" version="1.3.80"/>
<dependency name="TextEditor" version="1.3.80"/>
<dependency name="QmlEditor" version="1.3.80"/>
<dependency name="QmlJSEditor" version="1.3.80"/>
<dependency name="Help" version="1.3.80"/>
</dependencyList>
</plugin>

View File

@@ -41,7 +41,7 @@
#include <coreplugin/editormanager/ieditor.h>
#include <coreplugin/modemanager.h>
#include <qmleditor/qmlmodelmanagerinterface.h>
#include <qmljseditor/qmlmodelmanagerinterface.h>
#include <utils/synchronousprocess.h>
@@ -71,7 +71,7 @@ using namespace ProjectExplorer;
QmlProject::QmlProject(Manager *manager, const QString &fileName)
: m_manager(manager),
m_fileName(fileName),
m_modelManager(ExtensionSystem::PluginManager::instance()->getObject<QmlEditor::QmlModelManagerInterface>())
m_modelManager(ExtensionSystem::PluginManager::instance()->getObject<QmlJSEditor::QmlModelManagerInterface>())
{
QFileInfo fileInfo(m_fileName);
m_projectName = fileInfo.completeBaseName();

View File

@@ -42,7 +42,7 @@
#include <QtCore/QDir>
namespace QmlEditor {
namespace QmlJSEditor {
class QmlModelManagerInterface;
}
@@ -194,7 +194,7 @@ private:
QString m_filesFileName;
Internal::QmlProjectFile *m_file;
QString m_projectName;
QmlEditor::QmlModelManagerInterface *m_modelManager;
QmlJSEditor::QmlModelManagerInterface *m_modelManager;
QStringList m_files;

View File

@@ -1,3 +1,3 @@
include(../../plugins/projectexplorer/projectexplorer.pri)
include(../../plugins/texteditor/texteditor.pri)
include(../../plugins/qmleditor/qmleditor.pri)
include(../../plugins/qmljseditor/qmljseditor.pri)

View File

@@ -44,7 +44,7 @@
#include <texteditor/texteditoractionhandler.h>
#include <projectexplorer/taskwindow.h>
#include <qmleditor/qmlmodelmanagerinterface.h>
#include <qmljseditor/qmlmodelmanagerinterface.h>
#include <QtCore/QtPlugin>
@@ -98,7 +98,7 @@ void QmlProjectPlugin::extensionsInitialized()
ProjectExplorer::TaskWindow *taskWindow = pluginManager->getObject<ProjectExplorer::TaskWindow>();
m_qmlTaskManager->setTaskWindow(taskWindow);
QmlEditor::QmlModelManagerInterface *modelManager = pluginManager->getObject<QmlEditor::QmlModelManagerInterface>();
QmlJSEditor::QmlModelManagerInterface *modelManager = pluginManager->getObject<QmlJSEditor::QmlModelManagerInterface>();
Q_ASSERT(modelManager);
connect(modelManager, SIGNAL(documentUpdated(Qml::QmlDocument::Ptr)),
m_qmlTaskManager, SLOT(documentUpdated(Qml::QmlDocument::Ptr)));

View File

@@ -1,19 +0,0 @@
<plugin name="QtScriptEditor" version="1.3.80" compatVersion="1.3.80">
<vendor>Nokia Corporation</vendor>
<copyright>(C) 2008-2009 Nokia Corporation</copyright>
<license>
Commercial Usage
Licensees holding valid Qt Commercial licenses may use this plugin 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 plugin may be used under the terms of the GNU Lesser General Public License version 2.1 as published by the Free Software Foundation. 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.
</license>
<description>Editor for QtScript.</description>
<url>http://qt.nokia.com</url>
<dependencyList>
<dependency name="Core" version="1.3.80"/>
<dependency name="TextEditor" version="1.3.80"/>
</dependencyList>
</plugin>

File diff suppressed because it is too large Load Diff

View File

@@ -1,774 +0,0 @@
/**************************************************************************
**
** 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 "javascriptast_p.h"
#include "javascriptastvisitor_p.h"
QT_BEGIN_NAMESPACE
namespace JavaScript { namespace AST {
ExpressionNode *Node::expressionCast()
{
return 0;
}
BinaryExpression *Node::binaryExpressionCast()
{
return 0;
}
Statement *Node::statementCast()
{
return 0;
}
ExpressionNode *ExpressionNode::expressionCast()
{
return this;
}
BinaryExpression *BinaryExpression::binaryExpressionCast()
{
return this;
}
Statement *Statement::statementCast()
{
return this;
}
void ThisExpression::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
}
visitor->endVisit(this);
}
void IdentifierExpression::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
}
visitor->endVisit(this);
}
void NullExpression::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
}
visitor->endVisit(this);
}
void TrueLiteral::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
}
visitor->endVisit(this);
}
void FalseLiteral::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
}
visitor->endVisit(this);
}
void StringLiteral::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
}
visitor->endVisit(this);
}
void NumericLiteral::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
}
visitor->endVisit(this);
}
void RegExpLiteral::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
}
visitor->endVisit(this);
}
void ArrayLiteral::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
acceptChild(elements, visitor);
acceptChild(elision, visitor);
}
visitor->endVisit(this);
}
void ObjectLiteral::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
acceptChild(properties, visitor);
}
visitor->endVisit(this);
}
void ElementList::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
ElementList *it = this;
do {
acceptChild(it->elision, visitor);
acceptChild(it->expression, visitor);
it = it->next;
} while (it);
}
visitor->endVisit(this);
}
void Elision::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
// ###
}
visitor->endVisit(this);
}
void PropertyNameAndValueList::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
PropertyNameAndValueList *it = this;
do {
acceptChild(it->name, visitor);
acceptChild(it->value, visitor);
it = it->next;
} while (it);
}
visitor->endVisit(this);
}
void IdentifierPropertyName::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
}
visitor->endVisit(this);
}
void StringLiteralPropertyName::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
}
visitor->endVisit(this);
}
void NumericLiteralPropertyName::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
}
visitor->endVisit(this);
}
void ArrayMemberExpression::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
acceptChild(base, visitor);
acceptChild(expression, visitor);
}
visitor->endVisit(this);
}
void FieldMemberExpression::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
acceptChild(base, visitor);
}
visitor->endVisit(this);
}
void NewMemberExpression::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
acceptChild(base, visitor);
acceptChild(arguments, visitor);
}
visitor->endVisit(this);
}
void NewExpression::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
acceptChild(expression, visitor);
}
visitor->endVisit(this);
}
void CallExpression::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
acceptChild(base, visitor);
acceptChild(arguments, visitor);
}
visitor->endVisit(this);
}
void ArgumentList::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
ArgumentList *it = this;
do {
acceptChild(it->expression, visitor);
it = it->next;
} while (it);
}
visitor->endVisit(this);
}
void PostIncrementExpression::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
acceptChild(base, visitor);
}
visitor->endVisit(this);
}
void PostDecrementExpression::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
acceptChild(base, visitor);
}
visitor->endVisit(this);
}
void DeleteExpression::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
acceptChild(expression, visitor);
}
visitor->endVisit(this);
}
void VoidExpression::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
acceptChild(expression, visitor);
}
visitor->endVisit(this);
}
void TypeOfExpression::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
acceptChild(expression, visitor);
}
visitor->endVisit(this);
}
void PreIncrementExpression::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
acceptChild(expression, visitor);
}
visitor->endVisit(this);
}
void PreDecrementExpression::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
acceptChild(expression, visitor);
}
visitor->endVisit(this);
}
void UnaryPlusExpression::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
acceptChild(expression, visitor);
}
visitor->endVisit(this);
}
void UnaryMinusExpression::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
acceptChild(expression, visitor);
}
visitor->endVisit(this);
}
void TildeExpression::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
acceptChild(expression, visitor);
}
visitor->endVisit(this);
}
void NotExpression::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
acceptChild(expression, visitor);
}
visitor->endVisit(this);
}
void BinaryExpression::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
acceptChild(left, visitor);
acceptChild(right, visitor);
}
visitor->endVisit(this);
}
void ConditionalExpression::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
acceptChild(expression, visitor);
acceptChild(ok, visitor);
acceptChild(ko, visitor);
}
visitor->endVisit(this);
}
void Expression::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
acceptChild(left, visitor);
acceptChild(right, visitor);
}
visitor->endVisit(this);
}
void Block::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
acceptChild(statements, visitor);
}
visitor->endVisit(this);
}
void StatementList::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
StatementList *it = this;
do {
acceptChild(it->statement, visitor);
it = it->next;
} while (it);
}
visitor->endVisit(this);
}
void VariableStatement::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
acceptChild(declarations, visitor);
}
visitor->endVisit(this);
}
void VariableDeclarationList::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
VariableDeclarationList *it = this;
do {
acceptChild(it->declaration, visitor);
it = it->next;
} while (it);
}
visitor->endVisit(this);
}
void VariableDeclaration::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
acceptChild(expression, visitor);
}
visitor->endVisit(this);
}
void EmptyStatement::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
}
visitor->endVisit(this);
}
void ExpressionStatement::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
acceptChild(expression, visitor);
}
visitor->endVisit(this);
}
void IfStatement::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
acceptChild(expression, visitor);
acceptChild(ok, visitor);
acceptChild(ko, visitor);
}
visitor->endVisit(this);
}
void DoWhileStatement::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
acceptChild(statement, visitor);
acceptChild(expression, visitor);
}
visitor->endVisit(this);
}
void WhileStatement::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
acceptChild(expression, visitor);
acceptChild(statement, visitor);
}
visitor->endVisit(this);
}
void ForStatement::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
acceptChild(initialiser, visitor);
acceptChild(condition, visitor);
acceptChild(expression, visitor);
acceptChild(statement, visitor);
}
visitor->endVisit(this);
}
void LocalForStatement::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
acceptChild(declarations, visitor);
acceptChild(condition, visitor);
acceptChild(expression, visitor);
acceptChild(statement, visitor);
}
visitor->endVisit(this);
}
void ForEachStatement::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
acceptChild(initialiser, visitor);
acceptChild(expression, visitor);
acceptChild(statement, visitor);
}
visitor->endVisit(this);
}
void LocalForEachStatement::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
acceptChild(declaration, visitor);
acceptChild(expression, visitor);
acceptChild(statement, visitor);
}
visitor->endVisit(this);
}
void ContinueStatement::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
}
visitor->endVisit(this);
}
void BreakStatement::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
}
visitor->endVisit(this);
}
void ReturnStatement::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
acceptChild(expression, visitor);
}
visitor->endVisit(this);
}
void WithStatement::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
acceptChild(expression, visitor);
acceptChild(statement, visitor);
}
visitor->endVisit(this);
}
void SwitchStatement::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
acceptChild(expression, visitor);
acceptChild(block, visitor);
}
visitor->endVisit(this);
}
void CaseBlock::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
acceptChild(clauses, visitor);
acceptChild(defaultClause, visitor);
acceptChild(moreClauses, visitor);
}
visitor->endVisit(this);
}
void CaseClauses::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
CaseClauses *it = this;
do {
acceptChild(it->clause, visitor);
it = it->next;
} while (it);
}
visitor->endVisit(this);
}
void CaseClause::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
acceptChild(expression, visitor);
acceptChild(statements, visitor);
}
visitor->endVisit(this);
}
void DefaultClause::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
acceptChild(statements, visitor);
}
visitor->endVisit(this);
}
void LabelledStatement::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
acceptChild(statement, visitor);
}
visitor->endVisit(this);
}
void ThrowStatement::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
acceptChild(expression, visitor);
}
visitor->endVisit(this);
}
void TryStatement::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
acceptChild(statement, visitor);
acceptChild(catchExpression, visitor);
acceptChild(finallyExpression, visitor);
}
visitor->endVisit(this);
}
void Catch::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
acceptChild(statement, visitor);
}
visitor->endVisit(this);
}
void Finally::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
acceptChild(statement, visitor);
}
visitor->endVisit(this);
}
void FunctionDeclaration::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
acceptChild(formals, visitor);
acceptChild(body, visitor);
}
visitor->endVisit(this);
}
void FunctionExpression::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
acceptChild(formals, visitor);
acceptChild(body, visitor);
}
visitor->endVisit(this);
}
void FormalParameterList::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
// ###
}
visitor->endVisit(this);
}
void FunctionBody::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
acceptChild(elements, visitor);
}
visitor->endVisit(this);
}
void Program::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
acceptChild(elements, visitor);
}
visitor->endVisit(this);
}
void SourceElements::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
SourceElements *it = this;
do {
acceptChild(it->element, visitor);
it = it->next;
} while (it);
}
visitor->endVisit(this);
}
void FunctionSourceElement::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
acceptChild(declaration, visitor);
}
visitor->endVisit(this);
}
void StatementSourceElement::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
acceptChild(statement, visitor);
}
visitor->endVisit(this);
}
void DebuggerStatement::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
}
visitor->endVisit(this);
}
} } // namespace JavaScript::AST
QT_END_NAMESPACE

File diff suppressed because it is too large Load Diff

View File

@@ -1,134 +0,0 @@
/**************************************************************************
**
** 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.
**
**************************************************************************/
//
// W A R N I N G
// -------------
//
// This file is not part of the Qt API. It exists purely as an
// implementation detail. This header file may change from version to
// version without notice, or even be removed.
//
// We mean it.
//
#ifndef JAVASCRIPTAST_FWD_P_H
#define JAVASCRIPTAST_FWD_P_H
#include <QtCore/qglobal.h>
QT_BEGIN_NAMESPACE
namespace JavaScript { namespace AST {
class Visitor;
class Node;
class ExpressionNode;
class Statement;
class ThisExpression;
class IdentifierExpression;
class NullExpression;
class TrueLiteral;
class FalseLiteral;
class NumericLiteral;
class StringLiteral;
class RegExpLiteral;
class ArrayLiteral;
class ObjectLiteral;
class ElementList;
class Elision;
class PropertyNameAndValueList;
class PropertyName;
class IdentifierPropertyName;
class StringLiteralPropertyName;
class NumericLiteralPropertyName;
class ArrayMemberExpression;
class FieldMemberExpression;
class NewMemberExpression;
class NewExpression;
class CallExpression;
class ArgumentList;
class PostIncrementExpression;
class PostDecrementExpression;
class DeleteExpression;
class VoidExpression;
class TypeOfExpression;
class PreIncrementExpression;
class PreDecrementExpression;
class UnaryPlusExpression;
class UnaryMinusExpression;
class TildeExpression;
class NotExpression;
class BinaryExpression;
class ConditionalExpression;
class Expression; // ### rename
class Block;
class StatementList;
class VariableStatement;
class VariableDeclarationList;
class VariableDeclaration;
class EmptyStatement;
class ExpressionStatement;
class IfStatement;
class DoWhileStatement;
class WhileStatement;
class ForStatement;
class LocalForStatement;
class ForEachStatement;
class LocalForEachStatement;
class ContinueStatement;
class BreakStatement;
class ReturnStatement;
class WithStatement;
class SwitchStatement;
class CaseBlock;
class CaseClauses;
class CaseClause;
class DefaultClause;
class LabelledStatement;
class ThrowStatement;
class TryStatement;
class Catch;
class Finally;
class FunctionDeclaration;
class FunctionExpression;
class FormalParameterList;
class FunctionBody;
class Program;
class SourceElements;
class SourceElement;
class FunctionSourceElement;
class StatementSourceElement;
class DebuggerStatement;
} } // namespace AST
QT_END_NAMESPACE
#endif

View File

@@ -1,46 +0,0 @@
/**************************************************************************
**
** 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 "javascriptastvisitor_p.h"
QT_BEGIN_NAMESPACE
namespace JavaScript { namespace AST {
Visitor::Visitor()
{
}
Visitor::~Visitor()
{
}
} } // namespace JavaScript::AST
QT_END_NAMESPACE

View File

@@ -1,294 +0,0 @@
/**************************************************************************
**
** 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.
**
**************************************************************************/
//
// W A R N I N G
// -------------
//
// This file is not part of the Qt API. It exists purely as an
// implementation detail. This header file may change from version to
// version without notice, or even be removed.
//
// We mean it.
//
#ifndef JAVASCRIPTASTVISITOR_P_H
#define JAVASCRIPTASTVISITOR_P_H
//
// W A R N I N G
// -------------
//
// This file is not part of the Qt API. It exists purely as an
// implementation detail. This header file may change from version to
// version without notice, or even be removed.
//
// We mean it.
//
#include "javascriptastfwd_p.h"
QT_BEGIN_NAMESPACE
namespace JavaScript { namespace AST {
class Visitor
{
public:
Visitor();
virtual ~Visitor();
virtual bool preVisit(Node *) { return true; }
virtual void postVisit(Node *) {}
virtual bool visit(ThisExpression *) { return true; }
virtual void endVisit(ThisExpression *) {}
virtual bool visit(IdentifierExpression *) { return true; }
virtual void endVisit(IdentifierExpression *) {}
virtual bool visit(NullExpression *) { return true; }
virtual void endVisit(NullExpression *) {}
virtual bool visit(TrueLiteral *) { return true; }
virtual void endVisit(TrueLiteral *) {}
virtual bool visit(FalseLiteral *) { return true; }
virtual void endVisit(FalseLiteral *) {}
virtual bool visit(StringLiteral *) { return true; }
virtual void endVisit(StringLiteral *) {}
virtual bool visit(NumericLiteral *) { return true; }
virtual void endVisit(NumericLiteral *) {}
virtual bool visit(RegExpLiteral *) { return true; }
virtual void endVisit(RegExpLiteral *) {}
virtual bool visit(ArrayLiteral *) { return true; }
virtual void endVisit(ArrayLiteral *) {}
virtual bool visit(ObjectLiteral *) { return true; }
virtual void endVisit(ObjectLiteral *) {}
virtual bool visit(ElementList *) { return true; }
virtual void endVisit(ElementList *) {}
virtual bool visit(Elision *) { return true; }
virtual void endVisit(Elision *) {}
virtual bool visit(PropertyNameAndValueList *) { return true; }
virtual void endVisit(PropertyNameAndValueList *) {}
virtual bool visit(IdentifierPropertyName *) { return true; }
virtual void endVisit(IdentifierPropertyName *) {}
virtual bool visit(StringLiteralPropertyName *) { return true; }
virtual void endVisit(StringLiteralPropertyName *) {}
virtual bool visit(NumericLiteralPropertyName *) { return true; }
virtual void endVisit(NumericLiteralPropertyName *) {}
virtual bool visit(ArrayMemberExpression *) { return true; }
virtual void endVisit(ArrayMemberExpression *) {}
virtual bool visit(FieldMemberExpression *) { return true; }
virtual void endVisit(FieldMemberExpression *) {}
virtual bool visit(NewMemberExpression *) { return true; }
virtual void endVisit(NewMemberExpression *) {}
virtual bool visit(NewExpression *) { return true; }
virtual void endVisit(NewExpression *) {}
virtual bool visit(CallExpression *) { return true; }
virtual void endVisit(CallExpression *) {}
virtual bool visit(ArgumentList *) { return true; }
virtual void endVisit(ArgumentList *) {}
virtual bool visit(PostIncrementExpression *) { return true; }
virtual void endVisit(PostIncrementExpression *) {}
virtual bool visit(PostDecrementExpression *) { return true; }
virtual void endVisit(PostDecrementExpression *) {}
virtual bool visit(DeleteExpression *) { return true; }
virtual void endVisit(DeleteExpression *) {}
virtual bool visit(VoidExpression *) { return true; }
virtual void endVisit(VoidExpression *) {}
virtual bool visit(TypeOfExpression *) { return true; }
virtual void endVisit(TypeOfExpression *) {}
virtual bool visit(PreIncrementExpression *) { return true; }
virtual void endVisit(PreIncrementExpression *) {}
virtual bool visit(PreDecrementExpression *) { return true; }
virtual void endVisit(PreDecrementExpression *) {}
virtual bool visit(UnaryPlusExpression *) { return true; }
virtual void endVisit(UnaryPlusExpression *) {}
virtual bool visit(UnaryMinusExpression *) { return true; }
virtual void endVisit(UnaryMinusExpression *) {}
virtual bool visit(TildeExpression *) { return true; }
virtual void endVisit(TildeExpression *) {}
virtual bool visit(NotExpression *) { return true; }
virtual void endVisit(NotExpression *) {}
virtual bool visit(BinaryExpression *) { return true; }
virtual void endVisit(BinaryExpression *) {}
virtual bool visit(ConditionalExpression *) { return true; }
virtual void endVisit(ConditionalExpression *) {}
virtual bool visit(Expression *) { return true; }
virtual void endVisit(Expression *) {}
virtual bool visit(Block *) { return true; }
virtual void endVisit(Block *) {}
virtual bool visit(StatementList *) { return true; }
virtual void endVisit(StatementList *) {}
virtual bool visit(VariableStatement *) { return true; }
virtual void endVisit(VariableStatement *) {}
virtual bool visit(VariableDeclarationList *) { return true; }
virtual void endVisit(VariableDeclarationList *) {}
virtual bool visit(VariableDeclaration *) { return true; }
virtual void endVisit(VariableDeclaration *) {}
virtual bool visit(EmptyStatement *) { return true; }
virtual void endVisit(EmptyStatement *) {}
virtual bool visit(ExpressionStatement *) { return true; }
virtual void endVisit(ExpressionStatement *) {}
virtual bool visit(IfStatement *) { return true; }
virtual void endVisit(IfStatement *) {}
virtual bool visit(DoWhileStatement *) { return true; }
virtual void endVisit(DoWhileStatement *) {}
virtual bool visit(WhileStatement *) { return true; }
virtual void endVisit(WhileStatement *) {}
virtual bool visit(ForStatement *) { return true; }
virtual void endVisit(ForStatement *) {}
virtual bool visit(LocalForStatement *) { return true; }
virtual void endVisit(LocalForStatement *) {}
virtual bool visit(ForEachStatement *) { return true; }
virtual void endVisit(ForEachStatement *) {}
virtual bool visit(LocalForEachStatement *) { return true; }
virtual void endVisit(LocalForEachStatement *) {}
virtual bool visit(ContinueStatement *) { return true; }
virtual void endVisit(ContinueStatement *) {}
virtual bool visit(BreakStatement *) { return true; }
virtual void endVisit(BreakStatement *) {}
virtual bool visit(ReturnStatement *) { return true; }
virtual void endVisit(ReturnStatement *) {}
virtual bool visit(WithStatement *) { return true; }
virtual void endVisit(WithStatement *) {}
virtual bool visit(SwitchStatement *) { return true; }
virtual void endVisit(SwitchStatement *) {}
virtual bool visit(CaseBlock *) { return true; }
virtual void endVisit(CaseBlock *) {}
virtual bool visit(CaseClauses *) { return true; }
virtual void endVisit(CaseClauses *) {}
virtual bool visit(CaseClause *) { return true; }
virtual void endVisit(CaseClause *) {}
virtual bool visit(DefaultClause *) { return true; }
virtual void endVisit(DefaultClause *) {}
virtual bool visit(LabelledStatement *) { return true; }
virtual void endVisit(LabelledStatement *) {}
virtual bool visit(ThrowStatement *) { return true; }
virtual void endVisit(ThrowStatement *) {}
virtual bool visit(TryStatement *) { return true; }
virtual void endVisit(TryStatement *) {}
virtual bool visit(Catch *) { return true; }
virtual void endVisit(Catch *) {}
virtual bool visit(Finally *) { return true; }
virtual void endVisit(Finally *) {}
virtual bool visit(FunctionDeclaration *) { return true; }
virtual void endVisit(FunctionDeclaration *) {}
virtual bool visit(FunctionExpression *) { return true; }
virtual void endVisit(FunctionExpression *) {}
virtual bool visit(FormalParameterList *) { return true; }
virtual void endVisit(FormalParameterList *) {}
virtual bool visit(FunctionBody *) { return true; }
virtual void endVisit(FunctionBody *) {}
virtual bool visit(Program *) { return true; }
virtual void endVisit(Program *) {}
virtual bool visit(SourceElements *) { return true; }
virtual void endVisit(SourceElements *) {}
virtual bool visit(FunctionSourceElement *) { return true; }
virtual void endVisit(FunctionSourceElement *) {}
virtual bool visit(StatementSourceElement *) { return true; }
virtual void endVisit(StatementSourceElement *) {}
virtual bool visit(DebuggerStatement *) { return true; }
virtual void endVisit(DebuggerStatement *) {}
};
} } // namespace AST
QT_END_NAMESPACE
#endif // JAVASCRIPTASTVISITOR_P_H

View File

@@ -1,143 +0,0 @@
/**************************************************************************
**
** 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 "javascriptengine_p.h"
#include "javascriptnodepool_p.h"
#include "javascriptvalue.h"
#include <qnumeric.h>
#include <QHash>
QT_BEGIN_NAMESPACE
namespace JavaScript {
int Ecma::RegExp::flagFromChar(const QChar &ch)
{
static QHash<QChar, int> flagsHash;
if (flagsHash.isEmpty()) {
flagsHash[QLatin1Char('g')] = Global;
flagsHash[QLatin1Char('i')] = IgnoreCase;
flagsHash[QLatin1Char('m')] = Multiline;
}
QHash<QChar, int>::const_iterator it;
it = flagsHash.constFind(ch);
if (it == flagsHash.constEnd())
return 0;
return it.value();
}
NodePool::NodePool(const QString &fileName, JavaScriptEnginePrivate *engine)
: m_fileName(fileName), m_engine(engine)
{
}
NodePool::~NodePool()
{
}
Code *NodePool::createCompiledCode(AST::Node *, CompilationUnit &)
{
Q_ASSERT(0);
return 0;
}
static int toDigit(char c)
{
if ((c >= '0') && (c <= '9'))
return c - '0';
else if ((c >= 'a') && (c <= 'z'))
return 10 + c - 'a';
else if ((c >= 'A') && (c <= 'Z'))
return 10 + c - 'A';
return -1;
}
qjsreal integerFromString(const char *buf, int size, int radix)
{
if (size == 0)
return qSNaN();
qjsreal sign = 1.0;
int i = 0;
if (buf[0] == '+') {
++i;
} else if (buf[0] == '-') {
sign = -1.0;
++i;
}
if (((size-i) >= 2) && (buf[i] == '0')) {
if (((buf[i+1] == 'x') || (buf[i+1] == 'X'))
&& (radix < 34)) {
if ((radix != 0) && (radix != 16))
return 0;
radix = 16;
i += 2;
} else {
if (radix == 0) {
radix = 8;
++i;
}
}
} else if (radix == 0) {
radix = 10;
}
int j = i;
for ( ; i < size; ++i) {
int d = toDigit(buf[i]);
if ((d == -1) || (d >= radix))
break;
}
qjsreal result;
if (j == i) {
if (!qstrcmp(buf, "Infinity"))
result = qInf();
else
result = qSNaN();
} else {
result = 0;
qjsreal multiplier = 1;
for (--i ; i >= j; --i, multiplier *= radix)
result += toDigit(buf[i]) * multiplier;
}
result *= sign;
return result;
}
qjsreal integerFromString(const QString &str, int radix)
{
QByteArray ba = str.trimmed().toUtf8();
return integerFromString(ba.constData(), ba.size(), radix);
}
} // end of namespace JavaScript
QT_END_NAMESPACE

View File

@@ -1,156 +0,0 @@
/**************************************************************************
**
** 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.
**
**************************************************************************/
//
// W A R N I N G
// -------------
//
// This file is not part of the Qt API. It exists purely as an
// implementation detail. This header file may change from version to
// version without notice, or even be removed.
//
// We mean it.
//
//
// This file is automatically generated from javascript.g.
// Changes will be lost.
//
#ifndef JAVASCRIPTENGINE_P_H
#define JAVASCRIPTENGINE_P_H
#include "javascriptvalue.h"
#include <QString>
#include <QSet>
QT_BEGIN_NAMESPACE
namespace JavaScript {
class Node;
class Lexer;
class NodePool;
namespace AST {
class Node;
} // end of namespace AST
namespace Ecma {
class RegExp
{
public:
enum RegExpFlag {
Global = 0x01,
IgnoreCase = 0x02,
Multiline = 0x04
};
public:
static int flagFromChar(const QChar &);
};
} // end of namespace Ecma
} // end of namespace JavaScript
class JavaScriptNameIdImpl
{
QString _text;
public:
JavaScriptNameIdImpl(const QChar *u, int s)
: _text(u, s)
{ }
const QString asString() const
{ return _text; }
bool operator == (const JavaScriptNameIdImpl &other) const
{ return _text == other._text; }
bool operator != (const JavaScriptNameIdImpl &other) const
{ return _text != other._text; }
bool operator < (const JavaScriptNameIdImpl &other) const
{ return _text < other._text; }
};
inline uint qHash(const JavaScriptNameIdImpl &id)
{ return qHash(id.asString()); }
class JavaScriptEnginePrivate
{
JavaScript::Lexer *_lexer;
JavaScript::NodePool *_nodePool;
JavaScript::AST::Node *_ast;
QSet<JavaScriptNameIdImpl> _literals;
public:
JavaScriptEnginePrivate()
: _lexer(0), _nodePool(0), _ast(0)
{ }
QSet<JavaScriptNameIdImpl> literals() const
{ return _literals; }
JavaScriptNameIdImpl *intern(const QChar *u, int s)
{ return const_cast<JavaScriptNameIdImpl *>(&*_literals.insert(JavaScriptNameIdImpl(u, s))); }
JavaScript::Lexer *lexer() const
{ return _lexer; }
void setLexer(JavaScript::Lexer *lexer)
{ _lexer = lexer; }
JavaScript::NodePool *nodePool() const
{ return _nodePool; }
void setNodePool(JavaScript::NodePool *nodePool)
{ _nodePool = nodePool; }
JavaScript::AST::Node *ast() const
{ return _ast; }
JavaScript::AST::Node *changeAbstractSyntaxTree(JavaScript::AST::Node *node)
{
JavaScript::AST::Node *previousAST = _ast;
_ast = node;
return previousAST;
}
};
QT_END_NAMESPACE
#endif // JAVASCRIPTENGINE_P_H

View File

@@ -1,640 +0,0 @@
// This file was generated by qlalr - DO NOT EDIT!
/**************************************************************************
**
** 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 "javascriptgrammar_p.h"
const char *const JavaScriptGrammar::spell [] = {
"end of file", "&", "&&", "&=", "break", "case", "catch", ":", ";", "continue",
"default", "delete", "/", "/=", "do", ".", "else", "=", "==", "===",
"finally", "for", "function", ">=", ">", ">>", ">>=", ">>>", ">>>=", "identifier",
"if", "in", "instanceof", "{", "[", "<=", "(", "<", "<<", "<<=",
"-", "-=", "--", "new", "!", "!=", "!==", "numeric literal", "|", "|=",
"||", "+", "+=", "++", "?", "}", "]", "%", "%=", "return",
")", ";", 0, "*", "*=", "string literal", "switch", "this", "throw", "~",
"try", "typeof", "var", "void", "while", "with", "^", "^=", "null", "true",
"false", "const", "debugger", "reserved word"};
const short JavaScriptGrammar::lhs [] = {
85, 85, 85, 85, 85, 85, 85, 85, 85, 85,
85, 85, 85, 85, 85, 87, 87, 92, 92, 86,
86, 89, 89, 93, 93, 93, 93, 94, 94, 94,
94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
94, 94, 94, 94, 94, 94, 94, 94, 95, 95,
96, 96, 96, 96, 96, 99, 99, 100, 100, 100,
100, 98, 98, 101, 101, 102, 102, 103, 103, 103,
104, 104, 104, 104, 104, 104, 104, 104, 104, 104,
105, 105, 105, 105, 106, 106, 106, 107, 107, 107,
107, 108, 108, 108, 108, 108, 108, 108, 109, 109,
109, 109, 109, 109, 110, 110, 110, 110, 110, 111,
111, 111, 111, 111, 112, 112, 113, 113, 114, 114,
115, 115, 116, 116, 117, 117, 118, 118, 119, 119,
120, 120, 121, 121, 122, 122, 123, 123, 91, 91,
124, 124, 125, 125, 125, 125, 125, 125, 125, 125,
125, 125, 125, 125, 90, 90, 126, 126, 127, 127,
128, 128, 129, 129, 129, 129, 129, 129, 129, 129,
129, 129, 129, 129, 129, 129, 129, 130, 146, 146,
145, 145, 131, 131, 147, 147, 148, 148, 150, 150,
149, 151, 154, 152, 152, 155, 153, 153, 132, 133,
133, 134, 134, 135, 135, 135, 135, 135, 135, 135,
136, 136, 136, 136, 137, 137, 137, 137, 138, 138,
139, 141, 156, 156, 159, 159, 157, 157, 160, 158,
140, 142, 142, 143, 143, 143, 161, 162, 144, 144,
163, 97, 167, 167, 164, 164, 165, 165, 168, 84,
169, 169, 170, 170, 166, 166, 88, 88, 171};
const short JavaScriptGrammar::rhs [] = {
1, 1, 1, 1, 1, 1, 1, 1, 1, 3,
3, 5, 3, 4, 3, 2, 4, 1, 2, 0,
1, 3, 5, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 4, 3, 3, 1, 2, 2, 2, 4,
3, 2, 3, 1, 3, 1, 1, 1, 2, 2,
1, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1, 3, 3, 3, 1, 3, 3, 1, 3, 3,
3, 1, 3, 3, 3, 3, 3, 3, 1, 3,
3, 3, 3, 3, 1, 3, 3, 3, 3, 1,
3, 3, 3, 3, 1, 3, 1, 3, 1, 3,
1, 3, 1, 3, 1, 3, 1, 3, 1, 3,
1, 3, 1, 3, 1, 5, 1, 5, 1, 3,
1, 3, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 3, 0, 1, 1, 3,
0, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 3, 1, 2,
0, 1, 3, 3, 1, 1, 1, 3, 1, 3,
2, 2, 2, 0, 1, 2, 0, 1, 1, 2,
2, 7, 5, 7, 7, 5, 9, 10, 7, 8,
2, 2, 3, 3, 2, 2, 3, 3, 3, 3,
5, 5, 3, 5, 1, 2, 0, 1, 4, 3,
3, 3, 3, 3, 3, 4, 5, 2, 2, 2,
8, 8, 1, 3, 0, 1, 0, 1, 1, 1,
1, 2, 1, 1, 0, 1, 0, 1, 2};
const short JavaScriptGrammar::action_default [] = {
0, 98, 165, 129, 137, 133, 173, 180, 77, 149,
179, 187, 175, 125, 0, 176, 264, 62, 177, 178,
183, 78, 141, 145, 66, 95, 76, 81, 61, 0,
115, 181, 102, 261, 260, 263, 184, 0, 195, 0,
0, 0, 8, 9, 0, 5, 0, 265, 2, 0,
267, 20, 0, 0, 0, 0, 0, 3, 6, 0,
0, 167, 209, 7, 0, 1, 0, 0, 4, 0,
0, 196, 0, 0, 0, 185, 186, 91, 0, 174,
182, 0, 0, 78, 97, 265, 2, 267, 80, 79,
0, 0, 0, 93, 94, 92, 0, 266, 255, 256,
0, 253, 0, 254, 0, 257, 258, 0, 259, 252,
262, 0, 268, 0, 27, 28, 29, 30, 55, 31,
56, 32, 33, 34, 35, 36, 37, 38, 39, 24,
40, 41, 42, 43, 44, 26, 57, 45, 25, 46,
47, 48, 49, 50, 51, 52, 53, 54, 58, 0,
22, 0, 0, 14, 0, 23, 13, 96, 0, 126,
0, 0, 0, 0, 116, 0, 0, 0, 0, 0,
0, 106, 0, 0, 0, 100, 101, 99, 104, 108,
107, 105, 103, 118, 117, 119, 0, 134, 0, 130,
69, 0, 0, 0, 71, 60, 59, 0, 0, 70,
166, 0, 74, 72, 0, 73, 75, 210, 211, 0,
162, 155, 153, 160, 161, 159, 158, 164, 157, 156,
154, 163, 150, 0, 138, 0, 0, 142, 0, 0,
146, 68, 0, 0, 64, 0, 63, 269, 225, 0,
226, 227, 228, 221, 0, 222, 223, 224, 249, 250,
82, 0, 0, 0, 0, 0, 214, 215, 171, 169,
131, 139, 135, 151, 127, 172, 0, 78, 143, 147,
120, 109, 0, 0, 128, 0, 0, 0, 0, 121,
0, 0, 0, 0, 0, 113, 111, 114, 112, 110,
123, 122, 124, 0, 136, 0, 132, 0, 170, 78,
0, 152, 167, 168, 0, 167, 0, 0, 217, 0,
0, 0, 219, 0, 140, 0, 0, 144, 0, 0,
148, 207, 0, 199, 208, 202, 0, 206, 0, 167,
200, 0, 167, 0, 0, 218, 0, 0, 0, 220,
266, 255, 0, 0, 257, 0, 251, 0, 241, 0,
0, 0, 213, 0, 212, 189, 192, 0, 28, 55,
31, 56, 33, 34, 5, 38, 39, 2, 40, 43,
3, 6, 167, 7, 46, 1, 48, 4, 50, 51,
52, 53, 54, 58, 190, 188, 66, 67, 65, 0,
229, 230, 0, 0, 0, 232, 237, 235, 238, 0,
0, 236, 237, 0, 233, 0, 234, 191, 240, 0,
191, 239, 0, 242, 243, 0, 191, 244, 245, 0,
0, 246, 0, 0, 0, 247, 248, 84, 83, 0,
0, 0, 216, 0, 0, 0, 231, 0, 21, 0,
18, 20, 11, 0, 17, 12, 19, 16, 10, 0,
15, 88, 86, 90, 87, 85, 89, 204, 197, 0,
205, 201, 0, 203, 193, 0, 194, 198};
const short JavaScriptGrammar::goto_default [] = {
29, 28, 439, 437, 113, 112, 14, 2, 438, 111,
114, 194, 24, 17, 190, 26, 8, 201, 21, 27,
77, 25, 1, 32, 30, 270, 13, 264, 3, 260,
5, 262, 4, 261, 22, 268, 23, 269, 9, 263,
259, 300, 389, 265, 266, 35, 6, 79, 12, 15,
18, 19, 10, 7, 31, 80, 20, 36, 75, 76,
11, 357, 356, 78, 459, 458, 322, 323, 461, 325,
460, 324, 395, 399, 402, 398, 397, 417, 418, 16,
100, 107, 96, 99, 106, 108, 33, 0};
const short JavaScriptGrammar::action_index [] = {
1318, 79, -84, 56, 39, -17, -84, -84, 169, -84,
-84, -84, -84, 216, 149, -84, -84, -84, -84, -84,
-84, 475, 68, 100, 180, 184, -84, -84, -84, 99,
303, -84, 193, -84, 1318, -84, -84, 160, -84, 194,
85, 629, -84, -84, 1398, -84, -5, 32, 42, 26,
1478, 37, 629, 629, 629, 366, 629, -84, -84, 629,
629, 629, -84, -84, 55, -84, 629, 629, -84, 61,
629, -84, 629, 52, 38, -84, -84, -84, 49, -84,
-84, 629, 629, 64, 182, 48, -84, 1158, -84, -84,
629, 629, 629, -84, -84, -84, 36, -84, 44, 50,
40, -84, 57, -84, -26, 1318, -84, -53, 1318, -84,
-84, 18, 7, 43, -84, -84, -84, -84, -84, -84,
-84, -84, -84, -84, -84, -84, -84, -84, -84, -84,
-84, -84, -84, -84, -84, -84, -84, -84, -84, -84,
-84, -84, -84, -84, -84, -84, -84, -84, -84, 629,
-84, 1238, 23, -84, 629, -84, -84, 189, 629, 214,
629, 629, 629, 629, 293, 629, 629, 629, 629, 629,
629, 143, 629, 629, 629, 65, 83, 69, 153, 152,
144, 161, 175, 273, 283, 318, 629, 62, 629, 74,
-84, 1078, 629, 702, -84, -84, -84, 84, 629, -84,
-84, 88, -84, -84, 629, -84, -84, -84, -84, 629,
-84, -84, -84, -84, -84, -84, -84, -84, -84, -84,
-84, -84, -84, 629, 45, 629, 629, 63, 53, 629,
-84, -84, 1078, 629, -84, 102, -84, -84, -84, 90,
-84, -84, -84, -84, 101, -84, -84, -84, -84, -84,
-84, 51, 59, 629, 89, 94, -84, -84, 775, -84,
13, -36, -65, -84, 230, 2, -52, 556, 14, 133,
248, 147, -12, 629, 224, 629, 629, 629, 629, 258,
629, 629, 629, 629, 629, 199, 261, 261, 261, 181,
242, 322, 322, 629, -55, 629, 5, 629, -84, 334,
629, -84, 629, 15, -61, 629, -59, 1398, -84, 629,
73, 1398, -84, 629, 20, 629, 629, 24, 41, 629,
-84, 54, 82, 19, -84, -84, 629, -84, 17, 629,
-84, -10, 629, -7, 1398, -84, 629, 77, 1398, -84,
31, 27, -13, 10, 1318, -22, -84, 1398, -84, 629,
76, 1398, 11, 1398, -84, -84, 1398, -15, 136, 9,
131, 80, 629, 1398, 28, 6, 78, 47, 8, 394,
34, 30, 925, 29, 3, 21, 629, 25, 1, 629,
35, 629, 33, 16, -84, -84, 202, -84, -84, 67,
-84, -84, 629, 72, -4, -84, -2, -84, -1, 66,
629, -84, 0, 12, -84, -37, -84, 1398, -84, 95,
1398, -84, 105, -84, -84, 98, 1398, 4, -84, -14,
-25, -84, -16, -40, 22, -84, -84, -84, -84, 629,
93, 1398, -84, 629, 104, 1398, -84, 103, 71, 848,
-84, 58, -84, 998, -84, -84, -84, -84, -84, 75,
-84, -84, -84, -84, -84, -84, -84, 46, -84, 114,
-84, -84, 629, -84, -84, 60, -84, -84,
-50, -88, -88, -88, -88, -88, -88, -88, -88, -88,
-88, -88, -88, -88, -88, -88, -88, -88, -88, -88,
-88, -28, -88, -88, -10, -88, -88, -88, -88, -88,
-88, -88, -88, -88, -64, -88, -88, -88, -88, -88,
-88, 131, -88, -88, -22, -88, -88, -88, -88, -88,
-27, -88, 13, 94, 88, 98, 89, -88, -88, 106,
107, -4, -88, -88, -88, -88, 68, 111, -88, -31,
85, -88, 110, -88, -88, -88, -88, -88, -88, -88,
-88, 127, 122, -88, -88, -88, -88, -88, -88, -88,
97, 100, 101, -88, -88, -88, -88, -88, -88, -88,
-88, -88, -88, -88, -88, -88, -88, -88, -48, -88,
-88, -88, -88, -88, -88, -88, -88, -88, -88, -88,
-88, -88, -88, -88, -88, -88, -88, -88, -88, -88,
-88, -88, -88, -88, -88, -88, -88, -88, -88, -88,
-88, -88, -88, -88, -88, -88, -88, -88, -88, 32,
-88, 33, -88, -88, 34, -88, -88, -88, 46, -88,
60, 74, 76, 77, -88, 73, 67, 70, 81, 58,
79, -88, 37, 51, 65, -88, -88, -88, -88, -88,
-88, -88, -88, -88, -88, -88, 59, -88, 43, -88,
-88, 42, 48, 20, -88, -88, -88, -88, 41, -88,
-88, -88, -88, -88, 40, -88, -88, -88, -88, 49,
-88, -88, -88, -88, -88, -88, -88, -88, -88, -88,
-88, -88, -88, 50, -88, 45, 26, -88, -88, 24,
-88, -88, 56, 22, -88, -88, -88, -88, -88, -88,
-88, -88, -88, -88, -88, -88, -88, -88, -88, -88,
-88, -88, -88, 31, -88, -88, -88, -88, 57, -88,
-88, -88, -88, -88, -88, -88, -88, -88, -88, -88,
-88, -88, -88, 158, -88, 146, 142, 150, 154, -88,
47, 138, 115, 135, 132, -88, -88, -88, -88, -88,
-88, -88, -88, 168, -88, 172, -88, 160, -88, -88,
180, -88, 220, -88, -88, 117, -88, -2, -88, 38,
-88, -5, -88, 174, -88, 170, 166, -88, -88, 164,
-88, -88, -88, -88, -88, -88, 190, -88, -37, 80,
-88, -88, 105, -88, -13, -88, 28, -88, 0, -88,
-88, -44, -88, -88, -52, -88, -88, 12, -88, 52,
-88, 1, -88, 4, -88, -88, 6, -88, -88, -88,
-88, -88, 119, 8, -88, -88, -88, -88, -88, 120,
-88, -88, 44, -88, -88, -88, 68, -88, -45, 116,
-88, 124, -88, -88, -88, -88, -14, -88, -88, -88,
-88, -88, -1, -88, -88, -88, -88, -88, -55, -88,
11, -88, -53, -88, -88, -88, -88, 109, -88, -88,
96, -88, -88, -88, -88, -88, -19, -54, -88, -88,
-21, -88, -88, -88, -43, -88, -88, -88, -88, 10,
-88, -38, -88, 2, -88, -39, -88, -88, -88, 3,
-88, 9, -88, 7, -88, -88, -88, -88, -88, -88,
-88, -88, -88, -88, -88, -88, -88, -88, -88, -88,
-88, -88, 5, -88, -88, -56, -88, -88};
const short JavaScriptGrammar::action_info [] = {
305, 307, 109, 400, 400, 400, 273, 105, 416, 302,
297, 295, 293, 423, 273, 151, 313, 321, 406, 407,
424, 295, 422, 198, 420, 149, 313, 353, -47, 396,
154, 258, -49, 346, 416, -36, -25, -26, -195, 392,
385, -44, 258, 344, 349, 440, 321, 343, 319, 347,
336, 332, 433, 334, 347, 416, 101, 158, 102, 188,
229, 340, 349, 462, -196, 223, 440, 341, 293, 429,
223, 326, 98, 101, 433, 158, 403, 97, 457, 446,
198, 198, 0, 198, 198, 198, 103, 186, 429, 457,
328, 392, 198, 186, 416, 253, 204, 198, 156, 237,
104, 198, 410, 198, 419, 81, 88, 97, 0, 81,
198, 441, 198, 198, -265, 0, 82, 89, 420, 81,
82, 404, 465, 81, 0, 252, 0, 0, 391, 390,
82, 0, 394, 311, 82, 450, 351, 338, 188, 0,
199, 249, 248, 329, 0, 0, 249, 248, 205, 255,
225, 242, 241, 431, 226, 257, 256, 198, 236, 442,
244, 0, 247, 246, 435, 239, 414, 413, 172, 172,
173, 173, 172, 0, 173, 466, 464, 172, 172, 173,
173, 174, 174, 315, 191, 174, 172, 316, 173, 239,
174, 174, 245, 243, 90, 232, 90, 240, 238, 174,
172, 90, 173, 192, 0, 193, 172, 0, 173, 0,
208, 207, 0, 174, 233, 0, 193, 232, 172, 174,
173, 240, 238, 244, 172, 0, 173, 0, 0, 0,
0, 174, 160, 161, 160, 161, 233, 174, 193, 91,
0, 91, 275, 276, 0, 92, 91, 92, 275, 276,
0, 0, 92, 0, 0, 245, 243, 0, 0, 162,
163, 162, 163, 0, 0, 280, 281, 0, 0, 277,
278, 280, 281, 0, 282, 277, 278, 283, 0, 284,
282, 280, 281, 283, 0, 284, 172, 0, 173, 0,
282, 0, 0, 283, 0, 284, 165, 166, 0, 174,
0, 0, 0, 0, 167, 168, 165, 166, 169, 0,
170, 0, 0, 0, 167, 168, 165, 166, 169, 0,
170, 0, 0, 0, 167, 168, 165, 166, 169, 0,
170, 0, 0, 0, 167, 168, 0, 210, 169, 0,
170, 165, 166, 0, 0, 280, 281, 211, 0, 167,
168, 212, 0, 169, 282, 170, 0, 283, 0, 284,
213, 0, 214, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 215, 0, 216, 88, 0, 42, 43,
0, 0, 0, 217, 0, 0, 218, 89, 85, 0,
0, 0, 219, 0, 0, 86, 0, 0, 220, 87,
51, 0, 52, 0, 0, 0, 42, 43, 0, 55,
0, 221, 0, 58, 0, 0, 85, 0, 0, 0,
0, 0, 0, 86, 0, 0, 0, 87, 51, 0,
52, 63, 0, 65, 0, 0, 0, 55, 0, 0,
0, 58, 0, 0, 57, 68, 45, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 63,
0, 65, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 57, 68, 45, 0, 0, 0, 210, 0,
0, 0, 0, 0, 0, 0, 0, 0, 211, 0,
0, 0, 212, 0, 0, 0, 0, 0, 0, 0,
0, 213, 0, 214, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 215, 0, 216, 88, 0, 0,
0, 0, 0, 0, 217, 0, 0, 218, 89, 0,
0, 0, 0, 219, 0, 0, 0, 0, 0, 220,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 221, 0, 0, 0, 0, 0, 0, 210,
0, 0, 0, 0, 0, 0, 0, 0, 0, 211,
0, 0, 0, 212, 0, 0, 0, 0, 0, 0,
0, 0, 213, 0, 214, 0, 0, 309, 0, 0,
0, 0, 0, 0, 0, 215, 0, 216, 88, 0,
0, 0, 0, 0, 0, 217, 0, 0, 218, 89,
0, 0, 0, 0, 219, 0, 0, 0, 0, 0,
220, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 221, 0, 0, 0, 0, 0, 0,
41, 42, 43, 0, 0, 0, 0, 0, 0, 0,
0, 85, 0, 0, 0, 0, 0, 0, 86, 0,
0, 0, 87, 51, 0, 52, 0, 0, 0, 53,
0, 54, 55, 56, 0, 0, 58, 0, 0, 0,
59, 0, 60, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 63, 0, 65, 0, 67, 0,
70, 0, 72, 0, 0, 0, 0, 57, 68, 45,
0, 0, 0, 41, 42, 43, 0, 0, 0, 0,
0, 0, 0, 0, 85, 0, 0, 0, 0, 0,
0, 86, 0, 0, 0, 87, 51, 0, 52, 0,
0, 0, 53, 0, 54, 55, 56, 0, 0, 58,
0, 0, 0, 59, 0, 60, 0, 0, 0, 0,
0, 0, 203, 0, 0, 0, 0, 63, 0, 65,
0, 67, 0, 70, 0, 72, 0, 0, 0, 0,
57, 68, 45, 0, 0, 0, 41, 42, 43, 0,
0, 0, 0, 0, 0, 0, 0, 85, 0, 0,
0, 0, 0, 0, 86, 0, 0, 0, 87, 51,
0, 52, 0, 0, 0, 53, 0, 54, 55, 56,
0, 0, 58, 0, 0, 0, 59, 0, 60, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
63, 0, 65, 0, 67, 0, 70, 272, 72, 0,
0, 0, 0, 57, 68, 45, 0, 0, 0, 41,
42, 43, 0, 0, 0, 0, 0, 0, 0, 0,
85, 0, 0, 0, 0, 0, 0, 86, 0, 0,
0, 87, 51, 0, 52, 0, 0, 0, 53, 0,
54, 55, 56, 0, 0, 58, 0, 0, 0, 59,
0, 60, 0, 0, 448, 0, 0, 0, 0, 0,
0, 0, 0, 63, 0, 65, 0, 67, 0, 70,
0, 72, 0, 0, 0, 0, 57, 68, 45, 0,
0, 0, -45, 0, 0, 0, 41, 42, 43, 0,
0, 0, 0, 0, 0, 0, 0, 85, 0, 0,
0, 0, 0, 0, 86, 0, 0, 0, 87, 51,
0, 52, 0, 0, 0, 53, 0, 54, 55, 56,
0, 0, 58, 0, 0, 0, 59, 0, 60, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
63, 0, 65, 0, 67, 0, 70, 0, 72, 0,
0, 0, 0, 57, 68, 45, 0, 0, 0, 41,
42, 43, 0, 0, 0, 0, 0, 0, 0, 0,
85, 0, 0, 0, 0, 0, 0, 86, 0, 0,
0, 87, 51, 0, 52, 0, 0, 0, 53, 0,
54, 55, 56, 0, 0, 58, 0, 0, 0, 59,
0, 60, 0, 0, 445, 0, 0, 0, 0, 0,
0, 0, 0, 63, 0, 65, 0, 67, 0, 70,
0, 72, 0, 0, 0, 0, 57, 68, 45, 0,
0, 0, 115, 116, 117, 0, 0, 119, 121, 122,
0, 0, 123, 0, 124, 0, 0, 0, 126, 127,
128, 0, 0, 0, 0, 0, 0, 196, 130, 131,
132, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 133, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 137, 0, 0,
0, 0, 0, 0, 139, 140, 141, 0, 143, 144,
145, 146, 147, 148, 0, 0, 134, 142, 125, 118,
120, 136, 115, 116, 117, 0, 0, 119, 121, 122,
0, 0, 123, 0, 124, 0, 0, 0, 126, 127,
128, 0, 0, 0, 0, 0, 0, 129, 130, 131,
132, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 133, 0, 0, 0, 135, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 137, 0, 0,
0, 0, 0, 138, 139, 140, 141, 0, 143, 144,
145, 146, 147, 148, 0, 0, 134, 142, 125, 118,
120, 136, 115, 116, 117, 0, 0, 119, 121, 122,
0, 0, 123, 0, 124, 0, 0, 0, 126, 127,
128, 0, 0, 0, 0, 0, 0, 129, 130, 131,
132, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 133, 0, 0, 0, 135, 0, 0, 0, 0,
0, 0, 0, 153, 0, 0, 0, 137, 0, 0,
0, 0, 0, 138, 139, 140, 141, 0, 143, 144,
145, 146, 147, 148, 0, 0, 134, 142, 125, 118,
120, 136, 37, 0, 0, 0, 0, 39, 0, 41,
42, 43, 44, 0, 0, 0, 0, 0, 0, 46,
47, 0, 0, 0, 0, 0, 0, 48, 49, 0,
0, 50, 51, 0, 52, 0, 0, 0, 53, 0,
54, 55, 56, 0, 0, 58, 0, 0, 0, 59,
0, 60, 0, 0, 0, 0, 0, 61, 0, 62,
0, 0, 0, 63, 64, 65, 66, 67, 69, 70,
71, 72, 73, 74, 0, 0, 57, 68, 45, 38,
40, 0, 37, 0, 0, 0, 0, 39, 0, 41,
42, 43, 44, 0, 0, 0, 0, 0, 0, 46,
85, 0, 0, 0, 0, 0, 0, 48, 49, 0,
0, 50, 51, 0, 52, 0, 0, 0, 53, 0,
54, 55, 56, 0, 0, 58, 0, 0, 0, 59,
0, 60, 0, 0, 0, 0, 0, 61, 0, 62,
0, 0, 0, 63, 64, 65, 66, 67, 69, 70,
71, 72, 73, 74, 0, 0, 57, 68, 45, 38,
40, 0, 358, 116, 117, 0, 0, 360, 121, 362,
42, 43, 363, 0, 124, 0, 0, 0, 126, 365,
366, 0, 0, 0, 0, 0, 0, 367, 368, 131,
132, 50, 51, 0, 52, 0, 0, 0, 53, 0,
54, 369, 56, 0, 0, 371, 0, 0, 0, 59,
0, 60, 0, -191, 0, 0, 0, 372, 0, 62,
0, 0, 0, 373, 374, 375, 376, 67, 378, 379,
380, 381, 382, 383, 0, 0, 370, 377, 364, 359,
361, 136,
388, 415, 303, 425, 231, 393, 436, 432, 434, 467,
447, 443, 463, 209, 444, 415, 430, 409, 355, 449,
405, 401, 110, 251, 421, 426, 355, 202, 235, 345,
330, 230, 335, 228, 337, 34, 342, 254, 110, 150,
312, 155, 152, 308, 310, 339, 352, 206, 200, 354,
303, 384, 195, 251, 197, 83, 222, 348, 350, 175,
0, 83, 0, 83, 83, 83, 195, 234, 83, 83,
285, 189, 159, 176, 412, 267, 83, 83, 83, 227,
271, 181, 224, 83, 164, 83, 303, 177, 83, 187,
178, 83, 83, 179, 83, 83, 171, 83, 183, 83,
184, 185, 182, 83, 180, 427, 83, 83, 452, 453,
386, 303, 83, 387, 451, 83, 0, 93, 83, 83,
94, 95, 331, 303, 83, 83, 454, 455, 83, 83,
428, 456, 386, 83, 83, 387, 427, 83, 287, 250,
83, 355, 83, 157, 428, 83, 0, 333, 84, 83,
83, 250, 0, 83, 355, 289, 83, 411, 288, 306,
83, 286, 0, 0, 83, 271, 0, 290, 83, 271,
408, 279, 83, 271, 0, 291, 83, 271, 299, 292,
0, 271, 299, 271, 299, 274, 83, 271, 83, 271,
83, 271, 83, 271, 0, 271, 0, 271, 299, 294,
298, 296, 0, 271, 320, 317, 318, 314, 299, 0,
0, 0, 0, 271, 0, 0, 0, 0, 0, 0,
301, 0, 0, 0, 0, 0, 303, 0, 0, 0,
327, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 304, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0};
const short JavaScriptGrammar::action_check [] = {
61, 60, 55, 5, 5, 5, 1, 33, 33, 61,
8, 76, 48, 29, 1, 8, 2, 29, 55, 7,
60, 76, 36, 8, 20, 7, 2, 16, 7, 33,
7, 36, 7, 55, 33, 7, 7, 7, 29, 36,
55, 7, 36, 33, 36, 8, 29, 60, 7, 7,
31, 61, 36, 60, 7, 33, 29, 1, 8, 76,
7, 29, 36, 17, 29, 2, 8, 36, 48, 36,
2, 17, 36, 29, 36, 1, 10, 29, 29, 8,
8, 8, -1, 8, 8, 8, 29, 48, 36, 29,
8, 36, 8, 48, 33, 36, 8, 8, 55, 0,
60, 8, 7, 8, 6, 40, 42, 29, -1, 40,
8, 8, 8, 8, 36, -1, 51, 53, 20, 40,
51, 55, 8, 40, -1, 74, -1, -1, 61, 62,
51, -1, 60, 60, 51, 60, 60, 60, 76, -1,
56, 61, 62, 61, -1, -1, 61, 62, 60, 60,
50, 61, 62, 60, 54, 61, 62, 8, 56, 56,
29, -1, 61, 62, 60, 29, 61, 62, 25, 25,
27, 27, 25, -1, 27, 61, 62, 25, 25, 27,
27, 38, 38, 50, 15, 38, 25, 54, 27, 29,
38, 38, 61, 62, 12, 15, 12, 61, 62, 38,
25, 12, 27, 34, -1, 36, 25, -1, 27, -1,
61, 62, -1, 38, 34, -1, 36, 15, 25, 38,
27, 61, 62, 29, 25, -1, 27, -1, -1, -1,
-1, 38, 18, 19, 18, 19, 34, 38, 36, 57,
-1, 57, 18, 19, -1, 63, 57, 63, 18, 19,
-1, -1, 63, -1, -1, 61, 62, -1, -1, 45,
46, 45, 46, -1, -1, 23, 24, -1, -1, 45,
46, 23, 24, -1, 32, 45, 46, 35, -1, 37,
32, 23, 24, 35, -1, 37, 25, -1, 27, -1,
32, -1, -1, 35, -1, 37, 23, 24, -1, 38,
-1, -1, -1, -1, 31, 32, 23, 24, 35, -1,
37, -1, -1, -1, 31, 32, 23, 24, 35, -1,
37, -1, -1, -1, 31, 32, 23, 24, 35, -1,
37, -1, -1, -1, 31, 32, -1, 3, 35, -1,
37, 23, 24, -1, -1, 23, 24, 13, -1, 31,
32, 17, -1, 35, 32, 37, -1, 35, -1, 37,
26, -1, 28, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, 39, -1, 41, 42, -1, 12, 13,
-1, -1, -1, 49, -1, -1, 52, 53, 22, -1,
-1, -1, 58, -1, -1, 29, -1, -1, 64, 33,
34, -1, 36, -1, -1, -1, 12, 13, -1, 43,
-1, 77, -1, 47, -1, -1, 22, -1, -1, -1,
-1, -1, -1, 29, -1, -1, -1, 33, 34, -1,
36, 65, -1, 67, -1, -1, -1, 43, -1, -1,
-1, 47, -1, -1, 78, 79, 80, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, 65,
-1, 67, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, 78, 79, 80, -1, -1, -1, 3, -1,
-1, -1, -1, -1, -1, -1, -1, -1, 13, -1,
-1, -1, 17, -1, -1, -1, -1, -1, -1, -1,
-1, 26, -1, 28, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, 39, -1, 41, 42, -1, -1,
-1, -1, -1, -1, 49, -1, -1, 52, 53, -1,
-1, -1, -1, 58, -1, -1, -1, -1, -1, 64,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, 77, -1, -1, -1, -1, -1, -1, 3,
-1, -1, -1, -1, -1, -1, -1, -1, -1, 13,
-1, -1, -1, 17, -1, -1, -1, -1, -1, -1,
-1, -1, 26, -1, 28, -1, -1, 31, -1, -1,
-1, -1, -1, -1, -1, 39, -1, 41, 42, -1,
-1, -1, -1, -1, -1, 49, -1, -1, 52, 53,
-1, -1, -1, -1, 58, -1, -1, -1, -1, -1,
64, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, 77, -1, -1, -1, -1, -1, -1,
11, 12, 13, -1, -1, -1, -1, -1, -1, -1,
-1, 22, -1, -1, -1, -1, -1, -1, 29, -1,
-1, -1, 33, 34, -1, 36, -1, -1, -1, 40,
-1, 42, 43, 44, -1, -1, 47, -1, -1, -1,
51, -1, 53, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, 65, -1, 67, -1, 69, -1,
71, -1, 73, -1, -1, -1, -1, 78, 79, 80,
-1, -1, -1, 11, 12, 13, -1, -1, -1, -1,
-1, -1, -1, -1, 22, -1, -1, -1, -1, -1,
-1, 29, -1, -1, -1, 33, 34, -1, 36, -1,
-1, -1, 40, -1, 42, 43, 44, -1, -1, 47,
-1, -1, -1, 51, -1, 53, -1, -1, -1, -1,
-1, -1, 60, -1, -1, -1, -1, 65, -1, 67,
-1, 69, -1, 71, -1, 73, -1, -1, -1, -1,
78, 79, 80, -1, -1, -1, 11, 12, 13, -1,
-1, -1, -1, -1, -1, -1, -1, 22, -1, -1,
-1, -1, -1, -1, 29, -1, -1, -1, 33, 34,
-1, 36, -1, -1, -1, 40, -1, 42, 43, 44,
-1, -1, 47, -1, -1, -1, 51, -1, 53, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
65, -1, 67, -1, 69, -1, 71, 72, 73, -1,
-1, -1, -1, 78, 79, 80, -1, -1, -1, 11,
12, 13, -1, -1, -1, -1, -1, -1, -1, -1,
22, -1, -1, -1, -1, -1, -1, 29, -1, -1,
-1, 33, 34, -1, 36, -1, -1, -1, 40, -1,
42, 43, 44, -1, -1, 47, -1, -1, -1, 51,
-1, 53, -1, -1, 56, -1, -1, -1, -1, -1,
-1, -1, -1, 65, -1, 67, -1, 69, -1, 71,
-1, 73, -1, -1, -1, -1, 78, 79, 80, -1,
-1, -1, 7, -1, -1, -1, 11, 12, 13, -1,
-1, -1, -1, -1, -1, -1, -1, 22, -1, -1,
-1, -1, -1, -1, 29, -1, -1, -1, 33, 34,
-1, 36, -1, -1, -1, 40, -1, 42, 43, 44,
-1, -1, 47, -1, -1, -1, 51, -1, 53, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
65, -1, 67, -1, 69, -1, 71, -1, 73, -1,
-1, -1, -1, 78, 79, 80, -1, -1, -1, 11,
12, 13, -1, -1, -1, -1, -1, -1, -1, -1,
22, -1, -1, -1, -1, -1, -1, 29, -1, -1,
-1, 33, 34, -1, 36, -1, -1, -1, 40, -1,
42, 43, 44, -1, -1, 47, -1, -1, -1, 51,
-1, 53, -1, -1, 56, -1, -1, -1, -1, -1,
-1, -1, -1, 65, -1, 67, -1, 69, -1, 71,
-1, 73, -1, -1, -1, -1, 78, 79, 80, -1,
-1, -1, 4, 5, 6, -1, -1, 9, 10, 11,
-1, -1, 14, -1, 16, -1, -1, -1, 20, 21,
22, -1, -1, -1, -1, -1, -1, 29, 30, 31,
32, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, 43, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, 59, -1, -1,
-1, -1, -1, -1, 66, 67, 68, -1, 70, 71,
72, 73, 74, 75, -1, -1, 78, 79, 80, 81,
82, 83, 4, 5, 6, -1, -1, 9, 10, 11,
-1, -1, 14, -1, 16, -1, -1, -1, 20, 21,
22, -1, -1, -1, -1, -1, -1, 29, 30, 31,
32, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, 43, -1, -1, -1, 47, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, 59, -1, -1,
-1, -1, -1, 65, 66, 67, 68, -1, 70, 71,
72, 73, 74, 75, -1, -1, 78, 79, 80, 81,
82, 83, 4, 5, 6, -1, -1, 9, 10, 11,
-1, -1, 14, -1, 16, -1, -1, -1, 20, 21,
22, -1, -1, -1, -1, -1, -1, 29, 30, 31,
32, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, 43, -1, -1, -1, 47, -1, -1, -1, -1,
-1, -1, -1, 55, -1, -1, -1, 59, -1, -1,
-1, -1, -1, 65, 66, 67, 68, -1, 70, 71,
72, 73, 74, 75, -1, -1, 78, 79, 80, 81,
82, 83, 4, -1, -1, -1, -1, 9, -1, 11,
12, 13, 14, -1, -1, -1, -1, -1, -1, 21,
22, -1, -1, -1, -1, -1, -1, 29, 30, -1,
-1, 33, 34, -1, 36, -1, -1, -1, 40, -1,
42, 43, 44, -1, -1, 47, -1, -1, -1, 51,
-1, 53, -1, -1, -1, -1, -1, 59, -1, 61,
-1, -1, -1, 65, 66, 67, 68, 69, 70, 71,
72, 73, 74, 75, -1, -1, 78, 79, 80, 81,
82, -1, 4, -1, -1, -1, -1, 9, -1, 11,
12, 13, 14, -1, -1, -1, -1, -1, -1, 21,
22, -1, -1, -1, -1, -1, -1, 29, 30, -1,
-1, 33, 34, -1, 36, -1, -1, -1, 40, -1,
42, 43, 44, -1, -1, 47, -1, -1, -1, 51,
-1, 53, -1, -1, -1, -1, -1, 59, -1, 61,
-1, -1, -1, 65, 66, 67, 68, 69, 70, 71,
72, 73, 74, 75, -1, -1, 78, 79, 80, 81,
82, -1, 4, 5, 6, -1, -1, 9, 10, 11,
12, 13, 14, -1, 16, -1, -1, -1, 20, 21,
22, -1, -1, -1, -1, -1, -1, 29, 30, 31,
32, 33, 34, -1, 36, -1, -1, -1, 40, -1,
42, 43, 44, -1, -1, 47, -1, -1, -1, 51,
-1, 53, -1, 55, -1, -1, -1, 59, -1, 61,
-1, -1, -1, 65, 66, 67, 68, 69, 70, 71,
72, 73, 74, 75, -1, -1, 78, 79, 80, 81,
82, 83,
14, 46, 6, 46, 14, 6, 45, 45, 6, 65,
7, 2, 7, 41, 7, 46, 6, 6, 45, 6,
73, 76, 86, 45, 78, 46, 45, 7, 6, 81,
67, 7, 45, 7, 6, 85, 80, 6, 86, 7,
45, 7, 9, 45, 6, 45, 45, 7, 7, 45,
6, 45, 10, 45, 6, 18, 7, 45, 6, 22,
-1, 18, -1, 18, 18, 18, 10, 11, 18, 18,
23, 28, 26, 22, 6, 18, 18, 18, 18, 34,
23, 23, 32, 18, 24, 18, 6, 22, 18, 30,
23, 18, 18, 23, 18, 18, 23, 18, 24, 18,
24, 24, 23, 18, 23, 20, 18, 18, 20, 20,
12, 6, 18, 15, 20, 18, -1, 20, 18, 18,
20, 20, 42, 6, 18, 18, 20, 20, 18, 18,
20, 20, 12, 18, 18, 15, 20, 18, 23, 20,
18, 45, 18, 21, 20, 18, -1, 42, 21, 18,
18, 20, -1, 18, 45, 23, 18, 61, 23, 42,
18, 23, -1, -1, 18, 23, -1, 25, 18, 23,
61, 25, 18, 23, -1, 25, 18, 23, 18, 25,
-1, 23, 18, 23, 18, 27, 18, 23, 18, 23,
18, 23, 18, 23, -1, 23, -1, 23, 18, 31,
40, 29, -1, 23, 40, 35, 40, 33, 18, -1,
-1, -1, -1, 23, -1, -1, -1, -1, -1, -1,
40, -1, -1, -1, -1, -1, 6, -1, -1, -1,
40, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, 42, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1};

View File

@@ -1,176 +0,0 @@
// This file was generated by qlalr - DO NOT EDIT!
/**************************************************************************
**
** 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.
**
**************************************************************************/
//
// W A R N I N G
// -------------
//
// This file is not part of the Qt API. It exists purely as an
// implementation detail. This header file may change from version to
// version without notice, or even be removed.
//
// We mean it.
//
#ifndef JAVASCRIPTGRAMMAR_P_H
#define JAVASCRIPTGRAMMAR_P_H
class JavaScriptGrammar
{
public:
enum {
EOF_SYMBOL = 0,
T_AND = 1,
T_AND_AND = 2,
T_AND_EQ = 3,
T_AUTOMATIC_SEMICOLON = 62,
T_BREAK = 4,
T_CASE = 5,
T_CATCH = 6,
T_COLON = 7,
T_COMMA = 8,
T_CONST = 81,
T_CONTINUE = 9,
T_DEBUGGER = 82,
T_DEFAULT = 10,
T_DELETE = 11,
T_DIVIDE_ = 12,
T_DIVIDE_EQ = 13,
T_DO = 14,
T_DOT = 15,
T_ELSE = 16,
T_EQ = 17,
T_EQ_EQ = 18,
T_EQ_EQ_EQ = 19,
T_FALSE = 80,
T_FINALLY = 20,
T_FOR = 21,
T_FUNCTION = 22,
T_GE = 23,
T_GT = 24,
T_GT_GT = 25,
T_GT_GT_EQ = 26,
T_GT_GT_GT = 27,
T_GT_GT_GT_EQ = 28,
T_IDENTIFIER = 29,
T_IF = 30,
T_IN = 31,
T_INSTANCEOF = 32,
T_LBRACE = 33,
T_LBRACKET = 34,
T_LE = 35,
T_LPAREN = 36,
T_LT = 37,
T_LT_LT = 38,
T_LT_LT_EQ = 39,
T_MINUS = 40,
T_MINUS_EQ = 41,
T_MINUS_MINUS = 42,
T_NEW = 43,
T_NOT = 44,
T_NOT_EQ = 45,
T_NOT_EQ_EQ = 46,
T_NULL = 78,
T_NUMERIC_LITERAL = 47,
T_OR = 48,
T_OR_EQ = 49,
T_OR_OR = 50,
T_PLUS = 51,
T_PLUS_EQ = 52,
T_PLUS_PLUS = 53,
T_QUESTION = 54,
T_RBRACE = 55,
T_RBRACKET = 56,
T_REMAINDER = 57,
T_REMAINDER_EQ = 58,
T_RESERVED_WORD = 83,
T_RETURN = 59,
T_RPAREN = 60,
T_SEMICOLON = 61,
T_STAR = 63,
T_STAR_EQ = 64,
T_STRING_LITERAL = 65,
T_SWITCH = 66,
T_THIS = 67,
T_THROW = 68,
T_TILDE = 69,
T_TRUE = 79,
T_TRY = 70,
T_TYPEOF = 71,
T_VAR = 72,
T_VOID = 73,
T_WHILE = 74,
T_WITH = 75,
T_XOR = 76,
T_XOR_EQ = 77,
ACCEPT_STATE = 237,
RULE_COUNT = 269,
STATE_COUNT = 468,
TERMINAL_COUNT = 84,
NON_TERMINAL_COUNT = 88,
GOTO_INDEX_OFFSET = 468,
GOTO_INFO_OFFSET = 1562,
GOTO_CHECK_OFFSET = 1562
};
static const char *const spell [];
static const short lhs [];
static const short rhs [];
static const short goto_default [];
static const short action_default [];
static const short action_index [];
static const short action_info [];
static const short action_check [];
static inline int nt_action (int state, int nt)
{
const int yyn = action_index [GOTO_INDEX_OFFSET + state] + nt;
if (yyn < 0 || action_check [GOTO_CHECK_OFFSET + yyn] != nt)
return goto_default [nt];
return action_info [GOTO_INFO_OFFSET + yyn];
}
static inline int t_action (int state, int token)
{
const int yyn = action_index [state] + token;
if (yyn < 0 || action_check [yyn] != token)
return - action_default [state];
return action_info [yyn];
}
};
#endif // JAVASCRIPTGRAMMAR_P_H

File diff suppressed because it is too large Load Diff

View File

@@ -1,239 +0,0 @@
/**************************************************************************
**
** 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.
**
**************************************************************************/
//
// W A R N I N G
// -------------
//
// This file is not part of the Qt API. It exists purely as an
// implementation detail. This header file may change from version to
// version without notice, or even be removed.
//
// We mean it.
//
//
// This file is automatically generated from javascript.g.
// Changes will be lost.
//
#ifndef JAVASCRIPTLEXER_P_H
#define JAVASCRIPTLEXER_P_H
#include <QtCore/QString>
QT_BEGIN_NAMESPACE
class JavaScriptEnginePrivate;
class JavaScriptNameIdImpl;
namespace JavaScript {
class Lexer
{
public:
Lexer(JavaScriptEnginePrivate *eng);
~Lexer();
void setCode(const QString &c, int lineno);
int lex();
int currentLineNo() const { return yylineno; }
int currentColumnNo() const { return yycolumn; }
int startLineNo() const { return startlineno; }
int startColumnNo() const { return startcolumn; }
int endLineNo() const { return currentLineNo(); }
int endColumnNo() const
{ int col = currentColumnNo(); return (col > 0) ? col - 1 : col; }
bool prevTerminator() const { return terminator; }
enum State { Start,
Identifier,
InIdentifier,
InSingleLineComment,
InMultiLineComment,
InNum,
InNum0,
InHex,
InOctal,
InDecimal,
InExponentIndicator,
InExponent,
Hex,
Octal,
Number,
String,
Eof,
InString,
InEscapeSequence,
InHexEscape,
InUnicodeEscape,
Other,
Bad };
enum Error {
NoError,
IllegalCharacter,
UnclosedStringLiteral,
IllegalEscapeSequence,
IllegalUnicodeEscapeSequence,
UnclosedComment,
IllegalExponentIndicator,
IllegalIdentifier
};
enum ParenthesesState {
IgnoreParentheses,
CountParentheses,
BalancedParentheses
};
enum RegExpBodyPrefix {
NoPrefix,
EqualPrefix
};
bool scanRegExp(RegExpBodyPrefix prefix = NoPrefix);
JavaScriptNameIdImpl *pattern;
int flags;
State lexerState() const
{ return state; }
QString errorMessage() const
{ return errmsg; }
void setErrorMessage(const QString &err)
{ errmsg = err; }
void setErrorMessage(const char *err)
{ setErrorMessage(QString::fromLatin1(err)); }
Error error() const
{ return err; }
void clearError()
{ err = NoError; }
private:
JavaScriptEnginePrivate *driver;
int yylineno;
bool done;
char *buffer8;
QChar *buffer16;
uint size8, size16;
uint pos8, pos16;
bool terminator;
bool restrKeyword;
// encountered delimiter like "'" and "}" on last run
bool delimited;
int stackToken;
State state;
void setDone(State s);
uint pos;
void shift(uint p);
int lookupKeyword(const char *);
bool isWhiteSpace() const;
bool isLineTerminator() const;
bool isHexDigit(ushort c) const;
bool isOctalDigit(ushort c) const;
int matchPunctuator(ushort c1, ushort c2,
ushort c3, ushort c4);
ushort singleEscape(ushort c) const;
ushort convertOctal(ushort c1, ushort c2,
ushort c3) const;
public:
static unsigned char convertHex(ushort c1);
static unsigned char convertHex(ushort c1, ushort c2);
static QChar convertUnicode(ushort c1, ushort c2,
ushort c3, ushort c4);
static bool isIdentLetter(ushort c);
static bool isDecimalDigit(ushort c);
inline int ival() const { return qsyylval.ival; }
inline double dval() const { return qsyylval.dval; }
inline JavaScriptNameIdImpl *ustr() const { return qsyylval.ustr; }
const QChar *characterBuffer() const { return buffer16; }
int characterCount() const { return pos16; }
private:
void record8(ushort c);
void record16(QChar c);
void recordStartPos();
int findReservedWord(const QChar *buffer, int size) const;
void syncProhibitAutomaticSemicolon();
const QChar *code;
uint length;
int yycolumn;
int startlineno;
int startcolumn;
int bol; // begin of line
union {
int ival;
double dval;
JavaScriptNameIdImpl *ustr;
} qsyylval;
// current and following unicode characters
ushort current, next1, next2, next3;
struct keyword {
const char *name;
int token;
};
QString errmsg;
Error err;
bool wantRx;
bool check_reserved;
ParenthesesState parenthesesState;
int parenthesesCount;
bool prohibitAutomaticSemicolon;
};
} // namespace JavaScript
QT_END_NAMESPACE
#endif

View File

@@ -1,134 +0,0 @@
/**************************************************************************
**
** 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.
**
**************************************************************************/
//
// W A R N I N G
// -------------
//
// This file is not part of the Qt API. It exists purely as an
// implementation detail. This header file may change from version to
// version without notice, or even be removed.
//
// We mean it.
//
//
// This file is automatically generated from javascript.g.
// Changes will be lost.
//
#ifndef JAVASCRIPTMEMORYPOOL_P_H
#define JAVASCRIPTMEMORYPOOL_P_H
//
// W A R N I N G
// -------------
//
// This file is not part of the Qt API. It exists purely as an
// implementation detail. This header file may change from version to
// version without notice, or even be removed.
//
// We mean it.
//
#include <QtCore/qglobal.h>
#include <QtCore/qshareddata.h>
#include <string.h>
QT_BEGIN_NAMESPACE
namespace JavaScript {
class MemoryPool : public QSharedData
{
public:
enum { maxBlockCount = -1 };
enum { defaultBlockSize = 1 << 12 };
MemoryPool() {
m_blockIndex = maxBlockCount;
m_currentIndex = 0;
m_storage = 0;
m_currentBlock = 0;
m_currentBlockSize = 0;
}
virtual ~MemoryPool() {
for (int index = 0; index < m_blockIndex + 1; ++index)
qFree(m_storage[index]);
qFree(m_storage);
}
char *allocate(int bytes) {
bytes += (8 - bytes) & 7; // ensure multiple of 8 bytes (maintain alignment)
if (m_currentBlock == 0 || m_currentBlockSize < m_currentIndex + bytes) {
++m_blockIndex;
m_currentBlockSize = defaultBlockSize << m_blockIndex;
m_storage = reinterpret_cast<char**>(qRealloc(m_storage, sizeof(char*) * (1 + m_blockIndex)));
m_currentBlock = m_storage[m_blockIndex] = reinterpret_cast<char*>(qMalloc(m_currentBlockSize));
::memset(m_currentBlock, 0, m_currentBlockSize);
m_currentIndex = (8 - quintptr(m_currentBlock)) & 7; // ensure first chunk is 64-bit aligned
Q_ASSERT(m_currentIndex + bytes <= m_currentBlockSize);
}
char *p = reinterpret_cast<char *>
(m_currentBlock + m_currentIndex);
m_currentIndex += bytes;
return p;
}
int bytesAllocated() const {
int bytes = 0;
for (int index = 0; index < m_blockIndex; ++index)
bytes += (defaultBlockSize << index);
bytes += m_currentIndex;
return bytes;
}
private:
int m_blockIndex;
int m_currentIndex;
char *m_currentBlock;
int m_currentBlockSize;
char **m_storage;
private:
Q_DISABLE_COPY(MemoryPool)
};
} // namespace JavaScript
QT_END_NAMESPACE
#endif

View File

@@ -1,126 +0,0 @@
/**************************************************************************
**
** 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.
**
**************************************************************************/
//
// W A R N I N G
// -------------
//
// This file is not part of the Qt API. It exists purely as an
// implementation detail. This header file may change from version to
// version without notice, or even be removed.
//
// We mean it.
//
//
// This file is automatically generated from javascript.g.
// Changes will be lost.
//
#ifndef JAVASCRIPTNODEPOOL_P_H
#define JAVASCRIPTNODEPOOL_P_H
#include <QtCore/QHash>
#include <QtCore/QString>
#include "javascriptmemorypool_p.h"
QT_BEGIN_NAMESPACE
class JavaScriptEnginePrivate;
namespace JavaScript {
namespace AST {
class Node;
} // namespace AST
class Code;
class CompilationUnit;
template <typename NodeType>
inline NodeType *makeAstNode(MemoryPool *storage)
{
NodeType *node = new (storage->allocate(sizeof(NodeType))) NodeType();
return node;
}
template <typename NodeType, typename Arg1>
inline NodeType *makeAstNode(MemoryPool *storage, Arg1 arg1)
{
NodeType *node = new (storage->allocate(sizeof(NodeType))) NodeType(arg1);
return node;
}
template <typename NodeType, typename Arg1, typename Arg2>
inline NodeType *makeAstNode(MemoryPool *storage, Arg1 arg1, Arg2 arg2)
{
NodeType *node = new (storage->allocate(sizeof(NodeType))) NodeType(arg1, arg2);
return node;
}
template <typename NodeType, typename Arg1, typename Arg2, typename Arg3>
inline NodeType *makeAstNode(MemoryPool *storage, Arg1 arg1, Arg2 arg2, Arg3 arg3)
{
NodeType *node = new (storage->allocate(sizeof(NodeType))) NodeType(arg1, arg2, arg3);
return node;
}
template <typename NodeType, typename Arg1, typename Arg2, typename Arg3, typename Arg4>
inline NodeType *makeAstNode(MemoryPool *storage, Arg1 arg1, Arg2 arg2, Arg3 arg3, Arg4 arg4)
{
NodeType *node = new (storage->allocate(sizeof(NodeType))) NodeType(arg1, arg2, arg3, arg4);
return node;
}
class NodePool : public MemoryPool
{
public:
NodePool(const QString &fileName, JavaScriptEnginePrivate *engine);
virtual ~NodePool();
Code *createCompiledCode(AST::Node *node, CompilationUnit &compilation);
inline QString fileName() const { return m_fileName; }
inline JavaScriptEnginePrivate *engine() const { return m_engine; }
private:
QHash<AST::Node*, Code*> m_codeCache;
QString m_fileName;
JavaScriptEnginePrivate *m_engine;
private:
Q_DISABLE_COPY(NodePool)
};
} // namespace JavaScript
QT_END_NAMESPACE
#endif

File diff suppressed because it is too large Load Diff

View File

@@ -1,206 +0,0 @@
// This file was generated by qlalr - DO NOT EDIT!
/**************************************************************************
**
** 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.
**
**************************************************************************/
//
// W A R N I N G
// -------------
//
// This file is not part of the Qt API. It exists purely as an
// implementation detail. This header file may change from version to
// version without notice, or even be removed.
//
// We mean it.
//
//
// This file is automatically generated from javascript.g.
// Changes will be lost.
// To re-generate, run: qlalr --no-debug --no-lines --qt javascript.g
//
#ifndef JAVASCRIPTPARSER_P_H
#define JAVASCRIPTPARSER_P_H
#include "javascriptgrammar_p.h"
#include "javascriptastfwd_p.h"
#include <QtCore/QList>
QT_BEGIN_NAMESPACE
class QString;
class JavaScriptEnginePrivate;
class JavaScriptNameIdImpl;
class JavaScriptParser: protected JavaScriptGrammar
{
public:
union Value {
int ival;
double dval;
JavaScriptNameIdImpl *sval;
JavaScript::AST::ArgumentList *ArgumentList;
JavaScript::AST::CaseBlock *CaseBlock;
JavaScript::AST::CaseClause *CaseClause;
JavaScript::AST::CaseClauses *CaseClauses;
JavaScript::AST::Catch *Catch;
JavaScript::AST::DefaultClause *DefaultClause;
JavaScript::AST::ElementList *ElementList;
JavaScript::AST::Elision *Elision;
JavaScript::AST::ExpressionNode *Expression;
JavaScript::AST::Finally *Finally;
JavaScript::AST::FormalParameterList *FormalParameterList;
JavaScript::AST::FunctionBody *FunctionBody;
JavaScript::AST::FunctionDeclaration *FunctionDeclaration;
JavaScript::AST::Node *Node;
JavaScript::AST::PropertyName *PropertyName;
JavaScript::AST::PropertyNameAndValueList *PropertyNameAndValueList;
JavaScript::AST::SourceElement *SourceElement;
JavaScript::AST::SourceElements *SourceElements;
JavaScript::AST::Statement *Statement;
JavaScript::AST::StatementList *StatementList;
JavaScript::AST::VariableDeclaration *VariableDeclaration;
JavaScript::AST::VariableDeclarationList *VariableDeclarationList;
};
struct Location {
int startLine;
int startColumn;
int endLine;
int endColumn;
};
struct DiagnosticMessage {
enum Kind { Warning, Error };
DiagnosticMessage()
: kind(Error), line(0), column(0) {}
DiagnosticMessage(Kind kind, int line, int column, const QString &message)
: kind(kind), line(line), column(column), message(message) {}
bool isWarning() const
{ return kind == Warning; }
bool isError() const
{ return kind == Error; }
Kind kind;
int line;
int column;
QString message;
};
public:
JavaScriptParser();
~JavaScriptParser();
bool parse(JavaScriptEnginePrivate *driver);
QList<DiagnosticMessage> diagnosticMessages() const
{ return diagnostic_messages; }
inline DiagnosticMessage diagnosticMessage() const
{
foreach (const DiagnosticMessage &d, diagnostic_messages) {
if (! d.kind == DiagnosticMessage::Warning)
return d;
}
return DiagnosticMessage();
}
inline QString errorMessage() const
{ return diagnosticMessage().message; }
inline int errorLineNumber() const
{ return diagnosticMessage().line; }
inline int errorColumnNumber() const
{ return diagnosticMessage().column; }
protected:
inline void reallocateStack();
inline Value &sym(int index)
{ return sym_stack [tos + index - 1]; }
inline Location &loc(int index)
{ return location_stack [tos + index - 1]; }
protected:
int tos;
int stack_size;
Value *sym_stack;
int *state_stack;
Location *location_stack;
// error recovery
enum { TOKEN_BUFFER_SIZE = 3 };
struct SavedToken {
int token;
double dval;
Location loc;
};
double yylval;
Location yylloc;
Location yyprevlloc;
SavedToken token_buffer[TOKEN_BUFFER_SIZE];
SavedToken *first_token;
SavedToken *last_token;
QList<DiagnosticMessage> diagnostic_messages;
};
inline void JavaScriptParser::reallocateStack()
{
if (! stack_size)
stack_size = 128;
else
stack_size <<= 1;
sym_stack = reinterpret_cast<Value*> (qRealloc(sym_stack, stack_size * sizeof(Value)));
state_stack = reinterpret_cast<int*> (qRealloc(state_stack, stack_size * sizeof(int)));
location_stack = reinterpret_cast<Location*> (qRealloc(location_stack, stack_size * sizeof(Location)));
}
#define J_SCRIPT_REGEXPLITERAL_RULE1 7
#define J_SCRIPT_REGEXPLITERAL_RULE2 8
QT_END_NAMESPACE
#endif // JAVASCRIPTPARSER_P_H

View File

@@ -1,35 +0,0 @@
/**************************************************************************
**
** 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.
**
**************************************************************************/
#ifndef JAVASCRIPTVALUE_H
#define JAVASCRIPTVALUE_H
typedef double qjsreal;
#endif // JAVASCRIPTVALUE_H

View File

@@ -1,19 +0,0 @@
HEADERS += $$PWD/javascriptast_p.h \
$$PWD/javascriptastfwd_p.h \
$$PWD/javascriptastvisitor_p.h \
$$PWD/javascriptengine_p.h \
$$PWD/javascriptgrammar_p.h \
$$PWD/javascriptlexer_p.h \
$$PWD/javascriptmemorypool_p.h \
$$PWD/javascriptnodepool_p.h \
$$PWD/javascriptparser_p.h \
$$PWD/javascriptvalue.h
SOURCES += $$PWD/javascriptast.cpp \
$$PWD/javascriptastvisitor.cpp \
$$PWD/javascriptengine_p.cpp \
$$PWD/javascriptgrammar.cpp \
$$PWD/javascriptlexer.cpp \
$$PWD/javascriptparser.cpp

View File

@@ -1,183 +0,0 @@
/**************************************************************************
**
** 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 "qtscriptcodecompletion.h"
#include "qtscripteditor.h"
#include <texteditor/basetexteditor.h>
#include <QtDebug>
using namespace QtScriptEditor::Internal;
QtScriptCodeCompletion::QtScriptCodeCompletion(QObject *parent)
: TextEditor::ICompletionCollector(parent),
m_editor(0),
m_startPosition(0),
m_caseSensitivity(Qt::CaseSensitive)
{ }
QtScriptCodeCompletion::~QtScriptCodeCompletion()
{ }
Qt::CaseSensitivity QtScriptCodeCompletion::caseSensitivity() const
{ return m_caseSensitivity; }
void QtScriptCodeCompletion::setCaseSensitivity(Qt::CaseSensitivity caseSensitivity)
{ m_caseSensitivity = caseSensitivity; }
bool QtScriptCodeCompletion::supportsEditor(TextEditor::ITextEditable *editor)
{
#if 0 // ### disable JS Completion. It's pretty buggy and it can crash Creator.
if (qobject_cast<ScriptEditor *>(editor->widget()))
return true;
#else
Q_UNUSED(editor)
#endif
return false;
}
bool QtScriptCodeCompletion::triggersCompletion(TextEditor::ITextEditable *)
{ return false; }
int QtScriptCodeCompletion::startCompletion(TextEditor::ITextEditable *editor)
{
m_editor = editor;
ScriptEditor *edit = qobject_cast<ScriptEditor *>(m_editor->widget());
if (! edit)
return -1;
int pos = editor->position();
while (editor->characterAt(pos - 1).isLetterOrNumber() || editor->characterAt(pos - 1) == QLatin1Char('_'))
--pos;
m_startPosition = pos;
m_completions.clear();
foreach (const QString &word, edit->words()) {
TextEditor::CompletionItem item(this);
item.text = word;
m_completions.append(item);
}
return pos;
}
void QtScriptCodeCompletion::completions(QList<TextEditor::CompletionItem> *completions)
{
// ### FIXME: this code needs to be generalized.
const int length = m_editor->position() - m_startPosition;
if (length == 0)
*completions = m_completions;
else if (length > 0) {
const QString key = m_editor->textAt(m_startPosition, length);
/*
* This code builds a regular expression in order to more intelligently match
* camel-case style. This means upper-case characters will be rewritten as follows:
*
* A => [a-z0-9_]*A (for any but the first capital letter)
*
* Meaning it allows any sequence of lower-case characters to preceed an
* upper-case character. So for example gAC matches getActionController.
*/
QString keyRegExp;
keyRegExp += QLatin1Char('^');
bool first = true;
foreach (const QChar &c, key) {
if (c.isUpper() && !first) {
keyRegExp += QLatin1String("[a-z0-9_]*");
keyRegExp += c;
} else if (m_caseSensitivity == Qt::CaseInsensitive && c.isLower()) {
keyRegExp += QLatin1Char('[');
keyRegExp += c;
keyRegExp += c.toUpper();
keyRegExp += QLatin1Char(']');
} else {
keyRegExp += QRegExp::escape(c);
}
first = false;
}
const QRegExp regExp(keyRegExp, Qt::CaseSensitive);
foreach (TextEditor::CompletionItem item, m_completions) {
if (regExp.indexIn(item.text) == 0) {
item.relevance = (key.length() > 0 &&
item.text.startsWith(key, Qt::CaseInsensitive)) ? 1 : 0;
(*completions) << item;
}
}
}
}
void QtScriptCodeCompletion::complete(const TextEditor::CompletionItem &item)
{
const QString toInsert = item.text;
const int length = m_editor->position() - m_startPosition;
m_editor->setCurPos(m_startPosition);
m_editor->replace(length, toInsert);
}
bool QtScriptCodeCompletion::partiallyComplete(const QList<TextEditor::CompletionItem> &completionItems)
{
if (completionItems.count() == 1) {
complete(completionItems.first());
return true;
} else {
// Compute common prefix
QString firstKey = completionItems.first().text;
QString lastKey = completionItems.last().text;
const int length = qMin(firstKey.length(), lastKey.length());
firstKey.truncate(length);
lastKey.truncate(length);
while (firstKey != lastKey) {
firstKey.chop(1);
lastKey.chop(1);
}
int typedLength = m_editor->position() - m_startPosition;
if (!firstKey.isEmpty() && firstKey.length() > typedLength) {
m_editor->setCurPos(m_startPosition);
m_editor->replace(typedLength, firstKey);
}
}
return false;
}
void QtScriptCodeCompletion::cleanup()
{
m_editor = 0;
m_startPosition = 0;
m_completions.clear();
}

View File

@@ -1,72 +0,0 @@
/**************************************************************************
**
** 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.
**
**************************************************************************/
#ifndef QTSCRIPTCODECOMPLETION_H
#define QTSCRIPTCODECOMPLETION_H
#include <texteditor/icompletioncollector.h>
namespace TextEditor {
class ITextEditable;
}
namespace QtScriptEditor {
namespace Internal {
class QtScriptCodeCompletion: public TextEditor::ICompletionCollector
{
Q_OBJECT
public:
QtScriptCodeCompletion(QObject *parent = 0);
virtual ~QtScriptCodeCompletion();
Qt::CaseSensitivity caseSensitivity() const;
void setCaseSensitivity(Qt::CaseSensitivity caseSensitivity);
virtual bool supportsEditor(TextEditor::ITextEditable *editor);
virtual bool triggersCompletion(TextEditor::ITextEditable *editor);
virtual int startCompletion(TextEditor::ITextEditable *editor);
virtual void completions(QList<TextEditor::CompletionItem> *completions);
virtual void complete(const TextEditor::CompletionItem &item);
virtual bool partiallyComplete(const QList<TextEditor::CompletionItem> &completionItems);
virtual void cleanup();
private:
TextEditor::ITextEditable *m_editor;
int m_startPosition;
QList<TextEditor::CompletionItem> m_completions;
Qt::CaseSensitivity m_caseSensitivity;
};
} // end of namespace Internal
} // end of namespace QtScriptEditor
#endif // QTSCRIPTCODECOMPLETION_H

View File

@@ -1,554 +0,0 @@
/**************************************************************************
**
** 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 "qtscripteditor.h"
#include "qtscripteditorconstants.h"
#include "qtscripthighlighter.h"
#include "qtscripteditorplugin.h"
#include <qscripthighlighter/qscriptindenter.h>
#include <qscripthighlighter/qscriptincrementalscanner.h>
#include "parser/javascriptengine_p.h"
#include "parser/javascriptparser_p.h"
#include "parser/javascriptlexer_p.h"
#include "parser/javascriptnodepool_p.h"
#include "parser/javascriptastvisitor_p.h"
#include "parser/javascriptast_p.h"
#include <utils/uncommentselection.h>
#include <coreplugin/icore.h>
#include <coreplugin/actionmanager/actionmanager.h>
#include <texteditor/basetextdocument.h>
#include <texteditor/fontsettings.h>
#include <texteditor/textblockiterator.h>
#include <texteditor/texteditorconstants.h>
#include <texteditor/texteditorsettings.h>
#include <QtCore/QTimer>
#include <QtCore/QtDebug>
#include <QtGui/QComboBox>
#include <QtGui/QHBoxLayout>
#include <QtGui/QMenu>
#include <QtGui/QToolBar>
enum {
UPDATE_DOCUMENT_DEFAULT_INTERVAL = 100
};
using namespace JavaScript::AST;
using namespace SharedTools;
namespace QtScriptEditor {
namespace Internal {
class FindDeclarations: protected Visitor
{
QList<Declaration> declarations;
public:
QList<Declaration> accept(JavaScript::AST::Node *node)
{
JavaScript::AST::Node::acceptChild(node, this);
return declarations;
}
protected:
using Visitor::visit;
virtual bool visit(FunctionExpression *)
{
return false;
}
virtual bool visit(FunctionDeclaration *ast)
{
if (! ast->name)
return false;
QString text = ast->name->asString();
text += QLatin1Char('(');
for (FormalParameterList *it = ast->formals; it; it = it->next) {
if (it->name)
text += it->name->asString();
if (it->next)
text += QLatin1String(", ");
}
text += QLatin1Char(')');
Declaration d;
d.text = text;
d.startLine = ast->startLine;
d.startColumn = ast->startColumn;
d.endLine = ast->endLine;
d.endColumn = ast->endColumn;
declarations.append(d);
return false;
}
virtual bool visit(VariableDeclaration *ast)
{
if (! ast->name)
return false;
Declaration d;
d.text = ast->name->asString();
d.startLine= ast->startLine;
d.startColumn = ast->startColumn;
d.endLine = ast->endLine;
d.endColumn = ast->endColumn;
declarations.append(d);
return false;
}
};
ScriptEditorEditable::ScriptEditorEditable(ScriptEditor *editor, const QList<int>& context)
: BaseTextEditorEditable(editor), m_context(context)
{
}
ScriptEditor::ScriptEditor(const Context &context,
QWidget *parent) :
TextEditor::BaseTextEditor(parent),
m_context(context),
m_methodCombo(0)
{
setParenthesesMatchingEnabled(true);
setMarksVisible(true);
setCodeFoldingSupported(true);
setCodeFoldingVisible(true);
setMimeType(QtScriptEditor::Constants::C_QTSCRIPTEDITOR_MIMETYPE);
m_updateDocumentTimer = new QTimer(this);
m_updateDocumentTimer->setInterval(UPDATE_DOCUMENT_DEFAULT_INTERVAL);
m_updateDocumentTimer->setSingleShot(true);
connect(m_updateDocumentTimer, SIGNAL(timeout()), this, SLOT(updateDocumentNow()));
connect(this, SIGNAL(textChanged()), this, SLOT(updateDocument()));
baseTextDocument()->setSyntaxHighlighter(new QtScriptHighlighter);
}
ScriptEditor::~ScriptEditor()
{
}
QList<Declaration> ScriptEditor::declarations() const
{ return m_declarations; }
QStringList ScriptEditor::words() const
{ return m_words; }
Core::IEditor *ScriptEditorEditable::duplicate(QWidget *parent)
{
ScriptEditor *newEditor = new ScriptEditor(m_context, parent);
newEditor->duplicateFrom(editor());
QtScriptEditorPlugin::instance()->initializeEditor(newEditor);
return newEditor->editableInterface();
}
QString ScriptEditorEditable::id() const
{
return QtScriptEditor::Constants::C_QTSCRIPTEDITOR_ID;
}
ScriptEditor::Context ScriptEditorEditable::context() const
{
return m_context;
}
void ScriptEditor::updateDocument()
{
m_updateDocumentTimer->start(UPDATE_DOCUMENT_DEFAULT_INTERVAL);
}
void ScriptEditor::updateDocumentNow()
{
// ### move in the parser thread.
m_updateDocumentTimer->stop();
const QString fileName = file()->fileName();
const QString code = toPlainText();
JavaScriptParser parser;
JavaScriptEnginePrivate driver;
JavaScript::NodePool nodePool(fileName, &driver);
driver.setNodePool(&nodePool);
JavaScript::Lexer lexer(&driver);
lexer.setCode(code, /*line = */ 1);
driver.setLexer(&lexer);
if (parser.parse(&driver)) {
JavaScript::AST::Visitor v;
driver.ast()->accept(&v);
FindDeclarations decls;
m_declarations = decls.accept(driver.ast());
m_words.clear();
foreach (const JavaScriptNameIdImpl &id, driver.literals())
m_words.append(id.asString());
QStringList items;
items.append(tr("<Select Symbol>"));
foreach (Declaration decl, m_declarations)
items.append(decl.text);
m_methodCombo->clear();
m_methodCombo->addItems(items);
updateMethodBoxIndex();
}
QList<QTextEdit::ExtraSelection> selections;
QTextCharFormat errorFormat;
errorFormat.setUnderlineColor(Qt::red);
errorFormat.setUnderlineStyle(QTextCharFormat::WaveUnderline);
QTextCharFormat warningFormat;
warningFormat.setUnderlineColor(Qt::darkYellow);
warningFormat.setUnderlineStyle(QTextCharFormat::WaveUnderline);
QTextEdit::ExtraSelection sel;
foreach (const JavaScriptParser::DiagnosticMessage &d, parser.diagnosticMessages()) {
int line = d.line;
int column = d.column;
if (column == 0)
column = 1;
if (d.isWarning())
sel.format = warningFormat;
else
sel.format = errorFormat;
QTextCursor c(document()->findBlockByNumber(line - 1));
sel.cursor = c;
sel.cursor.setPosition(c.position() + column - 1);
sel.cursor.movePosition(QTextCursor::EndOfWord, QTextCursor::KeepAnchor);
selections.append(sel);
}
setExtraSelections(CodeWarningsSelection, selections);
}
void ScriptEditor::jumpToMethod(int index)
{
if (index) {
Declaration d = m_declarations.at(index - 1);
gotoLine(d.startLine, d.startColumn - 1);
setFocus();
}
}
void ScriptEditor::updateMethodBoxIndex()
{
int line = 0, column = 0;
convertPosition(position(), &line, &column);
int currentSymbolIndex = 0;
int index = 0;
while (index < m_declarations.size()) {
const Declaration &d = m_declarations.at(index++);
if (line < d.startLine)
break;
else
currentSymbolIndex = index;
}
m_methodCombo->setCurrentIndex(currentSymbolIndex);
}
void ScriptEditor::updateMethodBoxToolTip()
{
}
void ScriptEditor::updateFileName()
{
}
void ScriptEditor::setFontSettings(const TextEditor::FontSettings &fs)
{
TextEditor::BaseTextEditor::setFontSettings(fs);
QtScriptHighlighter *highlighter = qobject_cast<QtScriptHighlighter*>(baseTextDocument()->syntaxHighlighter());
if (!highlighter)
return;
static QVector<QString> categories;
if (categories.isEmpty()) {
categories << QLatin1String(TextEditor::Constants::C_NUMBER)
<< QLatin1String(TextEditor::Constants::C_STRING)
<< QLatin1String(TextEditor::Constants::C_TYPE)
<< QLatin1String(TextEditor::Constants::C_KEYWORD)
<< QLatin1String(TextEditor::Constants::C_PREPROCESSOR)
<< QLatin1String(TextEditor::Constants::C_LABEL)
<< QLatin1String(TextEditor::Constants::C_COMMENT)
<< QLatin1String(TextEditor::Constants::C_VISUAL_WHITESPACE);
}
highlighter->setFormats(fs.toTextCharFormats(categories));
highlighter->rehighlight();
}
bool ScriptEditor::isElectricCharacter(const QChar &ch) const
{
if (ch == QLatin1Char('{') || ch == QLatin1Char('}'))
return true;
return false;
}
void ScriptEditor::indentBlock(QTextDocument *doc, QTextBlock block, QChar typedChar)
{
TextEditor::TabSettings ts = tabSettings();
SharedTools::QScriptIndenter indenter;
indenter.setTabSize(ts.m_tabSize);
indenter.setIndentSize(ts.m_indentSize);
const int indent = indenter.indentForBottomLine(doc->begin(), block.next(), typedChar);
ts.indentLine(block, indent);
}
TextEditor::BaseTextEditorEditable *ScriptEditor::createEditableInterface()
{
ScriptEditorEditable *editable = new ScriptEditorEditable(this, m_context);
createToolBar(editable);
return editable;
}
void ScriptEditor::createToolBar(ScriptEditorEditable *editable)
{
m_methodCombo = new QComboBox;
m_methodCombo->setMinimumContentsLength(22);
//m_methodCombo->setSizeAdjustPolicy(QComboBox::AdjustToContents);
// Make the combo box prefer to expand
QSizePolicy policy = m_methodCombo->sizePolicy();
policy.setHorizontalPolicy(QSizePolicy::Expanding);
m_methodCombo->setSizePolicy(policy);
connect(m_methodCombo, SIGNAL(activated(int)), this, SLOT(jumpToMethod(int)));
connect(this, SIGNAL(cursorPositionChanged()), this, SLOT(updateMethodBoxIndex()));
connect(m_methodCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(updateMethodBoxToolTip()));
connect(file(), SIGNAL(changed()), this, SLOT(updateFileName()));
QToolBar *toolBar = static_cast<QToolBar*>(editable->toolBar());
QList<QAction*> actions = toolBar->actions();
QWidget *w = toolBar->widgetForAction(actions.first());
static_cast<QHBoxLayout*>(w->layout())->insertWidget(0, m_methodCombo, 1);
}
void ScriptEditor::contextMenuEvent(QContextMenuEvent *e)
{
QMenu *menu = new QMenu();
if (Core::ActionContainer *mcontext = Core::ICore::instance()->actionManager()->actionContainer(QtScriptEditor::Constants::M_CONTEXT)) {
QMenu *contextMenu = mcontext->menu();
foreach (QAction *action, contextMenu->actions())
menu->addAction(action);
}
appendStandardContextMenuActions(menu);
menu->exec(e->globalPos());
delete menu;
}
void ScriptEditor::unCommentSelection()
{
Utils::unCommentSelection(this);
}
static bool isCompleteStringLiteral(const QStringRef &text)
{
if (text.length() < 2)
return false;
const QChar quote = text.at(0);
if (text.at(text.length() - 1) == quote)
return text.at(text.length() - 2) != QLatin1Char('\\'); // ### not exactly.
return false;
}
bool ScriptEditor::contextAllowsAutoParentheses(const QTextCursor &cursor, const QString &textToInsert) const
{
QChar ch;
if (! textToInsert.isEmpty())
ch = textToInsert.at(0);
switch (ch.unicode()) {
case '\'':
case '"':
case '(':
case '[':
case '{':
case ')':
case ']':
case '}':
case ';':
break;
default:
if (ch.isNull())
break;
return false;
} // end of switch
const QString blockText = cursor.block().text();
int blockState = cursor.block().userState();
if (blockState == -1)
blockState = 0;
else
blockState = blockState & 0xFF;
QScriptIncrementalScanner tokenize;
const QList<QScriptIncrementalScanner::Token> tokens = tokenize(blockText, blockState);
const int pos = cursor.columnNumber();
int tokenIndex = 0;
for (; tokenIndex < tokens.size(); ++tokenIndex) {
const QScriptIncrementalScanner::Token &token = tokens.at(tokenIndex);
if (pos >= token.begin()) {
if (pos < token.end())
break;
else if (pos == token.end() && (token.is(QScriptIncrementalScanner::Token::Comment) ||
token.is(QScriptIncrementalScanner::Token::String)))
break;
}
}
if (tokenIndex != tokens.size()) {
const QScriptIncrementalScanner::Token &token = tokens.at(tokenIndex);
switch (token.kind) {
case QScriptIncrementalScanner::Token::Comment:
return false;
case QScriptIncrementalScanner::Token::String: {
const QStringRef tokenText = blockText.midRef(token.offset, token.length);
const QChar quote = tokenText.at(0);
if (ch == quote && isCompleteStringLiteral(tokenText))
break;
return false;
}
default:
break;
} // end of switch
}
return true;
}
bool ScriptEditor::isInComment(const QTextCursor &) const
{
// ### implement me
return false;
}
QString ScriptEditor::insertMatchingBrace(const QTextCursor &tc, const QString &text, const QChar &, int *skippedChars) const
{
if (text.length() != 1)
return QString();
const QChar la = characterAt(tc.position());
const QChar ch = text.at(0);
switch (ch.unicode()) {
case '\'':
if (la != ch)
return QString(ch);
++*skippedChars;
break;
case '"':
if (la != ch)
return QString(ch);
++*skippedChars;
break;
case '(':
return QString(QLatin1Char(')'));
case '[':
return QString(QLatin1Char(']'));
case '{':
return QString(); // nothing to do.
case ')':
case ']':
case '}':
case ';':
if (la == ch)
++*skippedChars;
break;
default:
break;
} // end of switch
return QString();
}
QString ScriptEditor::insertParagraphSeparator(const QTextCursor &) const
{
return QLatin1String("}\n");
}
} // namespace Internal
} // namespace QtScriptEditor

View File

@@ -1,137 +0,0 @@
/**************************************************************************
**
** 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.
**
**************************************************************************/
#ifndef QTSCRIPTDITORW_H
#define QTSCRIPTDITORW_H
#include <texteditor/basetexteditor.h>
QT_BEGIN_NAMESPACE
class QComboBox;
class QTimer;
QT_END_NAMESPACE
namespace Core {
class ICore;
}
namespace QtScriptEditor {
namespace Internal {
class QtScriptHighlighter;
class ScriptEditor;
class ScriptEditorEditable : public TextEditor::BaseTextEditorEditable
{
public:
ScriptEditorEditable(ScriptEditor *, const QList<int> &);
QList<int> context() const;
bool duplicateSupported() const { return true; }
Core::IEditor *duplicate(QWidget *parent);
QString id() const;
bool isTemporary() const { return false; }
private:
QList<int> m_context;
};
struct Declaration
{
QString text;
int startLine;
int startColumn;
int endLine;
int endColumn;
Declaration()
: startLine(0),
startColumn(0),
endLine(0),
endColumn(0)
{ }
};
class ScriptEditor : public TextEditor::BaseTextEditor
{
Q_OBJECT
public:
typedef QList<int> Context;
ScriptEditor(const Context &context,
QWidget *parent = 0);
~ScriptEditor();
QList<Declaration> declarations() const;
QStringList words() const;
void unCommentSelection(); // from basetexteditor
public slots:
virtual void setFontSettings(const TextEditor::FontSettings &);
private slots:
void updateDocument();
void updateDocumentNow();
void jumpToMethod(int index);
void updateMethodBoxIndex();
void updateMethodBoxToolTip();
void updateFileName();
protected:
void contextMenuEvent(QContextMenuEvent *e);
TextEditor::BaseTextEditorEditable *createEditableInterface();
void createToolBar(ScriptEditorEditable *editable);
//// brace matching
virtual bool contextAllowsAutoParentheses(const QTextCursor &cursor, const QString &textToInsert = QString()) const;
virtual bool isInComment(const QTextCursor &cursor) const;
virtual QString insertMatchingBrace(const QTextCursor &tc, const QString &text, const QChar &la, int *skippedChars) const;
virtual QString insertParagraphSeparator(const QTextCursor &tc) const;
private:
virtual bool isElectricCharacter(const QChar &ch) const;
virtual void indentBlock(QTextDocument *doc, QTextBlock block, QChar typedChar);
const Context m_context;
QTimer *m_updateDocumentTimer;
QComboBox *m_methodCombo;
QList<Declaration> m_declarations;
QStringList m_words;
};
} // namespace Internal
} // namespace QtScriptEditor
#endif // QTSCRIPTDITORW_H

View File

@@ -1,25 +0,0 @@
TEMPLATE = lib
TARGET = QtScriptEditor
QT += script
include(../../qtcreatorplugin.pri)
include(../../plugins/coreplugin/coreplugin.pri)
include(../../plugins/texteditor/texteditor.pri)
include(parser/parser.pri)
include(../../shared/qscripthighlighter/qscripthighlighter.pri)
DEPENDPATH += ../../shared/qscripthighlighter
HEADERS += qtscripteditor.h \
qtscripteditorfactory.h \
qtscripteditorplugin.h \
qtscripthighlighter.h \
qtscriptcodecompletion.h
SOURCES += qtscripteditor.cpp \
qtscripteditorfactory.cpp \
qtscripteditorplugin.cpp \
qtscripthighlighter.cpp \
qtscriptcodecompletion.cpp
RESOURCES += qtscripteditor.qrc

View File

@@ -1,5 +0,0 @@
<RCC>
<qresource prefix="/qtscripteditor" >
<file>QtScriptEditor.mimetypes.xml</file>
</qresource>
</RCC>

View File

@@ -1,45 +0,0 @@
/**************************************************************************
**
** 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.
**
**************************************************************************/
#ifndef QTSCRIPTEDITOR_CONSTANTS_H
#define QTSCRIPTEDITOR_CONSTANTS_H
namespace QtScriptEditor {
namespace Constants {
const char * const M_CONTEXT = "Qt Script Editor.ContextMenu";
const char * const C_QTSCRIPTEDITOR_ID = "Qt4.ScriptEditor";
const char * const C_QTSCRIPTEDITOR_DISPLAY_NAME = QT_TRANSLATE_NOOP("OpenWith::Editors", "Qt Script Editor");
const char * const C_QTSCRIPTEDITOR_MIMETYPE = "application/javascript";
} // namespace Constants
} // namespace QtScriptEditor
#endif // QTSCRIPTEDITOR_CONSTANTS_H

View File

@@ -1,88 +0,0 @@
/**************************************************************************
**
** 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 "qtscripteditorfactory.h"
#include "qtscripteditor.h"
#include "qtscripteditorconstants.h"
#include "qtscripteditorplugin.h"
#include <coreplugin/icore.h>
#include <coreplugin/editormanager/editormanager.h>
#include <coreplugin/actionmanager/actionmanager.h>
#include <texteditor/texteditorconstants.h>
#include <QtCore/QFileInfo>
#include <QtCore/QDebug>
using namespace QtScriptEditor::Internal;
using namespace QtScriptEditor::Constants;
QtScriptEditorFactory::QtScriptEditorFactory(const Context &context, QObject *parent)
: Core::IEditorFactory(parent),
m_mimeTypes(QLatin1String(QtScriptEditor::Constants::C_QTSCRIPTEDITOR_MIMETYPE)),
m_context(context)
{
}
QtScriptEditorFactory::~QtScriptEditorFactory()
{
}
QString QtScriptEditorFactory::id() const
{
return QLatin1String(C_QTSCRIPTEDITOR_ID);
}
QString QtScriptEditorFactory::displayName() const
{
return tr(C_QTSCRIPTEDITOR_DISPLAY_NAME);
}
Core::IFile *QtScriptEditorFactory::open(const QString &fileName)
{
Core::IEditor *iface = Core::EditorManager::instance()->openEditor(fileName, id());
if (!iface) {
qWarning() << "QtScriptEditorFactory::open: openEditor failed for " << fileName;
return 0;
}
return iface->file();
}
Core::IEditor *QtScriptEditorFactory::createEditor(QWidget *parent)
{
ScriptEditor *rc = new ScriptEditor(m_context, parent);
QtScriptEditorPlugin::instance()->initializeEditor(rc);
return rc->editableInterface();
}
QStringList QtScriptEditorFactory::mimeTypes() const
{
return m_mimeTypes;
}

View File

@@ -1,72 +0,0 @@
/**************************************************************************
**
** 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.
**
**************************************************************************/
#ifndef RQTSCRIPTEDITORFACTORY_H
#define RQTSCRIPTEDITORFACTORY_H
#include <coreplugin/editormanager/ieditorfactory.h>
#include <QtCore/QStringList>
namespace TextEditor {
class TextEditorActionHandler;
}
namespace QtScriptEditor {
namespace Internal {
class QtScriptEditorActionHandler;
class QtScriptEditorFactory : public Core::IEditorFactory
{
Q_OBJECT
public:
typedef QList<int> Context;
QtScriptEditorFactory(const Context &context, QObject *parent);
~QtScriptEditorFactory();
virtual QStringList mimeTypes() const;
// IEditorFactory
QString id() const;
QString displayName() const;
Core::IFile *open(const QString &fileName);
Core::IEditor *createEditor(QWidget *parent);
private:
const QStringList m_mimeTypes;
const Context m_context;
};
} // namespace Internal
} // namespace QtScriptEditor
#endif // RQTSCRIPTEDITORFACTORY_H

View File

@@ -1,160 +0,0 @@
/**************************************************************************
**
** 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 "qtscripteditorplugin.h"
#include "qscripthighlighter.h"
#include "qtscripteditor.h"
#include "qtscripteditorconstants.h"
#include "qtscripteditorfactory.h"
#include "qtscriptcodecompletion.h"
#include <coreplugin/icore.h>
#include <coreplugin/coreconstants.h>
#include <coreplugin/mimedatabase.h>
#include <coreplugin/uniqueidmanager.h>
#include <coreplugin/actionmanager/actionmanager.h>
#include <extensionsystem/pluginmanager.h>
#include <texteditor/fontsettings.h>
#include <texteditor/storagesettings.h>
#include <texteditor/texteditorconstants.h>
#include <texteditor/texteditorsettings.h>
#include <texteditor/textfilewizard.h>
#include <texteditor/texteditoractionhandler.h>
#include <texteditor/completionsupport.h>
#include <utils/qtcassert.h>
#include <QtCore/QtPlugin>
#include <QtCore/QDebug>
#include <QtCore/QSettings>
#include <QtCore/QCoreApplication>
#include <QtGui/QAction>
using namespace QtScriptEditor::Internal;
using namespace QtScriptEditor::Constants;
QtScriptEditorPlugin *QtScriptEditorPlugin::m_instance = 0;
QtScriptEditorPlugin::QtScriptEditorPlugin() :
m_wizard(0),
m_editor(0),
m_actionHandler(0),
m_completion(0)
{
m_instance = this;
}
QtScriptEditorPlugin::~QtScriptEditorPlugin()
{
removeObject(m_editor);
removeObject(m_wizard);
delete m_actionHandler;
m_instance = 0;
}
bool QtScriptEditorPlugin::initialize(const QStringList & /*arguments*/, QString *error_message)
{
typedef SharedTools::QScriptHighlighter QScriptHighlighter;
Core::ICore *core = Core::ICore::instance();
if (!core->mimeDatabase()->addMimeTypes(QLatin1String(":/qtscripteditor/QtScriptEditor.mimetypes.xml"), error_message))
return false;
m_scriptcontext << core->uniqueIDManager()->uniqueIdentifier(QtScriptEditor::Constants::C_QTSCRIPTEDITOR_ID);
m_context = m_scriptcontext;
m_context << core->uniqueIDManager()->uniqueIdentifier(TextEditor::Constants::C_TEXTEDITOR);
m_actionHandler = new TextEditor::TextEditorActionHandler(QtScriptEditor::Constants::C_QTSCRIPTEDITOR_ID,
TextEditor::TextEditorActionHandler::Format
| TextEditor::TextEditorActionHandler::UnCommentSelection
| TextEditor::TextEditorActionHandler::UnCollapseAll);
registerActions();
m_editor = new QtScriptEditorFactory(m_context, this);
addObject(m_editor);
Core::BaseFileWizardParameters wizardParameters(Core::IWizard::FileWizard);
wizardParameters.setDescription(tr("Creates a Qt Script file."));
wizardParameters.setDisplayName(tr("Qt Script file"));
wizardParameters.setId(QLatin1String("Z.Script"));
wizardParameters.setCategory(QLatin1String(Core::Constants::WIZARD_CATEGORY_QT));
wizardParameters.setDisplayCategory(QCoreApplication::translate("Core", Core::Constants::WIZARD_TR_CATEGORY_QT));
m_wizard = new TextEditor::TextFileWizard(QLatin1String(QtScriptEditor::Constants::C_QTSCRIPTEDITOR_MIMETYPE),
QLatin1String(QtScriptEditor::Constants::C_QTSCRIPTEDITOR_ID),
QLatin1String("qtscript$"),
wizardParameters, this);
addObject(m_wizard);
m_completion = new QtScriptCodeCompletion();
addAutoReleasedObject(m_completion);
// Restore settings
QSettings *settings = Core::ICore::instance()->settings();
settings->beginGroup(QLatin1String("CppTools")); // ### FIXME:
settings->beginGroup(QLatin1String("Completion"));
const bool caseSensitive = settings->value(QLatin1String("CaseSensitive"), true).toBool();
m_completion->setCaseSensitivity(caseSensitive ? Qt::CaseSensitive : Qt::CaseInsensitive);
settings->endGroup();
settings->endGroup();
error_message->clear();
return true;
}
void QtScriptEditorPlugin::extensionsInitialized()
{
}
void QtScriptEditorPlugin::initializeEditor(QtScriptEditor::Internal::ScriptEditor *editor)
{
QTC_ASSERT(m_instance, /**/);
m_actionHandler->setupActions(editor);
TextEditor::TextEditorSettings::instance()->initializeEditor(editor);
// auto completion
connect(editor, SIGNAL(requestAutoCompletion(TextEditor::ITextEditable*, bool)),
TextEditor::Internal::CompletionSupport::instance(), SLOT(autoComplete(TextEditor::ITextEditable*, bool)));
}
void QtScriptEditorPlugin::registerActions()
{
m_actionHandler->initializeActions();
Core::ActionManager *am = Core::ICore::instance()->actionManager();
Core::ActionContainer *contextMenu= am->createMenu(QtScriptEditor::Constants::M_CONTEXT);
Core::Command *cmd = am->command(TextEditor::Constants::AUTO_INDENT_SELECTION);
contextMenu->addAction(cmd);
cmd = am->command(TextEditor::Constants::UN_COMMENT_SELECTION);
contextMenu->addAction(cmd);
}
Q_EXPORT_PLUGIN(QtScriptEditorPlugin)

View File

@@ -1,82 +0,0 @@
/**************************************************************************
**
** 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.
**
**************************************************************************/
#ifndef QTSCRIPTEDITORPLUGIN_H
#define QTSCRIPTEDITORPLUGIN_H
#include <extensionsystem/iplugin.h>
namespace TextEditor {
class TextFileWizard;
class TextEditorActionHandler;
} // namespace TextEditor
namespace QtScriptEditor {
namespace Internal {
class QtScriptEditorFactory;
class QtScriptCodeCompletion;
class ScriptEditor;
class QtScriptEditorPlugin : public ExtensionSystem::IPlugin
{
Q_OBJECT
public:
QtScriptEditorPlugin();
virtual ~QtScriptEditorPlugin();
// IPlugin
bool initialize(const QStringList &arguments, QString *errorMessage = 0);
void extensionsInitialized();
static QtScriptEditorPlugin *instance()
{ return m_instance; }
void initializeEditor(ScriptEditor *editor);
private:
void registerActions();
static QtScriptEditorPlugin *m_instance;
typedef QList<int> Context;
Context m_context;
Context m_scriptcontext;
TextEditor::TextFileWizard *m_wizard;
QtScriptEditorFactory *m_editor;
TextEditor::TextEditorActionHandler *m_actionHandler;
QtScriptCodeCompletion *m_completion;
};
} // namespace Internal
} // namespace QtScriptEditor
#endif // QTSCRIPTEDITORPLUGIN_H

View File

@@ -1,109 +0,0 @@
/**************************************************************************
**
** 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 "qtscripthighlighter.h"
#include <utils/qtcassert.h>
namespace QtScriptEditor {
namespace Internal {
QtScriptHighlighter::QtScriptHighlighter(QTextDocument *parent) :
SharedTools::QScriptHighlighter(false, parent)
{
m_currentBlockParentheses.reserve(20);
m_braceDepth = 0;
}
int QtScriptHighlighter::onBlockStart()
{
m_currentBlockParentheses.clear();
m_braceDepth = 0;
int state = 0;
int previousState = previousBlockState();
if (previousState != -1) {
state = previousState & 0xff;
m_braceDepth = previousState >> 8;
}
return state;
}
void QtScriptHighlighter::onOpeningParenthesis(QChar parenthesis, int pos)
{
if (parenthesis == QLatin1Char('{'))
++m_braceDepth;
m_currentBlockParentheses.push_back(Parenthesis(Parenthesis::Opened, parenthesis, pos));
}
void QtScriptHighlighter::onClosingParenthesis(QChar parenthesis, int pos)
{
if (parenthesis == QLatin1Char('}'))
--m_braceDepth;
m_currentBlockParentheses.push_back(Parenthesis(Parenthesis::Closed, parenthesis, pos));
}
void QtScriptHighlighter::onBlockEnd(int state, int firstNonSpace)
{
typedef TextEditor::TextBlockUserData TextEditorBlockData;
setCurrentBlockState((m_braceDepth << 8) | state);
// Set block data parentheses. Force creation of block data unless empty
TextEditorBlockData *blockData = 0;
if (QTextBlockUserData *userData = currentBlockUserData())
blockData = static_cast<TextEditorBlockData *>(userData);
if (!blockData && !m_currentBlockParentheses.empty()) {
blockData = new TextEditorBlockData;
setCurrentBlockUserData(blockData);
}
if (blockData) {
blockData->setParentheses(m_currentBlockParentheses);
blockData->setClosingCollapseMode(TextEditor::TextBlockUserData::NoClosingCollapse);
blockData->setCollapseMode(TextEditor::TextBlockUserData::NoCollapse);
}
if (!m_currentBlockParentheses.isEmpty()) {
QTC_ASSERT(blockData, return);
int collapse = Parenthesis::collapseAtPos(m_currentBlockParentheses);
if (collapse >= 0) {
if (collapse == firstNonSpace)
blockData->setCollapseMode(TextEditor::TextBlockUserData::CollapseThis);
else
blockData->setCollapseMode(TextEditor::TextBlockUserData::CollapseAfter);
}
if (Parenthesis::hasClosingCollapse(m_currentBlockParentheses))
blockData->setClosingCollapseMode(TextEditor::TextBlockUserData::NoClosingCollapse);
}
}
} // namespace Internal
} // namespace QtScriptEditor

View File

@@ -1,64 +0,0 @@
/**************************************************************************
**
** 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.
**
**************************************************************************/
#ifndef QTSCRIPTSYNTAXHIGHLIGHTER_H
#define QTSCRIPTSYNTAXHIGHLIGHTER_H
#include "qscripthighlighter.h"
#include <texteditor/basetexteditor.h>
namespace QtScriptEditor {
namespace Internal {
// Highlighter for Scripts that stores
// the parentheses encountered in the block data
// for parentheses matching to work.
class QtScriptHighlighter : public SharedTools::QScriptHighlighter
{
Q_OBJECT
public:
QtScriptHighlighter(QTextDocument *parent = 0);
private:
virtual int onBlockStart();
virtual void onOpeningParenthesis(QChar parenthesis, int pos);
virtual void onClosingParenthesis(QChar parenthesis, int pos);
virtual void onBlockEnd(int state, int firstNonSpace);
typedef TextEditor::Parenthesis Parenthesis;
typedef TextEditor::Parentheses Parentheses;
Parentheses m_currentBlockParentheses;
int m_braceDepth;
};
} // namespace Internal
} // namespace QtScriptEditor
#endif // QTSCRIPTSYNTAXHIGHLIGHTER_H

View File

@@ -3,7 +3,7 @@ CONFIG += qt warn_on console depend_includepath
QT += testlib
include(../../../../../src/shared/qmljs/qmljs.pri)
DEFINES += QML_BUILD_STATIC_LIB
EDITOR_DIR=../../../../../src/plugins/qmleditor
EDITOR_DIR=../../../../../src/plugins/qmljseditor
INCLUDEPATH += $$EDITOR_DIR

View File

@@ -11,8 +11,8 @@
#include <typeinfo>
using namespace Qml;
using namespace QmlEditor;
using namespace QmlEditor::Internal;
using namespace QmlJSEditor;
using namespace QmlJSEditor::Internal;
using namespace QmlJS;
using namespace QmlJS::AST;