Imported the javascript front-end

This commit is contained in:
Roberto Raggi
2009-03-30 23:17:36 +02:00
parent dcbe9115a0
commit cf09ca0fb1
21 changed files with 9687 additions and 0 deletions

View File

@@ -0,0 +1,16 @@
s/#include "qscriptcontext_p.h"//g
s/#include "qscriptcontext.h"//g
s/#include "qscriptengine.h"//g
s/#include "qscriptmember_p.h"//g
s/#include "qscriptobject_p.h"//g
s/#include "qscriptvalueimpl_p.h"//g
s/#ifndef QT_NO_SCRIPT//g
s,#endif // QT_NO_SCRIPT,,g
s/QScript/JavaScript/g
s/QSCRIPT/JAVASCRIPT/g
s/qscript/javascript/g
s/Q_SCRIPT/J_SCRIPT/g
s/qsreal/qjsreal/g

View File

@@ -0,0 +1,44 @@
#!/bin/sh
me=$(dirname $0)
rm -f javascript.g
rm -f javascriptast.cpp
rm -f javascriptast_p.h
rm -f javascriptastfwd_p.h
rm -f javascriptastvisitor.cpp
rm -f javascriptastvisitor_p.h
rm -f javascriptlexer.cpp
rm -f javascriptlexer_p.h
rm -f javascriptmemorypool_p.h
rm -f javascriptnodepool_p.h
sed -f $me/cmd.sed $QTDIR/src/script/qscript.g > javascript.g
sed -f $me/cmd.sed $QTDIR/src/script/qscriptast.cpp > javascriptast.cpp
sed -f $me/cmd.sed $QTDIR/src/script/qscriptast_p.h > javascriptast_p.h
sed -f $me/cmd.sed $QTDIR/src/script/qscriptastfwd_p.h > javascriptastfwd_p.h
sed -f $me/cmd.sed $QTDIR/src/script/qscriptastvisitor.cpp > javascriptastvisitor.cpp
sed -f $me/cmd.sed $QTDIR/src/script/qscriptastvisitor_p.h > javascriptastvisitor_p.h
sed -f $me/cmd.sed $QTDIR/src/script/qscriptlexer_p.h > javascriptlexer_p.h
sed -f $me/cmd.sed $QTDIR/src/script/qscriptlexer.cpp > javascriptlexer.cpp
sed -f $me/cmd.sed $QTDIR/src/script/qscriptmemorypool_p.h > javascriptmemorypool_p.h
sed -f $me/cmd.sed $QTDIR/src/script/qscriptnodepool_p.h > javascriptnodepool_p.h
qlalr $me/javascript.g
chmod ugo-w javascript.g
chmod ugo-w javascriptast.cpp
chmod ugo-w javascriptast_p.h
chmod ugo-w javascriptastfwd_p.h
chmod ugo-w javascriptastvisitor.cpp
chmod ugo-w javascriptastvisitor_p.h
chmod ugo-w javascriptlexer_p.h
chmod ugo-w javascriptlexer.cpp
chmod ugo-w javascriptmemorypool_p.h
chmod ugo-w javascriptnodepool_p.h
chmod ugo-w javascriptgrammar_p.h
chmod ugo-w javascriptgrammar.cpp
chmod ugo-w javascriptparser_p.h
chmod ugo-w javascriptparser.cpp

File diff suppressed because it is too large Load Diff

View File

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

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,146 @@
/****************************************************************************
**
** 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 JAVASCRIPTAST_FWD_P_H
#define JAVASCRIPTAST_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 JavaScript { namespace AST {
class Visitor;
class Node;
class ExpressionNode;
class Statement;
class ThisExpression;
class IdentifierExpression;
class NullExpression;
class TrueLiteral;
class FalseLiteral;
class NumericLiteral;
class StringLiteral;
class RegExpLiteral;
class ArrayLiteral;
class ObjectLiteral;
class ElementList;
class Elision;
class PropertyNameAndValueList;
class PropertyName;
class IdentifierPropertyName;
class StringLiteralPropertyName;
class NumericLiteralPropertyName;
class ArrayMemberExpression;
class FieldMemberExpression;
class NewMemberExpression;
class NewExpression;
class CallExpression;
class ArgumentList;
class PostIncrementExpression;
class PostDecrementExpression;
class DeleteExpression;
class VoidExpression;
class TypeOfExpression;
class PreIncrementExpression;
class PreDecrementExpression;
class UnaryPlusExpression;
class UnaryMinusExpression;
class TildeExpression;
class NotExpression;
class BinaryExpression;
class ConditionalExpression;
class Expression; // ### rename
class Block;
class StatementList;
class VariableStatement;
class VariableDeclarationList;
class VariableDeclaration;
class EmptyStatement;
class ExpressionStatement;
class IfStatement;
class DoWhileStatement;
class WhileStatement;
class ForStatement;
class LocalForStatement;
class ForEachStatement;
class LocalForEachStatement;
class ContinueStatement;
class BreakStatement;
class ReturnStatement;
class WithStatement;
class SwitchStatement;
class CaseBlock;
class CaseClauses;
class CaseClause;
class DefaultClause;
class LabelledStatement;
class ThrowStatement;
class TryStatement;
class Catch;
class Finally;
class FunctionDeclaration;
class FunctionExpression;
class FormalParameterList;
class FunctionBody;
class Program;
class SourceElements;
class SourceElement;
class FunctionSourceElement;
class StatementSourceElement;
class DebuggerStatement;
} } // namespace AST
QT_END_NAMESPACE
#endif

View File

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

View File

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

View File

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

View File

@@ -0,0 +1,105 @@
#ifndef JAVASCRIPTENGINE_P_H
#define JAVASCRIPTENGINE_P_H
#include "javascriptvalue.h"
#include <QString>
#include <QSet>
namespace JavaScript {
class Node;
class Lexer;
class NodePool;
namespace AST {
class Node;
} // end of namespace AST
namespace Ecma {
class RegExp
{
public:
enum RegExpFlag {
Global = 0x01,
IgnoreCase = 0x02,
Multiline = 0x04
};
public:
static int flagFromChar(const QChar &);
};
} // end of namespace Ecma
} // end of namespace JavaScript
class JavaScriptNameIdImpl
{
QString _text;
public:
JavaScriptNameIdImpl(const QChar *u, int s)
: _text(u, s)
{ }
const QString asString() const
{ return _text; }
bool operator == (const JavaScriptNameIdImpl &other) const
{ return _text == other._text; }
bool operator != (const JavaScriptNameIdImpl &other) const
{ return _text != other._text; }
bool operator < (const JavaScriptNameIdImpl &other) const
{ return _text < other._text; }
};
inline uint qHash(const JavaScriptNameIdImpl &id)
{ return qHash(id.asString()); }
class JavaScriptEnginePrivate
{
JavaScript::Lexer *_lexer;
JavaScript::NodePool *_nodePool;
JavaScript::AST::Node *_ast;
QSet<JavaScriptNameIdImpl> _literals;
public:
JavaScriptEnginePrivate()
: _lexer(0), _nodePool(0), _ast(0)
{ }
JavaScriptNameIdImpl *JavaScriptEnginePrivate::intern(const QChar *u, int s)
{ return const_cast<JavaScriptNameIdImpl *>(&*_literals.insert(JavaScriptNameIdImpl(u, s))); }
JavaScript::Lexer *lexer() const
{ return _lexer; }
void setLexer(JavaScript::Lexer *lexer)
{ _lexer = lexer; }
JavaScript::NodePool *nodePool() const
{ return _nodePool; }
void setNodePool(JavaScript::NodePool *nodePool)
{ _nodePool = nodePool; }
JavaScript::AST::Node *ast() const
{ return _ast; }
JavaScript::AST::Node *changeAbstractSyntaxTree(JavaScript::AST::Node *node)
{
JavaScript::AST::Node *previousAST = _ast;
_ast = node;
return previousAST;
}
};
#endif // JAVASCRIPTENGINE_P_H

View File

@@ -0,0 +1,927 @@
// This file was generated by qlalr - DO NOT EDIT!
#include "javascriptgrammar_p.h"
const char *const JavaScriptGrammar::spell [] = {
"end of file", "&", "&&", "&=", "break", "case", "catch", ":", ";", "continue",
"default", "delete", "/", "/=", "do", ".", "else", "=", "==", "===",
"finally", "for", "function", ">=", ">", ">>", ">>=", ">>>", ">>>=", "identifier",
"if", "in", "instanceof", "{", "[", "<=", "(", "<", "<<", "<<=",
"-", "-=", "--", "new", "!", "!=", "!==", "numeric literal", "|", "|=",
"||", "+", "+=", "++", "?", "}", "]", "%", "%=", "return",
")", ";", 0, "*", "*=", "string literal", "switch", "this", "throw", "~",
"try", "typeof", "var", "void", "while", "with", "^", "^=", "null", "true",
"false", "const", "debugger", "reserved word",
#ifndef QLALR_NO_JAVASCRIPTGRAMMAR_DEBUG_INFO
"Program", "PrimaryExpression", "ElisionOpt", "ElementList", "PropertyNameAndValueListOpt", "PropertyNameAndValueList",
"Expression", "AssignmentExpression", "Elision", "PropertyName", "ReservedIdentifier", "PropertyIdentifier", "MemberExpression", "FunctionExpression", "Arguments", "NewExpression",
"CallExpression", "ArgumentList", "LeftHandSideExpression", "PostfixExpression", "UnaryExpression", "MultiplicativeExpression", "AdditiveExpression", "ShiftExpression", "RelationalExpression", "RelationalExpressionNotIn",
"EqualityExpression", "EqualityExpressionNotIn", "BitwiseANDExpression", "BitwiseANDExpressionNotIn", "BitwiseXORExpression", "BitwiseXORExpressionNotIn", "BitwiseORExpression", "BitwiseORExpressionNotIn", "LogicalANDExpression", "LogicalANDExpressionNotIn",
"LogicalORExpression", "LogicalORExpressionNotIn", "ConditionalExpression", "ConditionalExpressionNotIn", "AssignmentExpressionNotIn", "AssignmentOperator", "ExpressionOpt", "ExpressionNotIn", "ExpressionNotInOpt", "Statement",
"Block", "VariableStatement", "EmptyStatement", "ExpressionStatement", "IfStatement", "IterationStatement", "ContinueStatement", "BreakStatement", "ReturnStatement", "WithStatement",
"LabelledStatement", "SwitchStatement", "ThrowStatement", "TryStatement", "DebuggerStatement", "StatementListOpt", "StatementList", "VariableDeclarationKind", "VariableDeclarationList", "VariableDeclaration",
"VariableDeclarationListNotIn", "VariableDeclarationNotIn", "InitialiserOpt", "InitialiserNotInOpt", "Initialiser", "InitialiserNotIn", "CaseBlock", "CaseClausesOpt", "DefaultClause", "CaseClauses",
"CaseClause", "Catch", "Finally", "FunctionDeclaration", "FormalParameterListOpt", "FunctionBodyOpt", "IdentifierOpt", "FormalParameterList", "FunctionBody", "SourceElements",
"SourceElement", "$accept"
#endif // QLALR_NO_JAVASCRIPTGRAMMAR_DEBUG_INFO
};
const int JavaScriptGrammar::lhs [] = {
85, 85, 85, 85, 85, 85, 85, 85, 85, 85,
85, 85, 85, 85, 85, 87, 87, 92, 92, 86,
86, 89, 89, 93, 93, 93, 93, 94, 94, 94,
94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
94, 94, 94, 94, 94, 94, 94, 94, 95, 95,
96, 96, 96, 96, 96, 99, 99, 100, 100, 100,
100, 98, 98, 101, 101, 102, 102, 103, 103, 103,
104, 104, 104, 104, 104, 104, 104, 104, 104, 104,
105, 105, 105, 105, 106, 106, 106, 107, 107, 107,
107, 108, 108, 108, 108, 108, 108, 108, 109, 109,
109, 109, 109, 109, 110, 110, 110, 110, 110, 111,
111, 111, 111, 111, 112, 112, 113, 113, 114, 114,
115, 115, 116, 116, 117, 117, 118, 118, 119, 119,
120, 120, 121, 121, 122, 122, 123, 123, 91, 91,
124, 124, 125, 125, 125, 125, 125, 125, 125, 125,
125, 125, 125, 125, 90, 90, 126, 126, 127, 127,
128, 128, 129, 129, 129, 129, 129, 129, 129, 129,
129, 129, 129, 129, 129, 129, 129, 130, 146, 146,
145, 145, 131, 131, 147, 147, 148, 148, 150, 150,
149, 151, 154, 152, 152, 155, 153, 153, 132, 133,
133, 134, 134, 135, 135, 135, 135, 135, 135, 135,
136, 136, 136, 136, 137, 137, 137, 137, 138, 138,
139, 141, 156, 156, 159, 159, 157, 157, 160, 158,
140, 142, 142, 143, 143, 143, 161, 162, 144, 144,
163, 97, 167, 167, 164, 164, 165, 165, 168, 84,
169, 169, 170, 170, 166, 166, 88, 88, 171};
const int JavaScriptGrammar:: rhs[] = {
1, 1, 1, 1, 1, 1, 1, 1, 1, 3,
3, 5, 3, 4, 3, 2, 4, 1, 2, 0,
1, 3, 5, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 4, 3, 3, 1, 2, 2, 2, 4,
3, 2, 3, 1, 3, 1, 1, 1, 2, 2,
1, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1, 3, 3, 3, 1, 3, 3, 1, 3, 3,
3, 1, 3, 3, 3, 3, 3, 3, 1, 3,
3, 3, 3, 3, 1, 3, 3, 3, 3, 1,
3, 3, 3, 3, 1, 3, 1, 3, 1, 3,
1, 3, 1, 3, 1, 3, 1, 3, 1, 3,
1, 3, 1, 3, 1, 5, 1, 5, 1, 3,
1, 3, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 3, 0, 1, 1, 3,
0, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 3, 1, 2,
0, 1, 3, 3, 1, 1, 1, 3, 1, 3,
2, 2, 2, 0, 1, 2, 0, 1, 1, 2,
2, 7, 5, 7, 7, 5, 9, 10, 7, 8,
2, 2, 3, 3, 2, 2, 3, 3, 3, 3,
5, 5, 3, 5, 1, 2, 0, 1, 4, 3,
3, 3, 3, 3, 3, 4, 5, 2, 2, 2,
8, 8, 1, 3, 0, 1, 0, 1, 1, 1,
1, 2, 1, 1, 0, 1, 0, 1, 2};
#ifndef QLALR_NO_JAVASCRIPTGRAMMAR_DEBUG_INFO
const int JavaScriptGrammar::rule_info [] = {
85, 67
, 85, 29
, 85, 78
, 85, 79
, 85, 80
, 85, 47
, 85, 65
, 85, 12
, 85, 13
, 85, 34, 86, 56
, 85, 34, 87, 56
, 85, 34, 87, 8, 86, 56
, 85, 33, 88, 55
, 85, 33, 89, 8, 55
, 85, 36, 90, 60
, 87, 86, 91
, 87, 87, 8, 86, 91
, 92, 8
, 92, 92, 8
, 86
, 86, 92
, 89, 93, 7, 91
, 89, 89, 8, 93, 7, 91
, 93, 29
, 93, 65
, 93, 47
, 93, 94
, 94, 4
, 94, 5
, 94, 6
, 94, 9
, 94, 10
, 94, 11
, 94, 14
, 94, 16
, 94, 80
, 94, 20
, 94, 21
, 94, 22
, 94, 30
, 94, 31
, 94, 32
, 94, 43
, 94, 78
, 94, 59
, 94, 66
, 94, 67
, 94, 68
, 94, 79
, 94, 70
, 94, 71
, 94, 72
, 94, 73
, 94, 74
, 94, 81
, 94, 82
, 94, 83
, 94, 75
, 95, 29
, 95, 94
, 96, 85
, 96, 97
, 96, 96, 34, 90, 56
, 96, 96, 15, 95
, 96, 43, 96, 98
, 99, 96
, 99, 43, 99
, 100, 96, 98
, 100, 100, 98
, 100, 100, 34, 90, 56
, 100, 100, 15, 95
, 98, 36, 60
, 98, 36, 101, 60
, 101, 91
, 101, 101, 8, 91
, 102, 99
, 102, 100
, 103, 102
, 103, 102, 53
, 103, 102, 42
, 104, 103
, 104, 11, 104
, 104, 73, 104
, 104, 71, 104
, 104, 53, 104
, 104, 42, 104
, 104, 51, 104
, 104, 40, 104
, 104, 69, 104
, 104, 44, 104
, 105, 104
, 105, 105, 63, 104
, 105, 105, 12, 104
, 105, 105, 57, 104
, 106, 105
, 106, 106, 51, 105
, 106, 106, 40, 105
, 107, 106
, 107, 107, 38, 106
, 107, 107, 25, 106
, 107, 107, 27, 106
, 108, 107
, 108, 108, 37, 107
, 108, 108, 24, 107
, 108, 108, 35, 107
, 108, 108, 23, 107
, 108, 108, 32, 107
, 108, 108, 31, 107
, 109, 107
, 109, 109, 37, 107
, 109, 109, 24, 107
, 109, 109, 35, 107
, 109, 109, 23, 107
, 109, 109, 32, 107
, 110, 108
, 110, 110, 18, 108
, 110, 110, 45, 108
, 110, 110, 19, 108
, 110, 110, 46, 108
, 111, 109
, 111, 111, 18, 109
, 111, 111, 45, 109
, 111, 111, 19, 109
, 111, 111, 46, 109
, 112, 110
, 112, 112, 1, 110
, 113, 111
, 113, 113, 1, 111
, 114, 112
, 114, 114, 76, 112
, 115, 113
, 115, 115, 76, 113
, 116, 114
, 116, 116, 48, 114
, 117, 115
, 117, 117, 48, 115
, 118, 116
, 118, 118, 2, 116
, 119, 117
, 119, 119, 2, 117
, 120, 118
, 120, 120, 50, 118
, 121, 119
, 121, 121, 50, 119
, 122, 120
, 122, 120, 54, 91, 7, 91
, 123, 121
, 123, 121, 54, 124, 7, 124
, 91, 122
, 91, 102, 125, 91
, 124, 123
, 124, 102, 125, 124
, 125, 17
, 125, 64
, 125, 13
, 125, 58
, 125, 52
, 125, 41
, 125, 39
, 125, 26
, 125, 28
, 125, 3
, 125, 77
, 125, 49
, 90, 91
, 90, 90, 8, 91
, 126
, 126, 90
, 127, 124
, 127, 127, 8, 124
, 128
, 128, 127
, 129, 130
, 129, 131
, 129, 132
, 129, 133
, 129, 134
, 129, 135
, 129, 136
, 129, 137
, 129, 138
, 129, 139
, 129, 140
, 129, 141
, 129, 142
, 129, 143
, 129, 144
, 130, 33, 145, 55
, 146, 129
, 146, 146, 129
, 145
, 145, 146
, 131, 147, 148, 62
, 131, 147, 148, 61
, 147, 81
, 147, 72
, 148, 149
, 148, 148, 8, 149
, 150, 151
, 150, 150, 8, 151
, 149, 29, 152
, 151, 29, 153
, 154, 17, 91
, 152
, 152, 154
, 155, 17, 124
, 153
, 153, 155
, 132, 61
, 133, 90, 62
, 133, 90, 61
, 134, 30, 36, 90, 60, 129, 16, 129
, 134, 30, 36, 90, 60, 129
, 135, 14, 129, 74, 36, 90, 60, 62
, 135, 14, 129, 74, 36, 90, 60, 61
, 135, 74, 36, 90, 60, 129
, 135, 21, 36, 128, 61, 126, 61, 126, 60, 129
, 135, 21, 36, 72, 150, 61, 126, 61, 126, 60, 129
, 135, 21, 36, 102, 31, 90, 60, 129
, 135, 21, 36, 72, 151, 31, 90, 60, 129
, 136, 9, 62
, 136, 9, 61
, 136, 9, 29, 62
, 136, 9, 29, 61
, 137, 4, 62
, 137, 4, 61
, 137, 4, 29, 62
, 137, 4, 29, 61
, 138, 59, 126, 62
, 138, 59, 126, 61
, 139, 75, 36, 90, 60, 129
, 141, 66, 36, 90, 60, 156
, 156, 33, 157, 55
, 156, 33, 157, 158, 157, 55
, 159, 160
, 159, 159, 160
, 157
, 157, 159
, 160, 5, 90, 7, 145
, 158, 10, 7, 145
, 140, 29, 7, 129
, 142, 68, 90, 62
, 142, 68, 90, 61
, 143, 70, 130, 161
, 143, 70, 130, 162
, 143, 70, 130, 161, 162
, 161, 6, 36, 29, 60, 130
, 162, 20, 130
, 144, 82, 62
, 144, 82, 61
, 163, 22, 29, 36, 164, 60, 33, 165, 55
, 97, 22, 166, 36, 164, 60, 33, 165, 55
, 167, 29
, 167, 167, 8, 29
, 164
, 164, 167
, 165
, 165, 168
, 168, 169
, 84, 169
, 169, 170
, 169, 169, 170
, 170, 129
, 170, 163
, 166
, 166, 29
, 88
, 88, 89
, 171, 84, 0};
const int JavaScriptGrammar::rule_index [] = {
0, 2, 4, 6, 8, 10, 12, 14, 16, 18,
22, 26, 32, 36, 41, 45, 48, 53, 55, 58,
59, 61, 65, 71, 73, 75, 77, 79, 81, 83,
85, 87, 89, 91, 93, 95, 97, 99, 101, 103,
105, 107, 109, 111, 113, 115, 117, 119, 121, 123,
125, 127, 129, 131, 133, 135, 137, 139, 141, 143,
145, 147, 149, 154, 158, 162, 164, 167, 170, 173,
178, 182, 185, 189, 191, 195, 197, 199, 201, 204,
207, 209, 212, 215, 218, 221, 224, 227, 230, 233,
236, 238, 242, 246, 250, 252, 256, 260, 262, 266,
270, 274, 276, 280, 284, 288, 292, 296, 300, 302,
306, 310, 314, 318, 322, 324, 328, 332, 336, 340,
342, 346, 350, 354, 358, 360, 364, 366, 370, 372,
376, 378, 382, 384, 388, 390, 394, 396, 400, 402,
406, 408, 412, 414, 418, 420, 426, 428, 434, 436,
440, 442, 446, 448, 450, 452, 454, 456, 458, 460,
462, 464, 466, 468, 470, 472, 476, 477, 479, 481,
485, 486, 488, 490, 492, 494, 496, 498, 500, 502,
504, 506, 508, 510, 512, 514, 516, 518, 522, 524,
527, 528, 530, 534, 538, 540, 542, 544, 548, 550,
554, 557, 560, 563, 564, 566, 569, 570, 572, 574,
577, 580, 588, 594, 602, 610, 616, 626, 637, 645,
654, 657, 660, 664, 668, 671, 674, 678, 682, 686,
690, 696, 702, 706, 712, 714, 717, 718, 720, 725,
729, 733, 737, 741, 745, 749, 754, 760, 763, 766,
769, 778, 787, 789, 793, 794, 796, 797, 799, 801,
803, 805, 808, 810, 812, 813, 815, 816, 818};
#endif // QLALR_NO_JAVASCRIPTGRAMMAR_DEBUG_INFO
const int JavaScriptGrammar::action_default [] = {
0, 98, 165, 129, 137, 133, 173, 180, 77, 149,
179, 187, 175, 125, 0, 176, 264, 62, 177, 178,
183, 78, 141, 145, 66, 95, 76, 81, 61, 0,
115, 181, 102, 261, 260, 263, 184, 0, 195, 0,
0, 0, 8, 9, 0, 5, 0, 265, 2, 0,
267, 20, 0, 0, 0, 0, 0, 3, 6, 0,
0, 167, 209, 7, 0, 1, 0, 0, 4, 0,
0, 196, 0, 0, 0, 185, 186, 91, 0, 174,
182, 0, 0, 78, 97, 265, 2, 267, 80, 79,
0, 0, 0, 93, 94, 92, 0, 266, 255, 256,
0, 253, 0, 254, 0, 257, 258, 0, 259, 252,
262, 0, 268, 0, 27, 28, 29, 30, 55, 31,
56, 32, 33, 34, 35, 36, 37, 38, 39, 24,
40, 41, 42, 43, 44, 26, 57, 45, 25, 46,
47, 48, 49, 50, 51, 52, 53, 54, 58, 0,
22, 0, 0, 14, 0, 23, 13, 96, 0, 126,
0, 0, 0, 0, 116, 0, 0, 0, 0, 0,
0, 106, 0, 0, 0, 100, 101, 99, 104, 108,
107, 105, 103, 118, 117, 119, 0, 134, 0, 130,
69, 0, 0, 0, 71, 60, 59, 0, 0, 70,
166, 0, 74, 72, 0, 73, 75, 210, 211, 0,
162, 155, 153, 160, 161, 159, 158, 164, 157, 156,
154, 163, 150, 0, 138, 0, 0, 142, 0, 0,
146, 68, 0, 0, 64, 0, 63, 269, 225, 0,
226, 227, 228, 221, 0, 222, 223, 224, 249, 250,
82, 0, 0, 0, 0, 0, 214, 215, 171, 169,
131, 139, 135, 151, 127, 172, 0, 78, 143, 147,
120, 109, 0, 0, 128, 0, 0, 0, 0, 121,
0, 0, 0, 0, 0, 113, 111, 114, 112, 110,
123, 122, 124, 0, 136, 0, 132, 0, 170, 78,
0, 152, 167, 168, 0, 167, 0, 0, 217, 0,
0, 0, 219, 0, 140, 0, 0, 144, 0, 0,
148, 207, 0, 199, 208, 202, 0, 206, 0, 167,
200, 0, 167, 0, 0, 218, 0, 0, 0, 220,
266, 255, 0, 0, 257, 0, 251, 0, 241, 0,
0, 0, 213, 0, 212, 189, 192, 0, 28, 55,
31, 56, 33, 34, 5, 38, 39, 2, 40, 43,
3, 6, 167, 7, 46, 1, 48, 4, 50, 51,
52, 53, 54, 58, 190, 188, 66, 67, 65, 0,
229, 230, 0, 0, 0, 232, 237, 235, 238, 0,
0, 236, 237, 0, 233, 0, 234, 191, 240, 0,
191, 239, 0, 242, 243, 0, 191, 244, 245, 0,
0, 246, 0, 0, 0, 247, 248, 84, 83, 0,
0, 0, 216, 0, 0, 0, 231, 0, 21, 0,
18, 20, 11, 0, 17, 12, 19, 16, 10, 0,
15, 88, 86, 90, 87, 85, 89, 204, 197, 0,
205, 201, 0, 203, 193, 0, 194, 198};
const int JavaScriptGrammar::goto_default [] = {
29, 28, 439, 437, 113, 112, 14, 2, 438, 111,
114, 194, 24, 17, 190, 26, 8, 201, 21, 27,
77, 25, 1, 32, 30, 270, 13, 264, 3, 260,
5, 262, 4, 261, 22, 268, 23, 269, 9, 263,
259, 300, 389, 265, 266, 35, 6, 79, 12, 15,
18, 19, 10, 7, 31, 80, 20, 36, 75, 76,
11, 357, 356, 78, 459, 458, 322, 323, 461, 325,
460, 324, 395, 399, 402, 398, 397, 417, 418, 16,
100, 107, 96, 99, 106, 108, 33, 0};
const int JavaScriptGrammar::action_index [] = {
1318, 79, -84, 56, 39, -17, -84, -84, 169, -84,
-84, -84, -84, 216, 149, -84, -84, -84, -84, -84,
-84, 475, 68, 100, 180, 184, -84, -84, -84, 99,
303, -84, 193, -84, 1318, -84, -84, 160, -84, 194,
85, 629, -84, -84, 1398, -84, -5, 32, 42, 26,
1478, 37, 629, 629, 629, 366, 629, -84, -84, 629,
629, 629, -84, -84, 55, -84, 629, 629, -84, 61,
629, -84, 629, 52, 38, -84, -84, -84, 49, -84,
-84, 629, 629, 64, 182, 48, -84, 1158, -84, -84,
629, 629, 629, -84, -84, -84, 36, -84, 44, 50,
40, -84, 57, -84, -26, 1318, -84, -53, 1318, -84,
-84, 18, 7, 43, -84, -84, -84, -84, -84, -84,
-84, -84, -84, -84, -84, -84, -84, -84, -84, -84,
-84, -84, -84, -84, -84, -84, -84, -84, -84, -84,
-84, -84, -84, -84, -84, -84, -84, -84, -84, 629,
-84, 1238, 23, -84, 629, -84, -84, 189, 629, 214,
629, 629, 629, 629, 293, 629, 629, 629, 629, 629,
629, 143, 629, 629, 629, 65, 83, 69, 153, 152,
144, 161, 175, 273, 283, 318, 629, 62, 629, 74,
-84, 1078, 629, 702, -84, -84, -84, 84, 629, -84,
-84, 88, -84, -84, 629, -84, -84, -84, -84, 629,
-84, -84, -84, -84, -84, -84, -84, -84, -84, -84,
-84, -84, -84, 629, 45, 629, 629, 63, 53, 629,
-84, -84, 1078, 629, -84, 102, -84, -84, -84, 90,
-84, -84, -84, -84, 101, -84, -84, -84, -84, -84,
-84, 51, 59, 629, 89, 94, -84, -84, 775, -84,
13, -36, -65, -84, 230, 2, -52, 556, 14, 133,
248, 147, -12, 629, 224, 629, 629, 629, 629, 258,
629, 629, 629, 629, 629, 199, 261, 261, 261, 181,
242, 322, 322, 629, -55, 629, 5, 629, -84, 334,
629, -84, 629, 15, -61, 629, -59, 1398, -84, 629,
73, 1398, -84, 629, 20, 629, 629, 24, 41, 629,
-84, 54, 82, 19, -84, -84, 629, -84, 17, 629,
-84, -10, 629, -7, 1398, -84, 629, 77, 1398, -84,
31, 27, -13, 10, 1318, -22, -84, 1398, -84, 629,
76, 1398, 11, 1398, -84, -84, 1398, -15, 136, 9,
131, 80, 629, 1398, 28, 6, 78, 47, 8, 394,
34, 30, 925, 29, 3, 21, 629, 25, 1, 629,
35, 629, 33, 16, -84, -84, 202, -84, -84, 67,
-84, -84, 629, 72, -4, -84, -2, -84, -1, 66,
629, -84, 0, 12, -84, -37, -84, 1398, -84, 95,
1398, -84, 105, -84, -84, 98, 1398, 4, -84, -14,
-25, -84, -16, -40, 22, -84, -84, -84, -84, 629,
93, 1398, -84, 629, 104, 1398, -84, 103, 71, 848,
-84, 58, -84, 998, -84, -84, -84, -84, -84, 75,
-84, -84, -84, -84, -84, -84, -84, 46, -84, 114,
-84, -84, 629, -84, -84, 60, -84, -84,
-50, -88, -88, -88, -88, -88, -88, -88, -88, -88,
-88, -88, -88, -88, -88, -88, -88, -88, -88, -88,
-88, -28, -88, -88, -10, -88, -88, -88, -88, -88,
-88, -88, -88, -88, -64, -88, -88, -88, -88, -88,
-88, 131, -88, -88, -22, -88, -88, -88, -88, -88,
-27, -88, 13, 94, 88, 98, 89, -88, -88, 106,
107, -4, -88, -88, -88, -88, 68, 111, -88, -31,
85, -88, 110, -88, -88, -88, -88, -88, -88, -88,
-88, 127, 122, -88, -88, -88, -88, -88, -88, -88,
97, 100, 101, -88, -88, -88, -88, -88, -88, -88,
-88, -88, -88, -88, -88, -88, -88, -88, -48, -88,
-88, -88, -88, -88, -88, -88, -88, -88, -88, -88,
-88, -88, -88, -88, -88, -88, -88, -88, -88, -88,
-88, -88, -88, -88, -88, -88, -88, -88, -88, -88,
-88, -88, -88, -88, -88, -88, -88, -88, -88, 32,
-88, 33, -88, -88, 34, -88, -88, -88, 46, -88,
60, 74, 76, 77, -88, 73, 67, 70, 81, 58,
79, -88, 37, 51, 65, -88, -88, -88, -88, -88,
-88, -88, -88, -88, -88, -88, 59, -88, 43, -88,
-88, 42, 48, 20, -88, -88, -88, -88, 41, -88,
-88, -88, -88, -88, 40, -88, -88, -88, -88, 49,
-88, -88, -88, -88, -88, -88, -88, -88, -88, -88,
-88, -88, -88, 50, -88, 45, 26, -88, -88, 24,
-88, -88, 56, 22, -88, -88, -88, -88, -88, -88,
-88, -88, -88, -88, -88, -88, -88, -88, -88, -88,
-88, -88, -88, 31, -88, -88, -88, -88, 57, -88,
-88, -88, -88, -88, -88, -88, -88, -88, -88, -88,
-88, -88, -88, 158, -88, 146, 142, 150, 154, -88,
47, 138, 115, 135, 132, -88, -88, -88, -88, -88,
-88, -88, -88, 168, -88, 172, -88, 160, -88, -88,
180, -88, 220, -88, -88, 117, -88, -2, -88, 38,
-88, -5, -88, 174, -88, 170, 166, -88, -88, 164,
-88, -88, -88, -88, -88, -88, 190, -88, -37, 80,
-88, -88, 105, -88, -13, -88, 28, -88, 0, -88,
-88, -44, -88, -88, -52, -88, -88, 12, -88, 52,
-88, 1, -88, 4, -88, -88, 6, -88, -88, -88,
-88, -88, 119, 8, -88, -88, -88, -88, -88, 120,
-88, -88, 44, -88, -88, -88, 68, -88, -45, 116,
-88, 124, -88, -88, -88, -88, -14, -88, -88, -88,
-88, -88, -1, -88, -88, -88, -88, -88, -55, -88,
11, -88, -53, -88, -88, -88, -88, 109, -88, -88,
96, -88, -88, -88, -88, -88, -19, -54, -88, -88,
-21, -88, -88, -88, -43, -88, -88, -88, -88, 10,
-88, -38, -88, 2, -88, -39, -88, -88, -88, 3,
-88, 9, -88, 7, -88, -88, -88, -88, -88, -88,
-88, -88, -88, -88, -88, -88, -88, -88, -88, -88,
-88, -88, 5, -88, -88, -56, -88, -88};
const int JavaScriptGrammar::action_info [] = {
305, 307, 109, 400, 400, 400, 273, 105, 416, 302,
297, 295, 293, 423, 273, 151, 313, 321, 406, 407,
424, 295, 422, 198, 420, 149, 313, 353, -47, 396,
154, 258, -49, 346, 416, -36, -25, -26, -195, 392,
385, -44, 258, 344, 349, 440, 321, 343, 319, 347,
336, 332, 433, 334, 347, 416, 101, 158, 102, 188,
229, 340, 349, 462, -196, 223, 440, 341, 293, 429,
223, 326, 98, 101, 433, 158, 403, 97, 457, 446,
198, 198, 0, 198, 198, 198, 103, 186, 429, 457,
328, 392, 198, 186, 416, 253, 204, 198, 156, 237,
104, 198, 410, 198, 419, 81, 88, 97, 0, 81,
198, 441, 198, 198, -265, 0, 82, 89, 420, 81,
82, 404, 465, 81, 0, 252, 0, 0, 391, 390,
82, 0, 394, 311, 82, 450, 351, 338, 188, 0,
199, 249, 248, 329, 0, 0, 249, 248, 205, 255,
225, 242, 241, 431, 226, 257, 256, 198, 236, 442,
244, 0, 247, 246, 435, 239, 414, 413, 172, 172,
173, 173, 172, 0, 173, 466, 464, 172, 172, 173,
173, 174, 174, 315, 191, 174, 172, 316, 173, 239,
174, 174, 245, 243, 90, 232, 90, 240, 238, 174,
172, 90, 173, 192, 0, 193, 172, 0, 173, 0,
208, 207, 0, 174, 233, 0, 193, 232, 172, 174,
173, 240, 238, 244, 172, 0, 173, 0, 0, 0,
0, 174, 160, 161, 160, 161, 233, 174, 193, 91,
0, 91, 275, 276, 0, 92, 91, 92, 275, 276,
0, 0, 92, 0, 0, 245, 243, 0, 0, 162,
163, 162, 163, 0, 0, 280, 281, 0, 0, 277,
278, 280, 281, 0, 282, 277, 278, 283, 0, 284,
282, 280, 281, 283, 0, 284, 172, 0, 173, 0,
282, 0, 0, 283, 0, 284, 165, 166, 0, 174,
0, 0, 0, 0, 167, 168, 165, 166, 169, 0,
170, 0, 0, 0, 167, 168, 165, 166, 169, 0,
170, 0, 0, 0, 167, 168, 165, 166, 169, 0,
170, 0, 0, 0, 167, 168, 0, 210, 169, 0,
170, 165, 166, 0, 0, 280, 281, 211, 0, 167,
168, 212, 0, 169, 282, 170, 0, 283, 0, 284,
213, 0, 214, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 215, 0, 216, 88, 0, 42, 43,
0, 0, 0, 217, 0, 0, 218, 89, 85, 0,
0, 0, 219, 0, 0, 86, 0, 0, 220, 87,
51, 0, 52, 0, 0, 0, 42, 43, 0, 55,
0, 221, 0, 58, 0, 0, 85, 0, 0, 0,
0, 0, 0, 86, 0, 0, 0, 87, 51, 0,
52, 63, 0, 65, 0, 0, 0, 55, 0, 0,
0, 58, 0, 0, 57, 68, 45, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 63,
0, 65, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 57, 68, 45, 0, 0, 0, 210, 0,
0, 0, 0, 0, 0, 0, 0, 0, 211, 0,
0, 0, 212, 0, 0, 0, 0, 0, 0, 0,
0, 213, 0, 214, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 215, 0, 216, 88, 0, 0,
0, 0, 0, 0, 217, 0, 0, 218, 89, 0,
0, 0, 0, 219, 0, 0, 0, 0, 0, 220,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 221, 0, 0, 0, 0, 0, 0, 210,
0, 0, 0, 0, 0, 0, 0, 0, 0, 211,
0, 0, 0, 212, 0, 0, 0, 0, 0, 0,
0, 0, 213, 0, 214, 0, 0, 309, 0, 0,
0, 0, 0, 0, 0, 215, 0, 216, 88, 0,
0, 0, 0, 0, 0, 217, 0, 0, 218, 89,
0, 0, 0, 0, 219, 0, 0, 0, 0, 0,
220, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 221, 0, 0, 0, 0, 0, 0,
41, 42, 43, 0, 0, 0, 0, 0, 0, 0,
0, 85, 0, 0, 0, 0, 0, 0, 86, 0,
0, 0, 87, 51, 0, 52, 0, 0, 0, 53,
0, 54, 55, 56, 0, 0, 58, 0, 0, 0,
59, 0, 60, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 63, 0, 65, 0, 67, 0,
70, 0, 72, 0, 0, 0, 0, 57, 68, 45,
0, 0, 0, 41, 42, 43, 0, 0, 0, 0,
0, 0, 0, 0, 85, 0, 0, 0, 0, 0,
0, 86, 0, 0, 0, 87, 51, 0, 52, 0,
0, 0, 53, 0, 54, 55, 56, 0, 0, 58,
0, 0, 0, 59, 0, 60, 0, 0, 0, 0,
0, 0, 203, 0, 0, 0, 0, 63, 0, 65,
0, 67, 0, 70, 0, 72, 0, 0, 0, 0,
57, 68, 45, 0, 0, 0, 41, 42, 43, 0,
0, 0, 0, 0, 0, 0, 0, 85, 0, 0,
0, 0, 0, 0, 86, 0, 0, 0, 87, 51,
0, 52, 0, 0, 0, 53, 0, 54, 55, 56,
0, 0, 58, 0, 0, 0, 59, 0, 60, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
63, 0, 65, 0, 67, 0, 70, 272, 72, 0,
0, 0, 0, 57, 68, 45, 0, 0, 0, 41,
42, 43, 0, 0, 0, 0, 0, 0, 0, 0,
85, 0, 0, 0, 0, 0, 0, 86, 0, 0,
0, 87, 51, 0, 52, 0, 0, 0, 53, 0,
54, 55, 56, 0, 0, 58, 0, 0, 0, 59,
0, 60, 0, 0, 448, 0, 0, 0, 0, 0,
0, 0, 0, 63, 0, 65, 0, 67, 0, 70,
0, 72, 0, 0, 0, 0, 57, 68, 45, 0,
0, 0, -45, 0, 0, 0, 41, 42, 43, 0,
0, 0, 0, 0, 0, 0, 0, 85, 0, 0,
0, 0, 0, 0, 86, 0, 0, 0, 87, 51,
0, 52, 0, 0, 0, 53, 0, 54, 55, 56,
0, 0, 58, 0, 0, 0, 59, 0, 60, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
63, 0, 65, 0, 67, 0, 70, 0, 72, 0,
0, 0, 0, 57, 68, 45, 0, 0, 0, 41,
42, 43, 0, 0, 0, 0, 0, 0, 0, 0,
85, 0, 0, 0, 0, 0, 0, 86, 0, 0,
0, 87, 51, 0, 52, 0, 0, 0, 53, 0,
54, 55, 56, 0, 0, 58, 0, 0, 0, 59,
0, 60, 0, 0, 445, 0, 0, 0, 0, 0,
0, 0, 0, 63, 0, 65, 0, 67, 0, 70,
0, 72, 0, 0, 0, 0, 57, 68, 45, 0,
0, 0, 115, 116, 117, 0, 0, 119, 121, 122,
0, 0, 123, 0, 124, 0, 0, 0, 126, 127,
128, 0, 0, 0, 0, 0, 0, 196, 130, 131,
132, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 133, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 137, 0, 0,
0, 0, 0, 0, 139, 140, 141, 0, 143, 144,
145, 146, 147, 148, 0, 0, 134, 142, 125, 118,
120, 136, 115, 116, 117, 0, 0, 119, 121, 122,
0, 0, 123, 0, 124, 0, 0, 0, 126, 127,
128, 0, 0, 0, 0, 0, 0, 129, 130, 131,
132, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 133, 0, 0, 0, 135, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 137, 0, 0,
0, 0, 0, 138, 139, 140, 141, 0, 143, 144,
145, 146, 147, 148, 0, 0, 134, 142, 125, 118,
120, 136, 115, 116, 117, 0, 0, 119, 121, 122,
0, 0, 123, 0, 124, 0, 0, 0, 126, 127,
128, 0, 0, 0, 0, 0, 0, 129, 130, 131,
132, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 133, 0, 0, 0, 135, 0, 0, 0, 0,
0, 0, 0, 153, 0, 0, 0, 137, 0, 0,
0, 0, 0, 138, 139, 140, 141, 0, 143, 144,
145, 146, 147, 148, 0, 0, 134, 142, 125, 118,
120, 136, 37, 0, 0, 0, 0, 39, 0, 41,
42, 43, 44, 0, 0, 0, 0, 0, 0, 46,
47, 0, 0, 0, 0, 0, 0, 48, 49, 0,
0, 50, 51, 0, 52, 0, 0, 0, 53, 0,
54, 55, 56, 0, 0, 58, 0, 0, 0, 59,
0, 60, 0, 0, 0, 0, 0, 61, 0, 62,
0, 0, 0, 63, 64, 65, 66, 67, 69, 70,
71, 72, 73, 74, 0, 0, 57, 68, 45, 38,
40, 0, 37, 0, 0, 0, 0, 39, 0, 41,
42, 43, 44, 0, 0, 0, 0, 0, 0, 46,
85, 0, 0, 0, 0, 0, 0, 48, 49, 0,
0, 50, 51, 0, 52, 0, 0, 0, 53, 0,
54, 55, 56, 0, 0, 58, 0, 0, 0, 59,
0, 60, 0, 0, 0, 0, 0, 61, 0, 62,
0, 0, 0, 63, 64, 65, 66, 67, 69, 70,
71, 72, 73, 74, 0, 0, 57, 68, 45, 38,
40, 0, 358, 116, 117, 0, 0, 360, 121, 362,
42, 43, 363, 0, 124, 0, 0, 0, 126, 365,
366, 0, 0, 0, 0, 0, 0, 367, 368, 131,
132, 50, 51, 0, 52, 0, 0, 0, 53, 0,
54, 369, 56, 0, 0, 371, 0, 0, 0, 59,
0, 60, 0, -191, 0, 0, 0, 372, 0, 62,
0, 0, 0, 373, 374, 375, 376, 67, 378, 379,
380, 381, 382, 383, 0, 0, 370, 377, 364, 359,
361, 136,
388, 415, 303, 425, 231, 393, 436, 432, 434, 467,
447, 443, 463, 209, 444, 415, 430, 409, 355, 449,
405, 401, 110, 251, 421, 426, 355, 202, 235, 345,
330, 230, 335, 228, 337, 34, 342, 254, 110, 150,
312, 155, 152, 308, 310, 339, 352, 206, 200, 354,
303, 384, 195, 251, 197, 83, 222, 348, 350, 175,
0, 83, 0, 83, 83, 83, 195, 234, 83, 83,
285, 189, 159, 176, 412, 267, 83, 83, 83, 227,
271, 181, 224, 83, 164, 83, 303, 177, 83, 187,
178, 83, 83, 179, 83, 83, 171, 83, 183, 83,
184, 185, 182, 83, 180, 427, 83, 83, 452, 453,
386, 303, 83, 387, 451, 83, 0, 93, 83, 83,
94, 95, 331, 303, 83, 83, 454, 455, 83, 83,
428, 456, 386, 83, 83, 387, 427, 83, 287, 250,
83, 355, 83, 157, 428, 83, 0, 333, 84, 83,
83, 250, 0, 83, 355, 289, 83, 411, 288, 306,
83, 286, 0, 0, 83, 271, 0, 290, 83, 271,
408, 279, 83, 271, 0, 291, 83, 271, 299, 292,
0, 271, 299, 271, 299, 274, 83, 271, 83, 271,
83, 271, 83, 271, 0, 271, 0, 271, 299, 294,
298, 296, 0, 271, 320, 317, 318, 314, 299, 0,
0, 0, 0, 271, 0, 0, 0, 0, 0, 0,
301, 0, 0, 0, 0, 0, 303, 0, 0, 0,
327, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 304, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0};
const int JavaScriptGrammar::action_check [] = {
61, 60, 55, 5, 5, 5, 1, 33, 33, 61,
8, 76, 48, 29, 1, 8, 2, 29, 55, 7,
60, 76, 36, 8, 20, 7, 2, 16, 7, 33,
7, 36, 7, 55, 33, 7, 7, 7, 29, 36,
55, 7, 36, 33, 36, 8, 29, 60, 7, 7,
31, 61, 36, 60, 7, 33, 29, 1, 8, 76,
7, 29, 36, 17, 29, 2, 8, 36, 48, 36,
2, 17, 36, 29, 36, 1, 10, 29, 29, 8,
8, 8, -1, 8, 8, 8, 29, 48, 36, 29,
8, 36, 8, 48, 33, 36, 8, 8, 55, 0,
60, 8, 7, 8, 6, 40, 42, 29, -1, 40,
8, 8, 8, 8, 36, -1, 51, 53, 20, 40,
51, 55, 8, 40, -1, 74, -1, -1, 61, 62,
51, -1, 60, 60, 51, 60, 60, 60, 76, -1,
56, 61, 62, 61, -1, -1, 61, 62, 60, 60,
50, 61, 62, 60, 54, 61, 62, 8, 56, 56,
29, -1, 61, 62, 60, 29, 61, 62, 25, 25,
27, 27, 25, -1, 27, 61, 62, 25, 25, 27,
27, 38, 38, 50, 15, 38, 25, 54, 27, 29,
38, 38, 61, 62, 12, 15, 12, 61, 62, 38,
25, 12, 27, 34, -1, 36, 25, -1, 27, -1,
61, 62, -1, 38, 34, -1, 36, 15, 25, 38,
27, 61, 62, 29, 25, -1, 27, -1, -1, -1,
-1, 38, 18, 19, 18, 19, 34, 38, 36, 57,
-1, 57, 18, 19, -1, 63, 57, 63, 18, 19,
-1, -1, 63, -1, -1, 61, 62, -1, -1, 45,
46, 45, 46, -1, -1, 23, 24, -1, -1, 45,
46, 23, 24, -1, 32, 45, 46, 35, -1, 37,
32, 23, 24, 35, -1, 37, 25, -1, 27, -1,
32, -1, -1, 35, -1, 37, 23, 24, -1, 38,
-1, -1, -1, -1, 31, 32, 23, 24, 35, -1,
37, -1, -1, -1, 31, 32, 23, 24, 35, -1,
37, -1, -1, -1, 31, 32, 23, 24, 35, -1,
37, -1, -1, -1, 31, 32, -1, 3, 35, -1,
37, 23, 24, -1, -1, 23, 24, 13, -1, 31,
32, 17, -1, 35, 32, 37, -1, 35, -1, 37,
26, -1, 28, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, 39, -1, 41, 42, -1, 12, 13,
-1, -1, -1, 49, -1, -1, 52, 53, 22, -1,
-1, -1, 58, -1, -1, 29, -1, -1, 64, 33,
34, -1, 36, -1, -1, -1, 12, 13, -1, 43,
-1, 77, -1, 47, -1, -1, 22, -1, -1, -1,
-1, -1, -1, 29, -1, -1, -1, 33, 34, -1,
36, 65, -1, 67, -1, -1, -1, 43, -1, -1,
-1, 47, -1, -1, 78, 79, 80, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, 65,
-1, 67, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, 78, 79, 80, -1, -1, -1, 3, -1,
-1, -1, -1, -1, -1, -1, -1, -1, 13, -1,
-1, -1, 17, -1, -1, -1, -1, -1, -1, -1,
-1, 26, -1, 28, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, 39, -1, 41, 42, -1, -1,
-1, -1, -1, -1, 49, -1, -1, 52, 53, -1,
-1, -1, -1, 58, -1, -1, -1, -1, -1, 64,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, 77, -1, -1, -1, -1, -1, -1, 3,
-1, -1, -1, -1, -1, -1, -1, -1, -1, 13,
-1, -1, -1, 17, -1, -1, -1, -1, -1, -1,
-1, -1, 26, -1, 28, -1, -1, 31, -1, -1,
-1, -1, -1, -1, -1, 39, -1, 41, 42, -1,
-1, -1, -1, -1, -1, 49, -1, -1, 52, 53,
-1, -1, -1, -1, 58, -1, -1, -1, -1, -1,
64, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, 77, -1, -1, -1, -1, -1, -1,
11, 12, 13, -1, -1, -1, -1, -1, -1, -1,
-1, 22, -1, -1, -1, -1, -1, -1, 29, -1,
-1, -1, 33, 34, -1, 36, -1, -1, -1, 40,
-1, 42, 43, 44, -1, -1, 47, -1, -1, -1,
51, -1, 53, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, 65, -1, 67, -1, 69, -1,
71, -1, 73, -1, -1, -1, -1, 78, 79, 80,
-1, -1, -1, 11, 12, 13, -1, -1, -1, -1,
-1, -1, -1, -1, 22, -1, -1, -1, -1, -1,
-1, 29, -1, -1, -1, 33, 34, -1, 36, -1,
-1, -1, 40, -1, 42, 43, 44, -1, -1, 47,
-1, -1, -1, 51, -1, 53, -1, -1, -1, -1,
-1, -1, 60, -1, -1, -1, -1, 65, -1, 67,
-1, 69, -1, 71, -1, 73, -1, -1, -1, -1,
78, 79, 80, -1, -1, -1, 11, 12, 13, -1,
-1, -1, -1, -1, -1, -1, -1, 22, -1, -1,
-1, -1, -1, -1, 29, -1, -1, -1, 33, 34,
-1, 36, -1, -1, -1, 40, -1, 42, 43, 44,
-1, -1, 47, -1, -1, -1, 51, -1, 53, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
65, -1, 67, -1, 69, -1, 71, 72, 73, -1,
-1, -1, -1, 78, 79, 80, -1, -1, -1, 11,
12, 13, -1, -1, -1, -1, -1, -1, -1, -1,
22, -1, -1, -1, -1, -1, -1, 29, -1, -1,
-1, 33, 34, -1, 36, -1, -1, -1, 40, -1,
42, 43, 44, -1, -1, 47, -1, -1, -1, 51,
-1, 53, -1, -1, 56, -1, -1, -1, -1, -1,
-1, -1, -1, 65, -1, 67, -1, 69, -1, 71,
-1, 73, -1, -1, -1, -1, 78, 79, 80, -1,
-1, -1, 7, -1, -1, -1, 11, 12, 13, -1,
-1, -1, -1, -1, -1, -1, -1, 22, -1, -1,
-1, -1, -1, -1, 29, -1, -1, -1, 33, 34,
-1, 36, -1, -1, -1, 40, -1, 42, 43, 44,
-1, -1, 47, -1, -1, -1, 51, -1, 53, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
65, -1, 67, -1, 69, -1, 71, -1, 73, -1,
-1, -1, -1, 78, 79, 80, -1, -1, -1, 11,
12, 13, -1, -1, -1, -1, -1, -1, -1, -1,
22, -1, -1, -1, -1, -1, -1, 29, -1, -1,
-1, 33, 34, -1, 36, -1, -1, -1, 40, -1,
42, 43, 44, -1, -1, 47, -1, -1, -1, 51,
-1, 53, -1, -1, 56, -1, -1, -1, -1, -1,
-1, -1, -1, 65, -1, 67, -1, 69, -1, 71,
-1, 73, -1, -1, -1, -1, 78, 79, 80, -1,
-1, -1, 4, 5, 6, -1, -1, 9, 10, 11,
-1, -1, 14, -1, 16, -1, -1, -1, 20, 21,
22, -1, -1, -1, -1, -1, -1, 29, 30, 31,
32, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, 43, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, 59, -1, -1,
-1, -1, -1, -1, 66, 67, 68, -1, 70, 71,
72, 73, 74, 75, -1, -1, 78, 79, 80, 81,
82, 83, 4, 5, 6, -1, -1, 9, 10, 11,
-1, -1, 14, -1, 16, -1, -1, -1, 20, 21,
22, -1, -1, -1, -1, -1, -1, 29, 30, 31,
32, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, 43, -1, -1, -1, 47, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, 59, -1, -1,
-1, -1, -1, 65, 66, 67, 68, -1, 70, 71,
72, 73, 74, 75, -1, -1, 78, 79, 80, 81,
82, 83, 4, 5, 6, -1, -1, 9, 10, 11,
-1, -1, 14, -1, 16, -1, -1, -1, 20, 21,
22, -1, -1, -1, -1, -1, -1, 29, 30, 31,
32, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, 43, -1, -1, -1, 47, -1, -1, -1, -1,
-1, -1, -1, 55, -1, -1, -1, 59, -1, -1,
-1, -1, -1, 65, 66, 67, 68, -1, 70, 71,
72, 73, 74, 75, -1, -1, 78, 79, 80, 81,
82, 83, 4, -1, -1, -1, -1, 9, -1, 11,
12, 13, 14, -1, -1, -1, -1, -1, -1, 21,
22, -1, -1, -1, -1, -1, -1, 29, 30, -1,
-1, 33, 34, -1, 36, -1, -1, -1, 40, -1,
42, 43, 44, -1, -1, 47, -1, -1, -1, 51,
-1, 53, -1, -1, -1, -1, -1, 59, -1, 61,
-1, -1, -1, 65, 66, 67, 68, 69, 70, 71,
72, 73, 74, 75, -1, -1, 78, 79, 80, 81,
82, -1, 4, -1, -1, -1, -1, 9, -1, 11,
12, 13, 14, -1, -1, -1, -1, -1, -1, 21,
22, -1, -1, -1, -1, -1, -1, 29, 30, -1,
-1, 33, 34, -1, 36, -1, -1, -1, 40, -1,
42, 43, 44, -1, -1, 47, -1, -1, -1, 51,
-1, 53, -1, -1, -1, -1, -1, 59, -1, 61,
-1, -1, -1, 65, 66, 67, 68, 69, 70, 71,
72, 73, 74, 75, -1, -1, 78, 79, 80, 81,
82, -1, 4, 5, 6, -1, -1, 9, 10, 11,
12, 13, 14, -1, 16, -1, -1, -1, 20, 21,
22, -1, -1, -1, -1, -1, -1, 29, 30, 31,
32, 33, 34, -1, 36, -1, -1, -1, 40, -1,
42, 43, 44, -1, -1, 47, -1, -1, -1, 51,
-1, 53, -1, 55, -1, -1, -1, 59, -1, 61,
-1, -1, -1, 65, 66, 67, 68, 69, 70, 71,
72, 73, 74, 75, -1, -1, 78, 79, 80, 81,
82, 83,
14, 46, 6, 46, 14, 6, 45, 45, 6, 65,
7, 2, 7, 41, 7, 46, 6, 6, 45, 6,
73, 76, 86, 45, 78, 46, 45, 7, 6, 81,
67, 7, 45, 7, 6, 85, 80, 6, 86, 7,
45, 7, 9, 45, 6, 45, 45, 7, 7, 45,
6, 45, 10, 45, 6, 18, 7, 45, 6, 22,
-1, 18, -1, 18, 18, 18, 10, 11, 18, 18,
23, 28, 26, 22, 6, 18, 18, 18, 18, 34,
23, 23, 32, 18, 24, 18, 6, 22, 18, 30,
23, 18, 18, 23, 18, 18, 23, 18, 24, 18,
24, 24, 23, 18, 23, 20, 18, 18, 20, 20,
12, 6, 18, 15, 20, 18, -1, 20, 18, 18,
20, 20, 42, 6, 18, 18, 20, 20, 18, 18,
20, 20, 12, 18, 18, 15, 20, 18, 23, 20,
18, 45, 18, 21, 20, 18, -1, 42, 21, 18,
18, 20, -1, 18, 45, 23, 18, 61, 23, 42,
18, 23, -1, -1, 18, 23, -1, 25, 18, 23,
61, 25, 18, 23, -1, 25, 18, 23, 18, 25,
-1, 23, 18, 23, 18, 27, 18, 23, 18, 23,
18, 23, 18, 23, -1, 23, -1, 23, 18, 31,
40, 29, -1, 23, 40, 35, 40, 33, 18, -1,
-1, -1, -1, 23, -1, -1, -1, -1, -1, -1,
40, -1, -1, -1, -1, -1, 6, -1, -1, -1,
40, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, 42, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1};

View File

@@ -0,0 +1,147 @@
// This file was generated by qlalr - DO NOT EDIT!
#ifndef JAVASCRIPTGRAMMAR_P_H
#define JAVASCRIPTGRAMMAR_P_H
class JavaScriptGrammar
{
public:
enum {
EOF_SYMBOL = 0,
T_AND = 1,
T_AND_AND = 2,
T_AND_EQ = 3,
T_AUTOMATIC_SEMICOLON = 62,
T_BREAK = 4,
T_CASE = 5,
T_CATCH = 6,
T_COLON = 7,
T_COMMA = 8,
T_CONST = 81,
T_CONTINUE = 9,
T_DEBUGGER = 82,
T_DEFAULT = 10,
T_DELETE = 11,
T_DIVIDE_ = 12,
T_DIVIDE_EQ = 13,
T_DO = 14,
T_DOT = 15,
T_ELSE = 16,
T_EQ = 17,
T_EQ_EQ = 18,
T_EQ_EQ_EQ = 19,
T_FALSE = 80,
T_FINALLY = 20,
T_FOR = 21,
T_FUNCTION = 22,
T_GE = 23,
T_GT = 24,
T_GT_GT = 25,
T_GT_GT_EQ = 26,
T_GT_GT_GT = 27,
T_GT_GT_GT_EQ = 28,
T_IDENTIFIER = 29,
T_IF = 30,
T_IN = 31,
T_INSTANCEOF = 32,
T_LBRACE = 33,
T_LBRACKET = 34,
T_LE = 35,
T_LPAREN = 36,
T_LT = 37,
T_LT_LT = 38,
T_LT_LT_EQ = 39,
T_MINUS = 40,
T_MINUS_EQ = 41,
T_MINUS_MINUS = 42,
T_NEW = 43,
T_NOT = 44,
T_NOT_EQ = 45,
T_NOT_EQ_EQ = 46,
T_NULL = 78,
T_NUMERIC_LITERAL = 47,
T_OR = 48,
T_OR_EQ = 49,
T_OR_OR = 50,
T_PLUS = 51,
T_PLUS_EQ = 52,
T_PLUS_PLUS = 53,
T_QUESTION = 54,
T_RBRACE = 55,
T_RBRACKET = 56,
T_REMAINDER = 57,
T_REMAINDER_EQ = 58,
T_RESERVED_WORD = 83,
T_RETURN = 59,
T_RPAREN = 60,
T_SEMICOLON = 61,
T_STAR = 63,
T_STAR_EQ = 64,
T_STRING_LITERAL = 65,
T_SWITCH = 66,
T_THIS = 67,
T_THROW = 68,
T_TILDE = 69,
T_TRUE = 79,
T_TRY = 70,
T_TYPEOF = 71,
T_VAR = 72,
T_VOID = 73,
T_WHILE = 74,
T_WITH = 75,
T_XOR = 76,
T_XOR_EQ = 77,
ACCEPT_STATE = 237,
RULE_COUNT = 269,
STATE_COUNT = 468,
TERMINAL_COUNT = 84,
NON_TERMINAL_COUNT = 88,
GOTO_INDEX_OFFSET = 468,
GOTO_INFO_OFFSET = 1562,
GOTO_CHECK_OFFSET = 1562
};
static const char *const spell [];
static const int lhs [];
static const int rhs [];
#ifndef QLALR_NO_JAVASCRIPTGRAMMAR_DEBUG_INFO
static const int rule_index [];
static const int rule_info [];
#endif // QLALR_NO_JAVASCRIPTGRAMMAR_DEBUG_INFO
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 // JAVASCRIPTGRAMMAR_P_H

File diff suppressed because it is too large Load Diff

View File

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

View File

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

View File

@@ -0,0 +1,139 @@
/****************************************************************************
**
** 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 JAVASCRIPTNODEPOOL_P_H
#define JAVASCRIPTNODEPOOL_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 "javascriptmemorypool_p.h"
QT_BEGIN_NAMESPACE
class JavaScriptEnginePrivate;
namespace JavaScript {
namespace AST {
class Node;
} // namespace AST
class Code;
class CompilationUnit;
template <typename NodeType>
inline NodeType *makeAstNode(MemoryPool *storage)
{
NodeType *node = new (storage->allocate(sizeof(NodeType))) NodeType();
return node;
}
template <typename NodeType, typename Arg1>
inline NodeType *makeAstNode(MemoryPool *storage, Arg1 arg1)
{
NodeType *node = new (storage->allocate(sizeof(NodeType))) NodeType(arg1);
return node;
}
template <typename NodeType, typename Arg1, typename Arg2>
inline NodeType *makeAstNode(MemoryPool *storage, Arg1 arg1, Arg2 arg2)
{
NodeType *node = new (storage->allocate(sizeof(NodeType))) NodeType(arg1, arg2);
return node;
}
template <typename NodeType, typename Arg1, typename Arg2, typename Arg3>
inline NodeType *makeAstNode(MemoryPool *storage, Arg1 arg1, Arg2 arg2, Arg3 arg3)
{
NodeType *node = new (storage->allocate(sizeof(NodeType))) NodeType(arg1, arg2, arg3);
return node;
}
template <typename NodeType, typename Arg1, typename Arg2, typename Arg3, typename Arg4>
inline NodeType *makeAstNode(MemoryPool *storage, Arg1 arg1, Arg2 arg2, Arg3 arg3, Arg4 arg4)
{
NodeType *node = new (storage->allocate(sizeof(NodeType))) NodeType(arg1, arg2, arg3, arg4);
return node;
}
class NodePool : public MemoryPool
{
public:
NodePool(const QString &fileName, JavaScriptEnginePrivate *engine);
virtual ~NodePool();
Code *createCompiledCode(AST::Node *node, CompilationUnit &compilation);
inline QString fileName() const { return m_fileName; }
inline JavaScriptEnginePrivate *engine() const { return m_engine; }
#ifndef J_SCRIPT_NO_EVENT_NOTIFY
inline qint64 id() const { return m_id; }
#endif
private:
QHash<AST::Node*, Code*> m_codeCache;
QString m_fileName;
JavaScriptEnginePrivate *m_engine;
#ifndef J_SCRIPT_NO_EVENT_NOTIFY
qint64 m_id;
#endif
private:
Q_DISABLE_COPY(NodePool)
};
} // namespace JavaScript
QT_END_NAMESPACE
#endif

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,175 @@
// This file was generated by qlalr - DO NOT EDIT!
#line 151 "./javascript.g"
/****************************************************************************
**
** 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 javascript.g.
// Changes will be lost.
//
#ifndef JAVAJAVASCRIPTPARSER_P_H
#define JAVAJAVASCRIPTPARSER_P_H
#include "javascriptgrammar_p.h"
#ifndef QT_NO_JAVASCRIPT
#include "javascriptastfwd_p.h"
QT_BEGIN_NAMESPACE
class QString;
class JavaScriptEnginePrivate;
class JavaScriptNameIdImpl;
class JavaScriptParser: protected JavaScriptGrammar
{
public:
union Value {
int ival;
double dval;
JavaScriptNameIdImpl *sval;
JavaScript::AST::ArgumentList *ArgumentList;
JavaScript::AST::CaseBlock *CaseBlock;
JavaScript::AST::CaseClause *CaseClause;
JavaScript::AST::CaseClauses *CaseClauses;
JavaScript::AST::Catch *Catch;
JavaScript::AST::DefaultClause *DefaultClause;
JavaScript::AST::ElementList *ElementList;
JavaScript::AST::Elision *Elision;
JavaScript::AST::ExpressionNode *Expression;
JavaScript::AST::Finally *Finally;
JavaScript::AST::FormalParameterList *FormalParameterList;
JavaScript::AST::FunctionBody *FunctionBody;
JavaScript::AST::FunctionDeclaration *FunctionDeclaration;
JavaScript::AST::Node *Node;
JavaScript::AST::PropertyName *PropertyName;
JavaScript::AST::PropertyNameAndValueList *PropertyNameAndValueList;
JavaScript::AST::SourceElement *SourceElement;
JavaScript::AST::SourceElements *SourceElements;
JavaScript::AST::Statement *Statement;
JavaScript::AST::StatementList *StatementList;
JavaScript::AST::VariableDeclaration *VariableDeclaration;
JavaScript::AST::VariableDeclarationList *VariableDeclarationList;
};
struct Location {
int startLine;
int startColumn;
int endLine;
int endColumn;
};
public:
JavaScriptParser();
~JavaScriptParser();
bool parse(JavaScriptEnginePrivate *driver);
inline QString errorMessage() const
{ return error_message; }
inline int errorLineNumber() const
{ return error_lineno; }
inline int errorColumnNumber() const
{ return error_column; }
protected:
inline void reallocateStack();
inline Value &sym(int index)
{ return sym_stack [tos + index - 1]; }
inline Location &loc(int index)
{ return location_stack [tos + index - 2]; }
protected:
int tos;
int stack_size;
Value *sym_stack;
int *state_stack;
Location *location_stack;
QString error_message;
int error_lineno;
int error_column;
};
inline void JavaScriptParser::reallocateStack()
{
if (! stack_size)
stack_size = 128;
else
stack_size <<= 1;
sym_stack = reinterpret_cast<Value*> (qRealloc(sym_stack, stack_size * sizeof(Value)));
state_stack = reinterpret_cast<int*> (qRealloc(state_stack, stack_size * sizeof(int)));
location_stack = reinterpret_cast<Location*> (qRealloc(location_stack, stack_size * sizeof(Location)));
}
#line 472 "./javascript.g"
#define Q_JAVASCRIPT_REGEXPLITERAL_RULE1 7
#line 490 "./javascript.g"
#define Q_JAVASCRIPT_REGEXPLITERAL_RULE2 8
#line 2117 "./javascript.g"
QT_END_NAMESPACE
#endif // QT_NO_JAVASCRIPT
#endif // JAVAJAVASCRIPTPARSER_P_H

View File

@@ -0,0 +1,6 @@
#ifndef JAVASCRIPTVALUE_H
#define JAVASCRIPTVALUE_H
typedef double qjsreal;
#endif // JAVASCRIPTVALUE_H

View File

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

View File

@@ -7,6 +7,7 @@ include(../../plugins/coreplugin/coreplugin.pri)
include(../../plugins/texteditor/texteditor.pri)
include(../../shared/qscripthighlighter/qscripthighlighter.pri)
include(../../shared/indenter/indenter.pri)
include(parser/parser.pri)
HEADERS += qtscripteditor.h \
qtscripteditorfactory.h \