Imported the QML front-end from Qt/Kinetic

This commit is contained in:
Roberto Raggi
2009-06-11 11:22:26 +02:00
parent d08b90b494
commit 0f9b9b0494
31 changed files with 14276 additions and 50 deletions

View File

@@ -28,15 +28,15 @@
**************************************************************************/ **************************************************************************/
#include "duidocument.h" #include "duidocument.h"
#include "javascriptast_p.h" #include "qmljsast_p.h"
#include "javascriptlexer_p.h" #include "qmljslexer_p.h"
#include "javascriptparser_p.h" #include "qmljsparser_p.h"
#include "javascriptengine_p.h" #include "qmljsengine_p.h"
#include "javascriptnodepool_p.h" #include "qmljsnodepool_p.h"
using namespace DuiEditor; using namespace DuiEditor;
using namespace DuiEditor::Internal; using namespace DuiEditor::Internal;
using namespace JavaScript; using namespace QmlJS;
DuiDocument::DuiDocument(const QString &fileName) DuiDocument::DuiDocument(const QString &fileName)
: _engine(0), _pool(0), _program(0), _fileName(fileName) : _engine(0), _pool(0), _program(0), _fileName(fileName)

View File

@@ -33,8 +33,8 @@
#include <QtCore/QMap> #include <QtCore/QMap>
#include <QtCore/QString> #include <QtCore/QString>
#include "javascriptengine_p.h" #include "qmljsengine_p.h"
#include "javascriptastfwd_p.h" #include "qmljsastfwd_p.h"
namespace DuiEditor { namespace DuiEditor {
namespace Internal { namespace Internal {
@@ -52,17 +52,17 @@ public:
static DuiDocument::Ptr create(const QString &fileName); static DuiDocument::Ptr create(const QString &fileName);
JavaScript::AST::UiProgram *program() const; QmlJS::AST::UiProgram *program() const;
QList<JavaScript::DiagnosticMessage> diagnosticMessages() const; QList<QmlJS::DiagnosticMessage> diagnosticMessages() const;
void setSource(const QString &source); void setSource(const QString &source);
bool parse(); bool parse();
private: private:
JavaScript::Engine *_engine; QmlJS::Engine *_engine;
JavaScript::NodePool *_pool; QmlJS::NodePool *_pool;
JavaScript::AST::UiProgram *_program; QmlJS::AST::UiProgram *_program;
QList<JavaScript::DiagnosticMessage> _diagnosticMessages; QList<QmlJS::DiagnosticMessage> _diagnosticMessages;
QString _fileName; QString _fileName;
QString _source; QString _source;
}; };

View File

@@ -35,9 +35,9 @@
#include "rewriter_p.h" #include "rewriter_p.h"
#include "javascriptastvisitor_p.h" #include "qmljsastvisitor_p.h"
#include "javascriptast_p.h" #include "qmljsast_p.h"
#include "javascriptengine_p.h" #include "qmljsengine_p.h"
#include <coreplugin/icore.h> #include <coreplugin/icore.h>
#include <coreplugin/actionmanager/actionmanager.h> #include <coreplugin/actionmanager/actionmanager.h>
@@ -61,8 +61,8 @@ enum {
UPDATE_DOCUMENT_DEFAULT_INTERVAL = 250 UPDATE_DOCUMENT_DEFAULT_INTERVAL = 250
}; };
using namespace JavaScript; using namespace QmlJS;
using namespace JavaScript::AST; using namespace QmlJS::AST;
namespace DuiEditor { namespace DuiEditor {

View File

@@ -32,8 +32,8 @@
#include <texteditor/basetexteditor.h> #include <texteditor/basetexteditor.h>
#include "javascriptastfwd_p.h" #include "qmljsastfwd_p.h"
#include "javascriptengine_p.h" #include "qmljsengine_p.h"
#include "duidocument.h" #include "duidocument.h"
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
@@ -101,7 +101,7 @@ public:
QStringList words() const; QStringList words() const;
QStringList keywords() const; QStringList keywords() const;
QList<JavaScript::DiagnosticMessage> diagnosticMessages() const QList<QmlJS::DiagnosticMessage> diagnosticMessages() const
{ return m_diagnosticMessages; } { return m_diagnosticMessages; }
virtual void unCommentSelection(); virtual void unCommentSelection();
@@ -137,8 +137,8 @@ private:
QComboBox *m_methodCombo; QComboBox *m_methodCombo;
QList<Declaration> m_declarations; QList<Declaration> m_declarations;
QStringList m_words; QStringList m_words;
QMap<QString, QList<JavaScript::AST::SourceLocation> > m_ids; // ### use QMultiMap QMap<QString, QList<QmlJS::AST::SourceLocation> > m_ids; // ### use QMultiMap
QList<JavaScript::DiagnosticMessage> m_diagnosticMessages; QList<QmlJS::DiagnosticMessage> m_diagnosticMessages;
DuiDocument::Ptr m_document; DuiDocument::Ptr m_document;
}; };

View File

@@ -7,15 +7,10 @@ include(../../plugins/texteditor/texteditor.pri)
include(../../shared/qscripthighlighter/qscripthighlighter.pri) include(../../shared/qscripthighlighter/qscripthighlighter.pri)
include(../../shared/indenter/indenter.pri) include(../../shared/indenter/indenter.pri)
DUI=$$(QTDIR_DUI) include(parser/parser.pri)
isEmpty(DUI):DUI=$$fromfile($$(QTDIR)/.qmake.cache,QT_SOURCE_TREE) include(rewriter/rewriter.pri)
!isEmpty(DUI):exists($$DUI/src/declarative/qml/parser) { INCLUDEPATH += parser rewriter
include($$DUI/src/declarative/qml/parser/parser.pri)
include($$DUI/src/declarative/qml/rewriter/rewriter.pri)
} else {
error(run with export QTDIR_DUI=<path to kinetic/qt>)
}
HEADERS += duieditor.h \ HEADERS += duieditor.h \
duieditorfactory.h \ duieditorfactory.h \

View File

@@ -92,7 +92,7 @@ void DuiHoverHandler::showToolTip(TextEditor::ITextEditor *editor, const QPoint
tc.setPosition(pos); tc.setPosition(pos);
const unsigned line = tc.block().blockNumber() + 1; const unsigned line = tc.block().blockNumber() + 1;
foreach (const JavaScript::DiagnosticMessage &m, ed->diagnosticMessages()) { foreach (const QmlJS::DiagnosticMessage &m, ed->diagnosticMessages()) {
if (m.loc.startLine == line) { if (m.loc.startLine == line) {
m_toolTip.append(m.message); m_toolTip.append(m.message);
break; break;

View File

@@ -0,0 +1,22 @@
INCLUDEPATH += $$PWD
HEADERS += $$PWD/qmljsast_p.h \
$$PWD/qmljsastfwd_p.h \
$$PWD/qmljsastvisitor_p.h \
$$PWD/qmljsengine_p.h \
$$PWD/qmljsgrammar_p.h \
$$PWD/qmljslexer_p.h \
$$PWD/qmljsmemorypool_p.h \
$$PWD/qmljsnodepool_p.h \
$$PWD/qmljsparser_p.h \
$$PWD/qmljsprettypretty_p.h
SOURCES += $$PWD/qmljsast.cpp \
$$PWD/qmljsastvisitor.cpp \
$$PWD/qmljsengine_p.cpp \
$$PWD/qmljsgrammar.cpp \
$$PWD/qmljslexer.cpp \
$$PWD/qmljsprettypretty.cpp \
$$PWD/qmljsparser.cpp

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,962 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
** Contact: Qt Software Information (qt-info@nokia.com)
**
** This file is part of the QtScript module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
** contained in the either Technology Preview License Agreement or the
** Beta Release License Agreement.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain
** additional rights. These rights are described in the Nokia Qt LGPL
** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
** package.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met: http://www.gnu.org/copyleft/gpl.html.
**
** If you are unsure which license is appropriate for your use, please
** contact the sales department at qt-sales@nokia.com.
** $QT_END_LICENSE$
**
****************************************************************************/
#include "qmljsast_p.h"
#include "qmljsastvisitor_p.h"
QT_BEGIN_NAMESPACE
namespace QmlJS { namespace AST {
int NumericLiteral::suffixLength[] = {
0, // noSuffix
2, // emSuffix
2, // exSuffix
2, // pxSuffix
2, // cmSuffix
2, // mmSuffix
2, // inSuffix
2, // ptSuffix
2, // pcSuffix
3, // degSuffix
3, // radSuffix
4, // gradSuffix
2, // msSuffix
1, // sSuffix
2, // hzSuffix
3 // khzSuffix
};
const char *const NumericLiteral::suffixSpell[] = {
"",
"em",
"ex",
"px",
"cm",
"mm",
"in",
"pt",
"pc",
"deg",
"rad",
"grad",
"ms",
"s",
"hz",
"khz"
};
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 NestedExpression::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
acceptChild(expression, visitor);
}
visitor->endVisit(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);
}
void UiProgram::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
for (UiObjectMemberList *it = members; it; it = it->next)
acceptChild(it->member, visitor);
}
visitor->endVisit(this);
}
void UiPublicMember::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
acceptChild(expression, visitor);
}
visitor->endVisit(this);
}
void UiObjectDefinition::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
acceptChild(qualifiedTypeNameId, visitor);
acceptChild(initializer, visitor);
}
visitor->endVisit(this);
}
void UiObjectInitializer::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
for (UiObjectMemberList *it = members; it; it = it->next)
acceptChild(it->member, visitor);
}
visitor->endVisit(this);
}
void UiObjectBinding::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
acceptChild(qualifiedId, visitor);
acceptChild(qualifiedTypeNameId, visitor);
acceptChild(initializer, visitor);
}
visitor->endVisit(this);
}
void UiScriptBinding::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
acceptChild(qualifiedId, visitor);
acceptChild(statement, visitor);
}
visitor->endVisit(this);
}
void UiArrayBinding::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
acceptChild(qualifiedId, visitor);
for (UiArrayMemberList *it = members; it; it = it->next)
acceptChild(it->member, visitor);
}
visitor->endVisit(this);
}
void UiObjectMemberList::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
for (UiObjectMemberList *it = this; it; it = it->next)
acceptChild(it->member, visitor);
}
visitor->endVisit(this);
}
void UiArrayMemberList::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
for (UiArrayMemberList *it = this; it; it = it->next)
acceptChild(it->member, visitor);
}
visitor->endVisit(this);
}
void UiQualifiedId::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
}
visitor->endVisit(this);
}
void UiImport::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
}
visitor->endVisit(this);
}
void UiImportList::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
acceptChild(import, visitor);
acceptChild(next, visitor);
}
visitor->endVisit(this);
}
void UiSourceElement::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
acceptChild(sourceElement, visitor);
}
visitor->endVisit(this);
}
} } // namespace QmlJS::AST
QT_END_NAMESPACE

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,184 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
** Contact: Qt Software Information (qt-info@nokia.com)
**
** This file is part of the QtScript module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
** contained in the either Technology Preview License Agreement or the
** Beta Release License Agreement.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain
** additional rights. These rights are described in the Nokia Qt LGPL
** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
** package.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met: http://www.gnu.org/copyleft/gpl.html.
**
** If you are unsure which license is appropriate for your use, please
** contact the sales department at qt-sales@nokia.com.
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef QMLJSAST_FWD_P_H
#define QMLJSAST_FWD_P_H
#include <QtCore/qglobal.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.
//
QT_BEGIN_NAMESPACE
namespace QmlJS { namespace AST {
class SourceLocation
{
public:
SourceLocation(quint32 offset = 0, quint32 length = 0)
: offset(offset), length(length),
startLine(0), startColumn(0)
{ }
bool isValid() const { return length != 0; }
quint32 begin() const { return offset; }
quint32 end() const { return offset + length; }
// attributes
// ### encode
quint32 offset;
quint32 length;
quint32 startLine;
quint32 startColumn;
};
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;
class NestedExpression;
// ui elements
class UiProgram;
class UiImportList;
class UiImport;
class UiPublicMember;
class UiObjectDefinition;
class UiObjectInitializer;
class UiObjectBinding;
class UiScriptBinding;
class UiSourceElement;
class UiArrayBinding;
class UiObjectMember;
class UiObjectMemberList;
class UiArrayMemberList;
class UiQualifiedId;
} } // namespace AST
QT_END_NAMESPACE
#endif

View File

@@ -0,0 +1,58 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
** Contact: Qt Software Information (qt-info@nokia.com)
**
** This file is part of the QtScript module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
** contained in the either Technology Preview License Agreement or the
** Beta Release License Agreement.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain
** additional rights. These rights are described in the Nokia Qt LGPL
** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
** package.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met: http://www.gnu.org/copyleft/gpl.html.
**
** If you are unsure which license is appropriate for your use, please
** contact the sales department at qt-sales@nokia.com.
** $QT_END_LICENSE$
**
****************************************************************************/
#include "qmljsastvisitor_p.h"
QT_BEGIN_NAMESPACE
namespace QmlJS { namespace AST {
Visitor::Visitor()
{
}
Visitor::~Visitor()
{
}
} } // namespace QmlJS::AST
QT_END_NAMESPACE

View File

@@ -0,0 +1,328 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
** Contact: Qt Software Information (qt-info@nokia.com)
**
** This file is part of the QtScript module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
** contained in the either Technology Preview License Agreement or the
** Beta Release License Agreement.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain
** additional rights. These rights are described in the Nokia Qt LGPL
** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
** package.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met: http://www.gnu.org/copyleft/gpl.html.
**
** If you are unsure which license is appropriate for your use, please
** contact the sales department at qt-sales@nokia.com.
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef QMLJSASTVISITOR_P_H
#define QMLJSASTVISITOR_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 "qmljsastfwd_p.h"
QT_BEGIN_NAMESPACE
namespace QmlJS { namespace AST {
class Visitor
{
public:
Visitor();
virtual ~Visitor();
virtual bool preVisit(Node *) { return true; }
virtual void postVisit(Node *) {}
// Ui
virtual bool visit(UiProgram *) { return true; }
virtual bool visit(UiImportList *) { return true; }
virtual bool visit(UiImport *) { return true; }
virtual bool visit(UiPublicMember *) { return true; }
virtual bool visit(UiSourceElement *) { return true; }
virtual bool visit(UiObjectDefinition *) { return true; }
virtual bool visit(UiObjectInitializer *) { return true; }
virtual bool visit(UiObjectBinding *) { return true; }
virtual bool visit(UiScriptBinding *) { return true; }
virtual bool visit(UiArrayBinding *) { return true; }
virtual bool visit(UiObjectMemberList *) { return true; }
virtual bool visit(UiArrayMemberList *) { return true; }
virtual bool visit(UiQualifiedId *) { return true; }
virtual void endVisit(UiProgram *) {}
virtual void endVisit(UiImportList *) {}
virtual void endVisit(UiImport *) {}
virtual void endVisit(UiPublicMember *) {}
virtual void endVisit(UiSourceElement *) {}
virtual void endVisit(UiObjectDefinition *) {}
virtual void endVisit(UiObjectInitializer *) {}
virtual void endVisit(UiObjectBinding *) {}
virtual void endVisit(UiScriptBinding *) {}
virtual void endVisit(UiArrayBinding *) {}
virtual void endVisit(UiObjectMemberList *) {}
virtual void endVisit(UiArrayMemberList *) {}
virtual void endVisit(UiQualifiedId *) {}
// QmlJS
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(NestedExpression *) { return true; }
virtual void endVisit(NestedExpression *) {}
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 // QMLJSASTVISITOR_P_H

View File

@@ -0,0 +1,191 @@
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Qt Software Information (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 qt-sales@nokia.com.
**
**************************************************************************/
#include "qmljsengine_p.h"
#include "qmljsnodepool_p.h"
#include <qnumeric.h>
#include <QHash>
QT_BEGIN_NAMESPACE
namespace QmlJS {
uint qHash(const QmlJS::NameId &id)
{ return qHash(id.asString()); }
QString numberToString(double value)
{ return QString::number(value); }
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();
}
QString Ecma::RegExp::flagsToString(int flags)
{
QString result;
if (flags & Global)
result += QLatin1Char('g');
if (flags & IgnoreCase)
result += QLatin1Char('i');
if (flags & Multiline)
result += QLatin1Char('m');
return result;
}
NodePool::NodePool(const QString &fileName, Engine *engine)
: m_fileName(fileName), m_engine(engine)
{
m_engine->setNodePool(this);
}
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;
}
double integerFromString(const char *buf, int size, int radix)
{
if (size == 0)
return qSNaN();
double 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;
}
double result;
if (j == i) {
if (!qstrcmp(buf, "Infinity"))
result = qInf();
else
result = qSNaN();
} else {
result = 0;
double multiplier = 1;
for (--i ; i >= j; --i, multiplier *= radix)
result += toDigit(buf[i]) * multiplier;
}
result *= sign;
return result;
}
double integerFromString(const QString &str, int radix)
{
QByteArray ba = str.trimmed().toUtf8();
return integerFromString(ba.constData(), ba.size(), radix);
}
Engine::Engine()
: _lexer(0), _nodePool(0)
{ }
Engine::~Engine()
{ }
QSet<NameId> Engine::literals() const
{ return _literals; }
NameId *Engine::intern(const QChar *u, int s)
{ return const_cast<NameId *>(&*_literals.insert(NameId(u, s))); }
QString Engine::toString(NameId *id)
{ return id->asString(); }
Lexer *Engine::lexer() const
{ return _lexer; }
void Engine::setLexer(Lexer *lexer)
{ _lexer = lexer; }
NodePool *Engine::nodePool() const
{ return _nodePool; }
void Engine::setNodePool(NodePool *nodePool)
{ _nodePool = nodePool; }
} // end of namespace QmlJS
QT_END_NAMESPACE

View File

@@ -0,0 +1,145 @@
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Qt Software Information (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 qt-sales@nokia.com.
**
**************************************************************************/
#ifndef QMLJSENGINE_P_H
#define QMLJSENGINE_P_H
#include <QString>
#include <QSet>
#include "qmljsastfwd_p.h"
QT_BEGIN_NAMESPACE
namespace QmlJS {
class NameId
{
QString _text;
public:
NameId(const QChar *u, int s)
: _text(u, s)
{ }
const QString asString() const
{ return _text; }
bool operator == (const NameId &other) const
{ return _text == other._text; }
bool operator != (const NameId &other) const
{ return _text != other._text; }
bool operator < (const NameId &other) const
{ return _text < other._text; }
};
uint qHash(const QmlJS::NameId &id);
} // end of namespace QmlJS
#if defined(Q_CC_MSVC) && _MSC_VER <= 1300
//this ensures that code outside QmlJS can use the hash function
//it also a workaround for some compilers
inline uint qHash(const QmlJS::NameId &nameId) { return QmlJS::qHash(nameId); }
#endif
namespace QmlJS {
class Lexer;
class NodePool;
namespace Ecma {
class RegExp
{
public:
enum RegExpFlag {
Global = 0x01,
IgnoreCase = 0x02,
Multiline = 0x04
};
public:
static int flagFromChar(const QChar &);
static QString flagsToString(int flags);
};
} // end of namespace Ecma
class DiagnosticMessage
{
public:
enum Kind { Warning, Error };
DiagnosticMessage()
: kind(Error) {}
DiagnosticMessage(Kind kind, const AST::SourceLocation &loc, const QString &message)
: kind(kind), loc(loc), message(message) {}
bool isWarning() const
{ return kind == Warning; }
bool isError() const
{ return kind == Error; }
Kind kind;
AST::SourceLocation loc;
QString message;
};
class Engine
{
Lexer *_lexer;
NodePool *_nodePool;
QSet<NameId> _literals;
public:
Engine();
~Engine();
QSet<NameId> literals() const;
NameId *intern(const QChar *u, int s);
static QString toString(NameId *id);
Lexer *lexer() const;
void setLexer(Lexer *lexer);
NodePool *nodePool() const;
void setNodePool(NodePool *nodePool);
};
} // end of namespace QmlJS
QT_END_NAMESPACE
#endif // QMLJSENGINE_P_H

View File

@@ -0,0 +1,829 @@
// This file was generated by qlalr - DO NOT EDIT!
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
** Contact: Qt Software Information (qt-info@nokia.com)
**
** This file is part of the QtCore module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
** contained in the either Technology Preview License Agreement or the
** Beta Release License Agreement.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain
** additional rights. These rights are described in the Nokia Qt LGPL
** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
** package.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met: http://www.gnu.org/copyleft/gpl.html.
**
** If you are unsure which license is appropriate for your use, please
** contact the sales department at qt-sales@nokia.com.
** $QT_END_LICENSE$
**
****************************************************************************/
#include "qmljsgrammar_p.h"
const char *const QmlJSGrammar::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", "property", "signal", "switch", "this",
"throw", "~", "try", "typeof", "var", "void", "while", "with", "^", "^=",
"null", "true", "false", "const", "debugger", "reserved word", "multiline string literal", "public", "import", 0,
0};
const int QmlJSGrammar::lhs [] = {
91, 92, 92, 95, 95, 96, 96, 94, 93, 98,
98, 100, 100, 101, 101, 97, 99, 99, 103, 104,
104, 99, 99, 99, 99, 99, 99, 99, 111, 111,
111, 99, 99, 99, 99, 99, 99, 99, 99, 99,
99, 99, 102, 102, 114, 114, 114, 115, 115, 115,
115, 115, 115, 115, 115, 115, 115, 115, 115, 115,
115, 115, 115, 115, 102, 102, 117, 117, 117, 117,
116, 116, 119, 119, 121, 121, 121, 121, 121, 121,
122, 122, 122, 122, 122, 122, 122, 122, 122, 122,
122, 122, 122, 122, 122, 122, 122, 122, 122, 122,
122, 122, 122, 122, 122, 122, 122, 122, 122, 122,
122, 123, 123, 124, 124, 124, 124, 124, 127, 127,
128, 128, 128, 128, 126, 126, 129, 129, 130, 130,
131, 131, 131, 132, 132, 132, 132, 132, 132, 132,
132, 132, 132, 133, 133, 133, 133, 134, 134, 134,
135, 135, 135, 135, 136, 136, 136, 136, 136, 136,
136, 137, 137, 137, 137, 137, 137, 138, 138, 138,
138, 138, 139, 139, 139, 139, 139, 140, 140, 141,
141, 142, 142, 143, 143, 144, 144, 145, 145, 146,
146, 147, 147, 148, 148, 149, 149, 150, 150, 151,
151, 120, 120, 152, 152, 153, 153, 153, 153, 153,
153, 153, 153, 153, 153, 153, 153, 105, 105, 154,
154, 155, 155, 156, 156, 157, 157, 157, 157, 157,
157, 157, 157, 157, 157, 157, 157, 157, 157, 157,
106, 168, 168, 167, 167, 113, 113, 169, 169, 170,
170, 172, 172, 171, 173, 176, 174, 174, 177, 175,
175, 107, 108, 108, 110, 110, 158, 158, 158, 158,
158, 158, 158, 159, 159, 159, 159, 160, 160, 160,
160, 161, 161, 162, 164, 178, 178, 181, 181, 179,
179, 182, 180, 163, 163, 163, 165, 165, 166, 166,
166, 183, 184, 109, 109, 112, 125, 188, 188, 185,
185, 186, 186, 189, 190, 190, 191, 191, 187, 187,
118, 118, 192};
const int QmlJSGrammar:: rhs[] = {
2, 1, 1, 1, 2, 3, 3, 0, 1, 1,
2, 1, 3, 2, 3, 2, 1, 5, 1, 2,
2, 4, 3, 3, 3, 3, 3, 3, 1, 1,
1, 2, 4, 4, 5, 5, 6, 6, 7, 7,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 2, 3, 3, 4,
5, 3, 4, 3, 1, 3, 1, 2, 3, 4,
1, 2, 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, 1, 1, 4, 3, 5, 1, 2,
4, 4, 4, 3, 0, 1, 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, 3, 3,
4, 5, 2, 2, 2, 8, 8, 1, 3, 0,
1, 0, 1, 1, 1, 2, 1, 1, 0, 1,
0, 1, 2};
const int QmlJSGrammar::action_default [] = {
8, 2, 0, 4, 3, 0, 0, 0, 6, 7,
5, 65, 45, 46, 43, 44, 47, 9, 0, 1,
0, 0, 16, 66, 41, 248, 0, 0, 46, 14,
47, 249, 17, 10, 0, 0, 0, 42, 0, 31,
30, 29, 0, 0, 35, 0, 36, 151, 218, 182,
190, 186, 130, 202, 178, 0, 115, 49, 131, 194,
198, 119, 148, 129, 134, 114, 168, 155, 0, 55,
56, 52, 319, 321, 0, 0, 0, 0, 0, 0,
50, 53, 0, 0, 54, 48, 0, 51, 0, 0,
144, 0, 0, 131, 150, 133, 132, 0, 0, 0,
146, 147, 145, 149, 0, 179, 0, 0, 0, 0,
169, 0, 0, 0, 0, 0, 0, 159, 0, 0,
0, 153, 154, 152, 157, 161, 160, 158, 156, 171,
170, 172, 0, 187, 0, 183, 0, 0, 125, 112,
124, 113, 81, 82, 83, 108, 84, 109, 85, 86,
87, 88, 89, 90, 91, 92, 93, 94, 95, 96,
97, 110, 98, 99, 100, 101, 102, 103, 104, 105,
106, 107, 111, 0, 0, 123, 219, 126, 0, 127,
0, 128, 122, 39, 40, 0, 215, 208, 206, 213,
214, 212, 211, 217, 210, 209, 207, 216, 203, 0,
191, 0, 0, 195, 0, 0, 199, 0, 0, 125,
117, 0, 116, 0, 121, 135, 0, 320, 310, 311,
0, 308, 0, 309, 0, 312, 226, 233, 232, 240,
228, 0, 229, 313, 0, 318, 230, 231, 236, 234,
315, 314, 317, 237, 0, 0, 0, 0, 0, 319,
45, 0, 321, 46, 220, 262, 47, 0, 0, 0,
0, 0, 238, 239, 227, 235, 263, 264, 307, 316,
0, 278, 279, 280, 281, 0, 274, 275, 276, 277,
304, 305, 0, 0, 0, 0, 0, 267, 268, 224,
222, 184, 192, 188, 204, 180, 225, 0, 131, 196,
200, 173, 162, 0, 0, 181, 0, 0, 0, 0,
174, 0, 0, 0, 0, 0, 166, 164, 167, 165,
163, 176, 175, 177, 0, 189, 0, 185, 0, 223,
131, 0, 205, 220, 221, 0, 220, 0, 0, 270,
0, 0, 0, 272, 0, 193, 0, 0, 197, 0,
0, 201, 260, 0, 252, 261, 255, 0, 259, 0,
220, 253, 0, 220, 0, 0, 271, 0, 0, 0,
273, 320, 310, 0, 0, 312, 0, 306, 0, 296,
0, 0, 0, 266, 0, 265, 0, 322, 0, 80,
242, 245, 0, 81, 248, 84, 109, 86, 87, 52,
91, 92, 45, 93, 96, 50, 53, 46, 220, 47,
54, 99, 48, 101, 51, 103, 104, 249, 106, 107,
111, 0, 73, 0, 0, 75, 79, 77, 63, 76,
78, 0, 74, 62, 243, 241, 119, 120, 125, 0,
118, 0, 295, 0, 282, 283, 0, 294, 0, 0,
0, 285, 290, 288, 291, 0, 0, 289, 290, 0,
286, 0, 287, 244, 293, 0, 244, 292, 0, 297,
298, 0, 244, 299, 300, 0, 0, 301, 0, 0,
0, 302, 303, 137, 136, 0, 0, 0, 269, 0,
0, 0, 284, 67, 0, 0, 71, 57, 0, 59,
69, 0, 60, 70, 72, 61, 68, 58, 0, 64,
141, 139, 143, 140, 138, 142, 0, 0, 0, 33,
0, 34, 0, 37, 38, 32, 15, 11, 0, 23,
26, 24, 0, 25, 28, 244, 0, 19, 0, 27,
22, 81, 248, 84, 109, 86, 87, 52, 91, 92,
45, 93, 96, 50, 53, 46, 220, 47, 54, 99,
48, 101, 51, 103, 104, 249, 106, 107, 111, 49,
0, 12, 0, 18, 13, 20, 21, 257, 250, 0,
258, 254, 0, 256, 246, 0, 247, 251, 323};
const int QmlJSGrammar::goto_default [] = {
6, 5, 19, 1, 4, 3, 32, 34, 33, 570,
22, 18, 538, 539, 231, 226, 230, 232, 229, 236,
517, 235, 264, 57, 65, 495, 494, 388, 387, 48,
386, 389, 140, 61, 56, 178, 63, 52, 177, 58,
64, 90, 62, 47, 67, 66, 301, 54, 295, 49,
291, 51, 293, 50, 292, 59, 299, 60, 300, 53,
294, 290, 331, 443, 296, 297, 390, 237, 228, 227,
239, 265, 238, 243, 262, 263, 392, 391, 36, 579,
578, 353, 354, 581, 356, 580, 355, 451, 455, 458,
454, 453, 473, 474, 220, 234, 216, 219, 233, 241,
240, 0};
const int QmlJSGrammar::action_index [] = {
8, -91, 14, -91, -15, 296, 67, 94, -91, -91,
-91, -91, -91, -91, -91, -91, -91, -91, 109, -91,
184, 408, -91, -91, -91, -91, 45, 125, 170, -91,
46, -91, -91, -91, 429, 171, 130, -91, 120, -91,
-91, -91, -19, 169, -91, 733, -91, 72, -91, 22,
-26, -59, 173, -91, 278, 174, -91, -91, 574, 51,
112, 183, 177, -91, -91, -91, 412, 214, 733, -91,
-91, -91, 161, 1566, 980, 733, 733, 733, 653, 733,
-91, -91, 733, 733, -91, -91, 733, -91, 733, 733,
-91, 733, 733, 98, 235, -91, -91, 733, 733, 733,
-91, -91, -91, 230, 733, 276, 733, 733, 733, 733,
396, 733, 733, 733, 733, 733, 733, 288, 733, 733,
733, 88, 87, 74, 288, 288, 288, 218, 221, 486,
372, 362, 733, 4, 733, 76, 1479, 733, 733, -91,
-91, -91, -91, -91, -91, -91, -91, -91, -91, -91,
-91, -91, -91, -91, -91, -91, -91, -91, -91, -91,
-91, -91, -91, -91, -91, -91, -91, -91, -91, -91,
-91, -91, -91, 102, 733, -91, -91, 60, 3, -91,
733, -91, -91, -91, -91, 733, -91, -91, -91, -91,
-91, -91, -91, -91, -91, -91, -91, -91, -91, 733,
-6, 733, 733, 30, 32, 733, -91, 1479, 733, 733,
-91, 107, -91, -14, -91, -91, 69, -91, 191, 49,
18, -91, 233, -91, 47, 1827, -91, -91, -91, -91,
-91, 204, -91, -91, 39, -91, -91, -91, -91, -91,
-91, 1827, -91, -91, 322, 281, 103, 1740, 50, 203,
77, 40, 2001, 53, 733, -91, 52, 29, 733, 25,
28, 35, -91, -91, -91, -91, -91, -91, -91, -91,
113, -91, -91, -91, -91, 106, -91, -91, -91, -91,
-91, -91, 15, 68, 733, 135, 119, -91, -91, 897,
-91, 82, 58, 17, -91, 261, 84, 42, 494, 91,
79, 304, 288, 208, 733, 245, 733, 733, 733, 733,
418, 733, 733, 733, 733, 733, 288, 288, 288, 288,
288, 343, 336, 279, 733, -57, 733, 19, 733, -91,
574, 733, -91, 733, -7, -30, 733, -60, 1740, -91,
733, 111, 1740, -91, 733, 2, 733, 733, 43, 37,
733, -91, 34, 118, 23, -91, -91, 733, -91, 238,
733, -91, -5, 733, -17, 1740, -91, 733, 133, 1740,
-91, -9, 194, -32, -8, 1827, -25, -91, 1740, -91,
733, 100, 1740, 21, 1740, -91, 31, 26, -20, -91,
-91, 1740, -38, 283, 41, 291, 85, 733, 1740, -1,
-34, 252, 54, -27, 653, 9, 5, -91, 817, -91,
6, -21, 7, 733, 11, -28, 733, 1, 733, -33,
-10, 733, -91, 1653, 33, -91, -91, -91, -91, -91,
-91, 733, -91, -91, -91, -91, 172, -91, 733, -24,
-91, 1740, -91, 73, -91, -91, 1740, -91, 733, 93,
0, -91, 24, -91, 36, 122, 733, -91, 44, 48,
-91, -3, -91, 1740, -91, 110, 1740, -91, 192, -91,
-91, 124, 1740, 27, -91, -12, -29, -91, 155, -53,
-22, -91, -91, -91, -91, 733, 123, 1740, -91, 733,
92, 1740, -91, -91, 105, 1229, -91, -91, 1146, -91,
-91, 1063, -91, -91, -91, -91, -91, -91, 90, -91,
-91, -91, -91, -91, -91, -91, 71, 70, 222, -91,
733, -91, 164, -91, -91, -91, -91, -91, 1392, -91,
-91, -91, 268, -91, -91, 1914, 1312, -91, 75, -91,
-91, 350, 55, 303, 108, 733, 1740, 59, 38, 242,
62, 40, 527, 63, 81, -91, 817, -91, 138, 29,
65, 733, 78, 56, 733, 80, 733, 61, 66, 57,
101, -91, 347, -91, -91, -91, -91, 64, -91, 140,
-91, -91, 733, -91, -91, 144, -91, -91, -91,
-102, -102, -102, -102, 19, 103, -102, -102, -102, -102,
-102, -102, -102, -102, -102, -102, -102, -102, -102, -102,
-4, 249, -102, -102, -102, -102, -102, -7, -102, -102,
-102, -102, -102, -102, 257, -102, -13, -102, -11, -102,
-102, -102, -102, -102, -102, -3, -102, -102, -102, -102,
-102, -102, -102, -102, -102, -102, -102, -102, -44, -102,
-102, -102, -102, -102, -102, -102, -102, -102, 141, -102,
-102, -102, -8, -102, 0, 16, 116, 122, 129, 119,
-102, -102, 90, 64, -102, -102, 94, -102, 91, 86,
-102, 71, 79, -102, -102, -102, -102, 159, 81, 76,
-102, -102, -102, -102, 98, -102, 67, 63, 47, 163,
-102, 160, 115, 104, 105, 127, 133, -102, 151, 144,
130, -102, -102, -102, -102, -102, -102, -102, -102, -102,
-102, -102, 145, -102, 152, -102, 162, 31, 21, -102,
-102, -102, -102, -102, -102, -102, -102, -102, -102, -102,
-102, -102, -102, -102, -102, -102, -102, -102, -102, -102,
-102, -102, -102, -102, -102, -102, -102, -102, -102, -102,
-102, -102, -102, -102, 23, -102, -102, -102, -102, -102,
29, -102, -102, -102, -102, 34, -102, -102, -102, -102,
-102, -102, -102, -102, -102, -102, -102, -102, -102, 89,
-102, 68, 36, -102, -102, 42, -102, 235, 46, 49,
-102, -102, -102, -102, -102, -102, -102, -102, 33, -102,
-102, -102, 26, -102, -102, -18, -102, -102, -102, -102,
-102, -102, -102, -102, -102, -102, -102, -102, -102, -102,
-102, 53, -102, -102, 8, 20, -102, -5, -102, 32,
-102, -102, -102, -102, 39, -102, -102, -102, 37, 73,
-102, -102, -102, -102, -102, -102, -102, -102, -102, -102,
-102, -102, -102, -102, -102, -102, -102, -102, -102, -102,
-102, -102, -102, -102, 40, -102, -102, -102, -102, 97,
-102, -102, -102, -102, -102, -102, -102, -102, -102, -102,
-102, -102, -102, 41, 213, -102, 186, 199, 203, 209,
-102, 50, 51, 38, 57, 60, -102, -102, -102, -102,
-102, -102, -102, -102, 212, -102, 174, -102, 166, -102,
-102, 168, -102, 125, -102, -102, 61, -102, 1, -102,
45, -102, -9, -102, 172, -102, 184, 176, -102, -102,
170, -102, -102, -102, -102, -102, -102, 215, -102, 124,
132, -102, -102, 178, -102, -29, -102, 25, -102, 2,
-102, -102, 62, -102, -102, 102, -102, -102, -28, -102,
22, -102, -31, -102, -33, -102, -102, -102, -102, -102,
-102, -34, -102, 17, -102, 18, -102, 111, -20, -102,
-102, 24, -102, -102, 153, -102, -102, -102, 30, -102,
-102, -102, -102, 28, -102, 73, 140, -102, 205, -102,
-102, 5, -102, 44, -102, -102, -102, -102, -102, -102,
-102, 43, -102, -102, -102, -102, -102, -102, 135, -102,
-102, 7, -102, -102, -102, -102, 4, -102, 55, -102,
-102, -102, -102, -102, -25, -102, 48, -102, 9, -102,
-102, -102, -102, -69, -102, -102, -70, -102, -102, -102,
-102, -102, -102, -92, -102, -102, -12, -102, -10, -102,
-1, -102, -102, -102, -102, 11, -102, -40, -102, 14,
-102, -39, -102, -102, -102, -17, -102, -102, 54, -102,
-102, -24, -102, -102, -102, -102, -102, -102, -102, -102,
-102, -102, -102, -102, -102, -102, -102, -102, -102, -102,
3, -102, -102, -102, -102, -102, -102, -102, 267, -102,
-102, -102, 12, -102, -102, -102, 301, -102, -102, -102,
-102, -19, -102, -15, -102, 59, -64, -102, -102, -2,
-102, -102, 142, -102, -102, -102, -14, -102, -102, -102,
-102, 6, -102, 73, 52, -102, 75, -102, -102, -102,
-102, -102, 128, -102, -102, -102, -102, -102, -102, -102,
-102, -102, -6, -102, -102, 58, -102, -102, -102};
const int QmlJSGrammar::action_info [] = {
338, 174, 289, 485, 472, 472, -89, 480, -105, 380,
43, 472, -79, -78, -100, 448, -97, 435, -102, 134,
304, 326, 132, 104, 478, 375, 489, 372, 374, 456,
377, 336, 199, 452, 423, 433, 440, 384, 421, 205,
431, 456, 132, 365, 350, 344, 214, 476, -108, 456,
324, 357, 462, 199, 367, 463, 363, 222, 472, 446,
441, -75, -108, 182, 485, 448, -89, 588, 180, -75,
-97, 489, -100, 2, 289, 525, 380, 104, 224, 7,
225, 582, 134, 304, 378, -102, 289, -105, -79, 472,
-65, 283, 328, 344, 268, 326, 2, 485, 174, 518,
174, 174, 489, 333, 284, 218, 324, 372, 174, 572,
174, 38, 91, 498, 91, 174, 0, 466, 174, 174,
0, 0, 0, 92, 20, 92, 359, 91, 91, 346,
475, 174, 459, 347, 445, 444, 576, 575, 92, 92,
95, 174, 21, 174, 476, -78, 281, 280, 585, 39,
509, 96, 491, 450, 12, 9, 8, 573, 175, 12,
382, 499, 201, 212, 281, 280, 202, 279, 278, 281,
280, 342, 174, 12, 274, 273, 45, 460, 528, 360,
288, 287, 174, 487, 12, 0, 20, 207, 136, 97,
12, 13, 16, 369, 41, 286, 13, 16, 207, 39,
174, 586, 584, 0, 21, 40, 208, 137, 438, 138,
13, 16, 174, 12, 0, 0, 0, 208, 0, 209,
12, 13, 16, 12, 0, 524, 523, 13, 16, 520,
46, 44, 12, 0, 98, 184, 183, 12, 0, 118,
99, 119, 97, 118, 41, 119, 118, 97, 119, 0,
13, 16, 120, 470, 469, 40, 120, 13, 16, 120,
13, 16, 12, 306, 307, 267, 266, 12, 0, 13,
16, 12, 0, 0, 13, 16, 174, 0, -319, 306,
307, 12, 0, 521, 519, 0, 0, 98, -319, 0,
308, 309, 98, 99, 106, 107, 106, 107, 99, 13,
16, 21, 311, 312, 13, 16, 308, 309, 13, 16,
12, 313, 12, 118, 314, 119, 315, 0, 13, 16,
12, 108, 109, 108, 109, 12, 120, 311, 312, 267,
266, 0, 12, 0, 0, 0, 313, 0, 0, 314,
0, 315, 277, 276, 272, 271, 0, 13, 16, 13,
16, 12, 277, 276, 0, 15, 0, 13, 16, 311,
312, 0, 13, 16, 277, 276, 311, 312, 313, 13,
16, 314, 0, 315, 0, 313, 12, 0, 314, 12,
315, 14, 0, 272, 271, 111, 112, 0, 13, 16,
0, 0, 0, 113, 114, 111, 112, 115, 0, 116,
0, 0, 0, 113, 114, 0, 15, 115, 0, 116,
0, 272, 271, 13, 16, 0, 13, 16, 26, 111,
112, 0, 0, 0, 0, 0, 0, 113, 114, 0,
27, 115, 14, 116, 0, 111, 112, 12, 0, 26,
0, 311, 312, 113, 114, 0, 0, 115, 0, 116,
313, 27, 0, 314, 0, 315, 0, 0, 12, 0,
0, 0, 0, 29, 0, 0, 0, 15, 0, 0,
0, 0, 0, 0, 28, 30, 0, 0, 0, 0,
0, 0, 31, 0, 526, 0, 0, 0, 15, 0,
0, 25, 0, 14, 0, 28, 30, 186, 0, 0,
0, 0, 0, 31, 0, 0, 0, 187, 0, 111,
112, 188, 25, 0, 14, 0, 0, 113, 114, 0,
189, 115, 190, 116, 0, 340, 0, 0, 0, 0,
0, 0, 0, 191, 0, 192, 95, 0, 0, 69,
70, 0, 0, 193, 0, 0, 194, 96, 0, 72,
0, 0, 195, 0, 0, 0, 12, 0, 196, 0,
73, 74, 0, 75, 0, 0, 0, 0, 0, 0,
78, 0, 0, 197, 81, 0, 0, 186, 0, 0,
0, 0, 0, 0, 0, 0, 0, 187, 0, 0,
0, 188, 84, 13, 16, 0, 85, 0, 0, 0,
189, 0, 190, 0, 0, 0, 0, 80, 87, 71,
0, 0, 0, 191, 0, 192, 95, 0, 0, 0,
0, 0, 0, 193, 0, 0, 194, 96, 0, 0,
0, 0, 195, 0, 0, 0, 0, 0, 196, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 197, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 69, 70, 0, 0, 0,
0, 0, 0, 0, 0, 72, 0, 0, 0, 0,
0, 0, 12, 0, 0, 0, 73, 74, 0, 75,
0, 0, 0, 0, 0, 0, 78, 0, 0, 0,
81, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 84, 13,
16, 0, 85, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 80, 87, 71, 0, 0, 0, 0,
0, 0, 0, 0, 68, 69, 70, 0, 0, 0,
0, 0, 0, 0, 0, 72, 0, 0, 0, 0,
0, 0, 12, 0, 0, 0, 73, 74, 0, 75,
0, 0, 0, 76, 0, 77, 78, 79, 0, 0,
81, 0, 0, 0, 82, 0, 83, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 84, 13,
16, 0, 85, 0, 86, 0, 88, 0, 89, 0,
0, 0, 0, 80, 87, 71, 0, 0, 0, 0,
0, 0, 0, 0, -98, 0, 0, 0, 68, 69,
70, 0, 0, 0, 0, 0, 0, 0, 0, 72,
0, 0, 0, 0, 0, 0, 12, 0, 0, 0,
73, 74, 0, 75, 0, 0, 0, 76, 0, 77,
78, 79, 0, 0, 81, 0, 0, 0, 82, 0,
83, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 84, 13, 16, 0, 85, 0, 86, 0,
88, 0, 89, 0, 0, 0, 0, 80, 87, 71,
0, 0, 0, 0, 0, 0, 0, 0, 68, 69,
70, 0, 0, 0, 0, 0, 0, 0, 0, 72,
0, 0, 0, 0, 0, 0, 12, 0, 0, 0,
73, 74, 0, 75, 0, 0, 0, 76, 0, 77,
78, 79, 0, 0, 81, 0, 0, 0, 82, 0,
83, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 84, 13, 16, 0, 85, 0, 86, 0,
88, 303, 89, 0, 0, 0, 0, 80, 87, 71,
0, 0, 0, 0, 0, 0, 0, 0, 496, 0,
0, 68, 69, 70, 0, 0, 0, 0, 0, 0,
0, 0, 72, 0, 0, 0, 0, 0, 0, 12,
0, 0, 0, 73, 74, 0, 75, 0, 0, 0,
76, 0, 77, 78, 79, 0, 0, 81, 0, 0,
0, 82, 0, 83, 0, 0, 497, 0, 0, 0,
0, 0, 0, 0, 0, 84, 13, 16, 0, 85,
0, 86, 0, 88, 0, 89, 0, 0, 0, 0,
80, 87, 71, 0, 0, 0, 0, 0, 0, 0,
0, 504, 0, 0, 68, 69, 70, 0, 0, 0,
0, 0, 0, 0, 0, 72, 0, 0, 0, 0,
0, 0, 12, 0, 0, 0, 73, 74, 0, 75,
0, 0, 0, 76, 0, 77, 78, 79, 0, 0,
81, 0, 0, 0, 82, 0, 83, 0, 0, 505,
0, 0, 0, 0, 0, 0, 0, 0, 84, 13,
16, 0, 85, 0, 86, 0, 88, 0, 89, 0,
0, 0, 0, 80, 87, 71, 0, 0, 0, 0,
0, 0, 0, 0, 496, 0, 0, 68, 69, 70,
0, 0, 0, 0, 0, 0, 0, 0, 72, 0,
0, 0, 0, 0, 0, 12, 0, 0, 0, 73,
74, 0, 75, 0, 0, 0, 76, 0, 77, 78,
79, 0, 0, 81, 0, 0, 0, 82, 0, 83,
0, 0, 502, 0, 0, 0, 0, 0, 0, 0,
0, 84, 13, 16, 0, 85, 0, 86, 0, 88,
0, 89, 0, 0, 0, 0, 80, 87, 71, 0,
0, 0, 0, 0, 0, 0, 0, 504, 0, 0,
68, 69, 70, 0, 0, 0, 0, 0, 0, 0,
0, 72, 0, 0, 0, 0, 0, 0, 12, 0,
0, 0, 73, 74, 0, 75, 0, 0, 0, 76,
0, 77, 78, 79, 0, 0, 81, 0, 0, 0,
82, 0, 83, 0, 0, 507, 0, 0, 0, 0,
0, 0, 0, 0, 84, 13, 16, 0, 85, 0,
86, 0, 88, 0, 89, 0, 0, 0, 0, 80,
87, 71, 0, 0, 0, 0, 0, 0, 0, 0,
496, 0, 0, 68, 69, 70, 0, 0, 0, 0,
0, 0, 0, 0, 72, 0, 0, 0, 0, 0,
0, 12, 0, 0, 0, 73, 74, 0, 75, 0,
0, 0, 76, 0, 77, 78, 79, 0, 0, 81,
0, 0, 0, 82, 0, 83, 0, 0, 497, 0,
0, 15, 0, 0, 0, 0, 0, 84, 13, 16,
0, 85, 0, 86, 0, 88, 0, 89, 0, 0,
0, 0, 80, 87, 71, 0, 0, 14, 0, 0,
0, 0, 0, 68, 69, 70, 0, 0, 0, 0,
0, 0, 0, 0, 72, 0, 0, 0, 0, 0,
0, 12, 251, 0, 0, 535, 536, 0, 75, 0,
0, 0, 76, 0, 77, 78, 79, 0, 0, 81,
0, 0, 0, 82, 0, 83, 0, 0, 0, 0,
0, 0, 0, 255, 0, 0, 0, 84, 13, 16,
0, 85, 0, 86, 0, 88, 0, 89, 0, 0,
0, 0, 80, 87, 71, 0, 246, 0, 537, 0,
0, 0, 0, 142, 143, 144, 0, 0, 146, 148,
149, 0, 0, 150, 0, 151, 0, 0, 0, 153,
154, 155, 0, 0, 0, 0, 0, 0, 12, 156,
157, 158, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 159, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 162, 0,
0, 0, 0, 0, 0, 13, 16, 163, 164, 165,
0, 167, 168, 169, 170, 171, 172, 0, 0, 160,
166, 152, 145, 147, 161, 0, 0, 0, 0, 0,
142, 143, 144, 0, 0, 146, 148, 149, 0, 0,
150, 0, 151, 0, 0, 0, 153, 154, 155, 0,
0, 0, 0, 0, 0, 425, 156, 157, 158, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 159,
0, 0, 0, 426, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 162, 0, 0, 0, 0,
0, 430, 427, 429, 163, 164, 165, 0, 167, 168,
169, 170, 171, 172, 0, 0, 160, 166, 152, 145,
147, 161, 0, 0, 0, 0, 0, 142, 143, 144,
0, 0, 146, 148, 149, 0, 0, 150, 0, 151,
0, 0, 0, 153, 154, 155, 0, 0, 0, 0,
0, 0, 425, 156, 157, 158, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 159, 0, 0, 0,
426, 0, 0, 0, 0, 0, 0, 0, 428, 0,
0, 0, 162, 0, 0, 0, 0, 0, 430, 427,
429, 163, 164, 165, 0, 167, 168, 169, 170, 171,
172, 0, 0, 160, 166, 152, 145, 147, 161, 0,
0, 0, 0, 0, 244, 0, 0, 0, 0, 245,
0, 68, 69, 70, 247, 0, 0, 0, 0, 0,
0, 248, 72, 0, 0, 0, 0, 0, 0, 250,
251, 0, 0, 252, 74, 0, 75, 0, 0, 0,
76, 0, 77, 78, 79, 0, 0, 81, 0, 0,
0, 82, 0, 83, 0, 0, 0, 0, 0, 254,
0, 255, 0, 0, 0, 84, 253, 256, 257, 85,
258, 86, 259, 88, 31, 89, 260, 261, 0, 0,
80, 87, 71, 25, 246, 0, 0, 0, 0, 0,
0, 244, 0, 0, 0, 0, 245, 0, 68, 69,
70, 247, 0, 0, 0, 0, 0, 0, 248, 249,
0, 0, 0, 0, 0, 0, 250, 251, 0, 0,
252, 74, 0, 75, 0, 0, 0, 76, 0, 77,
78, 79, 0, 0, 81, 0, 0, 0, 82, 0,
83, 0, 0, 0, 0, 0, 254, 0, 255, 0,
0, 0, 84, 253, 256, 257, 85, 258, 86, 259,
88, 31, 89, 260, 261, 0, 0, 80, 87, 71,
25, 246, 0, 0, 0, 0, 0, 0, 541, 143,
144, 0, 0, 543, 148, 545, 69, 70, 546, 0,
151, 0, 0, 0, 153, 548, 549, 0, 0, 0,
0, 0, 0, 550, 551, 157, 158, 252, 74, 0,
75, 0, 0, 0, 76, 0, 77, 552, 79, 0,
0, 554, 0, 0, 0, 82, 0, 83, 0, 0,
0, 0, 0, 556, 0, 255, 0, 0, 0, 558,
555, 557, 559, 560, 561, 86, 563, 564, 565, 566,
567, 568, 0, 0, 553, 562, 547, 542, 544, 161,
0, 0, 0, 0, 0, 393, 143, 144, 0, 0,
395, 148, 397, 69, 70, 398, 0, 151, 0, 0,
0, 153, 400, 401, 0, 0, 0, 0, 0, 0,
402, 403, 157, 158, 252, 74, 0, 75, 0, 0,
0, 76, 0, 77, 404, 79, 0, 0, 406, 0,
0, 0, 82, 0, 83, 0, -244, 0, 0, 0,
408, 0, 255, 0, 0, 0, 410, 407, 409, 411,
412, 413, 86, 415, 416, 417, 418, 419, 420, 0,
0, 405, 414, 399, 394, 396, 161, 0, 0, 0,
0, 0,
334, 477, 282, 482, 270, 503, 467, 464, 275, 42,
577, 55, 506, 479, 481, 217, 516, 522, 185, 23,
468, 217, 540, 583, 10, 486, 488, 492, 490, 493,
508, 270, 434, 385, 422, 383, 381, 366, 379, 368,
270, 275, 468, 275, 334, 173, 282, 217, 242, 223,
179, 468, 176, 334, 285, 371, 221, 343, 181, 341,
211, 282, 465, 198, 352, 204, 457, 339, 370, 449,
447, 206, 432, 442, 424, 334, 0, 93, 179, 501,
0, 577, 318, 500, 213, 221, 93, 0, 471, 93,
93, 93, 130, 483, 316, 317, 93, 461, 93, 93,
215, 319, 93, 93, 320, 514, 93, 93, 129, 17,
93, 0, 110, 94, 93, 93, 484, 102, 93, 242,
93, 103, 101, 203, 337, 93, 11, 484, 93, 93,
93, 513, 483, 93, 574, 515, 298, 93, 587, 334,
0, 302, 200, 93, 93, 105, 334, 352, 125, 126,
93, 11, 215, 269, 93, 93, 373, 510, 93, 124,
512, 93, 436, 511, 179, 437, 93, 0, 242, 93,
439, 127, 93, 123, 0, 436, 0, 128, 437, 93,
93, 483, 215, 93, 93, 139, 436, 122, 335, 437,
93, 93, 334, 141, 121, 362, 133, 376, 93, 93,
100, 135, 93, 0, 117, 330, 361, 330, 131, 330,
302, 93, 302, 93, 302, 330, 302, 0, 302, 0,
302, 0, 0, 93, 327, 93, 345, 329, 302, 332,
302, 351, 310, 0, 0, 0, 0, 349, 93, 0,
348, 364, 93, 302, 93, 321, 484, 302, 93, 322,
0, 93, 93, 302, 330, 323, 302, 302, 139, 302,
35, 305, 0, 0, 325, 527, 141, 210, 35, 0,
24, 37, 11, 0, 0, 0, 358, 0, 24, 37,
11, 532, 529, 531, 533, 530, 534, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 571, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 569, 0, 0, 0, 0, 0,
493, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 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 int QmlJSGrammar::action_check [] = {
60, 8, 36, 36, 33, 33, 7, 60, 7, 36,
29, 33, 7, 7, 7, 36, 7, 55, 7, 78,
1, 78, 48, 1, 36, 33, 36, 36, 60, 5,
55, 61, 2, 33, 8, 55, 60, 16, 7, 7,
7, 5, 48, 60, 7, 2, 60, 20, 7, 5,
48, 17, 55, 2, 31, 7, 61, 8, 33, 7,
7, 7, 7, 60, 36, 36, 7, 0, 8, 7,
7, 36, 7, 88, 36, 29, 36, 1, 60, 65,
33, 17, 78, 1, 7, 7, 36, 7, 7, 33,
33, 76, 8, 2, 55, 78, 88, 36, 8, 29,
8, 8, 36, 61, 36, 36, 48, 36, 8, 8,
8, 66, 40, 8, 40, 8, -1, 7, 8, 8,
-1, -1, -1, 51, 15, 51, 8, 40, 40, 50,
6, 8, 10, 54, 61, 62, 61, 62, 51, 51,
42, 8, 33, 8, 20, 7, 61, 62, 8, 29,
60, 53, 60, 60, 29, 61, 62, 56, 56, 29,
60, 56, 50, 56, 61, 62, 54, 61, 62, 61,
62, 60, 8, 29, 61, 62, 7, 55, 7, 61,
61, 62, 8, 60, 29, -1, 15, 15, 15, 12,
29, 66, 67, 60, 74, 60, 66, 67, 15, 29,
8, 61, 62, -1, 33, 85, 34, 34, 36, 36,
66, 67, 8, 29, -1, -1, -1, 34, -1, 36,
29, 66, 67, 29, -1, 61, 62, 66, 67, 7,
61, 62, 29, -1, 57, 61, 62, 29, -1, 25,
63, 27, 12, 25, 74, 27, 25, 12, 27, -1,
66, 67, 38, 61, 62, 85, 38, 66, 67, 38,
66, 67, 29, 18, 19, 61, 62, 29, -1, 66,
67, 29, -1, -1, 66, 67, 8, -1, 36, 18,
19, 29, -1, 61, 62, -1, -1, 57, 36, -1,
45, 46, 57, 63, 18, 19, 18, 19, 63, 66,
67, 33, 23, 24, 66, 67, 45, 46, 66, 67,
29, 32, 29, 25, 35, 27, 37, -1, 66, 67,
29, 45, 46, 45, 46, 29, 38, 23, 24, 61,
62, -1, 29, -1, -1, -1, 32, -1, -1, 35,
-1, 37, 61, 62, 61, 62, -1, 66, 67, 66,
67, 29, 61, 62, -1, 59, -1, 66, 67, 23,
24, -1, 66, 67, 61, 62, 23, 24, 32, 66,
67, 35, -1, 37, -1, 32, 29, -1, 35, 29,
37, 85, -1, 61, 62, 23, 24, -1, 66, 67,
-1, -1, -1, 31, 32, 23, 24, 35, -1, 37,
-1, -1, -1, 31, 32, -1, 59, 35, -1, 37,
-1, 61, 62, 66, 67, -1, 66, 67, 10, 23,
24, -1, -1, -1, -1, -1, -1, 31, 32, -1,
22, 35, 85, 37, -1, 23, 24, 29, -1, 10,
-1, 23, 24, 31, 32, -1, -1, 35, -1, 37,
32, 22, -1, 35, -1, 37, -1, -1, 29, -1,
-1, -1, -1, 55, -1, -1, -1, 59, -1, -1,
-1, -1, -1, -1, 66, 67, -1, -1, -1, -1,
-1, -1, 74, -1, 55, -1, -1, -1, 59, -1,
-1, 83, -1, 85, -1, 66, 67, 3, -1, -1,
-1, -1, -1, 74, -1, -1, -1, 13, -1, 23,
24, 17, 83, -1, 85, -1, -1, 31, 32, -1,
26, 35, 28, 37, -1, 31, -1, -1, -1, -1,
-1, -1, -1, 39, -1, 41, 42, -1, -1, 12,
13, -1, -1, 49, -1, -1, 52, 53, -1, 22,
-1, -1, 58, -1, -1, -1, 29, -1, 64, -1,
33, 34, -1, 36, -1, -1, -1, -1, -1, -1,
43, -1, -1, 79, 47, -1, -1, 3, -1, -1,
-1, -1, -1, -1, -1, -1, -1, 13, -1, -1,
-1, 17, 65, 66, 67, -1, 69, -1, -1, -1,
26, -1, 28, -1, -1, -1, -1, 80, 81, 82,
-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, -1, -1, 79, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, 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, -1, -1, -1, 43, -1, -1, -1,
47, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, 65, 66,
67, -1, 69, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, 80, 81, 82, -1, -1, -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, 66,
67, -1, 69, -1, 71, -1, 73, -1, 75, -1,
-1, -1, -1, 80, 81, 82, -1, -1, -1, -1,
-1, -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, 66, 67, -1, 69, -1, 71, -1,
73, -1, 75, -1, -1, -1, -1, 80, 81, 82,
-1, -1, -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, 66, 67, -1, 69, -1, 71, -1,
73, 74, 75, -1, -1, -1, -1, 80, 81, 82,
-1, -1, -1, -1, -1, -1, -1, -1, 8, -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, 66, 67, -1, 69,
-1, 71, -1, 73, -1, 75, -1, -1, -1, -1,
80, 81, 82, -1, -1, -1, -1, -1, -1, -1,
-1, 8, -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, 66,
67, -1, 69, -1, 71, -1, 73, -1, 75, -1,
-1, -1, -1, 80, 81, 82, -1, -1, -1, -1,
-1, -1, -1, -1, 8, -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, 66, 67, -1, 69, -1, 71, -1, 73,
-1, 75, -1, -1, -1, -1, 80, 81, 82, -1,
-1, -1, -1, -1, -1, -1, -1, 8, -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, 66, 67, -1, 69, -1,
71, -1, 73, -1, 75, -1, -1, -1, -1, 80,
81, 82, -1, -1, -1, -1, -1, -1, -1, -1,
8, -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, 59, -1, -1, -1, -1, -1, 65, 66, 67,
-1, 69, -1, 71, -1, 73, -1, 75, -1, -1,
-1, -1, 80, 81, 82, -1, -1, 85, -1, -1,
-1, -1, -1, 11, 12, 13, -1, -1, -1, -1,
-1, -1, -1, -1, 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, -1, -1, 61, -1, -1, -1, 65, 66, 67,
-1, 69, -1, 71, -1, 73, -1, 75, -1, -1,
-1, -1, 80, 81, 82, -1, 84, -1, 86, -1,
-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, 69, 70,
-1, 72, 73, 74, 75, 76, 77, -1, -1, 80,
81, 82, 83, 84, 85, -1, -1, -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, 47, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, 59, -1, -1, -1, -1,
-1, 65, 66, 67, 68, 69, 70, -1, 72, 73,
74, 75, 76, 77, -1, -1, 80, 81, 82, 83,
84, 85, -1, -1, -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,
47, -1, -1, -1, -1, -1, -1, -1, 55, -1,
-1, -1, 59, -1, -1, -1, -1, -1, 65, 66,
67, 68, 69, 70, -1, 72, 73, 74, 75, 76,
77, -1, -1, 80, 81, 82, 83, 84, 85, -1,
-1, -1, -1, -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, 76, 77, -1, -1,
80, 81, 82, 83, 84, -1, -1, -1, -1, -1,
-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, 76, 77, -1, -1, 80, 81, 82,
83, 84, -1, -1, -1, -1, -1, -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, -1,
-1, -1, -1, 59, -1, 61, -1, -1, -1, 65,
66, 67, 68, 69, 70, 71, 72, 73, 74, 75,
76, 77, -1, -1, 80, 81, 82, 83, 84, 85,
-1, -1, -1, -1, -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, 76, 77, -1,
-1, 80, 81, 82, 83, 84, 85, -1, -1, -1,
-1, -1,
14, 93, 66, 15, 23, 29, 76, 76, 23, 20,
23, 14, 29, 23, 15, 23, 23, 14, 62, 23,
14, 23, 10, 29, 5, 14, 66, 66, 14, 29,
14, 23, 66, 66, 29, 66, 14, 66, 66, 14,
23, 23, 14, 23, 14, 14, 66, 23, 66, 23,
29, 14, 29, 14, 14, 23, 23, 66, 29, 14,
14, 66, 14, 29, 23, 29, 91, 66, 66, 14,
66, 29, 29, 66, 30, 14, -1, 39, 29, 25,
-1, 23, 44, 29, 35, 23, 39, -1, 15, 39,
39, 39, 45, 41, 44, 44, 39, 88, 39, 39,
41, 44, 39, 39, 44, 41, 39, 39, 45, 6,
39, -1, 45, 42, 39, 39, 41, 41, 39, 66,
39, 42, 41, 55, 63, 39, 23, 41, 39, 39,
39, 41, 41, 39, 6, 41, 39, 39, 80, 14,
-1, 44, 53, 39, 39, 47, 14, 23, 44, 44,
39, 23, 41, 100, 39, 39, 94, 41, 39, 44,
41, 39, 33, 41, 29, 36, 39, -1, 66, 39,
35, 44, 39, 43, -1, 33, -1, 44, 36, 39,
39, 41, 41, 39, 39, 23, 33, 43, 63, 36,
39, 39, 14, 31, 43, 63, 51, 95, 39, 39,
41, 49, 39, -1, 44, 39, 82, 39, 45, 39,
44, 39, 44, 39, 44, 39, 44, -1, 44, -1,
44, -1, -1, 39, 50, 39, 54, 61, 44, 61,
44, 61, 46, -1, -1, -1, -1, 61, 39, -1,
56, 63, 39, 44, 39, 46, 41, 44, 39, 46,
-1, 39, 39, 44, 39, 46, 44, 44, 23, 44,
11, 48, -1, -1, 52, 8, 31, 32, 11, -1,
21, 22, 23, -1, -1, -1, 61, -1, 21, 22,
23, 14, 15, 16, 17, 18, 19, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, 6, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, 23, -1, -1, -1, -1, -1,
29, -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, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1};

View File

@@ -0,0 +1,200 @@
// This file was generated by qlalr - DO NOT EDIT!
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
** Contact: Qt Software Information (qt-info@nokia.com)
**
** This file is part of the QtCore module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
** contained in the either Technology Preview License Agreement or the
** Beta Release License Agreement.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain
** additional rights. These rights are described in the Nokia Qt LGPL
** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
** package.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met: http://www.gnu.org/copyleft/gpl.html.
**
** If you are unsure which license is appropriate for your use, please
** contact the sales department at qt-sales@nokia.com.
** $QT_END_LICENSE$
**
****************************************************************************/
//
// W A R N I N G
// -------------
//
// This file is not part of the Qt API. It exists for the convenience
// of other Qt classes. This header file may change from version to
// version without notice, or even be removed.
//
// We mean it.
//
#ifndef QMLJSGRAMMAR_P_H
#define QMLJSGRAMMAR_P_H
class QmlJSGrammar
{
public:
enum {
EOF_SYMBOL = 0,
REDUCE_HERE = 90,
SHIFT_THERE = 89,
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 = 83,
T_CONTINUE = 9,
T_DEBUGGER = 84,
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 = 82,
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_IMPORT = 88,
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_MULTILINE_STRING_LITERAL = 86,
T_NEW = 43,
T_NOT = 44,
T_NOT_EQ = 45,
T_NOT_EQ_EQ = 46,
T_NULL = 80,
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_PROPERTY = 66,
T_PUBLIC = 87,
T_QUESTION = 54,
T_RBRACE = 55,
T_RBRACKET = 56,
T_REMAINDER = 57,
T_REMAINDER_EQ = 58,
T_RESERVED_WORD = 85,
T_RETURN = 59,
T_RPAREN = 60,
T_SEMICOLON = 61,
T_SIGNAL = 67,
T_STAR = 63,
T_STAR_EQ = 64,
T_STRING_LITERAL = 65,
T_SWITCH = 68,
T_THIS = 69,
T_THROW = 70,
T_TILDE = 71,
T_TRUE = 81,
T_TRY = 72,
T_TYPEOF = 73,
T_VAR = 74,
T_VOID = 75,
T_WHILE = 76,
T_WITH = 77,
T_XOR = 78,
T_XOR_EQ = 79,
ACCEPT_STATE = 588,
RULE_COUNT = 323,
STATE_COUNT = 589,
TERMINAL_COUNT = 91,
NON_TERMINAL_COUNT = 102,
GOTO_INDEX_OFFSET = 589,
GOTO_INFO_OFFSET = 2092,
GOTO_CHECK_OFFSET = 2092
};
static const char *const spell [];
static const int lhs [];
static const int rhs [];
static const int goto_default [];
static const int action_default [];
static const int action_index [];
static const int action_info [];
static const int action_check [];
static inline int nt_action (int state, int nt)
{
const int *const goto_index = &action_index [GOTO_INDEX_OFFSET];
const int *const goto_check = &action_check [GOTO_CHECK_OFFSET];
const int yyn = goto_index [state] + nt;
if (yyn < 0 || goto_check [yyn] != nt)
return goto_default [nt];
const int *const goto_info = &action_info [GOTO_INFO_OFFSET];
return goto_info [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 // QMLJSGRAMMAR_P_H

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,269 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
** Contact: Qt Software Information (qt-info@nokia.com)
**
** This file is part of the QtScript module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
** contained in the either Technology Preview License Agreement or the
** Beta Release License Agreement.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain
** additional rights. These rights are described in the Nokia Qt LGPL
** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
** package.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met: http://www.gnu.org/copyleft/gpl.html.
**
** If you are unsure which license is appropriate for your use, please
** contact the sales department at qt-sales@nokia.com.
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef QMLJSLEXER_P_H
#define QMLJSLEXER_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/QString>
QT_BEGIN_NAMESPACE
namespace QmlJS {
class Engine;
class NameId;
class Lexer
{
public:
Lexer(Engine *eng);
~Lexer();
void setCode(const QString &c, int lineno);
int lex();
int currentLineNo() const { return yylineno; }
int currentColumnNo() const { return yycolumn; }
int tokenOffset() const { return startpos; }
int tokenLength() const { return pos - startpos; }
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 Suffix {
noSuffix,
emSuffix,
exSuffix,
pxSuffix,
cmSuffix,
mmSuffix,
inSuffix,
ptSuffix,
pcSuffix,
degSuffix,
radSuffix,
gradSuffix,
msSuffix,
sSuffix,
hzSuffix,
khzSuffix
};
enum Error {
NoError,
IllegalCharacter,
UnclosedStringLiteral,
IllegalEscapeSequence,
IllegalUnicodeEscapeSequence,
UnclosedComment,
IllegalExponentIndicator,
IllegalIdentifier
};
enum ParenthesesState {
IgnoreParentheses,
CountParentheses,
BalancedParentheses
};
enum RegExpBodyPrefix {
NoPrefix,
EqualPrefix
};
bool scanRegExp(RegExpBodyPrefix prefix = NoPrefix);
NameId *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:
Engine *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 NameId *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 startpos;
int startlineno;
int startcolumn;
int bol; // begin of line
union {
int ival;
double dval;
NameId *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 QmlJS
QT_END_NAMESPACE
#endif

View File

@@ -0,0 +1,130 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
** Contact: Qt Software Information (qt-info@nokia.com)
**
** This file is part of the QtScript module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
** contained in the either Technology Preview License Agreement or the
** Beta Release License Agreement.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain
** additional rights. These rights are described in the Nokia Qt LGPL
** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
** package.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met: http://www.gnu.org/copyleft/gpl.html.
**
** If you are unsure which license is appropriate for your use, please
** contact the sales department at qt-sales@nokia.com.
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef QMLJSMEMORYPOOL_P_H
#define QMLJSMEMORYPOOL_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 QmlJS {
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 QmlJS
QT_END_NAMESPACE
#endif

View File

@@ -0,0 +1,138 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
** Contact: Qt Software Information (qt-info@nokia.com)
**
** This file is part of the QtScript module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
** contained in the either Technology Preview License Agreement or the
** Beta Release License Agreement.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain
** additional rights. These rights are described in the Nokia Qt LGPL
** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
** package.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met: http://www.gnu.org/copyleft/gpl.html.
**
** If you are unsure which license is appropriate for your use, please
** contact the sales department at qt-sales@nokia.com.
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef QMLJSNODEPOOL_P_H
#define QMLJSNODEPOOL_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/QHash>
#include <QtCore/QString>
#include "qmljsmemorypool_p.h"
QT_BEGIN_NAMESPACE
namespace QmlJS {
namespace AST {
class Node;
} // namespace AST
class Code;
class CompilationUnit;
class Engine;
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, Engine *engine);
virtual ~NodePool();
Code *createCompiledCode(AST::Node *node, CompilationUnit &compilation);
inline QString fileName() const { return m_fileName; }
inline Engine *engine() const { return m_engine; }
#ifndef J_SCRIPT_NO_EVENT_NOTIFY
inline qint64 id() const { return m_id; }
#endif
private:
QHash<AST::Node*, Code*> m_codeCache;
QString m_fileName;
Engine *m_engine;
#ifndef J_SCRIPT_NO_EVENT_NOTIFY
qint64 m_id;
#endif
private:
Q_DISABLE_COPY(NodePool)
};
} // namespace QmlJS
QT_END_NAMESPACE
#endif

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,208 @@
// This file was generated by qlalr - DO NOT EDIT!
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
** Contact: Qt Software Information (qt-info@nokia.com)
**
** This file is part of the QtScript module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
** contained in the either Technology Preview License Agreement or the
** Beta Release License Agreement.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain
** additional rights. These rights are described in the Nokia Qt LGPL
** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
** package.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met: http://www.gnu.org/copyleft/gpl.html.
**
** If you are unsure which license is appropriate for your use, please
** contact the sales department at qt-sales@nokia.com.
** $QT_END_LICENSE$
**
****************************************************************************/
//
// 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 qmljs.g.
// Changes will be lost.
//
#ifndef QMLJSPARSER_P_H
#define QMLJSPARSER_P_H
#include "qmljsgrammar_p.h"
#include "qmljsast_p.h"
#include "qmljsengine_p.h"
#include <QtCore/QList>
QT_BEGIN_NAMESPACE
class QString;
namespace QmlJS {
class Engine;
class NameId;
class Parser: protected QmlJSGrammar
{
public:
union Value {
int ival;
double dval;
NameId *sval;
AST::ArgumentList *ArgumentList;
AST::CaseBlock *CaseBlock;
AST::CaseClause *CaseClause;
AST::CaseClauses *CaseClauses;
AST::Catch *Catch;
AST::DefaultClause *DefaultClause;
AST::ElementList *ElementList;
AST::Elision *Elision;
AST::ExpressionNode *Expression;
AST::Finally *Finally;
AST::FormalParameterList *FormalParameterList;
AST::FunctionBody *FunctionBody;
AST::FunctionDeclaration *FunctionDeclaration;
AST::Node *Node;
AST::PropertyName *PropertyName;
AST::PropertyNameAndValueList *PropertyNameAndValueList;
AST::SourceElement *SourceElement;
AST::SourceElements *SourceElements;
AST::Statement *Statement;
AST::StatementList *StatementList;
AST::Block *Block;
AST::VariableDeclaration *VariableDeclaration;
AST::VariableDeclarationList *VariableDeclarationList;
AST::UiProgram *UiProgram;
AST::UiImportList *UiImportList;
AST::UiImport *UiImport;
AST::UiPublicMember *UiPublicMember;
AST::UiObjectDefinition *UiObjectDefinition;
AST::UiObjectInitializer *UiObjectInitializer;
AST::UiObjectBinding *UiObjectBinding;
AST::UiScriptBinding *UiScriptBinding;
AST::UiArrayBinding *UiArrayBinding;
AST::UiObjectMember *UiObjectMember;
AST::UiObjectMemberList *UiObjectMemberList;
AST::UiArrayMemberList *UiArrayMemberList;
AST::UiQualifiedId *UiQualifiedId;
};
public:
Parser(Engine *engine);
~Parser();
bool parse();
AST::UiProgram *ast()
{ return program; }
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().loc.startLine; }
inline int errorColumnNumber() const
{ return diagnosticMessage().loc.startColumn; }
protected:
void reallocateStack();
inline Value &sym(int index)
{ return sym_stack [tos + index - 1]; }
inline AST::SourceLocation &loc(int index)
{ return location_stack [tos + index - 1]; }
AST::UiQualifiedId *reparseAsQualifiedId(AST::ExpressionNode *expr);
protected:
Engine *driver;
int tos;
int stack_size;
Value *sym_stack;
int *state_stack;
AST::SourceLocation *location_stack;
AST::UiProgram *program;
// error recovery
enum { TOKEN_BUFFER_SIZE = 3 };
struct SavedToken {
int token;
double dval;
AST::SourceLocation loc;
};
double yylval;
AST::SourceLocation yylloc;
AST::SourceLocation yyprevlloc;
SavedToken token_buffer[TOKEN_BUFFER_SIZE];
SavedToken *first_token;
SavedToken *last_token;
QList<DiagnosticMessage> diagnostic_messages;
};
} // end of namespace QmlJS
#define J_SCRIPT_REGEXPLITERAL_RULE1 54
#define J_SCRIPT_REGEXPLITERAL_RULE2 55
QT_END_NAMESPACE
#endif // QMLJSPARSER_P_H

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,329 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
** Contact: Qt Software Information (qt-info@nokia.com)
**
** This file is part of the QtScript module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
** contained in the either Technology Preview License Agreement or the
** Beta Release License Agreement.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain
** additional rights. These rights are described in the Nokia Qt LGPL
** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
** package.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met: http://www.gnu.org/copyleft/gpl.html.
**
** If you are unsure which license is appropriate for your use, please
** contact the sales department at qt-sales@nokia.com.
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef QMLJSPRETTYPRETTY_P_H
#define QMLJSPRETTYPRETTY_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 "qmljsastvisitor_p.h"
QT_BEGIN_NAMESPACE
class QTextStream;
namespace QmlJS {
class PrettyPretty: protected AST::Visitor
{
public:
PrettyPretty(QTextStream &out);
virtual ~PrettyPretty();
QTextStream &operator () (AST::Node *node, int level = 0);
protected:
void accept(AST::Node *node);
virtual bool preVisit(AST::Node *node);
virtual bool visit(AST::ThisExpression *node);
virtual void endVisit(AST::ThisExpression *node);
virtual bool visit(AST::IdentifierExpression *node);
virtual void endVisit(AST::IdentifierExpression *node);
virtual bool visit(AST::NullExpression *node);
virtual void endVisit(AST::NullExpression *node);
virtual bool visit(AST::TrueLiteral *node);
virtual void endVisit(AST::TrueLiteral *node);
virtual bool visit(AST::FalseLiteral *node);
virtual void endVisit(AST::FalseLiteral *node);
virtual bool visit(AST::StringLiteral *node);
virtual void endVisit(AST::StringLiteral *node);
virtual bool visit(AST::NumericLiteral *node);
virtual void endVisit(AST::NumericLiteral *node);
virtual bool visit(AST::RegExpLiteral *node);
virtual void endVisit(AST::RegExpLiteral *node);
virtual bool visit(AST::ArrayLiteral *node);
virtual void endVisit(AST::ArrayLiteral *node);
virtual bool visit(AST::ObjectLiteral *node);
virtual void endVisit(AST::ObjectLiteral *node);
virtual bool visit(AST::ElementList *node);
virtual void endVisit(AST::ElementList *node);
virtual bool visit(AST::Elision *node);
virtual void endVisit(AST::Elision *node);
virtual bool visit(AST::PropertyNameAndValueList *node);
virtual void endVisit(AST::PropertyNameAndValueList *node);
virtual bool visit(AST::IdentifierPropertyName *node);
virtual void endVisit(AST::IdentifierPropertyName *node);
virtual bool visit(AST::StringLiteralPropertyName *node);
virtual void endVisit(AST::StringLiteralPropertyName *node);
virtual bool visit(AST::NumericLiteralPropertyName *node);
virtual void endVisit(AST::NumericLiteralPropertyName *node);
virtual bool visit(AST::ArrayMemberExpression *node);
virtual void endVisit(AST::ArrayMemberExpression *node);
virtual bool visit(AST::FieldMemberExpression *node);
virtual void endVisit(AST::FieldMemberExpression *node);
virtual bool visit(AST::NewMemberExpression *node);
virtual void endVisit(AST::NewMemberExpression *node);
virtual bool visit(AST::NewExpression *node);
virtual void endVisit(AST::NewExpression *node);
virtual bool visit(AST::CallExpression *node);
virtual void endVisit(AST::CallExpression *node);
virtual bool visit(AST::ArgumentList *node);
virtual void endVisit(AST::ArgumentList *node);
virtual bool visit(AST::PostIncrementExpression *node);
virtual void endVisit(AST::PostIncrementExpression *node);
virtual bool visit(AST::PostDecrementExpression *node);
virtual void endVisit(AST::PostDecrementExpression *node);
virtual bool visit(AST::DeleteExpression *node);
virtual void endVisit(AST::DeleteExpression *node);
virtual bool visit(AST::VoidExpression *node);
virtual void endVisit(AST::VoidExpression *node);
virtual bool visit(AST::TypeOfExpression *node);
virtual void endVisit(AST::TypeOfExpression *node);
virtual bool visit(AST::PreIncrementExpression *node);
virtual void endVisit(AST::PreIncrementExpression *node);
virtual bool visit(AST::PreDecrementExpression *node);
virtual void endVisit(AST::PreDecrementExpression *node);
virtual bool visit(AST::UnaryPlusExpression *node);
virtual void endVisit(AST::UnaryPlusExpression *node);
virtual bool visit(AST::UnaryMinusExpression *node);
virtual void endVisit(AST::UnaryMinusExpression *node);
virtual bool visit(AST::TildeExpression *node);
virtual void endVisit(AST::TildeExpression *node);
virtual bool visit(AST::NotExpression *node);
virtual void endVisit(AST::NotExpression *node);
virtual bool visit(AST::BinaryExpression *node);
virtual void endVisit(AST::BinaryExpression *node);
virtual bool visit(AST::ConditionalExpression *node);
virtual void endVisit(AST::ConditionalExpression *node);
virtual bool visit(AST::Expression *node);
virtual void endVisit(AST::Expression *node);
virtual bool visit(AST::Block *node);
virtual void endVisit(AST::Block *node);
virtual bool visit(AST::StatementList *node);
virtual void endVisit(AST::StatementList *node);
virtual bool visit(AST::VariableStatement *node);
virtual void endVisit(AST::VariableStatement *node);
virtual bool visit(AST::VariableDeclarationList *node);
virtual void endVisit(AST::VariableDeclarationList *node);
virtual bool visit(AST::VariableDeclaration *node);
virtual void endVisit(AST::VariableDeclaration *node);
virtual bool visit(AST::EmptyStatement *node);
virtual void endVisit(AST::EmptyStatement *node);
virtual bool visit(AST::ExpressionStatement *node);
virtual void endVisit(AST::ExpressionStatement *node);
virtual bool visit(AST::IfStatement *node);
virtual void endVisit(AST::IfStatement *node);
virtual bool visit(AST::DoWhileStatement *node);
virtual void endVisit(AST::DoWhileStatement *node);
virtual bool visit(AST::WhileStatement *node);
virtual void endVisit(AST::WhileStatement *node);
virtual bool visit(AST::ForStatement *node);
virtual void endVisit(AST::ForStatement *node);
virtual bool visit(AST::LocalForStatement *node);
virtual void endVisit(AST::LocalForStatement *node);
virtual bool visit(AST::ForEachStatement *node);
virtual void endVisit(AST::ForEachStatement *node);
virtual bool visit(AST::LocalForEachStatement *node);
virtual void endVisit(AST::LocalForEachStatement *node);
virtual bool visit(AST::ContinueStatement *node);
virtual void endVisit(AST::ContinueStatement *node);
virtual bool visit(AST::BreakStatement *node);
virtual void endVisit(AST::BreakStatement *node);
virtual bool visit(AST::ReturnStatement *node);
virtual void endVisit(AST::ReturnStatement *node);
virtual bool visit(AST::WithStatement *node);
virtual void endVisit(AST::WithStatement *node);
virtual bool visit(AST::SwitchStatement *node);
virtual void endVisit(AST::SwitchStatement *node);
virtual bool visit(AST::CaseBlock *node);
virtual void endVisit(AST::CaseBlock *node);
virtual bool visit(AST::CaseClauses *node);
virtual void endVisit(AST::CaseClauses *node);
virtual bool visit(AST::CaseClause *node);
virtual void endVisit(AST::CaseClause *node);
virtual bool visit(AST::DefaultClause *node);
virtual void endVisit(AST::DefaultClause *node);
virtual bool visit(AST::LabelledStatement *node);
virtual void endVisit(AST::LabelledStatement *node);
virtual bool visit(AST::ThrowStatement *node);
virtual void endVisit(AST::ThrowStatement *node);
virtual bool visit(AST::TryStatement *node);
virtual void endVisit(AST::TryStatement *node);
virtual bool visit(AST::Catch *node);
virtual void endVisit(AST::Catch *node);
virtual bool visit(AST::Finally *node);
virtual void endVisit(AST::Finally *node);
virtual bool visit(AST::FunctionDeclaration *node);
virtual void endVisit(AST::FunctionDeclaration *node);
virtual bool visit(AST::FunctionExpression *node);
virtual void endVisit(AST::FunctionExpression *node);
virtual bool visit(AST::FormalParameterList *node);
virtual void endVisit(AST::FormalParameterList *node);
virtual bool visit(AST::FunctionBody *node);
virtual void endVisit(AST::FunctionBody *node);
virtual bool visit(AST::Program *node);
virtual void endVisit(AST::Program *node);
virtual bool visit(AST::SourceElements *node);
virtual void endVisit(AST::SourceElements *node);
virtual bool visit(AST::FunctionSourceElement *node);
virtual void endVisit(AST::FunctionSourceElement *node);
virtual bool visit(AST::StatementSourceElement *node);
virtual void endVisit(AST::StatementSourceElement *node);
virtual bool visit(AST::DebuggerStatement *node);
virtual void endVisit(AST::DebuggerStatement *node);
int indentLevel(int level)
{
int was = m_indentLevel;
m_indentLevel = level;
return was;
}
void pushIndentLevel()
{ ++m_indentLevel; }
void popIndentLevel()
{ --m_indentLevel; }
QTextStream &newlineAndIndent();
void acceptAsBlock(AST::Node *node);
static int operatorPrecedenceLevel(int op);
static int compareOperatorPrecedence(int op1, int op2);
private:
QTextStream &out;
int m_indentLevel;
Q_DISABLE_COPY(PrettyPretty)
};
} // namespace QmlJS
QT_END_NAMESPACE
#endif

View File

@@ -0,0 +1,96 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
** Contact: Qt Software Information (qt-info@nokia.com)
**
** This file is part of the QtDeclarative module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
** contained in the either Technology Preview License Agreement or the
** Beta Release License Agreement.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain
** additional rights. These rights are described in the Nokia Qt LGPL
** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
** package.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met: http://www.gnu.org/copyleft/gpl.html.
**
** If you are unsure which license is appropriate for your use, please
** contact the sales department at qt-sales@nokia.com.
** $QT_END_LICENSE$
**
****************************************************************************/
#include "rewriter_p.h"
#include "qmljsast_p.h"
QT_BEGIN_NAMESPACE
using namespace QmlJS;
void Rewriter::replace(const AST::SourceLocation &loc, const QString &text)
{ replace(loc.offset, loc.length, text); }
void Rewriter::remove(const AST::SourceLocation &loc)
{ return replace(loc.offset, loc.length, QString()); }
void Rewriter::remove(const AST::SourceLocation &firstLoc, const AST::SourceLocation &lastLoc)
{ return replace(firstLoc.offset, lastLoc.offset + lastLoc.length - firstLoc.offset, QString()); }
void Rewriter::insertTextBefore(const AST::SourceLocation &loc, const QString &text)
{ replace(loc.offset, 0, text); }
void Rewriter::insertTextAfter(const AST::SourceLocation &loc, const QString &text)
{ replace(loc.offset + loc.length, 0, text); }
void Rewriter::replace(int offset, int length, const QString &text)
{ textWriter.replace(offset, length, text); }
void Rewriter::insertText(int offset, const QString &text)
{ replace(offset, 0, text); }
void Rewriter::removeText(int offset, int length)
{ replace(offset, length, QString()); }
QString Rewriter::textAt(const AST::SourceLocation &loc) const
{ return _code.mid(loc.offset, loc.length); }
QString Rewriter::textAt(const AST::SourceLocation &firstLoc, const AST::SourceLocation &lastLoc) const
{ return _code.mid(firstLoc.offset, lastLoc.offset + lastLoc.length - firstLoc.offset); }
void Rewriter::accept(QmlJS::AST::Node *node)
{ QmlJS::AST::Node::acceptChild(node, this); }
void Rewriter::moveTextBefore(const AST::SourceLocation &firstLoc,
const AST::SourceLocation &lastLoc,
const AST::SourceLocation &loc)
{
textWriter.move(firstLoc.offset, lastLoc.offset + lastLoc.length - firstLoc.offset, loc.offset);
}
void Rewriter::moveTextAfter(const AST::SourceLocation &firstLoc,
const AST::SourceLocation &lastLoc,
const AST::SourceLocation &loc)
{
textWriter.move(firstLoc.offset, lastLoc.offset + lastLoc.length - firstLoc.offset, loc.offset + loc.length);
}
QT_END_NAMESPACE

View File

@@ -0,0 +1,9 @@
INCLUDEPATH += $$PWD
HEADERS += $$PWD/textwriter_p.h
SOURCES += $$PWD/textwriter.cpp
!no_ast_rewriter {
HEADERS += $$PWD/rewriter_p.h
SOURCES += $$PWD/rewriter.cpp
}

View File

@@ -0,0 +1,151 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
** Contact: Qt Software Information (qt-info@nokia.com)
**
** This file is part of the QtDeclarative module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
** contained in the either Technology Preview License Agreement or the
** Beta Release License Agreement.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain
** additional rights. These rights are described in the Nokia Qt LGPL
** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
** package.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met: http://www.gnu.org/copyleft/gpl.html.
**
** If you are unsure which license is appropriate for your use, please
** contact the sales department at qt-sales@nokia.com.
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef REWRITER_H
#define REWRITER_H
#include <QtCore/QList>
#include <QtCore/QString>
#include "textwriter_p.h"
#include "qmljsastvisitor_p.h"
QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
namespace QmlJS {
////////////////////////////////////////////////////////////////////////////////
// Replacement
////////////////////////////////////////////////////////////////////////////////
class Replacement
{
int _offset;
int _length;
QString _text;
public:
Replacement(int offset = 0, int length = 0, const QString &text = QString())
: _offset(offset), _length(length), _text(text)
{ }
bool isNull() const { return _offset == _length; }
operator bool() const { return ! isNull(); }
int offset() const { return _offset; }
int length() const { return _length; }
QString text() const { return _text; }
};
////////////////////////////////////////////////////////////////////////////////
// Rewriter
////////////////////////////////////////////////////////////////////////////////
class Rewriter: public AST::Visitor
{
protected:
TextWriter textWriter;
public:
//
// Token based API
//
/// Returns the text of the token at the given \a location.
QString textAt(const AST::SourceLocation &location) const;
QString textAt(const AST::SourceLocation &firstLoc,
const AST::SourceLocation &lastLoc) const;
/// Replace the token at \a loc with the given \a text.
void replace(const AST::SourceLocation &loc, const QString &text);
/// Remove the token at the given \a location.
void remove(const AST::SourceLocation &location);
/// Remove all tokens in the range [\a firstLoc, \a lastLoc].
void remove(const AST::SourceLocation &firstLoc, const AST::SourceLocation &lastLoc);
/// Insert \a text before the token at the given \a location.
void insertTextBefore(const AST::SourceLocation &location, const QString &text);
/// Insert \a text after the token at the given \a location.
void insertTextAfter(const AST::SourceLocation &loc, const QString &text);
void moveTextBefore(const AST::SourceLocation &firstLoc,
const AST::SourceLocation &lastLoc,
const AST::SourceLocation &loc);
void moveTextAfter(const AST::SourceLocation &firstLoc,
const AST::SourceLocation &lastLoc,
const AST::SourceLocation &loc);
//
// low-level offset based API
//
void replace(int offset, int length, const QString &text);
void insertText(int offset, const QString &text);
void removeText(int offset, int length);
/// Visit the given \a node.
void accept(AST::Node *node);
/// Returns the original unchanged source code.
QString code() const { return _code; }
/// Returns the list of replacements.
QList<Replacement> replacementList() const { return _replacementList; }
protected:
/// \internal
void setCode(const QString &code) { _code = code; }
private:
QString _code;
QList<Replacement> _replacementList;
};
} // end of namespace QmlJS
QT_END_NAMESPACE
QT_END_HEADER
#endif // REWRITER_H

View File

@@ -0,0 +1,217 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
** Contact: Qt Software Information (qt-info@nokia.com)
**
** This file is part of the QtDeclarative module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
** contained in the either Technology Preview License Agreement or the
** Beta Release License Agreement.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain
** additional rights. These rights are described in the Nokia Qt LGPL
** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
** package.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met: http://www.gnu.org/copyleft/gpl.html.
**
** If you are unsure which license is appropriate for your use, please
** contact the sales department at qt-sales@nokia.com.
** $QT_END_LICENSE$
**
****************************************************************************/
#include "textwriter_p.h"
QT_BEGIN_NAMESPACE
using namespace QmlJS;
TextWriter::TextWriter()
:string(0), cursor(0)
{
}
static bool overlaps(int posA, int lengthA, int posB, int lengthB) {
return (posA < posB + lengthB && posA + lengthA > posB + lengthB)
|| (posA < posB && posA + lengthA > posB);
}
bool TextWriter::hasOverlap(int pos, int length)
{
{
QListIterator<Replace> i(replaceList);
while (i.hasNext()) {
const Replace &cmd = i.next();
if (overlaps(pos, length, cmd.pos, cmd.length))
return true;
}
}
{
QListIterator<Move> i(moveList);
while (i.hasNext()) {
const Move &cmd = i.next();
if (overlaps(pos, length, cmd.pos, cmd.length))
return true;
}
return false;
}
}
bool TextWriter::hasMoveInto(int pos, int length)
{
QListIterator<Move> i(moveList);
while (i.hasNext()) {
const Move &cmd = i.next();
if (cmd.to >= pos && cmd.to < pos + length)
return true;
}
return false;
}
void TextWriter::replace(int pos, int length, const QString &replacement)
{
Q_ASSERT(!hasOverlap(pos, length));
Q_ASSERT(!hasMoveInto(pos, length));
Replace cmd;
cmd.pos = pos;
cmd.length = length;
cmd.replacement = replacement;
replaceList += cmd;
}
void TextWriter::move(int pos, int length, int to)
{
Q_ASSERT(!hasOverlap(pos, length));
Move cmd;
cmd.pos = pos;
cmd.length = length;
cmd.to = to;
moveList += cmd;
}
void TextWriter::doReplace(const Replace &replace)
{
int diff = replace.replacement.size() - replace.length;
{
QMutableListIterator<Replace> i(replaceList);
while (i.hasNext()) {
Replace &c = i.next();
if (replace.pos < c.pos)
c.pos += diff;
else if (replace.pos + replace.length < c.pos + c.length)
c.length += diff;
}
}
{
QMutableListIterator<Move> i(moveList);
while (i.hasNext()) {
Move &c = i.next();
if (replace.pos < c.pos)
c.pos += diff;
else if (replace.pos + replace.length < c.pos + c.length)
c.length += diff;
if (replace.pos < c.to)
c.to += diff;
}
}
if (string) {
string->replace(replace.pos, replace.length, replace.replacement);
} else if (cursor) {
cursor->setPosition(replace.pos);
cursor->setPosition(replace.pos + replace.length, QTextCursor::KeepAnchor);
cursor->insertText(replace.replacement);
}
}
void TextWriter::doMove(const Move &move)
{
QString text;
if (string) {
text = string->mid(move.pos, move.length);
} else if (cursor) {
cursor->setPosition(move.pos);
cursor->setPosition(move.pos + move.length, QTextCursor::KeepAnchor);
text = cursor->selectedText();
}
Replace cut;
cut.pos = move.pos;
cut.length = move.length;
Replace paste;
paste.pos = move.to;
paste.length = 0;
paste.replacement = text;
replaceList.append(cut);
replaceList.append(paste);
Replace cmd;
while (!replaceList.isEmpty()) {
cmd = replaceList.first();
replaceList.removeFirst();
doReplace(cmd);
}
}
void TextWriter::write(QString *s)
{
string = s;
write_helper();
string = 0;
}
void TextWriter::write(QTextCursor *textCursor)
{
cursor = textCursor;
write_helper();
cursor = 0;
}
void TextWriter::write_helper()
{
if (cursor)
cursor->beginEditBlock();
{
Replace cmd;
while (!replaceList.isEmpty()) {
cmd = replaceList.first();
replaceList.removeFirst();
doReplace(cmd);
}
}
{
Move cmd;
while (!moveList.isEmpty()) {
cmd = moveList.first();
moveList.removeFirst();
doMove(cmd);
}
}
if (cursor)
cursor->endEditBlock();
}
QT_END_NAMESPACE

View File

@@ -0,0 +1,99 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
** Contact: Qt Software Information (qt-info@nokia.com)
**
** This file is part of the QtDeclarative module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
** contained in the either Technology Preview License Agreement or the
** Beta Release License Agreement.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain
** additional rights. These rights are described in the Nokia Qt LGPL
** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
** package.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met: http://www.gnu.org/copyleft/gpl.html.
**
** If you are unsure which license is appropriate for your use, please
** contact the sales department at qt-sales@nokia.com.
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef TEXTWRITER_H
#define TEXTWRITER_H
#include <QtCore/QString>
#include <QtCore/QList>
#include <QtGui/QTextCursor>
QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
namespace QmlJS {
class TextWriter
{
QString *string;
QTextCursor *cursor;
struct Replace {
int pos;
int length;
QString replacement;
};
QList<Replace> replaceList;
struct Move {
int pos;
int length;
int to;
};
QList<Move> moveList;
bool hasOverlap(int pos, int length);
bool hasMoveInto(int pos, int length);
void doReplace(const Replace &replace);
void doMove(const Move &move);
void write_helper();
public:
TextWriter();
void replace(int pos, int length, const QString &replacement);
void move(int pos, int length, int to);
void write(QString *s);
void write(QTextCursor *textCursor);
};
} // end of namespace QmlJS
QT_END_NAMESPACE
QT_END_HEADER
#endif // TEXTWRITER_H

View File

@@ -30,25 +30,10 @@ SUBDIRS = plugin_coreplugin \
plugin_designer \ plugin_designer \
plugin_resourceeditor \ plugin_resourceeditor \
plugin_genericprojectmanager \ plugin_genericprojectmanager \
plugin_duieditor \
plugin_qmlprojectmanager \
debugger/dumper.pro debugger/dumper.pro
DUI=$$(QTDIR_DUI)
isEmpty(DUI):DUI=$$fromfile($$(QTDIR)/.qmake.cache,QT_SOURCE_TREE)
!isEmpty(DUI):exists($$DUI/src/declarative/qml/parser) {
SUBDIRS += plugin_duieditor \
plugin_qmlprojectmanager
plugin_duieditor.subdir = duieditor
plugin_duieditor.depends = plugin_texteditor
plugin_duieditor.depends += plugin_coreplugin
plugin_qmlprojectmanager.subdir = qmlprojectmanager
plugin_qmlprojectmanager.depends = plugin_texteditor
plugin_qmlprojectmanager.depends += plugin_projectexplorer
plugin_qmlprojectmanager.depends += plugin_help
}
plugin_coreplugin.subdir = coreplugin plugin_coreplugin.subdir = coreplugin
plugin_find.subdir = find plugin_find.subdir = find
@@ -173,3 +158,12 @@ plugin_genericprojectmanager.depends = plugin_texteditor
plugin_genericprojectmanager.depends += plugin_projectexplorer plugin_genericprojectmanager.depends += plugin_projectexplorer
plugin_genericprojectmanager.depends += plugin_cpptools plugin_genericprojectmanager.depends += plugin_cpptools
plugin_genericprojectmanager.depends += plugin_cppeditor plugin_genericprojectmanager.depends += plugin_cppeditor
plugin_duieditor.subdir = duieditor
plugin_duieditor.depends = plugin_texteditor
plugin_duieditor.depends += plugin_coreplugin
plugin_qmlprojectmanager.subdir = qmlprojectmanager
plugin_qmlprojectmanager.depends = plugin_texteditor
plugin_qmlprojectmanager.depends += plugin_projectexplorer
plugin_qmlprojectmanager.depends += plugin_help