diff --git a/src/plugins/plugins.pro b/src/plugins/plugins.pro index 2e3a354e941c97ef3cb4b2db996225eb77efea97..3ce320bbabb939756b79674e37bd3d7686fadfef 100644 --- a/src/plugins/plugins.pro +++ b/src/plugins/plugins.pro @@ -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 diff --git a/src/plugins/qmldesigner/core/filemanager/filemanager.pri b/src/plugins/qmldesigner/core/filemanager/filemanager.pri index 03ca7da00f50c60d64480fc6985ac01517259b66..81f5b3fd789a5322c402fa8e6d1aa31ff3bbc905 100644 --- a/src/plugins/qmldesigner/core/filemanager/filemanager.pri +++ b/src/plugins/qmldesigner/core/filemanager/filemanager.pri @@ -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 \ diff --git a/src/plugins/qmleditor/QmlEditor.mimetypes.xml b/src/plugins/qmleditor/QmlEditor.mimetypes.xml deleted file mode 100644 index 60528b73c3a8bd1f18d47b016aa89dac09fd097c..0000000000000000000000000000000000000000 --- a/src/plugins/qmleditor/QmlEditor.mimetypes.xml +++ /dev/null @@ -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> diff --git a/src/plugins/qmleditor/qmleditor.pri b/src/plugins/qmleditor/qmleditor.pri deleted file mode 100644 index 0635392969412034d4ca5a1f8a49d4aaac12f49b..0000000000000000000000000000000000000000 --- a/src/plugins/qmleditor/qmleditor.pri +++ /dev/null @@ -1,3 +0,0 @@ -include(qmleditor_dependencies.pri) - -LIBS *= -l$$qtLibraryTarget(QmlEditor) diff --git a/src/plugins/qmleditor/qmleditor.qrc b/src/plugins/qmleditor/qmleditor.qrc deleted file mode 100644 index b6eac04ae517e35cc2b89bf2fd64116404449e38..0000000000000000000000000000000000000000 --- a/src/plugins/qmleditor/qmleditor.qrc +++ /dev/null @@ -1,5 +0,0 @@ -<RCC> - <qresource prefix="/qmleditor" > - <file>QmlEditor.mimetypes.xml</file> - </qresource> -</RCC> diff --git a/src/plugins/qmleditor/qmleditor_global.h b/src/plugins/qmleditor/qmleditor_global.h deleted file mode 100644 index 81eacd75b40214886c19d3e2539701ce1f4c5dc0..0000000000000000000000000000000000000000 --- a/src/plugins/qmleditor/qmleditor_global.h +++ /dev/null @@ -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 diff --git a/src/plugins/qtscripteditor/QtScriptEditor.mimetypes.xml b/src/plugins/qmljseditor/QmlJSEditor.mimetypes.xml similarity index 70% rename from src/plugins/qtscripteditor/QtScriptEditor.mimetypes.xml rename to src/plugins/qmljseditor/QmlJSEditor.mimetypes.xml index 83a3ff27f1c4e7718d89a1d5198941be02daab29..480adbdf30b000d589ed62560bb7484d2b87f913 100644 --- a/src/plugins/qtscripteditor/QtScriptEditor.mimetypes.xml +++ b/src/plugins/qmljseditor/QmlJSEditor.mimetypes.xml @@ -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"/> diff --git a/src/plugins/qmleditor/QmlEditor.pluginspec b/src/plugins/qmljseditor/QmlJSEditor.pluginspec similarity index 88% rename from src/plugins/qmleditor/QmlEditor.pluginspec rename to src/plugins/qmljseditor/QmlJSEditor.pluginspec index 1e743258a3e412c70ea4aeff5d42695835d995d4..ce705010cd21f55204cf81f3880b316906c792b7 100644 --- a/src/plugins/qmleditor/QmlEditor.pluginspec +++ b/src/plugins/qmljseditor/QmlJSEditor.pluginspec @@ -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"/> diff --git a/src/plugins/qmleditor/qmlcodecompletion.cpp b/src/plugins/qmljseditor/qmlcodecompletion.cpp similarity index 97% rename from src/plugins/qmleditor/qmlcodecompletion.cpp rename to src/plugins/qmljseditor/qmlcodecompletion.cpp index 725748bd0b620d047bcb1cfb902d717bf52c3129..bc4888e4b1923d5760ace0d7f3e3fcf4c8b6822c 100644 --- a/src/plugins/qmleditor/qmlcodecompletion.cpp +++ b/src/plugins/qmljseditor/qmlcodecompletion.cpp @@ -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; diff --git a/src/plugins/qmleditor/qmlcodecompletion.h b/src/plugins/qmljseditor/qmlcodecompletion.h similarity index 97% rename from src/plugins/qmleditor/qmlcodecompletion.h rename to src/plugins/qmljseditor/qmlcodecompletion.h index 86305607a30c83a294f7fef98f5c5a603d54b0cd..d8510d200a760c29b75ca99faf9fb58b9f850deb 100644 --- a/src/plugins/qmleditor/qmlcodecompletion.h +++ b/src/plugins/qmljseditor/qmlcodecompletion.h @@ -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 diff --git a/src/plugins/qmleditor/qmlcompletionvisitor.cpp b/src/plugins/qmljseditor/qmlcompletionvisitor.cpp similarity index 100% rename from src/plugins/qmleditor/qmlcompletionvisitor.cpp rename to src/plugins/qmljseditor/qmlcompletionvisitor.cpp diff --git a/src/plugins/qmleditor/qmlcompletionvisitor.h b/src/plugins/qmljseditor/qmlcompletionvisitor.h similarity index 100% rename from src/plugins/qmleditor/qmlcompletionvisitor.h rename to src/plugins/qmljseditor/qmlcompletionvisitor.h diff --git a/src/plugins/qmleditor/qmlexpressionundercursor.cpp b/src/plugins/qmljseditor/qmlexpressionundercursor.cpp similarity index 99% rename from src/plugins/qmleditor/qmlexpressionundercursor.cpp rename to src/plugins/qmljseditor/qmlexpressionundercursor.cpp index feda2b13dcef06b1c7bc46214d7315a3f847c331..70c019795ddb26e9c516a37644414d9afb402cf6 100644 --- a/src/plugins/qmleditor/qmlexpressionundercursor.cpp +++ b/src/plugins/qmljseditor/qmlexpressionundercursor.cpp @@ -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), diff --git a/src/plugins/qmleditor/qmlexpressionundercursor.h b/src/plugins/qmljseditor/qmlexpressionundercursor.h similarity index 98% rename from src/plugins/qmleditor/qmlexpressionundercursor.h rename to src/plugins/qmljseditor/qmlexpressionundercursor.h index e054d913054a85a639184ea512a86eebc95b3163..c458caaaf7a26a779d2cea7ca13e477346845699 100644 --- a/src/plugins/qmleditor/qmlexpressionundercursor.h +++ b/src/plugins/qmljseditor/qmlexpressionundercursor.h @@ -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 diff --git a/src/plugins/qmleditor/qmlfilewizard.cpp b/src/plugins/qmljseditor/qmlfilewizard.cpp similarity index 92% rename from src/plugins/qmleditor/qmlfilewizard.cpp rename to src/plugins/qmljseditor/qmlfilewizard.cpp index 644bf524d01d734dfb85c1445e37a15b63756684..a35236ab52941edbeca450cda1505ab22f1e993f 100644 --- a/src/plugins/qmleditor/qmlfilewizard.cpp +++ b/src/plugins/qmljseditor/qmlfilewizard.cpp @@ -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 ¶meters, 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; diff --git a/src/plugins/qmleditor/qmlfilewizard.h b/src/plugins/qmljseditor/qmlfilewizard.h similarity index 97% rename from src/plugins/qmleditor/qmlfilewizard.h rename to src/plugins/qmljseditor/qmlfilewizard.h index f7eb84595f9e7c4ab3cc3964fca41c12e957ab1d..db5f35172ca8e6bdc2bc1a9eb4df9f20cd5e24c9 100644 --- a/src/plugins/qmleditor/qmlfilewizard.h +++ b/src/plugins/qmljseditor/qmlfilewizard.h @@ -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 diff --git a/src/plugins/qmleditor/qmlhighlighter.cpp b/src/plugins/qmljseditor/qmlhighlighter.cpp similarity index 98% rename from src/plugins/qmleditor/qmlhighlighter.cpp rename to src/plugins/qmljseditor/qmlhighlighter.cpp index 4f35bcd3723d662c8d48d3a92f0b1aec274d3172..b074ca2b17c868e06e3566bfc2d84a5b3e2e7be9 100644 --- a/src/plugins/qmleditor/qmlhighlighter.cpp +++ b/src/plugins/qmljseditor/qmlhighlighter.cpp @@ -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) diff --git a/src/plugins/qmleditor/qmlhighlighter.h b/src/plugins/qmljseditor/qmlhighlighter.h similarity index 97% rename from src/plugins/qmleditor/qmlhighlighter.h rename to src/plugins/qmljseditor/qmlhighlighter.h index d265b0e722978fe37aaac63d122c10b6a88877c3..0ffad660c3cbe937baa1761dc267bbb7f88f6b3e 100644 --- a/src/plugins/qmleditor/qmlhighlighter.h +++ b/src/plugins/qmljseditor/qmlhighlighter.h @@ -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 diff --git a/src/plugins/qmleditor/qmlhoverhandler.cpp b/src/plugins/qmljseditor/qmlhoverhandler.cpp similarity index 96% rename from src/plugins/qmleditor/qmlhoverhandler.cpp rename to src/plugins/qmljseditor/qmlhoverhandler.cpp index d508489e815efc62e322f24829328052a4e4bacc..6f33b6dd490cccd25499138004b061d316da1649 100644 --- a/src/plugins/qmleditor/qmlhoverhandler.cpp +++ b/src/plugins/qmljseditor/qmlhoverhandler.cpp @@ -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; diff --git a/src/plugins/qmleditor/qmlhoverhandler.h b/src/plugins/qmljseditor/qmlhoverhandler.h similarity index 97% rename from src/plugins/qmleditor/qmlhoverhandler.h rename to src/plugins/qmljseditor/qmlhoverhandler.h index b2050702e426701b8784d428e1559ec76097d198..7d3012b398eb28d78c738f0b3c367e701488c281 100644 --- a/src/plugins/qmleditor/qmlhoverhandler.h +++ b/src/plugins/qmljseditor/qmlhoverhandler.h @@ -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 diff --git a/src/plugins/qmleditor/qmleditor.cpp b/src/plugins/qmljseditor/qmljseditor.cpp similarity index 89% rename from src/plugins/qmleditor/qmleditor.cpp rename to src/plugins/qmljseditor/qmljseditor.cpp index b3bb4aed6358eb90b99dcb5307651b6a74f2c5bc..37736abf70ae71f38ecd8844304f3b0e0bb0ea3d 100644 --- a/src/plugins/qmleditor/qmleditor.cpp +++ b/src/plugins/qmljseditor/qmljseditor.cpp @@ -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 diff --git a/src/plugins/qmleditor/qmleditor.h b/src/plugins/qmljseditor/qmljseditor.h similarity index 90% rename from src/plugins/qmleditor/qmleditor.h rename to src/plugins/qmljseditor/qmljseditor.h index 4d5f9101da7b62ae24f6f39e1bfe5d8a6d372293..c3541a975f3654c3711320cc798f947016c166d2 100644 --- a/src/plugins/qmleditor/qmleditor.h +++ b/src/plugins/qmljseditor/qmljseditor.h @@ -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 diff --git a/src/plugins/qmljseditor/qmljseditor.pri b/src/plugins/qmljseditor/qmljseditor.pri new file mode 100644 index 0000000000000000000000000000000000000000..3bf969a302e47f30480102f9bab139e538636e14 --- /dev/null +++ b/src/plugins/qmljseditor/qmljseditor.pri @@ -0,0 +1,3 @@ +include(qmljseditor_dependencies.pri) + +LIBS *= -l$$qtLibraryTarget(QmlJSEditor) diff --git a/src/plugins/qmleditor/qmleditor.pro b/src/plugins/qmljseditor/qmljseditor.pro similarity index 61% rename from src/plugins/qmleditor/qmleditor.pro rename to src/plugins/qmljseditor/qmljseditor.pro index 3ab3c11f92810bfb8517fd8da1e29e9c7b356025..01ebebda2b875fa9f2fc47706462802c51c22ba3 100644 --- a/src/plugins/qmleditor/qmleditor.pro +++ b/src/plugins/qmljseditor/qmljseditor.pro @@ -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 diff --git a/src/plugins/qmljseditor/qmljseditor.qrc b/src/plugins/qmljseditor/qmljseditor.qrc new file mode 100644 index 0000000000000000000000000000000000000000..11ad582e93e5b452547aa6776dd7efb0bf04af68 --- /dev/null +++ b/src/plugins/qmljseditor/qmljseditor.qrc @@ -0,0 +1,5 @@ +<RCC> + <qresource prefix="/qmljseditor" > + <file>QmlJSEditor.mimetypes.xml</file> + </qresource> +</RCC> diff --git a/src/plugins/qmleditor/qmleditor_dependencies.pri b/src/plugins/qmljseditor/qmljseditor_dependencies.pri similarity index 100% rename from src/plugins/qmleditor/qmleditor_dependencies.pri rename to src/plugins/qmljseditor/qmljseditor_dependencies.pri diff --git a/src/plugins/qmldesigner/core/filemanager/qmleditor_global.h b/src/plugins/qmljseditor/qmljseditor_global.h similarity index 85% rename from src/plugins/qmldesigner/core/filemanager/qmleditor_global.h rename to src/plugins/qmljseditor/qmljseditor_global.h index 81eacd75b40214886c19d3e2539701ce1f4c5dc0..d49816b652a9de1e1efe367f1db381d473637a99 100644 --- a/src/plugins/qmldesigner/core/filemanager/qmleditor_global.h +++ b/src/plugins/qmljseditor/qmljseditor_global.h @@ -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 diff --git a/src/plugins/qmleditor/qmleditoractionhandler.cpp b/src/plugins/qmljseditor/qmljseditoractionhandler.cpp similarity index 82% rename from src/plugins/qmleditor/qmleditoractionhandler.cpp rename to src/plugins/qmljseditor/qmljseditoractionhandler.cpp index 019769c08aa4e6ee9139b46992fb4220d9e699f3..42f21553c8c54a58186b9279c9916ba2a2b6ac2e 100644 --- a/src/plugins/qmleditor/qmleditoractionhandler.cpp +++ b/src/plugins/qmljseditor/qmljseditoractionhandler.cpp @@ -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 diff --git a/src/plugins/qmleditor/qmleditoractionhandler.h b/src/plugins/qmljseditor/qmljseditoractionhandler.h similarity index 90% rename from src/plugins/qmleditor/qmleditoractionhandler.h rename to src/plugins/qmljseditor/qmljseditoractionhandler.h index 49b9c320ea138d716027a4180a194727e6e9651c..9b553362679295eb0f8e519fc58ff3e55cf0ea93 100644 --- a/src/plugins/qmleditor/qmleditoractionhandler.h +++ b/src/plugins/qmljseditor/qmljseditoractionhandler.h @@ -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 diff --git a/src/plugins/qmleditor/qmleditorconstants.h b/src/plugins/qmljseditor/qmljseditorconstants.h similarity index 69% rename from src/plugins/qmleditor/qmleditorconstants.h rename to src/plugins/qmljseditor/qmljseditorconstants.h index 9a8755b67933eec6b73512f34658b191071c7a0b..df82492d165ce4531410fbe71ef4b61e1a424da4 100644 --- a/src/plugins/qmleditor/qmleditorconstants.h +++ b/src/plugins/qmljseditor/qmljseditorconstants.h @@ -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 diff --git a/src/plugins/qmleditor/qmleditorfactory.cpp b/src/plugins/qmljseditor/qmljseditorfactory.cpp similarity index 65% rename from src/plugins/qmleditor/qmleditorfactory.cpp rename to src/plugins/qmljseditor/qmljseditorfactory.cpp index 13e308b58f80457bf2780e580a6e8dc175fb63b7..56654e5d2411892fb58d8596d766e9bbcede57f6 100644 --- a/src/plugins/qmleditor/qmleditorfactory.cpp +++ b/src/plugins/qmljseditor/qmljseditorfactory.cpp @@ -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; } diff --git a/src/plugins/qmleditor/qmleditorfactory.h b/src/plugins/qmljseditor/qmljseditorfactory.h similarity index 85% rename from src/plugins/qmleditor/qmleditorfactory.h rename to src/plugins/qmljseditor/qmljseditorfactory.h index f22b24c7a9ced39c944152a50a4065fa5209b969..4c3158bd07356350684f51d11f22119e9fe9e6dd 100644 --- a/src/plugins/qmleditor/qmleditorfactory.h +++ b/src/plugins/qmljseditor/qmljseditorfactory.h @@ -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 diff --git a/src/plugins/qmleditor/qmleditorplugin.cpp b/src/plugins/qmljseditor/qmljseditorplugin.cpp similarity index 85% rename from src/plugins/qmleditor/qmleditorplugin.cpp rename to src/plugins/qmljseditor/qmljseditorplugin.cpp index 13659fcdf23230494c0db4bbc3df1d69719b242c..aee7f43c5b574ca49240744317d5b8457f647bfc 100644 --- a/src/plugins/qmleditor/qmleditorplugin.cpp +++ b/src/plugins/qmljseditor/qmljseditorplugin.cpp @@ -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) diff --git a/src/plugins/qmleditor/qmleditorplugin.h b/src/plugins/qmljseditor/qmljseditorplugin.h similarity index 79% rename from src/plugins/qmleditor/qmleditorplugin.h rename to src/plugins/qmljseditor/qmljseditorplugin.h index 66a749973d19210b34b2edc9aeea0b584b4a44f6..660b118903be90d7e54016373de1e3276e0f48a8 100644 --- a/src/plugins/qmleditor/qmleditorplugin.h +++ b/src/plugins/qmljseditor/qmljseditorplugin.h @@ -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 diff --git a/src/plugins/qmleditor/qmllookupcontext.cpp b/src/plugins/qmljseditor/qmllookupcontext.cpp similarity index 99% rename from src/plugins/qmleditor/qmllookupcontext.cpp rename to src/plugins/qmljseditor/qmllookupcontext.cpp index f31031181647bd9874e4652fed62da6a8657e92b..d22133fc127ce404689c405bb211a93e7ba2ba7a 100644 --- a/src/plugins/qmleditor/qmllookupcontext.cpp +++ b/src/plugins/qmljseditor/qmllookupcontext.cpp @@ -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; diff --git a/src/plugins/qmleditor/qmllookupcontext.h b/src/plugins/qmljseditor/qmllookupcontext.h similarity index 98% rename from src/plugins/qmleditor/qmllookupcontext.h rename to src/plugins/qmljseditor/qmllookupcontext.h index b406d087cad7193eb79ab6f28f332229947c82b5..4817aa6a1c6f37cfa890eacbb0653f794c1cf538 100644 --- a/src/plugins/qmleditor/qmllookupcontext.h +++ b/src/plugins/qmljseditor/qmllookupcontext.h @@ -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 diff --git a/src/plugins/qmleditor/qmlmodelmanager.cpp b/src/plugins/qmljseditor/qmlmodelmanager.cpp similarity index 96% rename from src/plugins/qmleditor/qmlmodelmanager.cpp rename to src/plugins/qmljseditor/qmlmodelmanager.cpp index 8b8c46c9f60c5240b3373cec464c1cf803d5b822..495dcd0114aa4be0b06c82047fbdda8b849d2146 100644 --- a/src/plugins/qmleditor/qmlmodelmanager.cpp +++ b/src/plugins/qmljseditor/qmlmodelmanager.cpp @@ -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; diff --git a/src/plugins/qmleditor/qmlmodelmanager.h b/src/plugins/qmljseditor/qmlmodelmanager.h similarity index 98% rename from src/plugins/qmleditor/qmlmodelmanager.h rename to src/plugins/qmljseditor/qmlmodelmanager.h index dbc6d490cfabe4cb94b0709d7cfd0c9336b90b6c..e4617947f241c78b598189722a035e40548ff40c 100644 --- a/src/plugins/qmleditor/qmlmodelmanager.h +++ b/src/plugins/qmljseditor/qmlmodelmanager.h @@ -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 diff --git a/src/plugins/qmleditor/qmlmodelmanagerinterface.cpp b/src/plugins/qmljseditor/qmlmodelmanagerinterface.cpp similarity index 97% rename from src/plugins/qmleditor/qmlmodelmanagerinterface.cpp rename to src/plugins/qmljseditor/qmlmodelmanagerinterface.cpp index 774c3ffb5db6f3c441c68219ecc0e7ac50d55c1c..c899703cc524e638e44bef219bff23b006d381a6 100644 --- a/src/plugins/qmleditor/qmlmodelmanagerinterface.cpp +++ b/src/plugins/qmljseditor/qmlmodelmanagerinterface.cpp @@ -29,7 +29,7 @@ #include "qmlmodelmanagerinterface.h" -using namespace QmlEditor; +using namespace QmlJSEditor; QmlModelManagerInterface::QmlModelManagerInterface(QObject *parent): QObject(parent) diff --git a/src/plugins/qmleditor/qmlmodelmanagerinterface.h b/src/plugins/qmljseditor/qmlmodelmanagerinterface.h similarity index 92% rename from src/plugins/qmleditor/qmlmodelmanagerinterface.h rename to src/plugins/qmljseditor/qmlmodelmanagerinterface.h index 9de2e97dcb0090e360477cfd549d91b4ca9ed462..c23e4248ab129f08e321a4552fdd567898ff4358 100644 --- a/src/plugins/qmleditor/qmlmodelmanagerinterface.h +++ b/src/plugins/qmljseditor/qmlmodelmanagerinterface.h @@ -30,24 +30,22 @@ #ifndef QMLMODELMANAGERINTERFACE_H #define QMLMODELMANAGERINTERFACE_H -#include "qmleditor_global.h" - -#include <QObject> -#include <QStringList> -#include <QSharedPointer> +#include "qmljseditor_global.h" #include <qmljs/qmldocument.h> #include <qmljs/qmltypesystem.h> +#include <QObject> +#include <QStringList> +#include <QSharedPointer> 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 diff --git a/src/plugins/qmleditor/qmlresolveexpression.cpp b/src/plugins/qmljseditor/qmlresolveexpression.cpp similarity index 98% rename from src/plugins/qmleditor/qmlresolveexpression.cpp rename to src/plugins/qmljseditor/qmlresolveexpression.cpp index 2a626851b30f1a24d7ce2fa7be0a1c2405133278..80a54ee8d27538e0b61931d3d0bba2b902f44165 100644 --- a/src/plugins/qmleditor/qmlresolveexpression.cpp +++ b/src/plugins/qmljseditor/qmlresolveexpression.cpp @@ -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; diff --git a/src/plugins/qmleditor/qmlresolveexpression.h b/src/plugins/qmljseditor/qmlresolveexpression.h similarity index 97% rename from src/plugins/qmleditor/qmlresolveexpression.h rename to src/plugins/qmljseditor/qmlresolveexpression.h index 0e01f21cc38afaa6163157c91e9ec7304d0066c9..6bdfd2dedf388343c76a308bc35800fb5ddd4631 100644 --- a/src/plugins/qmleditor/qmlresolveexpression.h +++ b/src/plugins/qmljseditor/qmlresolveexpression.h @@ -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 diff --git a/src/plugins/qmlprojectmanager/QmlProjectManager.pluginspec b/src/plugins/qmlprojectmanager/QmlProjectManager.pluginspec index cff36bcfcb2405078d079ee9b099a54768caa4dc..37a61519fd27e8d9e22a052e2726c46916841c07 100644 --- a/src/plugins/qmlprojectmanager/QmlProjectManager.pluginspec +++ b/src/plugins/qmlprojectmanager/QmlProjectManager.pluginspec @@ -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> diff --git a/src/plugins/qmlprojectmanager/qmlproject.cpp b/src/plugins/qmlprojectmanager/qmlproject.cpp index edfb45a9859beeeda65fac832d0c5bc944f3729b..3f2f543a78b90c6652decf2f4e9c888bfd65ad73 100644 --- a/src/plugins/qmlprojectmanager/qmlproject.cpp +++ b/src/plugins/qmlprojectmanager/qmlproject.cpp @@ -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(); diff --git a/src/plugins/qmlprojectmanager/qmlproject.h b/src/plugins/qmlprojectmanager/qmlproject.h index 16e1d16aeef929a1feda52efb8285f6b8fbf4262..0f5da50297f3edd18afc1d46ad1a54c9dfb010d2 100644 --- a/src/plugins/qmlprojectmanager/qmlproject.h +++ b/src/plugins/qmlprojectmanager/qmlproject.h @@ -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; diff --git a/src/plugins/qmlprojectmanager/qmlprojectmanager_dependencies.pri b/src/plugins/qmlprojectmanager/qmlprojectmanager_dependencies.pri index 5a4e4cd588ffd1ad62696e16bf584b81833c9f80..1623c86f07a0ca37f943cf57d82c5ae3f0942867 100644 --- a/src/plugins/qmlprojectmanager/qmlprojectmanager_dependencies.pri +++ b/src/plugins/qmlprojectmanager/qmlprojectmanager_dependencies.pri @@ -1,3 +1,3 @@ include(../../plugins/projectexplorer/projectexplorer.pri) include(../../plugins/texteditor/texteditor.pri) -include(../../plugins/qmleditor/qmleditor.pri) +include(../../plugins/qmljseditor/qmljseditor.pri) diff --git a/src/plugins/qmlprojectmanager/qmlprojectplugin.cpp b/src/plugins/qmlprojectmanager/qmlprojectplugin.cpp index d07909d5f07c048c5c521603349e39d70b6fae50..4a06e4740f8550e2bc4779a9cc1c5e60479d70f5 100644 --- a/src/plugins/qmlprojectmanager/qmlprojectplugin.cpp +++ b/src/plugins/qmlprojectmanager/qmlprojectplugin.cpp @@ -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))); diff --git a/src/plugins/qtscripteditor/QtScriptEditor.pluginspec b/src/plugins/qtscripteditor/QtScriptEditor.pluginspec deleted file mode 100644 index b5814c711799fecd8a8e28b80d6f2567b1eb4204..0000000000000000000000000000000000000000 --- a/src/plugins/qtscripteditor/QtScriptEditor.pluginspec +++ /dev/null @@ -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> diff --git a/src/plugins/qtscripteditor/parser/javascript.g b/src/plugins/qtscripteditor/parser/javascript.g deleted file mode 100644 index 62bd02fa05006475e7a2a1ae9bc78783538e8a1f..0000000000000000000000000000000000000000 --- a/src/plugins/qtscripteditor/parser/javascript.g +++ /dev/null @@ -1,2189 +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. --- ---------------------------------------------------------------------------- - -%parser JavaScriptGrammar -%decl javascriptparser_p.h -%impl javascriptparser.cpp -%expect 3 -%expect-rr 1 - -%token T_AND "&" T_AND_AND "&&" T_AND_EQ "&=" -%token T_BREAK "break" T_CASE "case" T_CATCH "catch" -%token T_COLON ":" T_COMMA ";" T_CONTINUE "continue" -%token T_DEFAULT "default" T_DELETE "delete" T_DIVIDE_ "/" -%token T_DIVIDE_EQ "/=" T_DO "do" T_DOT "." -%token T_ELSE "else" T_EQ "=" T_EQ_EQ "==" -%token T_EQ_EQ_EQ "===" T_FINALLY "finally" T_FOR "for" -%token T_FUNCTION "function" T_GE ">=" T_GT ">" -%token T_GT_GT ">>" T_GT_GT_EQ ">>=" T_GT_GT_GT ">>>" -%token T_GT_GT_GT_EQ ">>>=" T_IDENTIFIER "identifier" T_IF "if" -%token T_IN "in" T_INSTANCEOF "instanceof" T_LBRACE "{" -%token T_LBRACKET "[" T_LE "<=" T_LPAREN "(" -%token T_LT "<" T_LT_LT "<<" T_LT_LT_EQ "<<=" -%token T_MINUS "-" T_MINUS_EQ "-=" T_MINUS_MINUS "--" -%token T_NEW "new" T_NOT "!" T_NOT_EQ "!=" -%token T_NOT_EQ_EQ "!==" T_NUMERIC_LITERAL "numeric literal" T_OR "|" -%token T_OR_EQ "|=" T_OR_OR "||" T_PLUS "+" -%token T_PLUS_EQ "+=" T_PLUS_PLUS "++" T_QUESTION "?" -%token T_RBRACE "}" T_RBRACKET "]" T_REMAINDER "%" -%token T_REMAINDER_EQ "%=" T_RETURN "return" T_RPAREN ")" -%token T_SEMICOLON ";" T_AUTOMATIC_SEMICOLON T_STAR "*" -%token T_STAR_EQ "*=" T_STRING_LITERAL "string literal" -%token T_SWITCH "switch" T_THIS "this" T_THROW "throw" -%token T_TILDE "~" T_TRY "try" T_TYPEOF "typeof" -%token T_VAR "var" T_VOID "void" T_WHILE "while" -%token T_WITH "with" T_XOR "^" T_XOR_EQ "^=" -%token T_NULL "null" T_TRUE "true" T_FALSE "false" -%token T_CONST "const" -%token T_DEBUGGER "debugger" -%token T_RESERVED_WORD "reserved word" - -%start Program - -/. -/************************************************************************** -** -** 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. -// - -#include <QtCore/QtDebug> -#include <string.h> -#include "javascriptengine_p.h" -#include "javascriptlexer_p.h" -#include "javascriptast_p.h" -#include "javascriptnodepool_p.h" - -#define J_SCRIPT_UPDATE_POSITION(node, startloc, endloc) do { \ - node->startLine = startloc.startLine; \ - node->startColumn = startloc.startColumn; \ - node->endLine = endloc.endLine; \ - node->endColumn = endloc.endColumn; \ -} while (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. -// 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 $table -{ -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))); -} - -:/ - - -/. - -#include "javascriptparser_p.h" - -// -// This file is automatically generated from javascript.g. -// Changes will be lost. -// To re-generate, run: qlalr --no-debug --no-lines --qt javascript.g -// - -QT_BEGIN_NAMESPACE - -inline static bool automatic(JavaScriptEnginePrivate *driver, int token) -{ - return token == $table::T_RBRACE - || token == 0 - || driver->lexer()->prevTerminator(); -} - - -JavaScriptParser::JavaScriptParser(): - tos(0), - stack_size(0), - sym_stack(0), - state_stack(0), - location_stack(0), - first_token(0), - last_token(0) -{ -} - -JavaScriptParser::~JavaScriptParser() -{ - if (stack_size) { - qFree(sym_stack); - qFree(state_stack); - qFree(location_stack); - } -} - -static inline JavaScriptParser::Location location(JavaScript::Lexer *lexer) -{ - JavaScriptParser::Location loc; - loc.startLine = lexer->startLineNo(); - loc.startColumn = lexer->startColumnNo(); - loc.endLine = lexer->endLineNo(); - loc.endColumn = lexer->endColumnNo(); - return loc; -} - -bool JavaScriptParser::parse(JavaScriptEnginePrivate *driver) -{ - JavaScript::Lexer *lexer = driver->lexer(); - bool hadErrors = false; - int yytoken = -1; - int action = 0; - - first_token = last_token = 0; - - tos = -1; - - do { - if (++tos == stack_size) - reallocateStack(); - - state_stack[tos] = action; - - _Lcheck_token: - if (yytoken == -1 && -TERMINAL_COUNT != action_index[action]) { - yyprevlloc = yylloc; - - if (first_token == last_token) { - yytoken = lexer->lex(); - yylval = lexer->dval(); - yylloc = location(lexer); - } else { - yytoken = first_token->token; - yylval = first_token->dval; - yylloc = first_token->loc; - ++first_token; - } - } - - action = t_action(action, yytoken); - if (action > 0) { - if (action != ACCEPT_STATE) { - yytoken = -1; - sym(1).dval = yylval; - loc(1) = yylloc; - } else { - --tos; - return ! hadErrors; - } - } else if (action < 0) { - const int r = -action - 1; - tos -= rhs[r]; - - switch (r) { -./ - -PrimaryExpression: T_THIS ; -/. -case $rule_number: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::ThisExpression> (driver->nodePool()); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(1)); -} break; -./ - -PrimaryExpression: T_IDENTIFIER ; -/. -case $rule_number: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::IdentifierExpression> (driver->nodePool(), sym(1).sval); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(1)); -} break; -./ - -PrimaryExpression: T_NULL ; -/. -case $rule_number: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::NullExpression> (driver->nodePool()); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(1)); -} break; -./ - -PrimaryExpression: T_TRUE ; -/. -case $rule_number: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::TrueLiteral> (driver->nodePool()); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(1)); -} break; -./ - -PrimaryExpression: T_FALSE ; -/. -case $rule_number: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::FalseLiteral> (driver->nodePool()); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(1)); -} break; -./ - -PrimaryExpression: T_NUMERIC_LITERAL ; -/. -case $rule_number: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::NumericLiteral> (driver->nodePool(), sym(1).dval); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(1)); -} break; -./ - -PrimaryExpression: T_STRING_LITERAL ; -/. -case $rule_number: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::StringLiteral> (driver->nodePool(), sym(1).sval); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(1)); -} break; -./ - -PrimaryExpression: T_DIVIDE_ ; -/: -#define J_SCRIPT_REGEXPLITERAL_RULE1 $rule_number -:/ -/. -case $rule_number: { - bool rx = lexer->scanRegExp(JavaScript::Lexer::NoPrefix); - if (!rx) { - diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, lexer->startLineNo(), - lexer->startColumnNo(), lexer->errorMessage())); - return false; - } - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::RegExpLiteral> (driver->nodePool(), lexer->pattern, lexer->flags); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(1)); -} break; -./ - -PrimaryExpression: T_DIVIDE_EQ ; -/: -#define J_SCRIPT_REGEXPLITERAL_RULE2 $rule_number -:/ -/. -case $rule_number: { - bool rx = lexer->scanRegExp(JavaScript::Lexer::EqualPrefix); - if (!rx) { - diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, lexer->startLineNo(), - lexer->startColumnNo(), lexer->errorMessage())); - return false; - } - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::RegExpLiteral> (driver->nodePool(), lexer->pattern, lexer->flags); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(1)); -} break; -./ - -PrimaryExpression: T_LBRACKET ElisionOpt T_RBRACKET ; -/. -case $rule_number: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::ArrayLiteral> (driver->nodePool(), sym(2).Elision); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); -} break; -./ - -PrimaryExpression: T_LBRACKET ElementList T_RBRACKET ; -/. -case $rule_number: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::ArrayLiteral> (driver->nodePool(), sym(2).ElementList->finish ()); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); -} break; -./ - -PrimaryExpression: T_LBRACKET ElementList T_COMMA ElisionOpt T_RBRACKET ; -/. -case $rule_number: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::ArrayLiteral> (driver->nodePool(), sym(2).ElementList->finish (), sym(4).Elision); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(5)); -} break; -./ - --- PrimaryExpression: T_LBRACE T_RBRACE ; --- /. --- case $rule_number: { --- sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::ObjectLiteral> (driver->nodePool()); --- J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(2)); --- } break; --- ./ - -PrimaryExpression: T_LBRACE PropertyNameAndValueListOpt T_RBRACE ; -/. -case $rule_number: { - if (sym(2).Node) - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::ObjectLiteral> (driver->nodePool(), sym(2).PropertyNameAndValueList->finish ()); - else - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::ObjectLiteral> (driver->nodePool()); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); -} break; -./ - -PrimaryExpression: T_LBRACE PropertyNameAndValueList T_COMMA T_RBRACE ; -/. -case $rule_number: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::ObjectLiteral> (driver->nodePool(), sym(2).PropertyNameAndValueList->finish ()); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(4)); -} break; -./ - -PrimaryExpression: T_LPAREN Expression T_RPAREN ; -/. -case $rule_number: { - sym(1) = sym(2); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); -} break; -./ - -ElementList: ElisionOpt AssignmentExpression ; -/. -case $rule_number: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::ElementList> (driver->nodePool(), sym(1).Elision, sym(2).Expression); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(2)); -} break; -./ - -ElementList: ElementList T_COMMA ElisionOpt AssignmentExpression ; -/. -case $rule_number: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::ElementList> (driver->nodePool(), sym(1).ElementList, sym(3).Elision, sym(4).Expression); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(4)); -} break; -./ - -Elision: T_COMMA ; -/. -case $rule_number: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::Elision> (driver->nodePool()); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(1)); -} break; -./ - -Elision: Elision T_COMMA ; -/. -case $rule_number: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::Elision> (driver->nodePool(), sym(1).Elision); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(2)); -} break; -./ - -ElisionOpt: ; -/. -case $rule_number: { - sym(1).Node = 0; -} break; -./ - -ElisionOpt: Elision ; -/. -case $rule_number: { - sym(1).Elision = sym(1).Elision->finish (); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(1)); -} break; -./ - -PropertyNameAndValueList: PropertyName T_COLON AssignmentExpression ; -/. -case $rule_number: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::PropertyNameAndValueList> (driver->nodePool(), sym(1).PropertyName, sym(3).Expression); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); -} break; -./ - -PropertyNameAndValueList: PropertyNameAndValueList T_COMMA PropertyName T_COLON AssignmentExpression ; -/. -case $rule_number: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::PropertyNameAndValueList> (driver->nodePool(), sym(1).PropertyNameAndValueList, sym(3).PropertyName, sym(5).Expression); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(5)); -} break; -./ - -PropertyName: T_IDENTIFIER ; -/. -case $rule_number: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::IdentifierPropertyName> (driver->nodePool(), sym(1).sval); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(1)); -} break; -./ - -PropertyName: T_STRING_LITERAL ; -/. -case $rule_number: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::StringLiteralPropertyName> (driver->nodePool(), sym(1).sval); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(1)); -} break; -./ - -PropertyName: T_NUMERIC_LITERAL ; -/. -case $rule_number: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::NumericLiteralPropertyName> (driver->nodePool(), sym(1).dval); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(1)); -} break; -./ - -PropertyName: ReservedIdentifier ; -/. -case $rule_number: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::IdentifierPropertyName> (driver->nodePool(), sym(1).sval); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(1)); -} break; -./ - -ReservedIdentifier: T_BREAK ; -/. -case $rule_number: -./ -ReservedIdentifier: T_CASE ; -/. -case $rule_number: -./ -ReservedIdentifier: T_CATCH ; -/. -case $rule_number: -./ -ReservedIdentifier: T_CONTINUE ; -/. -case $rule_number: -./ -ReservedIdentifier: T_DEFAULT ; -/. -case $rule_number: -./ -ReservedIdentifier: T_DELETE ; -/. -case $rule_number: -./ -ReservedIdentifier: T_DO ; -/. -case $rule_number: -./ -ReservedIdentifier: T_ELSE ; -/. -case $rule_number: -./ -ReservedIdentifier: T_FALSE ; -/. -case $rule_number: -./ -ReservedIdentifier: T_FINALLY ; -/. -case $rule_number: -./ -ReservedIdentifier: T_FOR ; -/. -case $rule_number: -./ -ReservedIdentifier: T_FUNCTION ; -/. -case $rule_number: -./ -ReservedIdentifier: T_IF ; -/. -case $rule_number: -./ -ReservedIdentifier: T_IN ; -/. -case $rule_number: -./ -ReservedIdentifier: T_INSTANCEOF ; -/. -case $rule_number: -./ -ReservedIdentifier: T_NEW ; -/. -case $rule_number: -./ -ReservedIdentifier: T_NULL ; -/. -case $rule_number: -./ -ReservedIdentifier: T_RETURN ; -/. -case $rule_number: -./ -ReservedIdentifier: T_SWITCH ; -/. -case $rule_number: -./ -ReservedIdentifier: T_THIS ; -/. -case $rule_number: -./ -ReservedIdentifier: T_THROW ; -/. -case $rule_number: -./ -ReservedIdentifier: T_TRUE ; -/. -case $rule_number: -./ -ReservedIdentifier: T_TRY ; -/. -case $rule_number: -./ -ReservedIdentifier: T_TYPEOF ; -/. -case $rule_number: -./ -ReservedIdentifier: T_VAR ; -/. -case $rule_number: -./ -ReservedIdentifier: T_VOID ; -/. -case $rule_number: -./ -ReservedIdentifier: T_WHILE ; -/. -case $rule_number: -./ -ReservedIdentifier: T_CONST ; -/. -case $rule_number: -./ -ReservedIdentifier: T_DEBUGGER ; -/. -case $rule_number: -./ -ReservedIdentifier: T_RESERVED_WORD ; -/. -case $rule_number: -./ -ReservedIdentifier: T_WITH ; -/. -case $rule_number: -{ - sym(1).sval = driver->intern(lexer->characterBuffer(), lexer->characterCount()); -} break; -./ - -PropertyIdentifier: T_IDENTIFIER ; -PropertyIdentifier: ReservedIdentifier ; - -MemberExpression: PrimaryExpression ; -MemberExpression: FunctionExpression ; - -MemberExpression: MemberExpression T_LBRACKET Expression T_RBRACKET ; -/. -case $rule_number: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::ArrayMemberExpression> (driver->nodePool(), sym(1).Expression, sym(3).Expression); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(4)); -} break; -./ - -MemberExpression: MemberExpression T_DOT PropertyIdentifier ; -/. -case $rule_number: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::FieldMemberExpression> (driver->nodePool(), sym(1).Expression, sym(3).sval); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(4)); -} break; -./ - -MemberExpression: T_NEW MemberExpression Arguments ; -/. -case $rule_number: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::NewMemberExpression> (driver->nodePool(), sym(2).Expression, sym(3).ArgumentList); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); -} break; -./ - -NewExpression: MemberExpression ; - -NewExpression: T_NEW NewExpression ; -/. -case $rule_number: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::NewExpression> (driver->nodePool(), sym(2).Expression); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(2)); -} break; -./ - -CallExpression: MemberExpression Arguments ; -/. -case $rule_number: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::CallExpression> (driver->nodePool(), sym(1).Expression, sym(2).ArgumentList); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(2)); -} break; -./ - -CallExpression: CallExpression Arguments ; -/. -case $rule_number: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::CallExpression> (driver->nodePool(), sym(1).Expression, sym(2).ArgumentList); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(2)); -} break; -./ - -CallExpression: CallExpression T_LBRACKET Expression T_RBRACKET ; -/. -case $rule_number: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::ArrayMemberExpression> (driver->nodePool(), sym(1).Expression, sym(3).Expression); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(4)); -} break; -./ - -CallExpression: CallExpression T_DOT PropertyIdentifier ; -/. -case $rule_number: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::FieldMemberExpression> (driver->nodePool(), sym(1).Expression, sym(3).sval); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); -} break; -./ - -Arguments: T_LPAREN T_RPAREN ; -/. -case $rule_number: { - sym(1).Node = 0; -} break; -./ - -Arguments: T_LPAREN ArgumentList T_RPAREN ; -/. -case $rule_number: { - sym(1).Node = sym(2).ArgumentList->finish (); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); -} break; -./ - -ArgumentList: AssignmentExpression ; -/. -case $rule_number: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::ArgumentList> (driver->nodePool(), sym(1).Expression); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(1)); -} break; -./ - -ArgumentList: ArgumentList T_COMMA AssignmentExpression ; -/. -case $rule_number: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::ArgumentList> (driver->nodePool(), sym(1).ArgumentList, sym(3).Expression); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); -} break; -./ - -LeftHandSideExpression: NewExpression ; -LeftHandSideExpression: CallExpression ; -PostfixExpression: LeftHandSideExpression ; - -PostfixExpression: LeftHandSideExpression T_PLUS_PLUS ; -/. -case $rule_number: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::PostIncrementExpression> (driver->nodePool(), sym(1).Expression); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(2)); -} break; -./ - -PostfixExpression: LeftHandSideExpression T_MINUS_MINUS ; -/. -case $rule_number: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::PostDecrementExpression> (driver->nodePool(), sym(1).Expression); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(2)); -} break; -./ - -UnaryExpression: PostfixExpression ; - -UnaryExpression: T_DELETE UnaryExpression ; -/. -case $rule_number: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::DeleteExpression> (driver->nodePool(), sym(2).Expression); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(2)); -} break; -./ - -UnaryExpression: T_VOID UnaryExpression ; -/. -case $rule_number: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::VoidExpression> (driver->nodePool(), sym(2).Expression); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(2)); -} break; -./ - -UnaryExpression: T_TYPEOF UnaryExpression ; -/. -case $rule_number: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::TypeOfExpression> (driver->nodePool(), sym(2).Expression); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(2)); -} break; -./ - -UnaryExpression: T_PLUS_PLUS UnaryExpression ; -/. -case $rule_number: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::PreIncrementExpression> (driver->nodePool(), sym(2).Expression); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(2)); -} break; -./ - -UnaryExpression: T_MINUS_MINUS UnaryExpression ; -/. -case $rule_number: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::PreDecrementExpression> (driver->nodePool(), sym(2).Expression); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(2)); -} break; -./ - -UnaryExpression: T_PLUS UnaryExpression ; -/. -case $rule_number: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::UnaryPlusExpression> (driver->nodePool(), sym(2).Expression); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(2)); -} break; -./ - -UnaryExpression: T_MINUS UnaryExpression ; -/. -case $rule_number: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::UnaryMinusExpression> (driver->nodePool(), sym(2).Expression); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(2)); -} break; -./ - -UnaryExpression: T_TILDE UnaryExpression ; -/. -case $rule_number: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::TildeExpression> (driver->nodePool(), sym(2).Expression); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(2)); -} break; -./ - -UnaryExpression: T_NOT UnaryExpression ; -/. -case $rule_number: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::NotExpression> (driver->nodePool(), sym(2).Expression); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(2)); -} break; -./ - -MultiplicativeExpression: UnaryExpression ; - -MultiplicativeExpression: MultiplicativeExpression T_STAR UnaryExpression ; -/. -case $rule_number: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::Mul, sym(3).Expression); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); -} break; -./ - -MultiplicativeExpression: MultiplicativeExpression T_DIVIDE_ UnaryExpression ; -/. -case $rule_number: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::Div, sym(3).Expression); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); -} break; -./ - -MultiplicativeExpression: MultiplicativeExpression T_REMAINDER UnaryExpression ; -/. -case $rule_number: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::Mod, sym(3).Expression); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); -} break; -./ - -AdditiveExpression: MultiplicativeExpression ; - -AdditiveExpression: AdditiveExpression T_PLUS MultiplicativeExpression ; -/. -case $rule_number: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::Add, sym(3).Expression); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); -} break; -./ - -AdditiveExpression: AdditiveExpression T_MINUS MultiplicativeExpression ; -/. -case $rule_number: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::Sub, sym(3).Expression); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); -} break; -./ - -ShiftExpression: AdditiveExpression ; - -ShiftExpression: ShiftExpression T_LT_LT AdditiveExpression ; -/. -case $rule_number: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::LShift, sym(3).Expression); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); -} break; -./ - -ShiftExpression: ShiftExpression T_GT_GT AdditiveExpression ; -/. -case $rule_number: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::RShift, sym(3).Expression); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); -} break; -./ - -ShiftExpression: ShiftExpression T_GT_GT_GT AdditiveExpression ; -/. -case $rule_number: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::URShift, sym(3).Expression); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); -} break; -./ - -RelationalExpression: ShiftExpression ; - -RelationalExpression: RelationalExpression T_LT ShiftExpression ; -/. -case $rule_number: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::Lt, sym(3).Expression); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); -} break; -./ - -RelationalExpression: RelationalExpression T_GT ShiftExpression ; -/. -case $rule_number: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::Gt, sym(3).Expression); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); -} break; -./ - -RelationalExpression: RelationalExpression T_LE ShiftExpression ; -/. -case $rule_number: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::Le, sym(3).Expression); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); -} break; -./ - -RelationalExpression: RelationalExpression T_GE ShiftExpression ; -/. -case $rule_number: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::Ge, sym(3).Expression); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); -} break; -./ - -RelationalExpression: RelationalExpression T_INSTANCEOF ShiftExpression ; -/. -case $rule_number: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::InstanceOf, sym(3).Expression); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); -} break; -./ - -RelationalExpression: RelationalExpression T_IN ShiftExpression ; -/. -case $rule_number: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::In, sym(3).Expression); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); -} break; -./ - -RelationalExpressionNotIn: ShiftExpression ; - -RelationalExpressionNotIn: RelationalExpressionNotIn T_LT ShiftExpression ; -/. -case $rule_number: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::Lt, sym(3).Expression); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); -} break; -./ - -RelationalExpressionNotIn: RelationalExpressionNotIn T_GT ShiftExpression ; -/. -case $rule_number: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::Gt, sym(3).Expression); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); -} break; -./ - -RelationalExpressionNotIn: RelationalExpressionNotIn T_LE ShiftExpression ; -/. -case $rule_number: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::Le, sym(3).Expression); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); -} break; -./ - -RelationalExpressionNotIn: RelationalExpressionNotIn T_GE ShiftExpression ; -/. -case $rule_number: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::Ge, sym(3).Expression); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); -} break; -./ - -RelationalExpressionNotIn: RelationalExpressionNotIn T_INSTANCEOF ShiftExpression ; -/. -case $rule_number: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::InstanceOf, sym(3).Expression); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); -} break; -./ - -EqualityExpression: RelationalExpression ; - -EqualityExpression: EqualityExpression T_EQ_EQ RelationalExpression ; -/. -case $rule_number: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::Equal, sym(3).Expression); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); -} break; -./ - -EqualityExpression: EqualityExpression T_NOT_EQ RelationalExpression ; -/. -case $rule_number: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::NotEqual, sym(3).Expression); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); -} break; -./ - -EqualityExpression: EqualityExpression T_EQ_EQ_EQ RelationalExpression ; -/. -case $rule_number: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::StrictEqual, sym(3).Expression); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); -} break; -./ - -EqualityExpression: EqualityExpression T_NOT_EQ_EQ RelationalExpression ; -/. -case $rule_number: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::StrictNotEqual, sym(3).Expression); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); -} break; -./ - -EqualityExpressionNotIn: RelationalExpressionNotIn ; - -EqualityExpressionNotIn: EqualityExpressionNotIn T_EQ_EQ RelationalExpressionNotIn ; -/. -case $rule_number: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::Equal, sym(3).Expression); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); -} break; -./ - -EqualityExpressionNotIn: EqualityExpressionNotIn T_NOT_EQ RelationalExpressionNotIn; -/. -case $rule_number: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::NotEqual, sym(3).Expression); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); -} break; -./ - -EqualityExpressionNotIn: EqualityExpressionNotIn T_EQ_EQ_EQ RelationalExpressionNotIn ; -/. -case $rule_number: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::StrictEqual, sym(3).Expression); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); -} break; -./ - -EqualityExpressionNotIn: EqualityExpressionNotIn T_NOT_EQ_EQ RelationalExpressionNotIn ; -/. -case $rule_number: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::StrictNotEqual, sym(3).Expression); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); -} break; -./ - -BitwiseANDExpression: EqualityExpression ; - -BitwiseANDExpression: BitwiseANDExpression T_AND EqualityExpression ; -/. -case $rule_number: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::BitAnd, sym(3).Expression); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); -} break; -./ - -BitwiseANDExpressionNotIn: EqualityExpressionNotIn ; - -BitwiseANDExpressionNotIn: BitwiseANDExpressionNotIn T_AND EqualityExpressionNotIn ; -/. -case $rule_number: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::BitAnd, sym(3).Expression); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); -} break; -./ - -BitwiseXORExpression: BitwiseANDExpression ; - -BitwiseXORExpression: BitwiseXORExpression T_XOR BitwiseANDExpression ; -/. -case $rule_number: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::BitXor, sym(3).Expression); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); -} break; -./ - -BitwiseXORExpressionNotIn: BitwiseANDExpressionNotIn ; - -BitwiseXORExpressionNotIn: BitwiseXORExpressionNotIn T_XOR BitwiseANDExpressionNotIn ; -/. -case $rule_number: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::BitXor, sym(3).Expression); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); -} break; -./ - -BitwiseORExpression: BitwiseXORExpression ; - -BitwiseORExpression: BitwiseORExpression T_OR BitwiseXORExpression ; -/. -case $rule_number: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::BitOr, sym(3).Expression); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); -} break; -./ - -BitwiseORExpressionNotIn: BitwiseXORExpressionNotIn ; - -BitwiseORExpressionNotIn: BitwiseORExpressionNotIn T_OR BitwiseXORExpressionNotIn ; -/. -case $rule_number: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::BitOr, sym(3).Expression); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); -} break; -./ - -LogicalANDExpression: BitwiseORExpression ; - -LogicalANDExpression: LogicalANDExpression T_AND_AND BitwiseORExpression ; -/. -case $rule_number: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::And, sym(3).Expression); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); -} break; -./ - -LogicalANDExpressionNotIn: BitwiseORExpressionNotIn ; - -LogicalANDExpressionNotIn: LogicalANDExpressionNotIn T_AND_AND BitwiseORExpressionNotIn ; -/. -case $rule_number: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::And, sym(3).Expression); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); -} break; -./ - -LogicalORExpression: LogicalANDExpression ; - -LogicalORExpression: LogicalORExpression T_OR_OR LogicalANDExpression ; -/. -case $rule_number: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::Or, sym(3).Expression); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); -} break; -./ - -LogicalORExpressionNotIn: LogicalANDExpressionNotIn ; - -LogicalORExpressionNotIn: LogicalORExpressionNotIn T_OR_OR LogicalANDExpressionNotIn ; -/. -case $rule_number: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::Or, sym(3).Expression); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); -} break; -./ - -ConditionalExpression: LogicalORExpression ; - -ConditionalExpression: LogicalORExpression T_QUESTION AssignmentExpression T_COLON AssignmentExpression ; -/. -case $rule_number: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::ConditionalExpression> (driver->nodePool(), sym(1).Expression, sym(3).Expression, sym(5).Expression); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); -} break; -./ - -ConditionalExpressionNotIn: LogicalORExpressionNotIn ; - -ConditionalExpressionNotIn: LogicalORExpressionNotIn T_QUESTION AssignmentExpressionNotIn T_COLON AssignmentExpressionNotIn ; -/. -case $rule_number: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::ConditionalExpression> (driver->nodePool(), sym(1).Expression, sym(3).Expression, sym(5).Expression); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); -} break; -./ - -AssignmentExpression: ConditionalExpression ; - -AssignmentExpression: LeftHandSideExpression AssignmentOperator AssignmentExpression ; -/. -case $rule_number: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, sym(2).ival, sym(3).Expression); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); -} break; -./ - -AssignmentExpressionNotIn: ConditionalExpressionNotIn ; - -AssignmentExpressionNotIn: LeftHandSideExpression AssignmentOperator AssignmentExpressionNotIn ; -/. -case $rule_number: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, sym(2).ival, sym(3).Expression); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); -} break; -./ - -AssignmentOperator: T_EQ ; -/. -case $rule_number: { - sym(1).ival = QSOperator::Assign; -} break; -./ - -AssignmentOperator: T_STAR_EQ ; -/. -case $rule_number: { - sym(1).ival = QSOperator::InplaceMul; -} break; -./ - -AssignmentOperator: T_DIVIDE_EQ ; -/. -case $rule_number: { - sym(1).ival = QSOperator::InplaceDiv; -} break; -./ - -AssignmentOperator: T_REMAINDER_EQ ; -/. -case $rule_number: { - sym(1).ival = QSOperator::InplaceMod; -} break; -./ - -AssignmentOperator: T_PLUS_EQ ; -/. -case $rule_number: { - sym(1).ival = QSOperator::InplaceAdd; -} break; -./ - -AssignmentOperator: T_MINUS_EQ ; -/. -case $rule_number: { - sym(1).ival = QSOperator::InplaceSub; -} break; -./ - -AssignmentOperator: T_LT_LT_EQ ; -/. -case $rule_number: { - sym(1).ival = QSOperator::InplaceLeftShift; -} break; -./ - -AssignmentOperator: T_GT_GT_EQ ; -/. -case $rule_number: { - sym(1).ival = QSOperator::InplaceRightShift; -} break; -./ - -AssignmentOperator: T_GT_GT_GT_EQ ; -/. -case $rule_number: { - sym(1).ival = QSOperator::InplaceURightShift; -} break; -./ - -AssignmentOperator: T_AND_EQ ; -/. -case $rule_number: { - sym(1).ival = QSOperator::InplaceAnd; -} break; -./ - -AssignmentOperator: T_XOR_EQ ; -/. -case $rule_number: { - sym(1).ival = QSOperator::InplaceXor; -} break; -./ - -AssignmentOperator: T_OR_EQ ; -/. -case $rule_number: { - sym(1).ival = QSOperator::InplaceOr; -} break; -./ - -Expression: AssignmentExpression ; - -Expression: Expression T_COMMA AssignmentExpression ; -/. -case $rule_number: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::Expression> (driver->nodePool(), sym(1).Expression, sym(3).Expression); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); -} break; -./ - -ExpressionOpt: ; -/. -case $rule_number: { - sym(1).Node = 0; -} break; -./ - -ExpressionOpt: Expression ; - -ExpressionNotIn: AssignmentExpressionNotIn ; - -ExpressionNotIn: ExpressionNotIn T_COMMA AssignmentExpressionNotIn ; -/. -case $rule_number: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::Expression> (driver->nodePool(), sym(1).Expression, sym(3).Expression); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); -} break; -./ - -ExpressionNotInOpt: ; -/. -case $rule_number: { - sym(1).Node = 0; -} break; -./ - -ExpressionNotInOpt: ExpressionNotIn ; - -Statement: Block ; -Statement: VariableStatement ; -Statement: EmptyStatement ; -Statement: ExpressionStatement ; -Statement: IfStatement ; -Statement: IterationStatement ; -Statement: ContinueStatement ; -Statement: BreakStatement ; -Statement: ReturnStatement ; -Statement: WithStatement ; -Statement: LabelledStatement ; -Statement: SwitchStatement ; -Statement: ThrowStatement ; -Statement: TryStatement ; -Statement: DebuggerStatement ; - - -Block: T_LBRACE StatementListOpt T_RBRACE ; -/. -case $rule_number: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::Block> (driver->nodePool(), sym(2).StatementList); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); -} break; -./ - -StatementList: Statement ; -/. -case $rule_number: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::StatementList> (driver->nodePool(), sym(1).Statement); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(1)); -} break; -./ - -StatementList: StatementList Statement ; -/. -case $rule_number: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::StatementList> (driver->nodePool(), sym(1).StatementList, sym(2).Statement); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(2)); -} break; -./ - -StatementListOpt: ; -/. -case $rule_number: { - sym(1).Node = 0; -} break; -./ - -StatementListOpt: StatementList ; -/. -case $rule_number: { - sym(1).Node = sym(1).StatementList->finish (); -} break; -./ - -VariableStatement: VariableDeclarationKind VariableDeclarationList T_AUTOMATIC_SEMICOLON ; -- automatic semicolon -VariableStatement: VariableDeclarationKind VariableDeclarationList T_SEMICOLON ; -/. -case $rule_number: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::VariableStatement> (driver->nodePool(), sym(2).VariableDeclarationList->finish (/*readOnly=*/sym(1).ival == T_CONST)); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); -} break; -./ - -VariableDeclarationKind: T_CONST ; -/. -case $rule_number: { - sym(1).ival = T_CONST; -} break; -./ - -VariableDeclarationKind: T_VAR ; -/. -case $rule_number: { - sym(1).ival = T_VAR; -} break; -./ - -VariableDeclarationList: VariableDeclaration ; -/. -case $rule_number: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::VariableDeclarationList> (driver->nodePool(), sym(1).VariableDeclaration); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(1)); -} break; -./ - -VariableDeclarationList: VariableDeclarationList T_COMMA VariableDeclaration ; -/. -case $rule_number: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::VariableDeclarationList> (driver->nodePool(), sym(1).VariableDeclarationList, sym(3).VariableDeclaration); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); -} break; -./ - -VariableDeclarationListNotIn: VariableDeclarationNotIn ; -/. -case $rule_number: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::VariableDeclarationList> (driver->nodePool(), sym(1).VariableDeclaration); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(1)); -} break; -./ - -VariableDeclarationListNotIn: VariableDeclarationListNotIn T_COMMA VariableDeclarationNotIn ; -/. -case $rule_number: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::VariableDeclarationList> (driver->nodePool(), sym(1).VariableDeclarationList, sym(3).VariableDeclaration); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); -} break; -./ - -VariableDeclaration: T_IDENTIFIER InitialiserOpt ; -/. -case $rule_number: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::VariableDeclaration> (driver->nodePool(), sym(1).sval, sym(2).Expression); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(2)); -} break; -./ - -VariableDeclarationNotIn: T_IDENTIFIER InitialiserNotInOpt ; -/. -case $rule_number: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::VariableDeclaration> (driver->nodePool(), sym(1).sval, sym(2).Expression); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(2)); -} break; -./ - -Initialiser: T_EQ AssignmentExpression ; -/. -case $rule_number: { - sym(1) = sym(2); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(2)); -} break; -./ - -InitialiserOpt: ; -/. -case $rule_number: { - sym(1).Node = 0; -} break; -./ - -InitialiserOpt: Initialiser ; - -InitialiserNotIn: T_EQ AssignmentExpressionNotIn ; -/. -case $rule_number: { - sym(1) = sym(2); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(2)); -} break; -./ - -InitialiserNotInOpt: ; -/. -case $rule_number: { - sym(1).Node = 0; -} break; -./ - -InitialiserNotInOpt: InitialiserNotIn ; - -EmptyStatement: T_SEMICOLON ; -/. -case $rule_number: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::EmptyStatement> (driver->nodePool()); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(1)); -} break; -./ - -ExpressionStatement: Expression T_AUTOMATIC_SEMICOLON ; -- automatic semicolon -ExpressionStatement: Expression T_SEMICOLON ; -/. -case $rule_number: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::ExpressionStatement> (driver->nodePool(), sym(1).Expression); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(2)); -} break; -./ - -IfStatement: T_IF T_LPAREN Expression T_RPAREN Statement T_ELSE Statement ; -/. -case $rule_number: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::IfStatement> (driver->nodePool(), sym(3).Expression, sym(5).Statement, sym(7).Statement); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(7)); -} break; -./ - -IfStatement: T_IF T_LPAREN Expression T_RPAREN Statement ; -/. -case $rule_number: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::IfStatement> (driver->nodePool(), sym(3).Expression, sym(5).Statement); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(5)); -} break; -./ - - -IterationStatement: T_DO Statement T_WHILE T_LPAREN Expression T_RPAREN T_AUTOMATIC_SEMICOLON ; -- automatic semicolon -IterationStatement: T_DO Statement T_WHILE T_LPAREN Expression T_RPAREN T_SEMICOLON ; -/. -case $rule_number: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::DoWhileStatement> (driver->nodePool(), sym(2).Statement, sym(5).Expression); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(7)); -} break; -./ - -IterationStatement: T_WHILE T_LPAREN Expression T_RPAREN Statement ; -/. -case $rule_number: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::WhileStatement> (driver->nodePool(), sym(3).Expression, sym(5).Statement); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(5)); -} break; -./ - -IterationStatement: T_FOR T_LPAREN ExpressionNotInOpt T_SEMICOLON ExpressionOpt T_SEMICOLON ExpressionOpt T_RPAREN Statement ; -/. -case $rule_number: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::ForStatement> (driver->nodePool(), sym(3).Expression, sym(5).Expression, sym(7).Expression, sym(9).Statement); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(9)); -} break; -./ - -IterationStatement: T_FOR T_LPAREN T_VAR VariableDeclarationListNotIn T_SEMICOLON ExpressionOpt T_SEMICOLON ExpressionOpt T_RPAREN Statement ; -/. -case $rule_number: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::LocalForStatement> (driver->nodePool(), sym(4).VariableDeclarationList->finish (/*readOnly=*/false), sym(6).Expression, sym(8).Expression, sym(10).Statement); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(10)); -} break; -./ - -IterationStatement: T_FOR T_LPAREN LeftHandSideExpression T_IN Expression T_RPAREN Statement ; -/. -case $rule_number: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::ForEachStatement> (driver->nodePool(), sym(3).Expression, sym(5).Expression, sym(7).Statement); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(7)); -} break; -./ - -IterationStatement: T_FOR T_LPAREN T_VAR VariableDeclarationNotIn T_IN Expression T_RPAREN Statement ; -/. -case $rule_number: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::LocalForEachStatement> (driver->nodePool(), sym(4).VariableDeclaration, sym(6).Expression, sym(8).Statement); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(8)); -} break; -./ - -ContinueStatement: T_CONTINUE T_AUTOMATIC_SEMICOLON ; -- automatic semicolon -ContinueStatement: T_CONTINUE T_SEMICOLON ; -/. -case $rule_number: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::ContinueStatement> (driver->nodePool()); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(2)); -} break; -./ - -ContinueStatement: T_CONTINUE T_IDENTIFIER T_AUTOMATIC_SEMICOLON ; -- automatic semicolon -ContinueStatement: T_CONTINUE T_IDENTIFIER T_SEMICOLON ; -/. -case $rule_number: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::ContinueStatement> (driver->nodePool(), sym(2).sval); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); -} break; -./ - -BreakStatement: T_BREAK T_AUTOMATIC_SEMICOLON ; -- automatic semicolon -BreakStatement: T_BREAK T_SEMICOLON ; -/. -case $rule_number: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::BreakStatement> (driver->nodePool()); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(2)); -} break; -./ - -BreakStatement: T_BREAK T_IDENTIFIER T_AUTOMATIC_SEMICOLON ; -- automatic semicolon -BreakStatement: T_BREAK T_IDENTIFIER T_SEMICOLON ; -/. -case $rule_number: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::BreakStatement> (driver->nodePool(), sym(2).sval); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); -} break; -./ - -ReturnStatement: T_RETURN ExpressionOpt T_AUTOMATIC_SEMICOLON ; -- automatic semicolon -ReturnStatement: T_RETURN ExpressionOpt T_SEMICOLON ; -/. -case $rule_number: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::ReturnStatement> (driver->nodePool(), sym(2).Expression); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); -} break; -./ - -WithStatement: T_WITH T_LPAREN Expression T_RPAREN Statement ; -/. -case $rule_number: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::WithStatement> (driver->nodePool(), sym(3).Expression, sym(5).Statement); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(5)); -} break; -./ - -SwitchStatement: T_SWITCH T_LPAREN Expression T_RPAREN CaseBlock ; -/. -case $rule_number: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::SwitchStatement> (driver->nodePool(), sym(3).Expression, sym(5).CaseBlock); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(5)); -} break; -./ - -CaseBlock: T_LBRACE CaseClausesOpt T_RBRACE ; -/. -case $rule_number: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::CaseBlock> (driver->nodePool(), sym(2).CaseClauses); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); -} break; -./ - -CaseBlock: T_LBRACE CaseClausesOpt DefaultClause CaseClausesOpt T_RBRACE ; -/. -case $rule_number: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::CaseBlock> (driver->nodePool(), sym(2).CaseClauses, sym(3).DefaultClause, sym(4).CaseClauses); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(5)); -} break; -./ - -CaseClauses: CaseClause ; -/. -case $rule_number: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::CaseClauses> (driver->nodePool(), sym(1).CaseClause); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(1)); -} break; -./ - -CaseClauses: CaseClauses CaseClause ; -/. -case $rule_number: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::CaseClauses> (driver->nodePool(), sym(1).CaseClauses, sym(2).CaseClause); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(2)); -} break; -./ - -CaseClausesOpt: ; -/. -case $rule_number: { - sym(1).Node = 0; -} break; -./ - -CaseClausesOpt: CaseClauses ; -/. -case $rule_number: { - sym(1).Node = sym(1).CaseClauses->finish (); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(1)); -} break; -./ - -CaseClause: T_CASE Expression T_COLON StatementListOpt ; -/. -case $rule_number: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::CaseClause> (driver->nodePool(), sym(2).Expression, sym(4).StatementList); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(4)); -} break; -./ - -DefaultClause: T_DEFAULT T_COLON StatementListOpt ; -/. -case $rule_number: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::DefaultClause> (driver->nodePool(), sym(3).StatementList); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); -} break; -./ - -LabelledStatement: T_IDENTIFIER T_COLON Statement ; -/. -case $rule_number: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::LabelledStatement> (driver->nodePool(), sym(1).sval, sym(3).Statement); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); -} break; -./ - -ThrowStatement: T_THROW Expression T_AUTOMATIC_SEMICOLON ; -- automatic semicolon -ThrowStatement: T_THROW Expression T_SEMICOLON ; -/. -case $rule_number: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::ThrowStatement> (driver->nodePool(), sym(2).Expression); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); -} break; -./ - -TryStatement: T_TRY Block Catch ; -/. -case $rule_number: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::TryStatement> (driver->nodePool(), sym(2).Statement, sym(3).Catch); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); -} break; -./ - -TryStatement: T_TRY Block Finally ; -/. -case $rule_number: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::TryStatement> (driver->nodePool(), sym(2).Statement, sym(3).Finally); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); -} break; -./ - -TryStatement: T_TRY Block Catch Finally ; -/. -case $rule_number: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::TryStatement> (driver->nodePool(), sym(2).Statement, sym(3).Catch, sym(4).Finally); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(4)); -} break; -./ - -Catch: T_CATCH T_LPAREN T_IDENTIFIER T_RPAREN Block ; -/. -case $rule_number: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::Catch> (driver->nodePool(), sym(3).sval, sym(5).Statement); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(5)); -} break; -./ - -Finally: T_FINALLY Block ; -/. -case $rule_number: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::Finally> (driver->nodePool(), sym(2).Statement); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(2)); -} break; -./ - -DebuggerStatement: T_DEBUGGER T_AUTOMATIC_SEMICOLON ; -- automatic semicolon -DebuggerStatement: T_DEBUGGER T_SEMICOLON ; -/. -case $rule_number: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::DebuggerStatement> (driver->nodePool()); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(1)); -} break; -./ - -FunctionDeclaration: T_FUNCTION T_IDENTIFIER T_LPAREN FormalParameterListOpt T_RPAREN T_LBRACE FunctionBodyOpt T_RBRACE ; -/. -case $rule_number: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::FunctionDeclaration> (driver->nodePool(), sym(2).sval, sym(4).FormalParameterList, sym(7).FunctionBody); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(8)); -} break; -./ - -FunctionExpression: T_FUNCTION IdentifierOpt T_LPAREN FormalParameterListOpt T_RPAREN T_LBRACE FunctionBodyOpt T_RBRACE ; -/. -case $rule_number: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::FunctionExpression> (driver->nodePool(), sym(2).sval, sym(4).FormalParameterList, sym(7).FunctionBody); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(8)); -} break; -./ - -FormalParameterList: T_IDENTIFIER ; -/. -case $rule_number: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::FormalParameterList> (driver->nodePool(), sym(1).sval); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(1)); -} break; -./ - -FormalParameterList: FormalParameterList T_COMMA T_IDENTIFIER ; -/. -case $rule_number: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::FormalParameterList> (driver->nodePool(), sym(1).FormalParameterList, sym(3).sval); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); -} break; -./ - -FormalParameterListOpt: ; -/. -case $rule_number: { - sym(1).Node = 0; -} break; -./ - -FormalParameterListOpt: FormalParameterList ; -/. -case $rule_number: { - sym(1).Node = sym(1).FormalParameterList->finish (); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(1)); -} break; -./ - -FunctionBodyOpt: ; -/. -case $rule_number: { - sym(1).Node = 0; -} break; -./ - -FunctionBodyOpt: FunctionBody ; - -FunctionBody: SourceElements ; -/. -case $rule_number: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::FunctionBody> (driver->nodePool(), sym(1).SourceElements->finish ()); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(1)); -} break; -./ - -Program: SourceElements ; -/. -case $rule_number: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::Program> (driver->nodePool(), sym(1).SourceElements->finish ()); - driver->changeAbstractSyntaxTree(sym(1).Node); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(1)); -} break; -./ - -SourceElements: SourceElement ; -/. -case $rule_number: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::SourceElements> (driver->nodePool(), sym(1).SourceElement); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(1)); -} break; -./ - -SourceElements: SourceElements SourceElement ; -/. -case $rule_number: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::SourceElements> (driver->nodePool(), sym(1).SourceElements, sym(2).SourceElement); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(2)); -} break; -./ - -SourceElement: Statement ; -/. -case $rule_number: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::StatementSourceElement> (driver->nodePool(), sym(1).Statement); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(1)); -} break; -./ - -SourceElement: FunctionDeclaration ; -/. -case $rule_number: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::FunctionSourceElement> (driver->nodePool(), sym(1).FunctionDeclaration); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(1)); -} break; -./ - -IdentifierOpt: ; -/. -case $rule_number: { - sym(1).sval = 0; -} break; -./ - -IdentifierOpt: T_IDENTIFIER ; - -PropertyNameAndValueListOpt: ; -/. -case $rule_number: { - sym(1).Node = 0; -} break; -./ - -PropertyNameAndValueListOpt: PropertyNameAndValueList ; - -/. - } // switch - action = nt_action(state_stack[tos], lhs[r] - TERMINAL_COUNT); - } // if - } while (action != 0); - - if (first_token == last_token) { - const int errorState = state_stack[tos]; - - // automatic insertion of `;' - if (t_action(errorState, T_AUTOMATIC_SEMICOLON) && automatic(driver, yytoken)) { - SavedToken &tk = token_buffer[0]; - tk.token = yytoken; - tk.dval = yylval; - tk.loc = yylloc; - - const QString msg = QString::fromUtf8("Missing `;'"); - - diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Warning, - yyprevlloc.startLine, yyprevlloc.startColumn, msg)); - - first_token = &token_buffer[0]; - last_token = &token_buffer[1]; - - yytoken = T_SEMICOLON; - yylval = 0; - - action = errorState; - - goto _Lcheck_token; - } - - hadErrors = true; - - token_buffer[0].token = yytoken; - token_buffer[0].dval = yylval; - token_buffer[0].loc = yylloc; - - token_buffer[1].token = yytoken = lexer->lex(); - token_buffer[1].dval = yylval = lexer->dval(); - token_buffer[1].loc = yylloc = location(lexer); - - if (token_buffer[0].token != -1 && t_action(errorState, yytoken)) { - QString msg = QString::fromUtf8("Removed token"); - if (const char *tokenSpell = spell[token_buffer[0].token]) { - msg += QLatin1String(": `"); - msg += QLatin1String(tokenSpell); - msg += QLatin1Char('\''); - } - - diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, - token_buffer[0].loc.startLine, token_buffer[0].loc.startColumn, msg)); - - action = errorState; - goto _Lcheck_token; - } - - static int tokens[] = { - T_PLUS, - T_EQ, - - T_COMMA, - T_COLON, - T_SEMICOLON, - - T_RPAREN, T_RBRACKET, T_RBRACE, - - T_NUMERIC_LITERAL, - T_IDENTIFIER, - - T_LPAREN, T_LBRACKET, T_LBRACE, - - EOF_SYMBOL - }; - - for (int *tk = tokens; *tk != EOF_SYMBOL; ++tk) { - int a = t_action(errorState, *tk); - if (a > 0 && t_action(a, yytoken)) { - QString msg = QString::fromUtf8("Inserted token"); - if (const char *tokenSpell = spell[*tk]) { - msg += QLatin1String(": `"); - msg += QLatin1String(tokenSpell); - msg += QLatin1Char('\''); - } - - diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, - token_buffer[0].loc.startLine, token_buffer[0].loc.startColumn, msg)); - - yytoken = *tk; - yylval = 0; - yylloc = token_buffer[0].loc; - - first_token = &token_buffer[0]; - last_token = &token_buffer[2]; - - action = errorState; - goto _Lcheck_token; - } - } - - for (int tk = 1; tk < TERMINAL_COUNT; ++tk) { - int a = t_action(errorState, tk); - if (a > 0 && t_action(a, yytoken)) { - QString msg = QString::fromUtf8("Inserted token"); - if (const char *tokenSpell = spell[tk]) { - msg += QLatin1String(": `"); - msg += QLatin1String(tokenSpell); - msg += QLatin1Char('\''); - } - - diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, - token_buffer[0].loc.startLine, token_buffer[0].loc.startColumn, msg)); - - yytoken = tk; - yylval = 0; - yylloc = token_buffer[0].loc; - - action = errorState; - goto _Lcheck_token; - } - } - - QString msg = QString::fromUtf8("Unexpected token"); - if (token_buffer[0].token >= 0 && token_buffer[0].token < TERMINAL_COUNT) { - if (const char *tokenSpell = spell[token_buffer[0].token]) { - msg += QLatin1String(": `"); - msg += QLatin1String(tokenSpell); - msg += QLatin1Char('\''); - } - } // ### FIXME: at this point, we should give more information than just "Unexpected token". However, we need more error recovery support from qlalr. - - diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, - token_buffer[0].loc.startLine, token_buffer[0].loc.startColumn, msg)); - } - - return false; -} - -QT_END_NAMESPACE - - -./ -/: -QT_END_NAMESPACE - - - -#endif // JAVASCRIPTPARSER_P_H -:/ diff --git a/src/plugins/qtscripteditor/parser/javascriptast.cpp b/src/plugins/qtscripteditor/parser/javascriptast.cpp deleted file mode 100644 index d109d09e4a6abf5b8511fc1773def20a6a96a42f..0000000000000000000000000000000000000000 --- a/src/plugins/qtscripteditor/parser/javascriptast.cpp +++ /dev/null @@ -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 - - diff --git a/src/plugins/qtscripteditor/parser/javascriptast_p.h b/src/plugins/qtscripteditor/parser/javascriptast_p.h deleted file mode 100644 index eb12f899cff8e4e9baecd2023a42438c2351870f..0000000000000000000000000000000000000000 --- a/src/plugins/qtscripteditor/parser/javascriptast_p.h +++ /dev/null @@ -1,1487 +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_P_H -#define JAVASCRIPTAST_P_H - -#include <QtCore/QString> -#include "javascriptastvisitor_p.h" - -QT_BEGIN_NAMESPACE - -class JavaScriptNameIdImpl; - -namespace QSOperator // ### rename -{ - -enum Op { - Add, - And, - InplaceAnd, - Assign, - BitAnd, - BitOr, - BitXor, - InplaceSub, - Div, - InplaceDiv, - Equal, - Ge, - Gt, - In, - InplaceAdd, - InstanceOf, - Le, - LShift, - InplaceLeftShift, - Lt, - Mod, - InplaceMod, - Mul, - InplaceMul, - NotEqual, - Or, - InplaceOr, - RShift, - InplaceRightShift, - StrictEqual, - StrictNotEqual, - Sub, - URShift, - InplaceURightShift, - InplaceXor -}; - -} // namespace QSOperator - -namespace JavaScript { namespace AST { - -class Node -{ -public: - enum Kind { - Kind_Node, - Kind_ExpressionNode, - Kind_Statement, - Kind_ThisExpression, - Kind_IdentifierExpression, - Kind_NullExpression, - Kind_TrueLiteral, - Kind_FalseLiteral, - Kind_NumericLiteral, - Kind_StringLiteral, - Kind_RegExpLiteral, - Kind_ArrayLiteral, - Kind_ObjectLiteral, - Kind_ElementList, - Kind_Elision, - Kind_PropertyNameAndValueList, - Kind_PropertyName, - Kind_IdentifierPropertyName, - Kind_StringLiteralPropertyName, - Kind_NumericLiteralPropertyName, - Kind_ArrayMemberExpression, - Kind_FieldMemberExpression, - Kind_NewMemberExpression, - Kind_NewExpression, - Kind_CallExpression, - Kind_ArgumentList, - Kind_PostIncrementExpression, - Kind_PostDecrementExpression, - Kind_DeleteExpression, - Kind_VoidExpression, - Kind_TypeOfExpression, - Kind_PreIncrementExpression, - Kind_PreDecrementExpression, - Kind_UnaryPlusExpression, - Kind_UnaryMinusExpression, - Kind_TildeExpression, - Kind_NotExpression, - Kind_BinaryExpression, - Kind_ConditionalExpression, - Kind_Expression, - Kind_Block, - Kind_StatementList, - Kind_VariableStatement, - Kind_VariableDeclarationList, - Kind_VariableDeclaration, - Kind_EmptyStatement, - Kind_ExpressionStatement, - Kind_IfStatement, - Kind_DoWhileStatement, - Kind_WhileStatement, - Kind_ForStatement, - Kind_LocalForStatement, - Kind_ForEachStatement, - Kind_LocalForEachStatement, - Kind_ContinueStatement, - Kind_BreakStatement, - Kind_ReturnStatement, - Kind_WithStatement, - Kind_SwitchStatement, - Kind_CaseBlock, - Kind_CaseClauses, - Kind_CaseClause, - Kind_DefaultClause, - Kind_LabelledStatement, - Kind_ThrowStatement, - Kind_TryStatement, - Kind_Catch, - Kind_Finally, - Kind_FunctionDeclaration, - Kind_FunctionExpression, - Kind_FormalParameterList, - Kind_FunctionBody, - Kind_Program, - Kind_SourceElements, - Kind_SourceElement, - Kind_FunctionSourceElement, - Kind_StatementSourceElement, - Kind_DebuggerStatement - }; - - inline Node(): - startLine(0), startColumn(0), - endLine(0), endColumn(0), kind(Kind_Node) {} - - virtual ~Node() {} - - virtual ExpressionNode *expressionCast(); - virtual BinaryExpression *binaryExpressionCast(); - virtual Statement *statementCast(); - - inline void accept(Visitor *visitor) - { - if (visitor->preVisit(this)) { - accept0(visitor); - visitor->postVisit(this); - } - } - - static void acceptChild(Node *node, Visitor *visitor) - { - if (node) - node->accept(visitor); - } - - virtual void accept0(Visitor *visitor) = 0; - - int startLine; - int startColumn; - int endLine; - int endColumn; - Kind kind; -}; - -class ExpressionNode: public Node -{ -public: - ExpressionNode() { kind = Kind_ExpressionNode; } - virtual ~ExpressionNode() {} - - virtual ExpressionNode *expressionCast(); -}; - -class Statement: public Node -{ -public: - Statement() { kind = Kind_Statement; } - virtual ~Statement() {} - - virtual Statement *statementCast(); -}; - -class ThisExpression: public ExpressionNode -{ -public: - ThisExpression() { kind = Kind_ThisExpression; } - virtual ~ThisExpression() {} - - virtual void accept0(Visitor *visitor); -}; - -class IdentifierExpression: public ExpressionNode -{ -public: - IdentifierExpression(JavaScriptNameIdImpl *n): - name (n) { kind = Kind_IdentifierExpression; } - - virtual ~IdentifierExpression() {} - - virtual void accept0(Visitor *visitor); - -// attributes - JavaScriptNameIdImpl *name; -}; - -class NullExpression: public ExpressionNode -{ -public: - NullExpression() { kind = Kind_NullExpression; } - virtual ~NullExpression() {} - - virtual void accept0(Visitor *visitor); -}; - -class TrueLiteral: public ExpressionNode -{ -public: - TrueLiteral() { kind = Kind_TrueLiteral; } - virtual ~TrueLiteral() {} - - virtual void accept0(Visitor *visitor); -}; - -class FalseLiteral: public ExpressionNode -{ -public: - FalseLiteral() { kind = Kind_FalseLiteral; } - virtual ~FalseLiteral() {} - - virtual void accept0(Visitor *visitor); -}; - -class NumericLiteral: public ExpressionNode -{ -public: - NumericLiteral(double v): - value (v) { kind = Kind_NumericLiteral; } - virtual ~NumericLiteral() {} - - virtual void accept0(Visitor *visitor); - -// attributes: - double value; -}; - -class StringLiteral: public ExpressionNode -{ -public: - StringLiteral(JavaScriptNameIdImpl *v): - value (v) { kind = Kind_StringLiteral; } - - virtual ~StringLiteral() {} - - virtual void accept0(Visitor *visitor); - -// attributes: - JavaScriptNameIdImpl *value; -}; - -class RegExpLiteral: public ExpressionNode -{ -public: - RegExpLiteral(JavaScriptNameIdImpl *p, int f): - pattern (p), flags (f) { kind = Kind_RegExpLiteral; } - - virtual ~RegExpLiteral() {} - - virtual void accept0(Visitor *visitor); - -// attributes: - JavaScriptNameIdImpl *pattern; - int flags; -}; - -class ArrayLiteral: public ExpressionNode -{ -public: - ArrayLiteral(Elision *e): - elements (0), elision (e) - { kind = Kind_ArrayLiteral; } - - ArrayLiteral(ElementList *elts): - elements (elts), elision (0) - { kind = Kind_ArrayLiteral; } - - ArrayLiteral(ElementList *elts, Elision *e): - elements (elts), elision (e) - { kind = Kind_ArrayLiteral; } - - virtual ~ArrayLiteral() {} - - virtual void accept0(Visitor *visitor); - -// attributes - ElementList *elements; - Elision *elision; -}; - -class ObjectLiteral: public ExpressionNode -{ -public: - ObjectLiteral(): - properties (0) { kind = Kind_ObjectLiteral; } - - ObjectLiteral(PropertyNameAndValueList *plist): - properties (plist) { kind = Kind_ObjectLiteral; } - - virtual ~ObjectLiteral() {} - - virtual void accept0(Visitor *visitor); - -// attributes - PropertyNameAndValueList *properties; -}; - -class ElementList: public Node -{ -public: - ElementList(Elision *e, ExpressionNode *expr): - elision (e), expression (expr), next (this) - { kind = Kind_ElementList; } - - ElementList(ElementList *previous, Elision *e, ExpressionNode *expr): - elision (e), expression (expr) - { - kind = Kind_ElementList; - next = previous->next; - previous->next = this; - } - - virtual ~ElementList() {} - - inline ElementList *finish () - { - ElementList *front = next; - next = 0; - return front; - } - - virtual void accept0(Visitor *visitor); - -// attributes - Elision *elision; - ExpressionNode *expression; - ElementList *next; -}; - -class Elision: public Node -{ -public: - Elision(): - next (this) { kind = Kind_Elision; } - - Elision(Elision *previous) - { - kind = Kind_Elision; - next = previous->next; - previous->next = this; - } - - virtual ~Elision() {} - - virtual void accept0(Visitor *visitor); - - inline Elision *finish () - { - Elision *front = next; - next = 0; - return front; - } - -// attributes - Elision *next; -}; - -class PropertyNameAndValueList: public Node -{ -public: - PropertyNameAndValueList(PropertyName *n, ExpressionNode *v): - name (n), value (v), next (this) - { kind = Kind_PropertyNameAndValueList; } - - PropertyNameAndValueList(PropertyNameAndValueList *previous, PropertyName *n, ExpressionNode *v): - name (n), value (v) - { - kind = Kind_PropertyNameAndValueList; - next = previous->next; - previous->next = this; - } - - virtual ~PropertyNameAndValueList() {} - - virtual void accept0(Visitor *visitor); - - inline PropertyNameAndValueList *finish () - { - PropertyNameAndValueList *front = next; - next = 0; - return front; - } - -// attributes - PropertyName *name; - ExpressionNode *value; - PropertyNameAndValueList *next; -}; - -class PropertyName: public Node -{ -public: - PropertyName() { kind = Kind_PropertyName; } - virtual ~PropertyName() {} -}; - -class IdentifierPropertyName: public PropertyName -{ -public: - IdentifierPropertyName(JavaScriptNameIdImpl *n): - id (n) { kind = Kind_IdentifierPropertyName; } - - virtual ~IdentifierPropertyName() {} - - virtual void accept0(Visitor *visitor); - -// attributes - JavaScriptNameIdImpl *id; -}; - -class StringLiteralPropertyName: public PropertyName -{ -public: - StringLiteralPropertyName(JavaScriptNameIdImpl *n): - id (n) { kind = Kind_StringLiteralPropertyName; } - virtual ~StringLiteralPropertyName() {} - - virtual void accept0(Visitor *visitor); - -// attributes - JavaScriptNameIdImpl *id; -}; - -class NumericLiteralPropertyName: public PropertyName -{ -public: - NumericLiteralPropertyName(double n): - id (n) { kind = Kind_NumericLiteralPropertyName; } - virtual ~NumericLiteralPropertyName() {} - - virtual void accept0(Visitor *visitor); - -// attributes - double id; -}; - -class ArrayMemberExpression: public ExpressionNode -{ -public: - ArrayMemberExpression(ExpressionNode *b, ExpressionNode *e): - base (b), expression (e) - { kind = Kind_ArrayMemberExpression; } - - virtual ~ArrayMemberExpression() {} - - virtual void accept0(Visitor *visitor); - -// attributes - ExpressionNode *base; - ExpressionNode *expression; -}; - -class FieldMemberExpression: public ExpressionNode -{ -public: - FieldMemberExpression(ExpressionNode *b, JavaScriptNameIdImpl *n): - base (b), name (n) - { kind = Kind_FieldMemberExpression; } - - virtual ~FieldMemberExpression() {} - - virtual void accept0(Visitor *visitor); - -// attributes - ExpressionNode *base; - JavaScriptNameIdImpl *name; -}; - -class NewMemberExpression: public ExpressionNode -{ -public: - NewMemberExpression(ExpressionNode *b, ArgumentList *a): - base (b), arguments (a) - { kind = Kind_NewMemberExpression; } - - virtual ~NewMemberExpression() {} - - virtual void accept0(Visitor *visitor); - -// attributes - ExpressionNode *base; - ArgumentList *arguments; -}; - -class NewExpression: public ExpressionNode -{ -public: - NewExpression(ExpressionNode *e): - expression (e) { kind = Kind_NewExpression; } - - virtual ~NewExpression() {} - - virtual void accept0(Visitor *visitor); - -// attributes - ExpressionNode *expression; -}; - -class CallExpression: public ExpressionNode -{ -public: - CallExpression(ExpressionNode *b, ArgumentList *a): - base (b), arguments (a) - { kind = Kind_CallExpression; } - - virtual ~CallExpression() {} - - virtual void accept0(Visitor *visitor); - -// attributes - ExpressionNode *base; - ArgumentList *arguments; -}; - -class ArgumentList: public Node -{ -public: - ArgumentList(ExpressionNode *e): - expression (e), next (this) - { kind = Kind_ArgumentList; } - - ArgumentList(ArgumentList *previous, ExpressionNode *e): - expression (e) - { - kind = Kind_ArgumentList; - next = previous->next; - previous->next = this; - } - - virtual ~ArgumentList() {} - - virtual void accept0(Visitor *visitor); - - inline ArgumentList *finish () - { - ArgumentList *front = next; - next = 0; - return front; - } - -// attributes - ExpressionNode *expression; - ArgumentList *next; -}; - -class PostIncrementExpression: public ExpressionNode -{ -public: - PostIncrementExpression(ExpressionNode *b): - base (b) { kind = Kind_PostIncrementExpression; } - - virtual ~PostIncrementExpression() {} - - virtual void accept0(Visitor *visitor); - -// attributes - ExpressionNode *base; -}; - -class PostDecrementExpression: public ExpressionNode -{ -public: - PostDecrementExpression(ExpressionNode *b): - base (b) { kind = Kind_PostDecrementExpression; } - - virtual ~PostDecrementExpression() {} - - virtual void accept0(Visitor *visitor); - -// attributes - ExpressionNode *base; -}; - -class DeleteExpression: public ExpressionNode -{ -public: - DeleteExpression(ExpressionNode *e): - expression (e) { kind = Kind_DeleteExpression; } - virtual ~DeleteExpression() {} - - virtual void accept0(Visitor *visitor); - -// attributes - ExpressionNode *expression; -}; - -class VoidExpression: public ExpressionNode -{ -public: - VoidExpression(ExpressionNode *e): - expression (e) { kind = Kind_VoidExpression; } - - virtual ~VoidExpression() {} - - virtual void accept0(Visitor *visitor); - -// attributes - ExpressionNode *expression; -}; - -class TypeOfExpression: public ExpressionNode -{ -public: - TypeOfExpression(ExpressionNode *e): - expression (e) { kind = Kind_TypeOfExpression; } - - virtual ~TypeOfExpression() {} - - virtual void accept0(Visitor *visitor); - -// attributes - ExpressionNode *expression; -}; - -class PreIncrementExpression: public ExpressionNode -{ -public: - PreIncrementExpression(ExpressionNode *e): - expression (e) { kind = Kind_PreIncrementExpression; } - - virtual ~PreIncrementExpression() {} - - virtual void accept0(Visitor *visitor); - -// attributes - ExpressionNode *expression; -}; - -class PreDecrementExpression: public ExpressionNode -{ -public: - PreDecrementExpression(ExpressionNode *e): - expression (e) { kind = Kind_PreDecrementExpression; } - - virtual ~PreDecrementExpression() {} - - virtual void accept0(Visitor *visitor); - -// attributes - ExpressionNode *expression; -}; - -class UnaryPlusExpression: public ExpressionNode -{ -public: - UnaryPlusExpression(ExpressionNode *e): - expression (e) { kind = Kind_UnaryPlusExpression; } - - virtual ~UnaryPlusExpression() {} - - virtual void accept0(Visitor *visitor); - -// attributes - ExpressionNode *expression; -}; - -class UnaryMinusExpression: public ExpressionNode -{ -public: - UnaryMinusExpression(ExpressionNode *e): - expression (e) { kind = Kind_UnaryMinusExpression; } - - virtual ~UnaryMinusExpression() {} - - virtual void accept0(Visitor *visitor); - -// attributes - ExpressionNode *expression; -}; - -class TildeExpression: public ExpressionNode -{ -public: - TildeExpression(ExpressionNode *e): - expression (e) { kind = Kind_TildeExpression; } - - virtual ~TildeExpression() {} - - virtual void accept0(Visitor *visitor); - -// attributes - ExpressionNode *expression; -}; - -class NotExpression: public ExpressionNode -{ -public: - NotExpression(ExpressionNode *e): - expression (e) { kind = Kind_NotExpression; } - - virtual ~NotExpression() {} - - virtual void accept0(Visitor *visitor); - -// attributes - ExpressionNode *expression; -}; - -class BinaryExpression: public ExpressionNode -{ -public: - BinaryExpression(ExpressionNode *l, int o, ExpressionNode *r): - left (l), op (o), right (r) - { kind = Kind_BinaryExpression; } - - virtual ~BinaryExpression() {} - - virtual BinaryExpression *binaryExpressionCast(); - - virtual void accept0(Visitor *visitor); - -// attributes - ExpressionNode *left; - int op; - ExpressionNode *right; -}; - -class ConditionalExpression: public ExpressionNode -{ -public: - ConditionalExpression(ExpressionNode *e, ExpressionNode *t, ExpressionNode *f): - expression (e), ok (t), ko (f) - { kind = Kind_ConditionalExpression; } - - virtual ~ConditionalExpression() {} - - virtual void accept0(Visitor *visitor); - -// attributes - ExpressionNode *expression; - ExpressionNode *ok; - ExpressionNode *ko; -}; - -class Expression: public ExpressionNode // ### rename -{ -public: - Expression(ExpressionNode *l, ExpressionNode *r): - left (l), right (r) { kind = Kind_Expression; } - - virtual ~Expression() {} - - virtual void accept0(Visitor *visitor); - -// attributes - ExpressionNode *left; - ExpressionNode *right; -}; - -class Block: public Statement -{ -public: - Block(StatementList *slist): - statements (slist) { kind = Kind_Block; } - - virtual ~Block() {} - - virtual void accept0(Visitor *visitor); - -// attributes - StatementList *statements; -}; - -class StatementList: public Node -{ -public: - StatementList(Statement *stmt): - statement (stmt), next (this) - { kind = Kind_StatementList; } - - StatementList(StatementList *previous, Statement *stmt): - statement (stmt) - { - kind = Kind_StatementList; - next = previous->next; - previous->next = this; - } - - virtual ~StatementList() {} - - virtual void accept0(Visitor *visitor); - - inline StatementList *finish () - { - StatementList *front = next; - next = 0; - return front; - } - -// attributes - Statement *statement; - StatementList *next; -}; - -class VariableStatement: public Statement -{ -public: - VariableStatement(VariableDeclarationList *vlist): - declarations (vlist) - { kind = Kind_VariableStatement; } - - virtual ~VariableStatement() {} - - virtual void accept0(Visitor *visitor); - -// attributes - VariableDeclarationList *declarations; -}; - -class VariableDeclaration: public Node -{ -public: - VariableDeclaration(JavaScriptNameIdImpl *n, ExpressionNode *e): - name (n), expression (e), readOnly(false) - { kind = Kind_VariableDeclaration; } - - virtual ~VariableDeclaration() {} - - virtual void accept0(Visitor *visitor); - -// attributes - JavaScriptNameIdImpl *name; - ExpressionNode *expression; - bool readOnly; -}; - -class VariableDeclarationList: public Node -{ -public: - VariableDeclarationList(VariableDeclaration *decl): - declaration (decl), next (this) - { kind = Kind_VariableDeclarationList; } - - VariableDeclarationList(VariableDeclarationList *previous, VariableDeclaration *decl): - declaration (decl) - { - kind = Kind_VariableDeclarationList; - next = previous->next; - previous->next = this; - } - - virtual ~VariableDeclarationList() {} - - virtual void accept0(Visitor *visitor); - - inline VariableDeclarationList *finish (bool readOnly) - { - VariableDeclarationList *front = next; - next = 0; - if (readOnly) { - VariableDeclarationList *vdl; - for (vdl = front; vdl != 0; vdl = vdl->next) - vdl->declaration->readOnly = true; - } - return front; - } - -// attributes - VariableDeclaration *declaration; - VariableDeclarationList *next; -}; - -class EmptyStatement: public Statement -{ -public: - EmptyStatement() { kind = Kind_EmptyStatement; } - virtual ~EmptyStatement() {} - - virtual void accept0(Visitor *visitor); -}; - -class ExpressionStatement: public Statement -{ -public: - ExpressionStatement(ExpressionNode *e): - expression (e) { kind = Kind_ExpressionStatement; } - - virtual ~ExpressionStatement() {} - - virtual void accept0(Visitor *visitor); - -// attributes - ExpressionNode *expression; -}; - -class IfStatement: public Statement -{ -public: - IfStatement(ExpressionNode *e, Statement *t, Statement *f = 0): - expression (e), ok (t), ko (f) - { kind = Kind_IfStatement; } - - virtual ~IfStatement() {} - - virtual void accept0(Visitor *visitor); - -// attributes - ExpressionNode *expression; - Statement *ok; - Statement *ko; -}; - -class DoWhileStatement: public Statement -{ -public: - DoWhileStatement(Statement *stmt, ExpressionNode *e): - statement (stmt), expression (e) - { kind = Kind_DoWhileStatement; } - - virtual ~DoWhileStatement() {} - - virtual void accept0(Visitor *visitor); - -// attributes - Statement *statement; - ExpressionNode *expression; -}; - -class WhileStatement: public Statement -{ -public: - WhileStatement(ExpressionNode *e, Statement *stmt): - expression (e), statement (stmt) - { kind = Kind_WhileStatement; } - - virtual ~WhileStatement() {} - - virtual void accept0(Visitor *visitor); - -// attributes - ExpressionNode *expression; - Statement *statement; -}; - -class ForStatement: public Statement -{ -public: - ForStatement(ExpressionNode *i, ExpressionNode *c, ExpressionNode *e, Statement *stmt): - initialiser (i), condition (c), expression (e), statement (stmt) - { kind = Kind_ForStatement; } - - virtual ~ForStatement() {} - - virtual void accept0(Visitor *visitor); - -// attributes - ExpressionNode *initialiser; - ExpressionNode *condition; - ExpressionNode *expression; - Statement *statement; -}; - -class LocalForStatement: public Statement -{ -public: - LocalForStatement(VariableDeclarationList *vlist, ExpressionNode *c, ExpressionNode *e, Statement *stmt): - declarations (vlist), condition (c), expression (e), statement (stmt) - { kind = Kind_LocalForStatement; } - - virtual ~LocalForStatement() {} - - virtual void accept0(Visitor *visitor); - -// attributes - VariableDeclarationList *declarations; - ExpressionNode *condition; - ExpressionNode *expression; - Statement *statement; -}; - -class ForEachStatement: public Statement -{ -public: - ForEachStatement(ExpressionNode *i, ExpressionNode *e, Statement *stmt): - initialiser (i), expression (e), statement (stmt) - { kind = Kind_ForEachStatement; } - - virtual ~ForEachStatement() {} - - virtual void accept0(Visitor *visitor); - -// attributes - ExpressionNode *initialiser; - ExpressionNode *expression; - Statement *statement; -}; - -class LocalForEachStatement: public Statement -{ -public: - LocalForEachStatement(VariableDeclaration *v, ExpressionNode *e, Statement *stmt): - declaration (v), expression (e), statement (stmt) - { kind = Kind_LocalForEachStatement; } - - virtual ~LocalForEachStatement() {} - - virtual void accept0(Visitor *visitor); - -// attributes - VariableDeclaration *declaration; - ExpressionNode *expression; - Statement *statement; -}; - -class ContinueStatement: public Statement -{ -public: - ContinueStatement(JavaScriptNameIdImpl *l = 0): - label (l) { kind = Kind_ContinueStatement; } - - virtual ~ContinueStatement() {} - - virtual void accept0(Visitor *visitor); - -// attributes - JavaScriptNameIdImpl *label; -}; - -class BreakStatement: public Statement -{ -public: - BreakStatement(JavaScriptNameIdImpl *l = 0): - label (l) { kind = Kind_BreakStatement; } - - virtual ~BreakStatement() {} - - virtual void accept0(Visitor *visitor); - -// attributes - JavaScriptNameIdImpl *label; -}; - -class ReturnStatement: public Statement -{ -public: - ReturnStatement(ExpressionNode *e): - expression (e) { kind = Kind_ReturnStatement; } - - virtual ~ReturnStatement() {} - - virtual void accept0(Visitor *visitor); - -// attributes - ExpressionNode *expression; -}; - -class WithStatement: public Statement -{ -public: - WithStatement(ExpressionNode *e, Statement *stmt): - expression (e), statement (stmt) - { kind = Kind_WithStatement; } - - virtual ~WithStatement() {} - - virtual void accept0(Visitor *visitor); - -// attributes - ExpressionNode *expression; - Statement *statement; -}; - -class SwitchStatement: public Statement -{ -public: - SwitchStatement(ExpressionNode *e, CaseBlock *b): - expression (e), block (b) - { kind = Kind_SwitchStatement; } - - virtual ~SwitchStatement() {} - - virtual void accept0(Visitor *visitor); - -// attributes - ExpressionNode *expression; - CaseBlock *block; -}; - -class CaseBlock: public Node -{ -public: - CaseBlock(CaseClauses *c, DefaultClause *d = 0, CaseClauses *r = 0): - clauses (c), defaultClause (d), moreClauses (r) - { kind = Kind_CaseBlock; } - - virtual ~CaseBlock() {} - - virtual void accept0(Visitor *visitor); - -// attributes - CaseClauses *clauses; - DefaultClause *defaultClause; - CaseClauses *moreClauses; -}; - -class CaseClauses: public Node -{ -public: - CaseClauses(CaseClause *c): - clause (c), next (this) - { kind = Kind_CaseClauses; } - - CaseClauses(CaseClauses *previous, CaseClause *c): - clause (c) - { - kind = Kind_CaseClauses; - next = previous->next; - previous->next = this; - } - - virtual ~CaseClauses() {} - - virtual void accept0(Visitor *visitor); - - inline CaseClauses *finish () - { - CaseClauses *front = next; - next = 0; - return front; - } - -//attributes - CaseClause *clause; - CaseClauses *next; -}; - -class CaseClause: public Node -{ -public: - CaseClause(ExpressionNode *e, StatementList *slist): - expression (e), statements (slist) - { kind = Kind_CaseClause; } - - virtual ~CaseClause() {} - - virtual void accept0(Visitor *visitor); - -// attributes - ExpressionNode *expression; - StatementList *statements; -}; - -class DefaultClause: public Node -{ -public: - DefaultClause(StatementList *slist): - statements (slist) - { kind = Kind_DefaultClause; } - - virtual ~DefaultClause() {} - - virtual void accept0(Visitor *visitor); - -// attributes - StatementList *statements; -}; - -class LabelledStatement: public Statement -{ -public: - LabelledStatement(JavaScriptNameIdImpl *l, Statement *stmt): - label (l), statement (stmt) - { kind = Kind_LabelledStatement; } - - virtual ~LabelledStatement() {} - - virtual void accept0(Visitor *visitor); - -// attributes - JavaScriptNameIdImpl *label; - Statement *statement; -}; - -class ThrowStatement: public Statement -{ -public: - ThrowStatement(ExpressionNode *e): - expression (e) { kind = Kind_ThrowStatement; } - - virtual ~ThrowStatement() {} - - virtual void accept0(Visitor *visitor); - -// attributes - ExpressionNode *expression; -}; - -class TryStatement: public Statement -{ -public: - TryStatement(Statement *stmt, Catch *c, Finally *f): - statement (stmt), catchExpression (c), finallyExpression (f) - { kind = Kind_TryStatement; } - - TryStatement(Statement *stmt, Finally *f): - statement (stmt), catchExpression (0), finallyExpression (f) - { kind = Kind_TryStatement; } - - TryStatement(Statement *stmt, Catch *c): - statement (stmt), catchExpression (c), finallyExpression (0) - { kind = Kind_TryStatement; } - - virtual ~TryStatement() {} - - virtual void accept0(Visitor *visitor); - -// attributes - Statement *statement; - Catch *catchExpression; - Finally *finallyExpression; -}; - -class Catch: public Node -{ -public: - Catch(JavaScriptNameIdImpl *n, Statement *stmt): - name (n), statement (stmt) - { kind = Kind_Catch; } - - virtual ~Catch() {} - - virtual void accept0(Visitor *visitor); - -// attributes - JavaScriptNameIdImpl *name; - Statement *statement; -}; - -class Finally: public Node -{ -public: - Finally(Statement *stmt): - statement (stmt) - { kind = Kind_Finally; } - - virtual ~Finally() {} - - virtual void accept0(Visitor *visitor); - -// attributes - Statement *statement; -}; - -class FunctionExpression: public ExpressionNode -{ -public: - FunctionExpression(JavaScriptNameIdImpl *n, FormalParameterList *f, FunctionBody *b): - name (n), formals (f), body (b) - { kind = Kind_FunctionExpression; } - - virtual ~FunctionExpression() {} - - virtual void accept0(Visitor *visitor); - -// attributes - JavaScriptNameIdImpl *name; - FormalParameterList *formals; - FunctionBody *body; -}; - -class FunctionDeclaration: public FunctionExpression -{ -public: - FunctionDeclaration(JavaScriptNameIdImpl *n, FormalParameterList *f, FunctionBody *b): - FunctionExpression(n, f, b) - { kind = Kind_FunctionDeclaration; } - - virtual ~FunctionDeclaration() {} - - virtual void accept0(Visitor *visitor); -}; - -class FormalParameterList: public Node -{ -public: - FormalParameterList(JavaScriptNameIdImpl *n): - name (n), next (this) - { kind = Kind_FormalParameterList; } - - FormalParameterList(FormalParameterList *previous, JavaScriptNameIdImpl *n): - name (n) - { - kind = Kind_FormalParameterList; - next = previous->next; - previous->next = this; - } - - virtual ~FormalParameterList() {} - - virtual void accept0(Visitor *visitor); - - inline FormalParameterList *finish () - { - FormalParameterList *front = next; - next = 0; - return front; - } - -// attributes - JavaScriptNameIdImpl *name; - FormalParameterList *next; -}; - -class FunctionBody: public Node -{ -public: - FunctionBody(SourceElements *elts): - elements (elts) - { kind = Kind_FunctionBody; } - - virtual ~FunctionBody() {} - - virtual void accept0(Visitor *visitor); - -// attributes - SourceElements *elements; -}; - -class Program: public Node -{ -public: - Program(SourceElements *elts): - elements (elts) - { kind = Kind_Program; } - - virtual ~Program() {} - - virtual void accept0(Visitor *visitor); - -// attributes - SourceElements *elements; -}; - -class SourceElements: public Node -{ -public: - SourceElements(SourceElement *elt): - element (elt), next (this) - { kind = Kind_SourceElements; } - - SourceElements(SourceElements *previous, SourceElement *elt): - element (elt) - { - kind = Kind_SourceElements; - next = previous->next; - previous->next = this; - } - - virtual ~SourceElements() {} - - virtual void accept0(Visitor *visitor); - - inline SourceElements *finish () - { - SourceElements *front = next; - next = 0; - return front; - } - -// attributes - SourceElement *element; - SourceElements *next; -}; - -class SourceElement: public Node -{ -public: - inline SourceElement() - { kind = Kind_SourceElement; } - - virtual ~SourceElement() {} -}; - -class FunctionSourceElement: public SourceElement -{ -public: - FunctionSourceElement(FunctionDeclaration *f): - declaration (f) - { kind = Kind_FunctionSourceElement; } - - virtual ~FunctionSourceElement() {} - - virtual void accept0(Visitor *visitor); - -// attributes - FunctionDeclaration *declaration; -}; - -class StatementSourceElement: public SourceElement -{ -public: - StatementSourceElement(Statement *stmt): - statement (stmt) - { kind = Kind_StatementSourceElement; } - - virtual ~StatementSourceElement() {} - - virtual void accept0(Visitor *visitor); - -// attributes - Statement *statement; -}; - -class DebuggerStatement: public Statement -{ -public: - DebuggerStatement() - { kind = Kind_DebuggerStatement; } - - virtual ~DebuggerStatement() {} - - virtual void accept0(Visitor *visitor); -}; - -} } // namespace AST - - - -QT_END_NAMESPACE - -#endif diff --git a/src/plugins/qtscripteditor/parser/javascriptastfwd_p.h b/src/plugins/qtscripteditor/parser/javascriptastfwd_p.h deleted file mode 100644 index 2c3a5955b9dfd626bf0e4b5ddf59e0b79acf9495..0000000000000000000000000000000000000000 --- a/src/plugins/qtscripteditor/parser/javascriptastfwd_p.h +++ /dev/null @@ -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 diff --git a/src/plugins/qtscripteditor/parser/javascriptastvisitor.cpp b/src/plugins/qtscripteditor/parser/javascriptastvisitor.cpp deleted file mode 100644 index 47e1ba4225a1cc77cb4e2a50f919f99a5d5b572a..0000000000000000000000000000000000000000 --- a/src/plugins/qtscripteditor/parser/javascriptastvisitor.cpp +++ /dev/null @@ -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 diff --git a/src/plugins/qtscripteditor/parser/javascriptastvisitor_p.h b/src/plugins/qtscripteditor/parser/javascriptastvisitor_p.h deleted file mode 100644 index df6f8bd6a7d1f85801ef9dd2581acfbcd03fb57b..0000000000000000000000000000000000000000 --- a/src/plugins/qtscripteditor/parser/javascriptastvisitor_p.h +++ /dev/null @@ -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 diff --git a/src/plugins/qtscripteditor/parser/javascriptengine_p.cpp b/src/plugins/qtscripteditor/parser/javascriptengine_p.cpp deleted file mode 100644 index 4674cf24df989ab53b72553effa11157ca3f4c7b..0000000000000000000000000000000000000000 --- a/src/plugins/qtscripteditor/parser/javascriptengine_p.cpp +++ /dev/null @@ -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 diff --git a/src/plugins/qtscripteditor/parser/javascriptengine_p.h b/src/plugins/qtscripteditor/parser/javascriptengine_p.h deleted file mode 100644 index 15232f288d36d9ed6cb637916075d687f858cee6..0000000000000000000000000000000000000000 --- a/src/plugins/qtscripteditor/parser/javascriptengine_p.h +++ /dev/null @@ -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 diff --git a/src/plugins/qtscripteditor/parser/javascriptgrammar.cpp b/src/plugins/qtscripteditor/parser/javascriptgrammar.cpp deleted file mode 100644 index 8ab893034e07095213e420e91e9f392310e9476c..0000000000000000000000000000000000000000 --- a/src/plugins/qtscripteditor/parser/javascriptgrammar.cpp +++ /dev/null @@ -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}; - diff --git a/src/plugins/qtscripteditor/parser/javascriptgrammar_p.h b/src/plugins/qtscripteditor/parser/javascriptgrammar_p.h deleted file mode 100644 index 04c245d6d6e5f749c5737fe9a4c38a204540f05d..0000000000000000000000000000000000000000 --- a/src/plugins/qtscripteditor/parser/javascriptgrammar_p.h +++ /dev/null @@ -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 - diff --git a/src/plugins/qtscripteditor/parser/javascriptlexer.cpp b/src/plugins/qtscripteditor/parser/javascriptlexer.cpp deleted file mode 100644 index 6f0220d4fcd77c65e7d8a5c18f27953540708c4a..0000000000000000000000000000000000000000 --- a/src/plugins/qtscripteditor/parser/javascriptlexer.cpp +++ /dev/null @@ -1,1099 +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 "javascriptlexer_p.h" -#include "javascriptgrammar_p.h" - -#include <ctype.h> -#include <stdlib.h> -#include <stdio.h> -#include <string.h> - -QT_BEGIN_NAMESPACE - -extern double qstrtod(const char *s00, char const **se, bool *ok); - -#define shiftWindowsLineBreak() \ - do { \ - if (((current == '\r') && (next1 == '\n')) \ - || ((current == '\n') && (next1 == '\r'))) { \ - shift(1); \ - } \ - } \ - while (0) - -namespace JavaScript { -extern qjsreal integerFromString(const char *buf, int size, int radix); -} - -JavaScript::Lexer::Lexer(JavaScriptEnginePrivate *eng) - : driver(eng), - yylineno(0), - done(false), - size8(128), size16(128), - pos8(0), pos16(0), - terminator(false), - restrKeyword(false), - delimited(false), - stackToken(-1), - state(Start), - pos(0), - code(0), length(0), - yycolumn(0), - startlineno(0), startcolumn(0), - bol(true), - current(0), next1(0), next2(0), next3(0), - err(NoError), - wantRx(false), - check_reserved(true), - parenthesesState(IgnoreParentheses), - parenthesesCount(0), - prohibitAutomaticSemicolon(false) -{ - // allocate space for read buffers - buffer8 = new char[size8]; - buffer16 = new QChar[size16]; - pattern = 0; - flags = 0; - -} - -JavaScript::Lexer::~Lexer() -{ - delete [] buffer8; - delete [] buffer16; -} - -void JavaScript::Lexer::setCode(const QString &c, int lineno) -{ - errmsg = QString(); - yylineno = lineno; - yycolumn = 1; - restrKeyword = false; - delimited = false; - stackToken = -1; - pos = 0; - code = c.unicode(); - length = c.length(); - bol = true; - - // read first characters - current = (length > 0) ? code[0].unicode() : 0; - next1 = (length > 1) ? code[1].unicode() : 0; - next2 = (length > 2) ? code[2].unicode() : 0; - next3 = (length > 3) ? code[3].unicode() : 0; -} - -void JavaScript::Lexer::shift(uint p) -{ - while (p--) { - ++pos; - ++yycolumn; - current = next1; - next1 = next2; - next2 = next3; - next3 = (pos + 3 < length) ? code[pos+3].unicode() : 0; - } -} - -void JavaScript::Lexer::setDone(State s) -{ - state = s; - done = true; -} - -int JavaScript::Lexer::findReservedWord(const QChar *c, int size) const -{ - switch (size) { - case 2: { - if (c[0] == QLatin1Char('d') && c[1] == QLatin1Char('o')) - return JavaScriptGrammar::T_DO; - else if (c[0] == QLatin1Char('i') && c[1] == QLatin1Char('f')) - return JavaScriptGrammar::T_IF; - else if (c[0] == QLatin1Char('i') && c[1] == QLatin1Char('n')) - return JavaScriptGrammar::T_IN; - } break; - - case 3: { - if (c[0] == QLatin1Char('f') && c[1] == QLatin1Char('o') && c[2] == QLatin1Char('r')) - return JavaScriptGrammar::T_FOR; - else if (c[0] == QLatin1Char('n') && c[1] == QLatin1Char('e') && c[2] == QLatin1Char('w')) - return JavaScriptGrammar::T_NEW; - else if (c[0] == QLatin1Char('t') && c[1] == QLatin1Char('r') && c[2] == QLatin1Char('y')) - return JavaScriptGrammar::T_TRY; - else if (c[0] == QLatin1Char('v') && c[1] == QLatin1Char('a') && c[2] == QLatin1Char('r')) - return JavaScriptGrammar::T_VAR; - else if (check_reserved) { - if (c[0] == QLatin1Char('i') && c[1] == QLatin1Char('n') && c[2] == QLatin1Char('t')) - return JavaScriptGrammar::T_RESERVED_WORD; - } - } break; - - case 4: { - if (c[0] == QLatin1Char('c') && c[1] == QLatin1Char('a') - && c[2] == QLatin1Char('s') && c[3] == QLatin1Char('e')) - return JavaScriptGrammar::T_CASE; - else if (c[0] == QLatin1Char('e') && c[1] == QLatin1Char('l') - && c[2] == QLatin1Char('s') && c[3] == QLatin1Char('e')) - return JavaScriptGrammar::T_ELSE; - else if (c[0] == QLatin1Char('t') && c[1] == QLatin1Char('h') - && c[2] == QLatin1Char('i') && c[3] == QLatin1Char('s')) - return JavaScriptGrammar::T_THIS; - else if (c[0] == QLatin1Char('v') && c[1] == QLatin1Char('o') - && c[2] == QLatin1Char('i') && c[3] == QLatin1Char('d')) - return JavaScriptGrammar::T_VOID; - else if (c[0] == QLatin1Char('w') && c[1] == QLatin1Char('i') - && c[2] == QLatin1Char('t') && c[3] == QLatin1Char('h')) - return JavaScriptGrammar::T_WITH; - else if (c[0] == QLatin1Char('t') && c[1] == QLatin1Char('r') - && c[2] == QLatin1Char('u') && c[3] == QLatin1Char('e')) - return JavaScriptGrammar::T_TRUE; - else if (c[0] == QLatin1Char('n') && c[1] == QLatin1Char('u') - && c[2] == QLatin1Char('l') && c[3] == QLatin1Char('l')) - return JavaScriptGrammar::T_NULL; - else if (check_reserved) { - if (c[0] == QLatin1Char('e') && c[1] == QLatin1Char('n') - && c[2] == QLatin1Char('u') && c[3] == QLatin1Char('m')) - return JavaScriptGrammar::T_RESERVED_WORD; - else if (c[0] == QLatin1Char('b') && c[1] == QLatin1Char('y') - && c[2] == QLatin1Char('t') && c[3] == QLatin1Char('e')) - return JavaScriptGrammar::T_RESERVED_WORD; - else if (c[0] == QLatin1Char('l') && c[1] == QLatin1Char('o') - && c[2] == QLatin1Char('n') && c[3] == QLatin1Char('g')) - return JavaScriptGrammar::T_RESERVED_WORD; - else if (c[0] == QLatin1Char('c') && c[1] == QLatin1Char('h') - && c[2] == QLatin1Char('a') && c[3] == QLatin1Char('r')) - return JavaScriptGrammar::T_RESERVED_WORD; - else if (c[0] == QLatin1Char('g') && c[1] == QLatin1Char('o') - && c[2] == QLatin1Char('t') && c[3] == QLatin1Char('o')) - return JavaScriptGrammar::T_RESERVED_WORD; - } - } break; - - case 5: { - if (c[0] == QLatin1Char('b') && c[1] == QLatin1Char('r') - && c[2] == QLatin1Char('e') && c[3] == QLatin1Char('a') - && c[4] == QLatin1Char('k')) - return JavaScriptGrammar::T_BREAK; - else if (c[0] == QLatin1Char('c') && c[1] == QLatin1Char('a') - && c[2] == QLatin1Char('t') && c[3] == QLatin1Char('c') - && c[4] == QLatin1Char('h')) - return JavaScriptGrammar::T_CATCH; - else if (c[0] == QLatin1Char('t') && c[1] == QLatin1Char('h') - && c[2] == QLatin1Char('r') && c[3] == QLatin1Char('o') - && c[4] == QLatin1Char('w')) - return JavaScriptGrammar::T_THROW; - else if (c[0] == QLatin1Char('w') && c[1] == QLatin1Char('h') - && c[2] == QLatin1Char('i') && c[3] == QLatin1Char('l') - && c[4] == QLatin1Char('e')) - return JavaScriptGrammar::T_WHILE; - else if (c[0] == QLatin1Char('c') && c[1] == QLatin1Char('o') - && c[2] == QLatin1Char('n') && c[3] == QLatin1Char('s') - && c[4] == QLatin1Char('t')) - return JavaScriptGrammar::T_CONST; - else if (c[0] == QLatin1Char('f') && c[1] == QLatin1Char('a') - && c[2] == QLatin1Char('l') && c[3] == QLatin1Char('s') - && c[4] == QLatin1Char('e')) - return JavaScriptGrammar::T_FALSE; - else if (check_reserved) { - if (c[0] == QLatin1Char('s') && c[1] == QLatin1Char('h') - && c[2] == QLatin1Char('o') && c[3] == QLatin1Char('r') - && c[4] == QLatin1Char('t')) - return JavaScriptGrammar::T_RESERVED_WORD; - else if (c[0] == QLatin1Char('s') && c[1] == QLatin1Char('u') - && c[2] == QLatin1Char('p') && c[3] == QLatin1Char('e') - && c[4] == QLatin1Char('r')) - return JavaScriptGrammar::T_RESERVED_WORD; - else if (c[0] == QLatin1Char('f') && c[1] == QLatin1Char('i') - && c[2] == QLatin1Char('n') && c[3] == QLatin1Char('a') - && c[4] == QLatin1Char('l')) - return JavaScriptGrammar::T_RESERVED_WORD; - else if (c[0] == QLatin1Char('c') && c[1] == QLatin1Char('l') - && c[2] == QLatin1Char('a') && c[3] == QLatin1Char('s') - && c[4] == QLatin1Char('s')) - return JavaScriptGrammar::T_RESERVED_WORD; - else if (c[0] == QLatin1Char('f') && c[1] == QLatin1Char('l') - && c[2] == QLatin1Char('o') && c[3] == QLatin1Char('a') - && c[4] == QLatin1Char('t')) - return JavaScriptGrammar::T_RESERVED_WORD; - } - } break; - - case 6: { - if (c[0] == QLatin1Char('d') && c[1] == QLatin1Char('e') - && c[2] == QLatin1Char('l') && c[3] == QLatin1Char('e') - && c[4] == QLatin1Char('t') && c[5] == QLatin1Char('e')) - return JavaScriptGrammar::T_DELETE; - else if (c[0] == QLatin1Char('r') && c[1] == QLatin1Char('e') - && c[2] == QLatin1Char('t') && c[3] == QLatin1Char('u') - && c[4] == QLatin1Char('r') && c[5] == QLatin1Char('n')) - return JavaScriptGrammar::T_RETURN; - else if (c[0] == QLatin1Char('s') && c[1] == QLatin1Char('w') - && c[2] == QLatin1Char('i') && c[3] == QLatin1Char('t') - && c[4] == QLatin1Char('c') && c[5] == QLatin1Char('h')) - return JavaScriptGrammar::T_SWITCH; - else if (c[0] == QLatin1Char('t') && c[1] == QLatin1Char('y') - && c[2] == QLatin1Char('p') && c[3] == QLatin1Char('e') - && c[4] == QLatin1Char('o') && c[5] == QLatin1Char('f')) - return JavaScriptGrammar::T_TYPEOF; - else if (check_reserved) { - if (c[0] == QLatin1Char('e') && c[1] == QLatin1Char('x') - && c[2] == QLatin1Char('p') && c[3] == QLatin1Char('o') - && c[4] == QLatin1Char('r') && c[5] == QLatin1Char('t')) - return JavaScriptGrammar::T_RESERVED_WORD; - else if (c[0] == QLatin1Char('s') && c[1] == QLatin1Char('t') - && c[2] == QLatin1Char('a') && c[3] == QLatin1Char('t') - && c[4] == QLatin1Char('i') && c[5] == QLatin1Char('c')) - return JavaScriptGrammar::T_RESERVED_WORD; - else if (c[0] == QLatin1Char('d') && c[1] == QLatin1Char('o') - && c[2] == QLatin1Char('u') && c[3] == QLatin1Char('b') - && c[4] == QLatin1Char('l') && c[5] == QLatin1Char('e')) - return JavaScriptGrammar::T_RESERVED_WORD; - else if (c[0] == QLatin1Char('i') && c[1] == QLatin1Char('m') - && c[2] == QLatin1Char('p') && c[3] == QLatin1Char('o') - && c[4] == QLatin1Char('r') && c[5] == QLatin1Char('t')) - return JavaScriptGrammar::T_RESERVED_WORD; - else if (c[0] == QLatin1Char('p') && c[1] == QLatin1Char('u') - && c[2] == QLatin1Char('b') && c[3] == QLatin1Char('l') - && c[4] == QLatin1Char('i') && c[5] == QLatin1Char('c')) - return JavaScriptGrammar::T_RESERVED_WORD; - else if (c[0] == QLatin1Char('n') && c[1] == QLatin1Char('a') - && c[2] == QLatin1Char('t') && c[3] == QLatin1Char('i') - && c[4] == QLatin1Char('v') && c[5] == QLatin1Char('e')) - return JavaScriptGrammar::T_RESERVED_WORD; - else if (c[0] == QLatin1Char('t') && c[1] == QLatin1Char('h') - && c[2] == QLatin1Char('r') && c[3] == QLatin1Char('o') - && c[4] == QLatin1Char('w') && c[5] == QLatin1Char('s')) - return JavaScriptGrammar::T_RESERVED_WORD; - } - } break; - - case 7: { - if (c[0] == QLatin1Char('d') && c[1] == QLatin1Char('e') - && c[2] == QLatin1Char('f') && c[3] == QLatin1Char('a') - && c[4] == QLatin1Char('u') && c[5] == QLatin1Char('l') - && c[6] == QLatin1Char('t')) - return JavaScriptGrammar::T_DEFAULT; - else if (c[0] == QLatin1Char('f') && c[1] == QLatin1Char('i') - && c[2] == QLatin1Char('n') && c[3] == QLatin1Char('a') - && c[4] == QLatin1Char('l') && c[5] == QLatin1Char('l') - && c[6] == QLatin1Char('y')) - return JavaScriptGrammar::T_FINALLY; - else if (check_reserved) { - if (c[0] == QLatin1Char('b') && c[1] == QLatin1Char('o') - && c[2] == QLatin1Char('o') && c[3] == QLatin1Char('l') - && c[4] == QLatin1Char('e') && c[5] == QLatin1Char('a') - && c[6] == QLatin1Char('n')) - return JavaScriptGrammar::T_RESERVED_WORD; - else if (c[0] == QLatin1Char('e') && c[1] == QLatin1Char('x') - && c[2] == QLatin1Char('t') && c[3] == QLatin1Char('e') - && c[4] == QLatin1Char('n') && c[5] == QLatin1Char('d') - && c[6] == QLatin1Char('s')) - return JavaScriptGrammar::T_RESERVED_WORD; - else if (c[0] == QLatin1Char('p') && c[1] == QLatin1Char('a') - && c[2] == QLatin1Char('c') && c[3] == QLatin1Char('k') - && c[4] == QLatin1Char('a') && c[5] == QLatin1Char('g') - && c[6] == QLatin1Char('e')) - return JavaScriptGrammar::T_RESERVED_WORD; - else if (c[0] == QLatin1Char('p') && c[1] == QLatin1Char('r') - && c[2] == QLatin1Char('i') && c[3] == QLatin1Char('v') - && c[4] == QLatin1Char('a') && c[5] == QLatin1Char('t') - && c[6] == QLatin1Char('e')) - return JavaScriptGrammar::T_RESERVED_WORD; - } - } break; - - case 8: { - if (c[0] == QLatin1Char('c') && c[1] == QLatin1Char('o') - && c[2] == QLatin1Char('n') && c[3] == QLatin1Char('t') - && c[4] == QLatin1Char('i') && c[5] == QLatin1Char('n') - && c[6] == QLatin1Char('u') && c[7] == QLatin1Char('e')) - return JavaScriptGrammar::T_CONTINUE; - else if (c[0] == QLatin1Char('f') && c[1] == QLatin1Char('u') - && c[2] == QLatin1Char('n') && c[3] == QLatin1Char('c') - && c[4] == QLatin1Char('t') && c[5] == QLatin1Char('i') - && c[6] == QLatin1Char('o') && c[7] == QLatin1Char('n')) - return JavaScriptGrammar::T_FUNCTION; - else if (c[0] == QLatin1Char('d') && c[1] == QLatin1Char('e') - && c[2] == QLatin1Char('b') && c[3] == QLatin1Char('u') - && c[4] == QLatin1Char('g') && c[5] == QLatin1Char('g') - && c[6] == QLatin1Char('e') && c[7] == QLatin1Char('r')) - return JavaScriptGrammar::T_DEBUGGER; - else if (check_reserved) { - if (c[0] == QLatin1Char('a') && c[1] == QLatin1Char('b') - && c[2] == QLatin1Char('s') && c[3] == QLatin1Char('t') - && c[4] == QLatin1Char('r') && c[5] == QLatin1Char('a') - && c[6] == QLatin1Char('c') && c[7] == QLatin1Char('t')) - return JavaScriptGrammar::T_RESERVED_WORD; - else if (c[0] == QLatin1Char('v') && c[1] == QLatin1Char('o') - && c[2] == QLatin1Char('l') && c[3] == QLatin1Char('a') - && c[4] == QLatin1Char('t') && c[5] == QLatin1Char('i') - && c[6] == QLatin1Char('l') && c[7] == QLatin1Char('e')) - return JavaScriptGrammar::T_RESERVED_WORD; - } - } break; - - case 9: { - if (check_reserved) { - if (c[0] == QLatin1Char('i') && c[1] == QLatin1Char('n') - && c[2] == QLatin1Char('t') && c[3] == QLatin1Char('e') - && c[4] == QLatin1Char('r') && c[5] == QLatin1Char('f') - && c[6] == QLatin1Char('a') && c[7] == QLatin1Char('c') - && c[8] == QLatin1Char('e')) - return JavaScriptGrammar::T_RESERVED_WORD; - else if (c[0] == QLatin1Char('t') && c[1] == QLatin1Char('r') - && c[2] == QLatin1Char('a') && c[3] == QLatin1Char('n') - && c[4] == QLatin1Char('s') && c[5] == QLatin1Char('i') - && c[6] == QLatin1Char('e') && c[7] == QLatin1Char('n') - && c[8] == QLatin1Char('t')) - return JavaScriptGrammar::T_RESERVED_WORD; - else if (c[0] == QLatin1Char('p') && c[1] == QLatin1Char('r') - && c[2] == QLatin1Char('o') && c[3] == QLatin1Char('t') - && c[4] == QLatin1Char('e') && c[5] == QLatin1Char('c') - && c[6] == QLatin1Char('t') && c[7] == QLatin1Char('e') - && c[8] == QLatin1Char('d')) - return JavaScriptGrammar::T_RESERVED_WORD; - } - } break; - - case 10: { - if (c[0] == QLatin1Char('i') && c[1] == QLatin1Char('n') - && c[2] == QLatin1Char('s') && c[3] == QLatin1Char('t') - && c[4] == QLatin1Char('a') && c[5] == QLatin1Char('n') - && c[6] == QLatin1Char('c') && c[7] == QLatin1Char('e') - && c[8] == QLatin1Char('o') && c[9] == QLatin1Char('f')) - return JavaScriptGrammar::T_INSTANCEOF; - else if (check_reserved) { - if (c[0] == QLatin1Char('i') && c[1] == QLatin1Char('m') - && c[2] == QLatin1Char('p') && c[3] == QLatin1Char('l') - && c[4] == QLatin1Char('e') && c[5] == QLatin1Char('m') - && c[6] == QLatin1Char('e') && c[7] == QLatin1Char('n') - && c[8] == QLatin1Char('t') && c[9] == QLatin1Char('s')) - return JavaScriptGrammar::T_RESERVED_WORD; - } - } break; - - case 12: { - if (check_reserved) { - if (c[0] == QLatin1Char('s') && c[1] == QLatin1Char('y') - && c[2] == QLatin1Char('n') && c[3] == QLatin1Char('c') - && c[4] == QLatin1Char('h') && c[5] == QLatin1Char('r') - && c[6] == QLatin1Char('o') && c[7] == QLatin1Char('n') - && c[8] == QLatin1Char('i') && c[9] == QLatin1Char('z') - && c[10] == QLatin1Char('e') && c[11] == QLatin1Char('d')) - return JavaScriptGrammar::T_RESERVED_WORD; - } - } break; - - } // switch - - return -1; -} - -int JavaScript::Lexer::lex() -{ - int token = 0; - state = Start; - ushort stringType = 0; // either single or double quotes - pos8 = pos16 = 0; - done = false; - terminator = false; - - // did we push a token on the stack previously ? - // (after an automatic semicolon insertion) - if (stackToken >= 0) { - setDone(Other); - token = stackToken; - stackToken = -1; - } - - while (!done) { - switch (state) { - case Start: - if (isWhiteSpace()) { - // do nothing - } else if (current == '/' && next1 == '/') { - recordStartPos(); - shift(1); - state = InSingleLineComment; - } else if (current == '/' && next1 == '*') { - recordStartPos(); - shift(1); - state = InMultiLineComment; - } else if (current == 0) { - syncProhibitAutomaticSemicolon(); - if (!terminator && !delimited && !prohibitAutomaticSemicolon) { - // automatic semicolon insertion if program incomplete - token = JavaScriptGrammar::T_SEMICOLON; - stackToken = 0; - setDone(Other); - } else { - setDone(Eof); - } - } else if (isLineTerminator()) { - shiftWindowsLineBreak(); - yylineno++; - yycolumn = 0; - bol = true; - terminator = true; - syncProhibitAutomaticSemicolon(); - if (restrKeyword) { - token = JavaScriptGrammar::T_SEMICOLON; - setDone(Other); - } - } else if (current == '"' || current == '\'') { - recordStartPos(); - state = InString; - stringType = current; - } else if (isIdentLetter(current)) { - recordStartPos(); - record16(current); - state = InIdentifier; - } else if (current == '0') { - recordStartPos(); - record8(current); - state = InNum0; - } else if (isDecimalDigit(current)) { - recordStartPos(); - record8(current); - state = InNum; - } else if (current == '.' && isDecimalDigit(next1)) { - recordStartPos(); - record8(current); - state = InDecimal; - } else { - recordStartPos(); - token = matchPunctuator(current, next1, next2, next3); - if (token != -1) { - if (terminator && !delimited && !prohibitAutomaticSemicolon - && (token == JavaScriptGrammar::T_PLUS_PLUS - || token == JavaScriptGrammar::T_MINUS_MINUS)) { - // automatic semicolon insertion - stackToken = token; - token = JavaScriptGrammar::T_SEMICOLON; - } - setDone(Other); - } - else { - setDone(Bad); - err = IllegalCharacter; - errmsg = QLatin1String("Illegal character"); - } - } - break; - case InString: - if (current == stringType) { - shift(1); - setDone(String); - } else if (current == 0 || isLineTerminator()) { - setDone(Bad); - err = UnclosedStringLiteral; - errmsg = QLatin1String("Unclosed string at end of line"); - } else if (current == '\\') { - state = InEscapeSequence; - } else { - record16(current); - } - break; - // Escape Sequences inside of strings - case InEscapeSequence: - if (isOctalDigit(current)) { - if (current >= '0' && current <= '3' && - isOctalDigit(next1) && isOctalDigit(next2)) { - record16(convertOctal(current, next1, next2)); - shift(2); - state = InString; - } else if (isOctalDigit(current) && - isOctalDigit(next1)) { - record16(convertOctal('0', current, next1)); - shift(1); - state = InString; - } else if (isOctalDigit(current)) { - record16(convertOctal('0', '0', current)); - state = InString; - } else { - setDone(Bad); - err = IllegalEscapeSequence; - errmsg = QLatin1String("Illegal escape squence"); - } - } else if (current == 'x') - state = InHexEscape; - else if (current == 'u') - state = InUnicodeEscape; - else { - if (isLineTerminator()) { - shiftWindowsLineBreak(); - yylineno++; - yycolumn = 0; - bol = true; - } else { - record16(singleEscape(current)); - } - state = InString; - } - break; - case InHexEscape: - if (isHexDigit(current) && isHexDigit(next1)) { - state = InString; - record16(QLatin1Char(convertHex(current, next1))); - shift(1); - } else if (current == stringType) { - record16(QLatin1Char('x')); - shift(1); - setDone(String); - } else { - record16(QLatin1Char('x')); - record16(current); - state = InString; - } - break; - case InUnicodeEscape: - if (isHexDigit(current) && isHexDigit(next1) && - isHexDigit(next2) && isHexDigit(next3)) { - record16(convertUnicode(current, next1, next2, next3)); - shift(3); - state = InString; - } else if (current == stringType) { - record16(QLatin1Char('u')); - shift(1); - setDone(String); - } else { - setDone(Bad); - err = IllegalUnicodeEscapeSequence; - errmsg = QLatin1String("Illegal unicode escape sequence"); - } - break; - case InSingleLineComment: - if (isLineTerminator()) { - shiftWindowsLineBreak(); - yylineno++; - yycolumn = 0; - terminator = true; - bol = true; - if (restrKeyword) { - token = JavaScriptGrammar::T_SEMICOLON; - setDone(Other); - } else - state = Start; - } else if (current == 0) { - setDone(Eof); - } - break; - case InMultiLineComment: - if (current == 0) { - setDone(Bad); - err = UnclosedComment; - errmsg = QLatin1String("Unclosed comment at end of file"); - } else if (isLineTerminator()) { - shiftWindowsLineBreak(); - yylineno++; - } else if (current == '*' && next1 == '/') { - state = Start; - shift(1); - } - break; - case InIdentifier: - if (isIdentLetter(current) || isDecimalDigit(current)) { - record16(current); - break; - } - setDone(Identifier); - break; - case InNum0: - if (current == 'x' || current == 'X') { - record8(current); - state = InHex; - } else if (current == '.') { - record8(current); - state = InDecimal; - } else if (current == 'e' || current == 'E') { - record8(current); - state = InExponentIndicator; - } else if (isOctalDigit(current)) { - record8(current); - state = InOctal; - } else if (isDecimalDigit(current)) { - record8(current); - state = InDecimal; - } else { - setDone(Number); - } - break; - case InHex: - if (isHexDigit(current)) - record8(current); - else - setDone(Hex); - break; - case InOctal: - if (isOctalDigit(current)) { - record8(current); - } else if (isDecimalDigit(current)) { - record8(current); - state = InDecimal; - } else { - setDone(Octal); - } - break; - case InNum: - if (isDecimalDigit(current)) { - record8(current); - } else if (current == '.') { - record8(current); - state = InDecimal; - } else if (current == 'e' || current == 'E') { - record8(current); - state = InExponentIndicator; - } else { - setDone(Number); - } - break; - case InDecimal: - if (isDecimalDigit(current)) { - record8(current); - } else if (current == 'e' || current == 'E') { - record8(current); - state = InExponentIndicator; - } else { - setDone(Number); - } - break; - case InExponentIndicator: - if (current == '+' || current == '-') { - record8(current); - } else if (isDecimalDigit(current)) { - record8(current); - state = InExponent; - } else { - setDone(Bad); - err = IllegalExponentIndicator; - errmsg = QLatin1String("Illegal syntax for exponential number"); - } - break; - case InExponent: - if (isDecimalDigit(current)) { - record8(current); - } else { - setDone(Number); - } - break; - default: - Q_ASSERT_X(0, "Lexer::lex", "Unhandled state in switch statement"); - } - - // move on to the next character - if (!done) - shift(1); - if (state != Start && state != InSingleLineComment) - bol = false; - } - - // no identifiers allowed directly after numeric literal, e.g. "3in" is bad - if ((state == Number || state == Octal || state == Hex) - && isIdentLetter(current)) { - state = Bad; - err = IllegalIdentifier; - errmsg = QLatin1String("Identifier cannot start with numeric literal"); - } - - // terminate string - buffer8[pos8] = '\0'; - - double dval = 0; - if (state == Number) { - dval = qstrtod(buffer8, 0, 0); - } else if (state == Hex) { // scan hex numbers - dval = JavaScript::integerFromString(buffer8, pos8, 16); - state = Number; - } else if (state == Octal) { // scan octal number - dval = JavaScript::integerFromString(buffer8, pos8, 8); - state = Number; - } - - restrKeyword = false; - delimited = false; - - switch (parenthesesState) { - case IgnoreParentheses: - break; - case CountParentheses: - if (token == JavaScriptGrammar::T_RPAREN) { - --parenthesesCount; - if (parenthesesCount == 0) - parenthesesState = BalancedParentheses; - } else if (token == JavaScriptGrammar::T_LPAREN) { - ++parenthesesCount; - } - break; - case BalancedParentheses: - parenthesesState = IgnoreParentheses; - break; - } - - switch (state) { - case Eof: - return 0; - case Other: - if(token == JavaScriptGrammar::T_RBRACE || token == JavaScriptGrammar::T_SEMICOLON) - delimited = true; - return token; - case Identifier: - if ((token = findReservedWord(buffer16, pos16)) < 0) { - /* TODO: close leak on parse error. same holds true for String */ - if (driver) - qsyylval.ustr = driver->intern(buffer16, pos16); - else - qsyylval.ustr = 0; - return JavaScriptGrammar::T_IDENTIFIER; - } - if (token == JavaScriptGrammar::T_CONTINUE || token == JavaScriptGrammar::T_BREAK - || token == JavaScriptGrammar::T_RETURN || token == JavaScriptGrammar::T_THROW) { - restrKeyword = true; - } else if (token == JavaScriptGrammar::T_IF || token == JavaScriptGrammar::T_FOR - || token == JavaScriptGrammar::T_WHILE || token == JavaScriptGrammar::T_WITH) { - parenthesesState = CountParentheses; - parenthesesCount = 0; - } else if (token == JavaScriptGrammar::T_DO) { - parenthesesState = BalancedParentheses; - } - return token; - case String: - if (driver) - qsyylval.ustr = driver->intern(buffer16, pos16); - else - qsyylval.ustr = 0; - return JavaScriptGrammar::T_STRING_LITERAL; - case Number: - qsyylval.dval = dval; - return JavaScriptGrammar::T_NUMERIC_LITERAL; - case Bad: - return -1; - default: - Q_ASSERT(!"unhandled numeration value in switch"); - return -1; - } -} - -bool JavaScript::Lexer::isWhiteSpace() const -{ - return (current == ' ' || current == '\t' || - current == 0x0b || current == 0x0c); -} - -bool JavaScript::Lexer::isLineTerminator() const -{ - return (current == '\n' || current == '\r'); -} - -bool JavaScript::Lexer::isIdentLetter(ushort c) -{ - /* TODO: allow other legitimate unicode chars */ - return ((c >= 'a' && c <= 'z') - || (c >= 'A' && c <= 'Z') - || c == '$' - || c == '_'); -} - -bool JavaScript::Lexer::isDecimalDigit(ushort c) -{ - return (c >= '0' && c <= '9'); -} - -bool JavaScript::Lexer::isHexDigit(ushort c) const -{ - return ((c >= '0' && c <= '9') - || (c >= 'a' && c <= 'f') - || (c >= 'A' && c <= 'F')); -} - -bool JavaScript::Lexer::isOctalDigit(ushort c) const -{ - return (c >= '0' && c <= '7'); -} - -int JavaScript::Lexer::matchPunctuator(ushort c1, ushort c2, - ushort c3, ushort c4) -{ - if (c1 == '>' && c2 == '>' && c3 == '>' && c4 == '=') { - shift(4); - return JavaScriptGrammar::T_GT_GT_GT_EQ; - } else if (c1 == '=' && c2 == '=' && c3 == '=') { - shift(3); - return JavaScriptGrammar::T_EQ_EQ_EQ; - } else if (c1 == '!' && c2 == '=' && c3 == '=') { - shift(3); - return JavaScriptGrammar::T_NOT_EQ_EQ; - } else if (c1 == '>' && c2 == '>' && c3 == '>') { - shift(3); - return JavaScriptGrammar::T_GT_GT_GT; - } else if (c1 == '<' && c2 == '<' && c3 == '=') { - shift(3); - return JavaScriptGrammar::T_LT_LT_EQ; - } else if (c1 == '>' && c2 == '>' && c3 == '=') { - shift(3); - return JavaScriptGrammar::T_GT_GT_EQ; - } else if (c1 == '<' && c2 == '=') { - shift(2); - return JavaScriptGrammar::T_LE; - } else if (c1 == '>' && c2 == '=') { - shift(2); - return JavaScriptGrammar::T_GE; - } else if (c1 == '!' && c2 == '=') { - shift(2); - return JavaScriptGrammar::T_NOT_EQ; - } else if (c1 == '+' && c2 == '+') { - shift(2); - return JavaScriptGrammar::T_PLUS_PLUS; - } else if (c1 == '-' && c2 == '-') { - shift(2); - return JavaScriptGrammar::T_MINUS_MINUS; - } else if (c1 == '=' && c2 == '=') { - shift(2); - return JavaScriptGrammar::T_EQ_EQ; - } else if (c1 == '+' && c2 == '=') { - shift(2); - return JavaScriptGrammar::T_PLUS_EQ; - } else if (c1 == '-' && c2 == '=') { - shift(2); - return JavaScriptGrammar::T_MINUS_EQ; - } else if (c1 == '*' && c2 == '=') { - shift(2); - return JavaScriptGrammar::T_STAR_EQ; - } else if (c1 == '/' && c2 == '=') { - shift(2); - return JavaScriptGrammar::T_DIVIDE_EQ; - } else if (c1 == '&' && c2 == '=') { - shift(2); - return JavaScriptGrammar::T_AND_EQ; - } else if (c1 == '^' && c2 == '=') { - shift(2); - return JavaScriptGrammar::T_XOR_EQ; - } else if (c1 == '%' && c2 == '=') { - shift(2); - return JavaScriptGrammar::T_REMAINDER_EQ; - } else if (c1 == '|' && c2 == '=') { - shift(2); - return JavaScriptGrammar::T_OR_EQ; - } else if (c1 == '<' && c2 == '<') { - shift(2); - return JavaScriptGrammar::T_LT_LT; - } else if (c1 == '>' && c2 == '>') { - shift(2); - return JavaScriptGrammar::T_GT_GT; - } else if (c1 == '&' && c2 == '&') { - shift(2); - return JavaScriptGrammar::T_AND_AND; - } else if (c1 == '|' && c2 == '|') { - shift(2); - return JavaScriptGrammar::T_OR_OR; - } - - switch(c1) { - case '=': shift(1); return JavaScriptGrammar::T_EQ; - case '>': shift(1); return JavaScriptGrammar::T_GT; - case '<': shift(1); return JavaScriptGrammar::T_LT; - case ',': shift(1); return JavaScriptGrammar::T_COMMA; - case '!': shift(1); return JavaScriptGrammar::T_NOT; - case '~': shift(1); return JavaScriptGrammar::T_TILDE; - case '?': shift(1); return JavaScriptGrammar::T_QUESTION; - case ':': shift(1); return JavaScriptGrammar::T_COLON; - case '.': shift(1); return JavaScriptGrammar::T_DOT; - case '+': shift(1); return JavaScriptGrammar::T_PLUS; - case '-': shift(1); return JavaScriptGrammar::T_MINUS; - case '*': shift(1); return JavaScriptGrammar::T_STAR; - case '/': shift(1); return JavaScriptGrammar::T_DIVIDE_; - case '&': shift(1); return JavaScriptGrammar::T_AND; - case '|': shift(1); return JavaScriptGrammar::T_OR; - case '^': shift(1); return JavaScriptGrammar::T_XOR; - case '%': shift(1); return JavaScriptGrammar::T_REMAINDER; - case '(': shift(1); return JavaScriptGrammar::T_LPAREN; - case ')': shift(1); return JavaScriptGrammar::T_RPAREN; - case '{': shift(1); return JavaScriptGrammar::T_LBRACE; - case '}': shift(1); return JavaScriptGrammar::T_RBRACE; - case '[': shift(1); return JavaScriptGrammar::T_LBRACKET; - case ']': shift(1); return JavaScriptGrammar::T_RBRACKET; - case ';': shift(1); return JavaScriptGrammar::T_SEMICOLON; - - default: return -1; - } -} - -ushort JavaScript::Lexer::singleEscape(ushort c) const -{ - switch(c) { - case 'b': - return 0x08; - case 't': - return 0x09; - case 'n': - return 0x0A; - case 'v': - return 0x0B; - case 'f': - return 0x0C; - case 'r': - return 0x0D; - case '"': - return 0x22; - case '\'': - return 0x27; - case '\\': - return 0x5C; - default: - return c; - } -} - -ushort JavaScript::Lexer::convertOctal(ushort c1, ushort c2, - ushort c3) const -{ - return ((c1 - '0') * 64 + (c2 - '0') * 8 + c3 - '0'); -} - -unsigned char JavaScript::Lexer::convertHex(ushort c) -{ - if (c >= '0' && c <= '9') - return (c - '0'); - else if (c >= 'a' && c <= 'f') - return (c - 'a' + 10); - else - return (c - 'A' + 10); -} - -unsigned char JavaScript::Lexer::convertHex(ushort c1, ushort c2) -{ - return ((convertHex(c1) << 4) + convertHex(c2)); -} - -QChar JavaScript::Lexer::convertUnicode(ushort c1, ushort c2, - ushort c3, ushort c4) -{ - return QChar((convertHex(c3) << 4) + convertHex(c4), - (convertHex(c1) << 4) + convertHex(c2)); -} - -void JavaScript::Lexer::record8(ushort c) -{ - Q_ASSERT(c <= 0xff); - - // enlarge buffer if full - if (pos8 >= size8 - 1) { - char *tmp = new char[2 * size8]; - memcpy(tmp, buffer8, size8 * sizeof(char)); - delete [] buffer8; - buffer8 = tmp; - size8 *= 2; - } - - buffer8[pos8++] = (char) c; -} - -void JavaScript::Lexer::record16(QChar c) -{ - // enlarge buffer if full - if (pos16 >= size16 - 1) { - QChar *tmp = new QChar[2 * size16]; - memcpy(tmp, buffer16, size16 * sizeof(QChar)); - delete [] buffer16; - buffer16 = tmp; - size16 *= 2; - } - - buffer16[pos16++] = c; -} - -void JavaScript::Lexer::recordStartPos() -{ - startlineno = yylineno; - startcolumn = yycolumn; -} - -bool JavaScript::Lexer::scanRegExp(RegExpBodyPrefix prefix) -{ - pos16 = 0; - bool lastWasEscape = false; - - if (prefix == EqualPrefix) - record16(QLatin1Char('=')); - - while (1) { - if (isLineTerminator() || current == 0) { - errmsg = QLatin1String("Unterminated regular expression literal"); - return false; - } - else if (current != '/' || lastWasEscape == true) - { - record16(current); - lastWasEscape = !lastWasEscape && (current == '\\'); - } - else { - if (driver) - pattern = driver->intern(buffer16, pos16); - else - pattern = 0; - pos16 = 0; - shift(1); - break; - } - shift(1); - } - - flags = 0; - while (isIdentLetter(current)) { - int flag = JavaScript::Ecma::RegExp::flagFromChar(current); - if (flag == 0) { - errmsg = QString::fromLatin1("Invalid regular expression flag '%0'") - .arg(QChar(current)); - return false; - } - flags |= flag; - record16(current); - shift(1); - } - - return true; -} - -void JavaScript::Lexer::syncProhibitAutomaticSemicolon() -{ - if (parenthesesState == BalancedParentheses) { - // we have seen something like "if (foo)", which means we should - // never insert an automatic semicolon at this point, since it would - // then be expanded into an empty statement (ECMA-262 7.9.1) - prohibitAutomaticSemicolon = true; - parenthesesState = IgnoreParentheses; - } else { - prohibitAutomaticSemicolon = false; - } -} - -QT_END_NAMESPACE - - diff --git a/src/plugins/qtscripteditor/parser/javascriptlexer_p.h b/src/plugins/qtscripteditor/parser/javascriptlexer_p.h deleted file mode 100644 index 406620bb3eab559742ca7d6dd4b70187b4953611..0000000000000000000000000000000000000000 --- a/src/plugins/qtscripteditor/parser/javascriptlexer_p.h +++ /dev/null @@ -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 diff --git a/src/plugins/qtscripteditor/parser/javascriptmemorypool_p.h b/src/plugins/qtscripteditor/parser/javascriptmemorypool_p.h deleted file mode 100644 index c58e2dc90e4d05d2f07d836ecdb13dfc5c0db8c9..0000000000000000000000000000000000000000 --- a/src/plugins/qtscripteditor/parser/javascriptmemorypool_p.h +++ /dev/null @@ -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 diff --git a/src/plugins/qtscripteditor/parser/javascriptnodepool_p.h b/src/plugins/qtscripteditor/parser/javascriptnodepool_p.h deleted file mode 100644 index 1b7242e29c9b326af2a4218ac933441ef80b6e6b..0000000000000000000000000000000000000000 --- a/src/plugins/qtscripteditor/parser/javascriptnodepool_p.h +++ /dev/null @@ -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 diff --git a/src/plugins/qtscripteditor/parser/javascriptparser.cpp b/src/plugins/qtscripteditor/parser/javascriptparser.cpp deleted file mode 100644 index 0c8a75070f56c5dab7e3fc528079e8a0c2f9763d..0000000000000000000000000000000000000000 --- a/src/plugins/qtscripteditor/parser/javascriptparser.cpp +++ /dev/null @@ -1,1201 +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 <QtCore/QtDebug> -#include <string.h> -#include "javascriptengine_p.h" -#include "javascriptlexer_p.h" -#include "javascriptast_p.h" -#include "javascriptnodepool_p.h" - -#define J_SCRIPT_UPDATE_POSITION(node, startloc, endloc) do { \ - node->startLine = startloc.startLine; \ - node->startColumn = startloc.startColumn; \ - node->endLine = endloc.endLine; \ - node->endColumn = endloc.endColumn; \ -} while (0) - - - -#include "javascriptparser_p.h" - -// -// This file is automatically generated from javascript.g. -// Changes will be lost. -// To re-generate, run: qlalr --no-debug --no-lines --qt javascript.g -// - -QT_BEGIN_NAMESPACE - -inline static bool automatic(JavaScriptEnginePrivate *driver, int token) -{ - return token == JavaScriptGrammar::T_RBRACE - || token == 0 - || driver->lexer()->prevTerminator(); -} - - -JavaScriptParser::JavaScriptParser(): - tos(0), - stack_size(0), - sym_stack(0), - state_stack(0), - location_stack(0), - first_token(0), - last_token(0) -{ -} - -JavaScriptParser::~JavaScriptParser() -{ - if (stack_size) { - qFree(sym_stack); - qFree(state_stack); - qFree(location_stack); - } -} - -static inline JavaScriptParser::Location location(JavaScript::Lexer *lexer) -{ - JavaScriptParser::Location loc; - loc.startLine = lexer->startLineNo(); - loc.startColumn = lexer->startColumnNo(); - loc.endLine = lexer->endLineNo(); - loc.endColumn = lexer->endColumnNo(); - return loc; -} - -bool JavaScriptParser::parse(JavaScriptEnginePrivate *driver) -{ - JavaScript::Lexer *lexer = driver->lexer(); - bool hadErrors = false; - int yytoken = -1; - int action = 0; - - first_token = last_token = 0; - - tos = -1; - - do { - if (++tos == stack_size) - reallocateStack(); - - state_stack[tos] = action; - - _Lcheck_token: - if (yytoken == -1 && -TERMINAL_COUNT != action_index[action]) { - yyprevlloc = yylloc; - - if (first_token == last_token) { - yytoken = lexer->lex(); - yylval = lexer->dval(); - yylloc = location(lexer); - } else { - yytoken = first_token->token; - yylval = first_token->dval; - yylloc = first_token->loc; - ++first_token; - } - } - - action = t_action(action, yytoken); - if (action > 0) { - if (action != ACCEPT_STATE) { - yytoken = -1; - sym(1).dval = yylval; - loc(1) = yylloc; - } else { - --tos; - return ! hadErrors; - } - } else if (action < 0) { - const int r = -action - 1; - tos -= rhs[r]; - - switch (r) { - -case 0: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::ThisExpression> (driver->nodePool()); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(1)); -} break; - -case 1: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::IdentifierExpression> (driver->nodePool(), sym(1).sval); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(1)); -} break; - -case 2: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::NullExpression> (driver->nodePool()); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(1)); -} break; - -case 3: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::TrueLiteral> (driver->nodePool()); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(1)); -} break; - -case 4: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::FalseLiteral> (driver->nodePool()); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(1)); -} break; - -case 5: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::NumericLiteral> (driver->nodePool(), sym(1).dval); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(1)); -} break; - -case 6: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::StringLiteral> (driver->nodePool(), sym(1).sval); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(1)); -} break; - -case 7: { - bool rx = lexer->scanRegExp(JavaScript::Lexer::NoPrefix); - if (!rx) { - diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, lexer->startLineNo(), - lexer->startColumnNo(), lexer->errorMessage())); - return false; - } - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::RegExpLiteral> (driver->nodePool(), lexer->pattern, lexer->flags); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(1)); -} break; - -case 8: { - bool rx = lexer->scanRegExp(JavaScript::Lexer::EqualPrefix); - if (!rx) { - diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, lexer->startLineNo(), - lexer->startColumnNo(), lexer->errorMessage())); - return false; - } - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::RegExpLiteral> (driver->nodePool(), lexer->pattern, lexer->flags); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(1)); -} break; - -case 9: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::ArrayLiteral> (driver->nodePool(), sym(2).Elision); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); -} break; - -case 10: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::ArrayLiteral> (driver->nodePool(), sym(2).ElementList->finish ()); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); -} break; - -case 11: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::ArrayLiteral> (driver->nodePool(), sym(2).ElementList->finish (), sym(4).Elision); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(5)); -} break; - -case 12: { - if (sym(2).Node) - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::ObjectLiteral> (driver->nodePool(), sym(2).PropertyNameAndValueList->finish ()); - else - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::ObjectLiteral> (driver->nodePool()); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); -} break; - -case 13: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::ObjectLiteral> (driver->nodePool(), sym(2).PropertyNameAndValueList->finish ()); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(4)); -} break; - -case 14: { - sym(1) = sym(2); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); -} break; - -case 15: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::ElementList> (driver->nodePool(), sym(1).Elision, sym(2).Expression); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(2)); -} break; - -case 16: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::ElementList> (driver->nodePool(), sym(1).ElementList, sym(3).Elision, sym(4).Expression); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(4)); -} break; - -case 17: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::Elision> (driver->nodePool()); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(1)); -} break; - -case 18: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::Elision> (driver->nodePool(), sym(1).Elision); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(2)); -} break; - -case 19: { - sym(1).Node = 0; -} break; - -case 20: { - sym(1).Elision = sym(1).Elision->finish (); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(1)); -} break; - -case 21: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::PropertyNameAndValueList> (driver->nodePool(), sym(1).PropertyName, sym(3).Expression); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); -} break; - -case 22: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::PropertyNameAndValueList> (driver->nodePool(), sym(1).PropertyNameAndValueList, sym(3).PropertyName, sym(5).Expression); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(5)); -} break; - -case 23: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::IdentifierPropertyName> (driver->nodePool(), sym(1).sval); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(1)); -} break; - -case 24: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::StringLiteralPropertyName> (driver->nodePool(), sym(1).sval); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(1)); -} break; - -case 25: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::NumericLiteralPropertyName> (driver->nodePool(), sym(1).dval); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(1)); -} break; - -case 26: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::IdentifierPropertyName> (driver->nodePool(), sym(1).sval); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(1)); -} break; - -case 27: - -case 28: - -case 29: - -case 30: - -case 31: - -case 32: - -case 33: - -case 34: - -case 35: - -case 36: - -case 37: - -case 38: - -case 39: - -case 40: - -case 41: - -case 42: - -case 43: - -case 44: - -case 45: - -case 46: - -case 47: - -case 48: - -case 49: - -case 50: - -case 51: - -case 52: - -case 53: - -case 54: - -case 55: - -case 56: - -case 57: -{ - sym(1).sval = driver->intern(lexer->characterBuffer(), lexer->characterCount()); -} break; - -case 62: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::ArrayMemberExpression> (driver->nodePool(), sym(1).Expression, sym(3).Expression); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(4)); -} break; - -case 63: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::FieldMemberExpression> (driver->nodePool(), sym(1).Expression, sym(3).sval); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(4)); -} break; - -case 64: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::NewMemberExpression> (driver->nodePool(), sym(2).Expression, sym(3).ArgumentList); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); -} break; - -case 66: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::NewExpression> (driver->nodePool(), sym(2).Expression); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(2)); -} break; - -case 67: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::CallExpression> (driver->nodePool(), sym(1).Expression, sym(2).ArgumentList); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(2)); -} break; - -case 68: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::CallExpression> (driver->nodePool(), sym(1).Expression, sym(2).ArgumentList); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(2)); -} break; - -case 69: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::ArrayMemberExpression> (driver->nodePool(), sym(1).Expression, sym(3).Expression); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(4)); -} break; - -case 70: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::FieldMemberExpression> (driver->nodePool(), sym(1).Expression, sym(3).sval); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); -} break; - -case 71: { - sym(1).Node = 0; -} break; - -case 72: { - sym(1).Node = sym(2).ArgumentList->finish (); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); -} break; - -case 73: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::ArgumentList> (driver->nodePool(), sym(1).Expression); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(1)); -} break; - -case 74: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::ArgumentList> (driver->nodePool(), sym(1).ArgumentList, sym(3).Expression); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); -} break; - -case 78: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::PostIncrementExpression> (driver->nodePool(), sym(1).Expression); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(2)); -} break; - -case 79: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::PostDecrementExpression> (driver->nodePool(), sym(1).Expression); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(2)); -} break; - -case 81: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::DeleteExpression> (driver->nodePool(), sym(2).Expression); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(2)); -} break; - -case 82: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::VoidExpression> (driver->nodePool(), sym(2).Expression); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(2)); -} break; - -case 83: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::TypeOfExpression> (driver->nodePool(), sym(2).Expression); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(2)); -} break; - -case 84: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::PreIncrementExpression> (driver->nodePool(), sym(2).Expression); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(2)); -} break; - -case 85: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::PreDecrementExpression> (driver->nodePool(), sym(2).Expression); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(2)); -} break; - -case 86: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::UnaryPlusExpression> (driver->nodePool(), sym(2).Expression); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(2)); -} break; - -case 87: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::UnaryMinusExpression> (driver->nodePool(), sym(2).Expression); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(2)); -} break; - -case 88: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::TildeExpression> (driver->nodePool(), sym(2).Expression); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(2)); -} break; - -case 89: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::NotExpression> (driver->nodePool(), sym(2).Expression); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(2)); -} break; - -case 91: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::Mul, sym(3).Expression); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); -} break; - -case 92: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::Div, sym(3).Expression); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); -} break; - -case 93: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::Mod, sym(3).Expression); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); -} break; - -case 95: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::Add, sym(3).Expression); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); -} break; - -case 96: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::Sub, sym(3).Expression); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); -} break; - -case 98: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::LShift, sym(3).Expression); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); -} break; - -case 99: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::RShift, sym(3).Expression); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); -} break; - -case 100: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::URShift, sym(3).Expression); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); -} break; - -case 102: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::Lt, sym(3).Expression); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); -} break; - -case 103: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::Gt, sym(3).Expression); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); -} break; - -case 104: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::Le, sym(3).Expression); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); -} break; - -case 105: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::Ge, sym(3).Expression); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); -} break; - -case 106: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::InstanceOf, sym(3).Expression); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); -} break; - -case 107: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::In, sym(3).Expression); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); -} break; - -case 109: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::Lt, sym(3).Expression); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); -} break; - -case 110: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::Gt, sym(3).Expression); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); -} break; - -case 111: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::Le, sym(3).Expression); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); -} break; - -case 112: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::Ge, sym(3).Expression); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); -} break; - -case 113: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::InstanceOf, sym(3).Expression); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); -} break; - -case 115: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::Equal, sym(3).Expression); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); -} break; - -case 116: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::NotEqual, sym(3).Expression); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); -} break; - -case 117: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::StrictEqual, sym(3).Expression); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); -} break; - -case 118: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::StrictNotEqual, sym(3).Expression); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); -} break; - -case 120: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::Equal, sym(3).Expression); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); -} break; - -case 121: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::NotEqual, sym(3).Expression); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); -} break; - -case 122: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::StrictEqual, sym(3).Expression); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); -} break; - -case 123: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::StrictNotEqual, sym(3).Expression); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); -} break; - -case 125: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::BitAnd, sym(3).Expression); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); -} break; - -case 127: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::BitAnd, sym(3).Expression); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); -} break; - -case 129: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::BitXor, sym(3).Expression); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); -} break; - -case 131: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::BitXor, sym(3).Expression); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); -} break; - -case 133: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::BitOr, sym(3).Expression); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); -} break; - -case 135: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::BitOr, sym(3).Expression); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); -} break; - -case 137: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::And, sym(3).Expression); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); -} break; - -case 139: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::And, sym(3).Expression); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); -} break; - -case 141: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::Or, sym(3).Expression); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); -} break; - -case 143: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::Or, sym(3).Expression); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); -} break; - -case 145: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::ConditionalExpression> (driver->nodePool(), sym(1).Expression, sym(3).Expression, sym(5).Expression); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); -} break; - -case 147: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::ConditionalExpression> (driver->nodePool(), sym(1).Expression, sym(3).Expression, sym(5).Expression); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); -} break; - -case 149: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, sym(2).ival, sym(3).Expression); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); -} break; - -case 151: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, sym(2).ival, sym(3).Expression); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); -} break; - -case 152: { - sym(1).ival = QSOperator::Assign; -} break; - -case 153: { - sym(1).ival = QSOperator::InplaceMul; -} break; - -case 154: { - sym(1).ival = QSOperator::InplaceDiv; -} break; - -case 155: { - sym(1).ival = QSOperator::InplaceMod; -} break; - -case 156: { - sym(1).ival = QSOperator::InplaceAdd; -} break; - -case 157: { - sym(1).ival = QSOperator::InplaceSub; -} break; - -case 158: { - sym(1).ival = QSOperator::InplaceLeftShift; -} break; - -case 159: { - sym(1).ival = QSOperator::InplaceRightShift; -} break; - -case 160: { - sym(1).ival = QSOperator::InplaceURightShift; -} break; - -case 161: { - sym(1).ival = QSOperator::InplaceAnd; -} break; - -case 162: { - sym(1).ival = QSOperator::InplaceXor; -} break; - -case 163: { - sym(1).ival = QSOperator::InplaceOr; -} break; - -case 165: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::Expression> (driver->nodePool(), sym(1).Expression, sym(3).Expression); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); -} break; - -case 166: { - sym(1).Node = 0; -} break; - -case 169: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::Expression> (driver->nodePool(), sym(1).Expression, sym(3).Expression); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); -} break; - -case 170: { - sym(1).Node = 0; -} break; - -case 187: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::Block> (driver->nodePool(), sym(2).StatementList); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); -} break; - -case 188: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::StatementList> (driver->nodePool(), sym(1).Statement); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(1)); -} break; - -case 189: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::StatementList> (driver->nodePool(), sym(1).StatementList, sym(2).Statement); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(2)); -} break; - -case 190: { - sym(1).Node = 0; -} break; - -case 191: { - sym(1).Node = sym(1).StatementList->finish (); -} break; - -case 193: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::VariableStatement> (driver->nodePool(), sym(2).VariableDeclarationList->finish (/*readOnly=*/sym(1).ival == T_CONST)); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); -} break; - -case 194: { - sym(1).ival = T_CONST; -} break; - -case 195: { - sym(1).ival = T_VAR; -} break; - -case 196: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::VariableDeclarationList> (driver->nodePool(), sym(1).VariableDeclaration); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(1)); -} break; - -case 197: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::VariableDeclarationList> (driver->nodePool(), sym(1).VariableDeclarationList, sym(3).VariableDeclaration); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); -} break; - -case 198: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::VariableDeclarationList> (driver->nodePool(), sym(1).VariableDeclaration); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(1)); -} break; - -case 199: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::VariableDeclarationList> (driver->nodePool(), sym(1).VariableDeclarationList, sym(3).VariableDeclaration); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); -} break; - -case 200: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::VariableDeclaration> (driver->nodePool(), sym(1).sval, sym(2).Expression); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(2)); -} break; - -case 201: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::VariableDeclaration> (driver->nodePool(), sym(1).sval, sym(2).Expression); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(2)); -} break; - -case 202: { - sym(1) = sym(2); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(2)); -} break; - -case 203: { - sym(1).Node = 0; -} break; - -case 205: { - sym(1) = sym(2); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(2)); -} break; - -case 206: { - sym(1).Node = 0; -} break; - -case 208: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::EmptyStatement> (driver->nodePool()); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(1)); -} break; - -case 210: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::ExpressionStatement> (driver->nodePool(), sym(1).Expression); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(2)); -} break; - -case 211: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::IfStatement> (driver->nodePool(), sym(3).Expression, sym(5).Statement, sym(7).Statement); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(7)); -} break; - -case 212: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::IfStatement> (driver->nodePool(), sym(3).Expression, sym(5).Statement); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(5)); -} break; - -case 214: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::DoWhileStatement> (driver->nodePool(), sym(2).Statement, sym(5).Expression); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(7)); -} break; - -case 215: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::WhileStatement> (driver->nodePool(), sym(3).Expression, sym(5).Statement); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(5)); -} break; - -case 216: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::ForStatement> (driver->nodePool(), sym(3).Expression, sym(5).Expression, sym(7).Expression, sym(9).Statement); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(9)); -} break; - -case 217: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::LocalForStatement> (driver->nodePool(), sym(4).VariableDeclarationList->finish (/*readOnly=*/false), sym(6).Expression, sym(8).Expression, sym(10).Statement); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(10)); -} break; - -case 218: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::ForEachStatement> (driver->nodePool(), sym(3).Expression, sym(5).Expression, sym(7).Statement); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(7)); -} break; - -case 219: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::LocalForEachStatement> (driver->nodePool(), sym(4).VariableDeclaration, sym(6).Expression, sym(8).Statement); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(8)); -} break; - -case 221: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::ContinueStatement> (driver->nodePool()); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(2)); -} break; - -case 223: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::ContinueStatement> (driver->nodePool(), sym(2).sval); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); -} break; - -case 225: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::BreakStatement> (driver->nodePool()); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(2)); -} break; - -case 227: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::BreakStatement> (driver->nodePool(), sym(2).sval); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); -} break; - -case 229: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::ReturnStatement> (driver->nodePool(), sym(2).Expression); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); -} break; - -case 230: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::WithStatement> (driver->nodePool(), sym(3).Expression, sym(5).Statement); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(5)); -} break; - -case 231: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::SwitchStatement> (driver->nodePool(), sym(3).Expression, sym(5).CaseBlock); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(5)); -} break; - -case 232: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::CaseBlock> (driver->nodePool(), sym(2).CaseClauses); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); -} break; - -case 233: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::CaseBlock> (driver->nodePool(), sym(2).CaseClauses, sym(3).DefaultClause, sym(4).CaseClauses); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(5)); -} break; - -case 234: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::CaseClauses> (driver->nodePool(), sym(1).CaseClause); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(1)); -} break; - -case 235: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::CaseClauses> (driver->nodePool(), sym(1).CaseClauses, sym(2).CaseClause); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(2)); -} break; - -case 236: { - sym(1).Node = 0; -} break; - -case 237: { - sym(1).Node = sym(1).CaseClauses->finish (); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(1)); -} break; - -case 238: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::CaseClause> (driver->nodePool(), sym(2).Expression, sym(4).StatementList); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(4)); -} break; - -case 239: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::DefaultClause> (driver->nodePool(), sym(3).StatementList); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); -} break; - -case 240: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::LabelledStatement> (driver->nodePool(), sym(1).sval, sym(3).Statement); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); -} break; - -case 242: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::ThrowStatement> (driver->nodePool(), sym(2).Expression); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); -} break; - -case 243: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::TryStatement> (driver->nodePool(), sym(2).Statement, sym(3).Catch); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); -} break; - -case 244: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::TryStatement> (driver->nodePool(), sym(2).Statement, sym(3).Finally); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); -} break; - -case 245: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::TryStatement> (driver->nodePool(), sym(2).Statement, sym(3).Catch, sym(4).Finally); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(4)); -} break; - -case 246: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::Catch> (driver->nodePool(), sym(3).sval, sym(5).Statement); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(5)); -} break; - -case 247: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::Finally> (driver->nodePool(), sym(2).Statement); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(2)); -} break; - -case 249: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::DebuggerStatement> (driver->nodePool()); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(1)); -} break; - -case 250: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::FunctionDeclaration> (driver->nodePool(), sym(2).sval, sym(4).FormalParameterList, sym(7).FunctionBody); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(8)); -} break; - -case 251: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::FunctionExpression> (driver->nodePool(), sym(2).sval, sym(4).FormalParameterList, sym(7).FunctionBody); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(8)); -} break; - -case 252: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::FormalParameterList> (driver->nodePool(), sym(1).sval); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(1)); -} break; - -case 253: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::FormalParameterList> (driver->nodePool(), sym(1).FormalParameterList, sym(3).sval); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(3)); -} break; - -case 254: { - sym(1).Node = 0; -} break; - -case 255: { - sym(1).Node = sym(1).FormalParameterList->finish (); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(1)); -} break; - -case 256: { - sym(1).Node = 0; -} break; - -case 258: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::FunctionBody> (driver->nodePool(), sym(1).SourceElements->finish ()); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(1)); -} break; - -case 259: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::Program> (driver->nodePool(), sym(1).SourceElements->finish ()); - driver->changeAbstractSyntaxTree(sym(1).Node); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(1)); -} break; - -case 260: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::SourceElements> (driver->nodePool(), sym(1).SourceElement); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(1)); -} break; - -case 261: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::SourceElements> (driver->nodePool(), sym(1).SourceElements, sym(2).SourceElement); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(2)); -} break; - -case 262: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::StatementSourceElement> (driver->nodePool(), sym(1).Statement); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(1)); -} break; - -case 263: { - sym(1).Node = JavaScript::makeAstNode<JavaScript::AST::FunctionSourceElement> (driver->nodePool(), sym(1).FunctionDeclaration); - J_SCRIPT_UPDATE_POSITION(sym(1).Node, loc(1), loc(1)); -} break; - -case 264: { - sym(1).sval = 0; -} break; - -case 266: { - sym(1).Node = 0; -} break; - - } // switch - action = nt_action(state_stack[tos], lhs[r] - TERMINAL_COUNT); - } // if - } while (action != 0); - - if (first_token == last_token) { - const int errorState = state_stack[tos]; - - // automatic insertion of `;' - if (t_action(errorState, T_AUTOMATIC_SEMICOLON) && automatic(driver, yytoken)) { - SavedToken &tk = token_buffer[0]; - tk.token = yytoken; - tk.dval = yylval; - tk.loc = yylloc; - - const QString msg = QString::fromUtf8("Missing `;'"); - - diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Warning, - yyprevlloc.startLine, yyprevlloc.startColumn, msg)); - - first_token = &token_buffer[0]; - last_token = &token_buffer[1]; - - yytoken = T_SEMICOLON; - yylval = 0; - - action = errorState; - - goto _Lcheck_token; - } - - hadErrors = true; - - token_buffer[0].token = yytoken; - token_buffer[0].dval = yylval; - token_buffer[0].loc = yylloc; - - token_buffer[1].token = yytoken = lexer->lex(); - token_buffer[1].dval = yylval = lexer->dval(); - token_buffer[1].loc = yylloc = location(lexer); - - if (token_buffer[0].token != -1 && t_action(errorState, yytoken)) { - QString msg = QString::fromUtf8("Removed token"); - if (const char *tokenSpell = spell[token_buffer[0].token]) { - msg += QLatin1String(": `"); - msg += QLatin1String(tokenSpell); - msg += QLatin1Char('\''); - } - - diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, - token_buffer[0].loc.startLine, token_buffer[0].loc.startColumn, msg)); - - action = errorState; - goto _Lcheck_token; - } - - static int tokens[] = { - T_PLUS, - T_EQ, - - T_COMMA, - T_COLON, - T_SEMICOLON, - - T_RPAREN, T_RBRACKET, T_RBRACE, - - T_NUMERIC_LITERAL, - T_IDENTIFIER, - - T_LPAREN, T_LBRACKET, T_LBRACE, - - EOF_SYMBOL - }; - - for (int *tk = tokens; *tk != EOF_SYMBOL; ++tk) { - int a = t_action(errorState, *tk); - if (a > 0 && t_action(a, yytoken)) { - QString msg = QString::fromUtf8("Inserted token"); - if (const char *tokenSpell = spell[*tk]) { - msg += QLatin1String(": `"); - msg += QLatin1String(tokenSpell); - msg += QLatin1Char('\''); - } - - diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, - token_buffer[0].loc.startLine, token_buffer[0].loc.startColumn, msg)); - - yytoken = *tk; - yylval = 0; - yylloc = token_buffer[0].loc; - - first_token = &token_buffer[0]; - last_token = &token_buffer[2]; - - action = errorState; - goto _Lcheck_token; - } - } - - for (int tk = 1; tk < TERMINAL_COUNT; ++tk) { - int a = t_action(errorState, tk); - if (a > 0 && t_action(a, yytoken)) { - QString msg = QString::fromUtf8("Inserted token"); - if (const char *tokenSpell = spell[tk]) { - msg += QLatin1String(": `"); - msg += QLatin1String(tokenSpell); - msg += QLatin1Char('\''); - } - - diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, - token_buffer[0].loc.startLine, token_buffer[0].loc.startColumn, msg)); - - yytoken = tk; - yylval = 0; - yylloc = token_buffer[0].loc; - - action = errorState; - goto _Lcheck_token; - } - } - - QString msg = QString::fromUtf8("Unexpected token"); - if (token_buffer[0].token >= 0 && token_buffer[0].token < TERMINAL_COUNT) { - if (const char *tokenSpell = spell[token_buffer[0].token]) { - msg += QLatin1String(": `"); - msg += QLatin1String(tokenSpell); - msg += QLatin1Char('\''); - } - } // ### FIXME: at this point, we should give more information than just "Unexpected token". However, we need more error recovery support from qlalr. - - diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, - token_buffer[0].loc.startLine, token_buffer[0].loc.startColumn, msg)); - } - - return false; -} - -QT_END_NAMESPACE - - diff --git a/src/plugins/qtscripteditor/parser/javascriptparser_p.h b/src/plugins/qtscripteditor/parser/javascriptparser_p.h deleted file mode 100644 index eb8bffa0d21caf5d55d29d0ee7867fb30bdc3d2d..0000000000000000000000000000000000000000 --- a/src/plugins/qtscripteditor/parser/javascriptparser_p.h +++ /dev/null @@ -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 diff --git a/src/plugins/qtscripteditor/parser/javascriptvalue.h b/src/plugins/qtscripteditor/parser/javascriptvalue.h deleted file mode 100644 index 715cedf3c4a06acd2a519245506c145b6f76831d..0000000000000000000000000000000000000000 --- a/src/plugins/qtscripteditor/parser/javascriptvalue.h +++ /dev/null @@ -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 diff --git a/src/plugins/qtscripteditor/parser/parser.pri b/src/plugins/qtscripteditor/parser/parser.pri deleted file mode 100644 index 5c1bb19a7667475c0588c3df39d3994110ce442a..0000000000000000000000000000000000000000 --- a/src/plugins/qtscripteditor/parser/parser.pri +++ /dev/null @@ -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 - diff --git a/src/plugins/qtscripteditor/qtscriptcodecompletion.cpp b/src/plugins/qtscripteditor/qtscriptcodecompletion.cpp deleted file mode 100644 index af685e2047803b6e53d892b8ce575ad89a9b5f78..0000000000000000000000000000000000000000 --- a/src/plugins/qtscripteditor/qtscriptcodecompletion.cpp +++ /dev/null @@ -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(); -} - diff --git a/src/plugins/qtscripteditor/qtscriptcodecompletion.h b/src/plugins/qtscripteditor/qtscriptcodecompletion.h deleted file mode 100644 index 1510d8a25dac5fb67dec7025b24edefa59209706..0000000000000000000000000000000000000000 --- a/src/plugins/qtscripteditor/qtscriptcodecompletion.h +++ /dev/null @@ -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 diff --git a/src/plugins/qtscripteditor/qtscripteditor.cpp b/src/plugins/qtscripteditor/qtscripteditor.cpp deleted file mode 100644 index a5fe7ecceeee8992315ed6d4515bf802e7720e98..0000000000000000000000000000000000000000 --- a/src/plugins/qtscripteditor/qtscripteditor.cpp +++ /dev/null @@ -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 diff --git a/src/plugins/qtscripteditor/qtscripteditor.h b/src/plugins/qtscripteditor/qtscripteditor.h deleted file mode 100644 index 1aa83a9d460cdabad9b36d0ed439d26ac18e99f3..0000000000000000000000000000000000000000 --- a/src/plugins/qtscripteditor/qtscripteditor.h +++ /dev/null @@ -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 diff --git a/src/plugins/qtscripteditor/qtscripteditor.pro b/src/plugins/qtscripteditor/qtscripteditor.pro deleted file mode 100644 index 847569bb2221e78b27554035c56090b38116f7db..0000000000000000000000000000000000000000 --- a/src/plugins/qtscripteditor/qtscripteditor.pro +++ /dev/null @@ -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 diff --git a/src/plugins/qtscripteditor/qtscripteditor.qrc b/src/plugins/qtscripteditor/qtscripteditor.qrc deleted file mode 100644 index 1e987b5a4a2e61a9bc7942a7162ed60b498269b9..0000000000000000000000000000000000000000 --- a/src/plugins/qtscripteditor/qtscripteditor.qrc +++ /dev/null @@ -1,5 +0,0 @@ -<RCC> - <qresource prefix="/qtscripteditor" > - <file>QtScriptEditor.mimetypes.xml</file> - </qresource> -</RCC> diff --git a/src/plugins/qtscripteditor/qtscripteditorconstants.h b/src/plugins/qtscripteditor/qtscripteditorconstants.h deleted file mode 100644 index 2b082229dccb5ed07cc61a5598ee0d1289deb9e6..0000000000000000000000000000000000000000 --- a/src/plugins/qtscripteditor/qtscripteditorconstants.h +++ /dev/null @@ -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 diff --git a/src/plugins/qtscripteditor/qtscripteditorfactory.cpp b/src/plugins/qtscripteditor/qtscripteditorfactory.cpp deleted file mode 100644 index a4d306b9183d795643c7855d34e38501def18239..0000000000000000000000000000000000000000 --- a/src/plugins/qtscripteditor/qtscripteditorfactory.cpp +++ /dev/null @@ -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; -} diff --git a/src/plugins/qtscripteditor/qtscripteditorfactory.h b/src/plugins/qtscripteditor/qtscripteditorfactory.h deleted file mode 100644 index d4c664ee37b09abd28e716a0cba9e4f6e60e241d..0000000000000000000000000000000000000000 --- a/src/plugins/qtscripteditor/qtscripteditorfactory.h +++ /dev/null @@ -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 diff --git a/src/plugins/qtscripteditor/qtscripteditorplugin.cpp b/src/plugins/qtscripteditor/qtscripteditorplugin.cpp deleted file mode 100644 index fef32e79a142653cf77a04aa009ed14197545ec0..0000000000000000000000000000000000000000 --- a/src/plugins/qtscripteditor/qtscripteditorplugin.cpp +++ /dev/null @@ -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) diff --git a/src/plugins/qtscripteditor/qtscripteditorplugin.h b/src/plugins/qtscripteditor/qtscripteditorplugin.h deleted file mode 100644 index d9b428798e610d4b6f365b83acd0ad3d62e5d544..0000000000000000000000000000000000000000 --- a/src/plugins/qtscripteditor/qtscripteditorplugin.h +++ /dev/null @@ -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 diff --git a/src/plugins/qtscripteditor/qtscripthighlighter.cpp b/src/plugins/qtscripteditor/qtscripthighlighter.cpp deleted file mode 100644 index 434e8de932608399933a2f545d9daa51cbb34fce..0000000000000000000000000000000000000000 --- a/src/plugins/qtscripteditor/qtscripthighlighter.cpp +++ /dev/null @@ -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 diff --git a/src/plugins/qtscripteditor/qtscripthighlighter.h b/src/plugins/qtscripteditor/qtscripthighlighter.h deleted file mode 100644 index 4770ed5133623555fcb38ce1123609f85ab29a4d..0000000000000000000000000000000000000000 --- a/src/plugins/qtscripteditor/qtscripthighlighter.h +++ /dev/null @@ -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 diff --git a/tests/auto/qml/qmleditor/lookup/lookup.pro b/tests/auto/qml/qmleditor/lookup/lookup.pro index ab2edc5d59192a6cbca2c0b2d27d8c666d0e50cb..d23180fc5b47f3945d083dd4850b75e6e7e040b4 100644 --- a/tests/auto/qml/qmleditor/lookup/lookup.pro +++ b/tests/auto/qml/qmleditor/lookup/lookup.pro @@ -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 diff --git a/tests/auto/qml/qmleditor/lookup/tst_lookup.cpp b/tests/auto/qml/qmleditor/lookup/tst_lookup.cpp index aa0954c12d575cc0ff0b87a359b367a6cce04e0b..c081781b814fa616b98c795d7a4ca955e3429241 100644 --- a/tests/auto/qml/qmleditor/lookup/tst_lookup.cpp +++ b/tests/auto/qml/qmleditor/lookup/tst_lookup.cpp @@ -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;