Revert "qmljs/parser: update to latest qt5 parser"

error 'QmlJS::Engine' does not have any field named 'directives to be fixed

This reverts commit 7d76f9040a933981ed44b2b4f0a6edcff034be6a

Change-Id: I24dbe6829ed3920af0f53f2ec31eba82ebdf749f
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
This commit is contained in:
Fawzi Mohamed
2013-01-23 15:06:08 +01:00
committed by Erik Verbruggen
parent 77c606917b
commit 7b166ccc09
14 changed files with 1017 additions and 1142 deletions

View File

@@ -1,17 +1,17 @@
diff --git a/src/libs/qmljs/parser/qmljsengine_p.cpp b/src/libs/qmljs/parser/qmljsengine_p.cpp
index 73850bb..d7d2189 100644
--- a/src/libs/qmljs/parser/qmljsengine_p.cpp
+++ b/src/libs/qmljs/parser/qmljsengine_p.cpp
@@ -110,7 +110,7 @@ double integerFromString(const QString &str, int radix)
diff --git a/src/libs/qmljs/parser/qmljs.g b/src/libs/qmljs/parser/qmljs.g
index 069be3c..9cbdc23 100644
--- a/src/libs/qmljs/parser/qmljs.g
+++ b/src/libs/qmljs/parser/qmljs.g
@@ -111,7 +111,7 @@ double integerFromString(const QString &str, int radix)
Engine::Engine()
- : _lexer(0)
+ : _lexer(0), directives(0)
+ : _lexer(0), _directives(0)
{ }
Engine::~Engine()
@@ -131,6 +131,12 @@ Lexer *Engine::lexer() const
@@ -132,6 +132,12 @@ Lexer *Engine::lexer() const
void Engine::setLexer(Lexer *lexer)
{ _lexer = lexer; }
@@ -24,11 +24,11 @@ index 73850bb..d7d2189 100644
MemoryPool *Engine::pool()
{ return &_pool; }
diff --git a/src/libs/qmljs/parser/qmljsengine_p.h b/src/libs/qmljs/parser/qmljsengine_p.h
index d4ed4b37..4908e02 100644
--- a/src/libs/qmljs/parser/qmljsengine_p.h
+++ b/src/libs/qmljs/parser/qmljsengine_p.h
@@ -53,6 +53,7 @@ QT_QML_BEGIN_NAMESPACE
diff --git b/src/libs/qmljs/parser/qmljsengine_p.h a/src/libs/qmljs/parser/qmljsengine_p.h
index 5057ea0..487619e 100644
--- b/src/libs/qmljs/parser/qmljsengine_p.h
+++ a/src/libs/qmljs/parser/qmljsengine_p.h
@@ -54,6 +54,7 @@ QT_QML_BEGIN_NAMESPACE
namespace QmlJS {
class Lexer;
@@ -36,7 +36,7 @@ index d4ed4b37..4908e02 100644
class MemoryPool;
class QML_PARSER_EXPORT DiagnosticMessage
@@ -80,6 +81,7 @@ public:
@@ -81,6 +82,7 @@ public:
class QML_PARSER_EXPORT Engine
{
Lexer *_lexer;
@@ -44,7 +44,7 @@ index d4ed4b37..4908e02 100644
MemoryPool _pool;
QList<AST::SourceLocation> _comments;
QString _extraCode;
@@ -97,6 +99,9 @@ public:
@@ -98,6 +100,9 @@ public:
Lexer *lexer() const;
void setLexer(Lexer *lexer);
@@ -54,11 +54,11 @@ index d4ed4b37..4908e02 100644
MemoryPool *pool();
inline QStringRef midRef(int position, int size) { return _code.midRef(position, size); }
diff --git a/src/libs/qmljs/parser/qmljsparser.cpp b/src/libs/qmljs/parser/qmljsparser.cpp
index d53960b..71e994f 100644
--- a/src/libs/qmljs/parser/qmljsparser.cpp
+++ b/src/libs/qmljs/parser/qmljsparser.cpp
@@ -143,7 +143,20 @@ bool Parser::parse(int startToken)
diff --git b/src/libs/qmljs/parser/qmljsparser.cpp a/src/libs/qmljs/parser/qmljsparser.cpp
index a731c1a..e986534 100644
--- b/src/libs/qmljs/parser/qmljsparser.cpp
+++ a/src/libs/qmljs/parser/qmljsparser.cpp
@@ -137,7 +137,20 @@ bool Parser::parse(int startToken)
token_buffer[0].token = startToken;
first_token = &token_buffer[0];

View File

@@ -21,6 +21,3 @@ SOURCES += \
$$PWD/qmljsparser.cpp \
$$PWD/qmldirparser.cpp \
$$PWD/qmlerror.cpp \
OTHER_FILES += \
$$PWD/qmljs.g

View File

@@ -32,7 +32,7 @@
#include <QtCore/QtDebug>
#include <QtCore/QDebug>
QT_BEGIN_NAMESPACE
@@ -86,7 +86,7 @@ bool QmlDirParser::parse(const QString &source)
_components.clear();
_scripts.clear();
quint16 lineNumber = 0;
int lineNumber = 0;
bool firstLine = true;
const QChar *ch = source.constData();
@@ -129,7 +129,7 @@ bool QmlDirParser::parse(const QString &source)
++ch;
if (invalidLine) {
reportError(lineNumber, 0,
reportError(lineNumber, -1,
QString::fromUtf8("invalid qmldir directive contains too many tokens"));
continue;
} else if (sectionCount == 0) {
@@ -137,18 +137,18 @@ bool QmlDirParser::parse(const QString &source)
} else if (sections[0] == QLatin1String("module")) {
if (sectionCount != 2) {
reportError(lineNumber, 0,
QString::fromUtf8("module identifier directive requires one argument, but %1 were provided").arg(sectionCount - 1));
reportError(lineNumber, -1,
QString::fromUtf8("module directive requires one argument, but %1 were provided").arg(sectionCount - 1));
continue;
}
if (!_typeNamespace.isEmpty()) {
reportError(lineNumber, 0,
QString::fromUtf8("only one module identifier directive may be defined in a qmldir file"));
reportError(lineNumber, -1,
QString::fromUtf8("only one module directive may be defined in a qmldir file"));
continue;
}
if (!firstLine) {
reportError(lineNumber, 0,
QString::fromUtf8("module identifier directive must be the first command in a qmldir file"));
reportError(lineNumber, -1,
QString::fromUtf8("module directive must be the first directive in a qmldir file"));
continue;
}
@@ -156,7 +156,7 @@ bool QmlDirParser::parse(const QString &source)
} else if (sections[0] == QLatin1String("plugin")) {
if (sectionCount < 2) {
reportError(lineNumber, 0,
reportError(lineNumber, -1,
QString::fromUtf8("plugin directive requires one or two arguments, but %1 were provided").arg(sectionCount - 1));
continue;
@@ -168,7 +168,7 @@ bool QmlDirParser::parse(const QString &source)
} else if (sections[0] == QLatin1String("internal")) {
if (sectionCount != 3) {
reportError(lineNumber, 0,
reportError(lineNumber, -1,
QString::fromUtf8("internal types require 2 arguments, but %1 were provided").arg(sectionCount - 1));
continue;
}
@@ -177,7 +177,7 @@ bool QmlDirParser::parse(const QString &source)
_components.insertMulti(entry.typeName, entry);
} else if (sections[0] == QLatin1String("typeinfo")) {
if (sectionCount != 2) {
reportError(lineNumber, 0,
reportError(lineNumber, -1,
QString::fromUtf8("typeinfo requires 1 argument, but %1 were provided").arg(sectionCount - 1));
continue;
}
@@ -195,9 +195,9 @@ bool QmlDirParser::parse(const QString &source)
const int dotIndex = version.indexOf(QLatin1Char('.'));
if (dotIndex == -1) {
reportError(lineNumber, 0, QLatin1String("expected '.'"));
reportError(lineNumber, -1, QLatin1String("expected '.'"));
} else if (version.indexOf(QLatin1Char('.'), dotIndex + 1) != -1) {
reportError(lineNumber, 0, QLatin1String("unexpected '.'"));
reportError(lineNumber, -1, QLatin1String("unexpected '.'"));
} else {
bool validVersionNumber = false;
const int majorVersion = parseInt(QStringRef(&version, 0, dotIndex), &validVersionNumber);
@@ -220,7 +220,7 @@ bool QmlDirParser::parse(const QString &source)
}
}
} else {
reportError(lineNumber, 0,
reportError(lineNumber, -1,
QString::fromUtf8("a component declaration requires two or three arguments, but %1 were provided").arg(sectionCount));
}
@@ -230,7 +230,7 @@ bool QmlDirParser::parse(const QString &source)
return hasError();
}
void QmlDirParser::reportError(quint16 line, quint16 column, const QString &description)
void QmlDirParser::reportError(int line, int column, const QString &description)
{
QmlError error;
error.setLine(line);

View File

@@ -128,7 +128,7 @@ public:
#endif
private:
void reportError(quint16 line, quint16 column, const QString &message);
void reportError(int line, int column, const QString &message);
private:
QList<QmlError> _errors;

View File

@@ -28,7 +28,6 @@
****************************************************************************/
#include "qmlerror.h"
#include "qmlglobal_p.h"
#include <QtCore/qdebug.h>
#include <QtCore/qfile.h>
@@ -70,12 +69,12 @@ public:
QUrl url;
QString description;
quint16 line;
quint16 column;
int line;
int column;
};
QmlErrorPrivate::QmlErrorPrivate()
: line(0), column(0)
: line(-1), column(-1)
{
}
@@ -115,7 +114,7 @@ QmlError &QmlError::operator=(const QmlError &other)
}
/*!
\internal
\internal
*/
QmlError::~QmlError()
{
@@ -171,7 +170,7 @@ void QmlError::setDescription(const QString &description)
*/
int QmlError::line() const
{
if (d) return qmlSourceCoordinate(d->line);
if (d) return d->line;
else return -1;
}
@@ -181,7 +180,7 @@ int QmlError::line() const
void QmlError::setLine(int line)
{
if (!d) d = new QmlErrorPrivate;
d->line = qmlSourceCoordinate(line);
d->line = line;
}
/*!
@@ -189,7 +188,7 @@ void QmlError::setLine(int line)
*/
int QmlError::column() const
{
if (d) return qmlSourceCoordinate(d->column);
if (d) return d->column;
else return -1;
}
@@ -199,7 +198,7 @@ int QmlError::column() const
void QmlError::setColumn(int column)
{
if (!d) d = new QmlErrorPrivate;
d->column = qmlSourceCoordinate(column);
d->column = column;
}
/*!
@@ -208,20 +207,14 @@ void QmlError::setColumn(int column)
QString QmlError::toString() const
{
QString rv;
QUrl u(url());
int l(line());
if (u.isEmpty()) {
if (url().isEmpty()) {
rv = QLatin1String("<Unknown File>");
} else if (l != -1) {
rv = u.toString() + QLatin1Char(':') + QString::number(l);
int c(column());
if (c != -1)
rv += QLatin1Char(':') + QString::number(c);
} else if (line() != -1) {
rv = url().toString() + QLatin1Char(':') + QString::number(line());
if (column() != -1)
rv += QLatin1Char(':') + QString::number(column());
} else {
rv = u.toString();
rv = url().toString();
}
rv += QLatin1String(": ") + description();
@@ -258,9 +251,9 @@ QDebug operator<<(QDebug debug, const QmlError &error)
const QString &line = lines.at(error.line() - 1);
debug << "\n " << qPrintable(line);
if(error.column() > 0) {
if (error.column() > 0) {
int column = qMax(0, error.column() - 1);
column = qMin(column, line.length());
column = qMin(column, line.length());
QByteArray ind;
ind.reserve(column);

View File

@@ -1,29 +1,37 @@
----------------------------------------------------------------------------
-----------------------------------------------------------------------------
--
-- Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
-- Contact: http://www.qt-project.org/legal
--
-- This file is part of the QtQml module of the Qt Toolkit.
-- This file is part of Qt Creator.
--
-- Commercial License Usage
-- Licensees holding valid commercial Qt licenses may use this file in
-- accordance with the commercial license agreement provided with the
-- Software or, alternatively, in accordance with the terms contained in
-- a written agreement between you and Digia. For licensing terms and
-- conditions see http://qt.digia.com/licensing. For further information
-- use the contact form at http://qt.digia.com/contact-us.
--
-- $QT_BEGIN_LICENSE:LGPL-ONLY$
-- GNU Lesser General Public License Usage
-- This file may be used under the terms of the GNU Lesser
-- 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 have questions regarding the use of this file, please contact
-- us via http://www.qt-project.org/.
-- In addition, as a special exception, Digia gives you certain additional
-- rights. These rights are described in the Digia Qt LGPL Exception
-- version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
--
-- $QT_END_LICENSE$
--
----------------------------------------------------------------------------
-----------------------------------------------------------------------------
%parser QmlJSGrammar
%decl qmljsparser_p.h
%impl qmljsparser.cpp
%impl qdeclarativejsparser.cpp
%expect 2
%expect-rr 2
@@ -60,7 +68,6 @@
%token T_RESERVED_WORD "reserved word"
%token T_MULTILINE_STRING_LITERAL "multiline string literal"
%token T_COMMENT "comment"
%token T_COMPATIBILITY_SEMICOLON
--- context keywords.
%token T_PUBLIC "public"
@@ -89,9 +96,8 @@
** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtQml module of the Qt Toolkit.
** This file is part of Qt Creator.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
@@ -112,20 +118,10 @@
** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, 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.
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include <QtCore/QtDebug>
#include <QtCore/QDebug>
#include <QtCore/QCoreApplication>
#include <string.h>
@@ -142,9 +138,8 @@
** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtQml module of the Qt Toolkit.
** This file is part of Qt Creator.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
@@ -165,20 +160,10 @@
** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, 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.
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
//
// W A R N I N G
// -------------
@@ -190,16 +175,9 @@
// We mean it.
//
//
// W A R N I N G
// -------------
//
// This file is automatically generated from qmljs.g.
// Changes should be made to that file, not here. Any change to this file will
// be lost!
//
// To regenerate this file, run:
// qlalr --no-debug --no-lines --qt qmljs.g
// Changes will be lost.
//
#ifndef QMLJSPARSER_P_H
@@ -390,16 +368,9 @@ protected:
#include "qmljsparser_p.h"
#include <QVarLengthArray>
//
// W A R N I N G
// -------------
//
// This file is automatically generated from qmljs.g.
// Changes should be made to that file, not here. Any change to this file will
// be lost!
//
// To regenerate this file, run:
// qlalr --no-debug --no-lines --qt qmljs.g
// Changes will be lost.
//
using namespace QmlJS;
@@ -2440,7 +2411,6 @@ case $rule_number: {
IterationStatement: T_DO Statement T_WHILE T_LPAREN Expression T_RPAREN T_AUTOMATIC_SEMICOLON ; -- automatic semicolon
IterationStatement: T_DO Statement T_WHILE T_LPAREN Expression T_RPAREN T_COMPATIBILITY_SEMICOLON ; -- for JSC/V8 compatibility
IterationStatement: T_DO Statement T_WHILE T_LPAREN Expression T_RPAREN T_SEMICOLON ;
/.
case $rule_number: {
@@ -2905,8 +2875,7 @@ PropertyNameAndValueListOpt: PropertyNameAndValueList ;
const int errorState = state_stack[tos];
// automatic insertion of `;'
if (yytoken != -1 && ((t_action(errorState, T_AUTOMATIC_SEMICOLON) && lexer->canInsertAutomaticSemicolon(yytoken))
|| t_action(errorState, T_COMPATIBILITY_SEMICOLON))) {
if (yytoken != -1 && t_action(errorState, T_AUTOMATIC_SEMICOLON) && lexer->canInsertAutomaticSemicolon(yytoken)) {
SavedToken &tk = token_buffer[0];
tk.token = yytoken;
tk.dval = yylval;
@@ -2918,7 +2887,7 @@ PropertyNameAndValueListOpt: PropertyNameAndValueList ;
yylloc.startColumn += yylloc.length;
yylloc.length = 0;
//const QString msg = qApp->translate("QmlParser", "Missing `;'");
//const QString msg = qApp->translate("QQmlParser", "Missing `;'");
//diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Warning, yylloc, msg));
first_token = &token_buffer[0];
@@ -2948,9 +2917,9 @@ PropertyNameAndValueListOpt: PropertyNameAndValueList ;
QString msg;
int token = token_buffer[0].token;
if (token < 0 || token >= TERMINAL_COUNT)
msg = qApp->translate("QmlParser", "Syntax error");
msg = qApp->translate("QQmlParser", "Syntax error");
else
msg = qApp->translate("QmlParser", "Unexpected token `%1'").arg(QLatin1String(spell[token]));
msg = qApp->translate("QQmlParser", "Unexpected token `%1'").arg(QLatin1String(spell[token]));
diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, token_buffer[0].loc, msg));
action = errorState;
@@ -2978,7 +2947,7 @@ PropertyNameAndValueListOpt: PropertyNameAndValueList ;
for (int *tk = tokens; *tk != EOF_SYMBOL; ++tk) {
int a = t_action(errorState, *tk);
if (a > 0 && t_action(a, yytoken)) {
const QString msg = qApp->translate("QmlParser", "Expected token `%1'").arg(QLatin1String(spell[*tk]));
const QString msg = qApp->translate("QQmlParser", "Expected token `%1'").arg(QLatin1String(spell[*tk]));
diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, token_buffer[0].loc, msg));
yytoken = *tk;
@@ -3002,7 +2971,7 @@ PropertyNameAndValueListOpt: PropertyNameAndValueList ;
int a = t_action(errorState, tk);
if (a > 0 && t_action(a, yytoken)) {
const QString msg = qApp->translate("QmlParser", "Expected token `%1'").arg(QLatin1String(spell[tk]));
const QString msg = qApp->translate("QQmlParser", "Expected token `%1'").arg(QLatin1String(spell[tk]));
diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, token_buffer[0].loc, msg));
yytoken = tk;
@@ -3015,7 +2984,7 @@ PropertyNameAndValueListOpt: PropertyNameAndValueList ;
}
}
const QString msg = qApp->translate("QmlParser", "Syntax error");
const QString msg = qApp->translate("QQmlParser", "Syntax error");
diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, token_buffer[0].loc, msg));
}

View File

@@ -110,7 +110,7 @@ double integerFromString(const QString &str, int radix)
Engine::Engine()
: _lexer(0), directives(0)
: _lexer(0), _directives(0)
{ }
Engine::~Engine()

File diff suppressed because it is too large Load Diff

View File

@@ -52,12 +52,12 @@ class QML_PARSER_EXPORT QmlJSGrammar
public:
enum VariousConstants {
EOF_SYMBOL = 0,
REDUCE_HERE = 102,
SHIFT_THERE = 101,
REDUCE_HERE = 101,
SHIFT_THERE = 100,
T_AND = 1,
T_AND_AND = 2,
T_AND_EQ = 3,
T_AS = 92,
T_AS = 91,
T_AUTOMATIC_SEMICOLON = 62,
T_BREAK = 4,
T_CASE = 5,
@@ -65,7 +65,6 @@ public:
T_COLON = 7,
T_COMMA = 8,
T_COMMENT = 88,
T_COMPATIBILITY_SEMICOLON = 89,
T_CONST = 84,
T_CONTINUE = 9,
T_DEBUGGER = 85,
@@ -79,14 +78,14 @@ public:
T_EQ = 17,
T_EQ_EQ = 18,
T_EQ_EQ_EQ = 19,
T_ERROR = 94,
T_ERROR = 93,
T_FALSE = 83,
T_FEED_JS_EXPRESSION = 98,
T_FEED_JS_PROGRAM = 100,
T_FEED_JS_SOURCE_ELEMENT = 99,
T_FEED_JS_STATEMENT = 97,
T_FEED_UI_OBJECT_MEMBER = 96,
T_FEED_UI_PROGRAM = 95,
T_FEED_JS_EXPRESSION = 97,
T_FEED_JS_PROGRAM = 99,
T_FEED_JS_SOURCE_ELEMENT = 98,
T_FEED_JS_STATEMENT = 96,
T_FEED_UI_OBJECT_MEMBER = 95,
T_FEED_UI_PROGRAM = 94,
T_FINALLY = 20,
T_FOR = 21,
T_FUNCTION = 22,
@@ -98,7 +97,7 @@ public:
T_GT_GT_GT_EQ = 28,
T_IDENTIFIER = 29,
T_IF = 30,
T_IMPORT = 91,
T_IMPORT = 90,
T_IN = 31,
T_INSTANCEOF = 32,
T_LBRACE = 33,
@@ -118,7 +117,7 @@ public:
T_NOT_EQ_EQ = 46,
T_NULL = 81,
T_NUMERIC_LITERAL = 47,
T_ON = 93,
T_ON = 92,
T_OR = 48,
T_OR_EQ = 49,
T_OR_OR = 50,
@@ -126,7 +125,7 @@ public:
T_PLUS_EQ = 52,
T_PLUS_PLUS = 53,
T_PROPERTY = 66,
T_PUBLIC = 90,
T_PUBLIC = 89,
T_QUESTION = 54,
T_RBRACE = 55,
T_RBRACKET = 56,
@@ -155,15 +154,15 @@ public:
T_XOR = 79,
T_XOR_EQ = 80,
ACCEPT_STATE = 645,
RULE_COUNT = 350,
STATE_COUNT = 646,
TERMINAL_COUNT = 103,
ACCEPT_STATE = 644,
RULE_COUNT = 349,
STATE_COUNT = 645,
TERMINAL_COUNT = 102,
NON_TERMINAL_COUNT = 107,
GOTO_INDEX_OFFSET = 646,
GOTO_INFO_OFFSET = 3019,
GOTO_CHECK_OFFSET = 3019
GOTO_INDEX_OFFSET = 645,
GOTO_INFO_OFFSET = 2807,
GOTO_CHECK_OFFSET = 2807
};
static const char *const spell [];

View File

@@ -44,7 +44,7 @@
static inline int classify2(const QChar *s, bool qmlMode) {
if (s[0].unicode() == 'a') {
if (s[1].unicode() == 's') {
return qmlMode ? Lexer::T_AS : Lexer::T_IDENTIFIER;
return qmlMode ? Lexer::T_AS : Lexer::T_RESERVED_WORD;
}
}
else if (s[0].unicode() == 'd') {
@@ -62,13 +62,13 @@ static inline int classify2(const QChar *s, bool qmlMode) {
}
else if (qmlMode && s[0].unicode() == 'o') {
if (s[1].unicode() == 'n') {
return qmlMode ? Lexer::T_ON : Lexer::T_IDENTIFIER;
return Lexer::T_ON;
}
}
return Lexer::T_IDENTIFIER;
}
static inline int classify3(const QChar *s, bool qmlMode) {
static inline int classify3(const QChar *s, bool /*qmlMode*/) {
if (s[0].unicode() == 'f') {
if (s[1].unicode() == 'o') {
if (s[2].unicode() == 'r') {
@@ -79,7 +79,7 @@ static inline int classify3(const QChar *s, bool qmlMode) {
else if (s[0].unicode() == 'i') {
if (s[1].unicode() == 'n') {
if (s[2].unicode() == 't') {
return qmlMode ? Lexer::T_INT : Lexer::T_IDENTIFIER;
return Lexer::T_INT;
}
}
}
@@ -107,12 +107,12 @@ static inline int classify3(const QChar *s, bool qmlMode) {
return Lexer::T_IDENTIFIER;
}
static inline int classify4(const QChar *s, bool qmlMode) {
static inline int classify4(const QChar *s, bool /*qmlMode*/) {
if (s[0].unicode() == 'b') {
if (s[1].unicode() == 'y') {
if (s[2].unicode() == 't') {
if (s[3].unicode() == 'e') {
return qmlMode ? Lexer::T_BYTE : Lexer::T_IDENTIFIER;
return Lexer::T_BYTE;
}
}
}
@@ -128,7 +128,7 @@ static inline int classify4(const QChar *s, bool qmlMode) {
else if (s[1].unicode() == 'h') {
if (s[2].unicode() == 'a') {
if (s[3].unicode() == 'r') {
return qmlMode ? Lexer::T_CHAR : Lexer::T_IDENTIFIER;
return Lexer::T_CHAR;
}
}
}
@@ -153,7 +153,7 @@ static inline int classify4(const QChar *s, bool qmlMode) {
if (s[1].unicode() == 'o') {
if (s[2].unicode() == 't') {
if (s[3].unicode() == 'o') {
return qmlMode ? Lexer::T_GOTO : Lexer::T_IDENTIFIER;
return Lexer::T_GOTO;
}
}
}
@@ -162,7 +162,7 @@ static inline int classify4(const QChar *s, bool qmlMode) {
if (s[1].unicode() == 'o') {
if (s[2].unicode() == 'n') {
if (s[3].unicode() == 'g') {
return qmlMode ? Lexer::T_LONG : Lexer::T_IDENTIFIER;
return Lexer::T_LONG;
}
}
}
@@ -213,7 +213,7 @@ static inline int classify4(const QChar *s, bool qmlMode) {
return Lexer::T_IDENTIFIER;
}
static inline int classify5(const QChar *s, bool qmlMode) {
static inline int classify5(const QChar *s, bool /*qmlMode*/) {
if (s[0].unicode() == 'b') {
if (s[1].unicode() == 'r') {
if (s[2].unicode() == 'e') {
@@ -248,7 +248,7 @@ static inline int classify5(const QChar *s, bool qmlMode) {
if (s[2].unicode() == 'n') {
if (s[3].unicode() == 's') {
if (s[4].unicode() == 't') {
return qmlMode ? Lexer::T_CONST : Lexer::T_RESERVED_WORD;
return Lexer::T_CONST;
}
}
}
@@ -268,7 +268,7 @@ static inline int classify5(const QChar *s, bool qmlMode) {
if (s[2].unicode() == 'n') {
if (s[3].unicode() == 'a') {
if (s[4].unicode() == 'l') {
return qmlMode ? Lexer::T_FINAL : Lexer::T_IDENTIFIER;
return Lexer::T_FINAL;
}
}
}
@@ -277,7 +277,7 @@ static inline int classify5(const QChar *s, bool qmlMode) {
if (s[2].unicode() == 'o') {
if (s[3].unicode() == 'a') {
if (s[4].unicode() == 't') {
return qmlMode ? Lexer::T_FLOAT : Lexer::T_IDENTIFIER;
return Lexer::T_FLOAT;
}
}
}
@@ -288,7 +288,7 @@ static inline int classify5(const QChar *s, bool qmlMode) {
if (s[2].unicode() == 'o') {
if (s[3].unicode() == 'r') {
if (s[4].unicode() == 't') {
return qmlMode ? Lexer::T_SHORT : Lexer::T_IDENTIFIER;
return Lexer::T_SHORT;
}
}
}
@@ -297,7 +297,7 @@ static inline int classify5(const QChar *s, bool qmlMode) {
if (s[2].unicode() == 'p') {
if (s[3].unicode() == 'e') {
if (s[4].unicode() == 'r') {
return qmlMode ? Lexer::T_SUPER : Lexer::T_IDENTIFIER;
return Lexer::T_SUPER;
}
}
}
@@ -346,7 +346,7 @@ static inline int classify6(const QChar *s, bool qmlMode) {
if (s[3].unicode() == 'b') {
if (s[4].unicode() == 'l') {
if (s[5].unicode() == 'e') {
return qmlMode ? Lexer::T_DOUBLE : Lexer::T_IDENTIFIER;
return Lexer::T_DOUBLE;
}
}
}
@@ -385,7 +385,7 @@ static inline int classify6(const QChar *s, bool qmlMode) {
if (s[3].unicode() == 'i') {
if (s[4].unicode() == 'v') {
if (s[5].unicode() == 'e') {
return qmlMode ? Lexer::T_NATIVE : Lexer::T_IDENTIFIER;
return Lexer::T_NATIVE;
}
}
}
@@ -398,7 +398,7 @@ static inline int classify6(const QChar *s, bool qmlMode) {
if (s[3].unicode() == 'l') {
if (s[4].unicode() == 'i') {
if (s[5].unicode() == 'c') {
return qmlMode ? Lexer::T_PUBLIC : Lexer::T_IDENTIFIER;
return qmlMode ? Lexer::T_PUBLIC : Lexer::T_RESERVED_WORD;
}
}
}
@@ -435,7 +435,7 @@ static inline int classify6(const QChar *s, bool qmlMode) {
if (s[3].unicode() == 't') {
if (s[4].unicode() == 'i') {
if (s[5].unicode() == 'c') {
return qmlMode ? Lexer::T_STATIC : Lexer::T_IDENTIFIER;
return Lexer::T_STATIC;
}
}
}
@@ -459,7 +459,7 @@ static inline int classify6(const QChar *s, bool qmlMode) {
if (s[3].unicode() == 'o') {
if (s[4].unicode() == 'w') {
if (s[5].unicode() == 's') {
return qmlMode ? Lexer::T_THROWS : Lexer::T_IDENTIFIER;
return Lexer::T_THROWS;
}
}
}
@@ -480,7 +480,7 @@ static inline int classify6(const QChar *s, bool qmlMode) {
return Lexer::T_IDENTIFIER;
}
static inline int classify7(const QChar *s, bool qmlMode) {
static inline int classify7(const QChar *s, bool /*qmlMode*/) {
if (s[0].unicode() == 'b') {
if (s[1].unicode() == 'o') {
if (s[2].unicode() == 'o') {
@@ -488,7 +488,7 @@ static inline int classify7(const QChar *s, bool qmlMode) {
if (s[4].unicode() == 'e') {
if (s[5].unicode() == 'a') {
if (s[6].unicode() == 'n') {
return qmlMode ? Lexer::T_BOOLEAN : Lexer::T_IDENTIFIER;
return Lexer::T_BOOLEAN;
}
}
}
@@ -548,7 +548,7 @@ static inline int classify7(const QChar *s, bool qmlMode) {
if (s[4].unicode() == 'a') {
if (s[5].unicode() == 'g') {
if (s[6].unicode() == 'e') {
return qmlMode ? Lexer::T_PACKAGE : Lexer::T_IDENTIFIER;
return Lexer::T_PACKAGE;
}
}
}
@@ -561,7 +561,7 @@ static inline int classify7(const QChar *s, bool qmlMode) {
if (s[4].unicode() == 'a') {
if (s[5].unicode() == 't') {
if (s[6].unicode() == 'e') {
return qmlMode ? Lexer::T_PRIVATE : Lexer::T_IDENTIFIER;
return Lexer::T_PRIVATE;
}
}
}
@@ -581,7 +581,7 @@ static inline int classify8(const QChar *s, bool qmlMode) {
if (s[5].unicode() == 'a') {
if (s[6].unicode() == 'c') {
if (s[7].unicode() == 't') {
return qmlMode ? Lexer::T_ABSTRACT : Lexer::T_IDENTIFIER;
return Lexer::T_ABSTRACT;
}
}
}
@@ -649,7 +649,7 @@ static inline int classify8(const QChar *s, bool qmlMode) {
if (s[5].unicode() == 'r') {
if (s[6].unicode() == 't') {
if (s[7].unicode() == 'y') {
return qmlMode ? Lexer::T_PROPERTY : Lexer::T_IDENTIFIER;
return Lexer::T_PROPERTY;
}
}
}
@@ -683,7 +683,7 @@ static inline int classify8(const QChar *s, bool qmlMode) {
if (s[5].unicode() == 'i') {
if (s[6].unicode() == 'l') {
if (s[7].unicode() == 'e') {
return qmlMode ? Lexer::T_VOLATILE : Lexer::T_IDENTIFIER;
return Lexer::T_VOLATILE;
}
}
}
@@ -695,7 +695,7 @@ static inline int classify8(const QChar *s, bool qmlMode) {
return Lexer::T_IDENTIFIER;
}
static inline int classify9(const QChar *s, bool qmlMode) {
static inline int classify9(const QChar *s, bool /*qmlMode*/) {
if (s[0].unicode() == 'i') {
if (s[1].unicode() == 'n') {
if (s[2].unicode() == 't') {
@@ -705,7 +705,7 @@ static inline int classify9(const QChar *s, bool qmlMode) {
if (s[6].unicode() == 'a') {
if (s[7].unicode() == 'c') {
if (s[8].unicode() == 'e') {
return qmlMode ? Lexer::T_INTERFACE : Lexer::T_IDENTIFIER;
return Lexer::T_INTERFACE;
}
}
}
@@ -724,7 +724,7 @@ static inline int classify9(const QChar *s, bool qmlMode) {
if (s[6].unicode() == 't') {
if (s[7].unicode() == 'e') {
if (s[8].unicode() == 'd') {
return qmlMode ? Lexer::T_PROTECTED : Lexer::T_IDENTIFIER;
return Lexer::T_PROTECTED;
}
}
}
@@ -743,7 +743,7 @@ static inline int classify9(const QChar *s, bool qmlMode) {
if (s[6].unicode() == 'e') {
if (s[7].unicode() == 'n') {
if (s[8].unicode() == 't') {
return qmlMode ? Lexer::T_TRANSIENT : Lexer::T_IDENTIFIER;
return Lexer::T_TRANSIENT;
}
}
}
@@ -756,7 +756,7 @@ static inline int classify9(const QChar *s, bool qmlMode) {
return Lexer::T_IDENTIFIER;
}
static inline int classify10(const QChar *s, bool qmlMode) {
static inline int classify10(const QChar *s, bool /*qmlMode*/) {
if (s[0].unicode() == 'i') {
if (s[1].unicode() == 'm') {
if (s[2].unicode() == 'p') {
@@ -767,7 +767,7 @@ static inline int classify10(const QChar *s, bool qmlMode) {
if (s[7].unicode() == 'n') {
if (s[8].unicode() == 't') {
if (s[9].unicode() == 's') {
return qmlMode ? Lexer::T_IMPLEMENTS : Lexer::T_IDENTIFIER;
return Lexer::T_IMPLEMENTS;
}
}
}
@@ -800,7 +800,7 @@ static inline int classify10(const QChar *s, bool qmlMode) {
return Lexer::T_IDENTIFIER;
}
static inline int classify12(const QChar *s, bool qmlMode) {
static inline int classify12(const QChar *s, bool /*qmlMode*/) {
if (s[0].unicode() == 's') {
if (s[1].unicode() == 'y') {
if (s[2].unicode() == 'n') {
@@ -813,7 +813,7 @@ static inline int classify12(const QChar *s, bool qmlMode) {
if (s[9].unicode() == 'z') {
if (s[10].unicode() == 'e') {
if (s[11].unicode() == 'd') {
return qmlMode ? Lexer::T_SYNCHRONIZED : Lexer::T_IDENTIFIER;
return Lexer::T_SYNCHRONIZED;
}
}
}

View File

@@ -154,13 +154,10 @@ void Lexer::setCode(const QString &code, int lineno, bool qmlMode)
void Lexer::scanChar()
{
unsigned sequenceLength = isLineTerminatorSequence();
_char = *_codePtr++;
if (sequenceLength == 2)
_char = *_codePtr++;
if (unsigned sequenceLength = isLineTerminatorSequence()) {
_lastLinePtr = _codePtr + sequenceLength - 1; // points to the first character after the newline
if (_char == QLatin1Char('\n')) {
_lastLinePtr = _codePtr; // points to the first character after the newline
++_currentLineNumber;
}
}
@@ -278,13 +275,13 @@ again:
_tokenLinePtr = _lastLinePtr;
while (_char.isSpace()) {
if (unsigned sequenceLength = isLineTerminatorSequence()) {
_tokenLinePtr = _codePtr + sequenceLength - 1;
if (_char == QLatin1Char('\n')) {
_tokenLinePtr = _codePtr;
if (_restrictedKeyword) {
// automatic semicolon insertion
_tokenLine = _currentLineNumber;
_tokenStartPtr = _codePtr - 1;
_tokenStartPtr = _codePtr - 1; // ### TODO: insert it before the optional \r sequence.
return T_SEMICOLON;
} else {
_terminator = true;
@@ -401,7 +398,7 @@ again:
}
}
} else if (_char == QLatin1Char('/')) {
while (!_char.isNull() && !isLineTerminator()) {
while (!_char.isNull() && _char != QLatin1Char('\n')) {
scanChar();
}
if (_engine) {
@@ -544,7 +541,7 @@ again:
if (_engine) {
while (!_char.isNull()) {
if (isLineTerminator() || _char == QLatin1Char('\\')) {
if (_char == QLatin1Char('\n') || _char == QLatin1Char('\\')) {
break;
} else if (_char == quote) {
_tokenSpell = _engine->midRef(startCode - _code.unicode() - 1, _codePtr - startCode);
@@ -559,15 +556,13 @@ again:
_validTokenText = true;
_tokenText.resize(0);
startCode--;
while (startCode != _codePtr - 1)
while (startCode != _codePtr - 1)
_tokenText += *startCode++;
while (! _char.isNull()) {
if (unsigned sequenceLength = isLineTerminatorSequence()) {
if (_char == QLatin1Char('\n')) {
multilineStringLiteral = true;
_tokenText += _char;
if (sequenceLength == 2)
_tokenText += *_codePtr;
scanChar();
} else if (_char == quote) {
scanChar();
@@ -592,6 +587,7 @@ again:
// hex escape sequence
case 'x':
case 'X':
if (isHexDigit(_codePtr[0]) && isHexDigit(_codePtr[1])) {
scanChar();
@@ -629,23 +625,23 @@ again:
break;
case '\r':
if (isLineTerminatorSequence() == 2) {
_tokenText += QLatin1Char('\r');
u = QLatin1Char('\n');
while (_char == QLatin1Char('\r'))
scanChar();
if (_char == QLatin1Char('\n')) {
u = _char;
scanChar();
} else {
u = QLatin1Char('\r');
u = QLatin1Char('\n');
}
scanChar();
break;
case '\n':
case 0x2028u:
case 0x2029u:
u = _char;
scanChar();
break;
default:
// non escape character
u = _char;
@@ -864,6 +860,11 @@ bool Lexer::scanRegExp(RegExpBodyPrefix prefix)
while (true) {
switch (_char.unicode()) {
case 0: // eof
case '\n': case '\r': // line terminator
_errorMessage = QCoreApplication::translate("QmlParser", "Unterminated regular expression literal");
return false;
case '/':
scanChar();
@@ -933,13 +934,8 @@ bool Lexer::scanRegExp(RegExpBodyPrefix prefix)
break;
default:
if (_char.isNull() || isLineTerminator()) {
_errorMessage = QCoreApplication::translate("QmlParser", "Unterminated regular expression literal");
return false;
} else {
_tokenText += _char;
scanChar();
}
_tokenText += _char;
scanChar();
} // switch
} // while
@@ -948,28 +944,7 @@ bool Lexer::scanRegExp(RegExpBodyPrefix prefix)
bool Lexer::isLineTerminator() const
{
const ushort unicode = _char.unicode();
return unicode == 0x000Au
|| unicode == 0x000Du
|| unicode == 0x2028u
|| unicode == 0x2029u;
}
unsigned Lexer::isLineTerminatorSequence() const
{
switch (_char.unicode()) {
case 0x000Au:
case 0x2028u:
case 0x2029u:
return 1;
case 0x000Du:
if (_codePtr->unicode() == 0x000Au)
return 2;
else
return 1;
default:
return 0;
}
return (_char == QLatin1Char('\n') || _char == QLatin1Char('\r'));
}
bool Lexer::isIdentLetter(QChar ch)
@@ -1137,7 +1112,7 @@ bool Lexer::scanDirectives(Directives *directives)
//
// recognize the mandatory `as' followed by the module name
//
if (! (lex() == T_IDENTIFIER && tokenText() == QLatin1String("as")))
if (! (lex() == T_RESERVED_WORD && tokenText() == QLatin1String("as")))
return false; // expected `as'
if (lex() != T_IDENTIFIER)

View File

@@ -92,6 +92,7 @@ public:
T_IMPLEMENTS = T_RESERVED_WORD,
T_INT = T_RESERVED_WORD,
T_INTERFACE = T_RESERVED_WORD,
T_LET = T_RESERVED_WORD,
T_LONG = T_RESERVED_WORD,
T_NATIVE = T_RESERVED_WORD,
T_PACKAGE = T_RESERVED_WORD,
@@ -103,7 +104,8 @@ public:
T_SYNCHRONIZED = T_RESERVED_WORD,
T_THROWS = T_RESERVED_WORD,
T_TRANSIENT = T_RESERVED_WORD,
T_VOLATILE = T_RESERVED_WORD
T_VOLATILE = T_RESERVED_WORD,
T_YIELD = T_RESERVED_WORD
};
enum Error {
@@ -180,7 +182,6 @@ private:
int scanNumber(QChar ch);
bool isLineTerminator() const;
unsigned isLineTerminatorSequence() const;
static bool isIdentLetter(QChar c);
static bool isDecimalDigit(ushort c);
static bool isHexDigit(QChar c);

View File

@@ -27,7 +27,7 @@
**
****************************************************************************/
#include <QtCore/QtDebug>
#include <QtCore/QDebug>
#include <QtCore/QCoreApplication>
#include <string.h>
@@ -42,16 +42,9 @@
#include "qmljsparser_p.h"
#include <QVarLengthArray>
//
// W A R N I N G
// -------------
//
// This file is automatically generated from qmljs.g.
// Changes should be made to that file, not here. Any change to this file will
// be lost!
//
// To regenerate this file, run:
// qlalr --no-debug --no-lines --qt qmljs.g
// Changes will be lost.
//
using namespace QmlJS;
@@ -1391,7 +1384,7 @@ case 289: {
sym(1).Node = node;
} break;
case 292: {
case 291: {
AST::DoWhileStatement *node = new (pool) AST::DoWhileStatement(sym(2).Statement, sym(5).Expression);
node->doToken = loc(1);
node->whileToken = loc(3);
@@ -1401,7 +1394,7 @@ case 292: {
sym(1).Node = node;
} break;
case 293: {
case 292: {
AST::WhileStatement *node = new (pool) AST::WhileStatement(sym(3).Expression, sym(5).Statement);
node->whileToken = loc(1);
node->lparenToken = loc(2);
@@ -1409,7 +1402,7 @@ case 293: {
sym(1).Node = node;
} break;
case 294: {
case 293: {
AST::ForStatement *node = new (pool) AST::ForStatement(sym(3).Expression,
sym(5).Expression, sym(7).Expression, sym(9).Statement);
node->forToken = loc(1);
@@ -1420,7 +1413,7 @@ case 294: {
sym(1).Node = node;
} break;
case 295: {
case 294: {
AST::LocalForStatement *node = new (pool) AST::LocalForStatement(
sym(4).VariableDeclarationList->finish (/*readOnly=*/false), sym(6).Expression,
sym(8).Expression, sym(10).Statement);
@@ -1433,7 +1426,7 @@ case 295: {
sym(1).Node = node;
} break;
case 296: {
case 295: {
AST:: ForEachStatement *node = new (pool) AST::ForEachStatement(sym(3).Expression,
sym(5).Expression, sym(7).Statement);
node->forToken = loc(1);
@@ -1443,7 +1436,7 @@ case 296: {
sym(1).Node = node;
} break;
case 297: {
case 296: {
AST::LocalForEachStatement *node = new (pool) AST::LocalForEachStatement(
sym(4).VariableDeclaration, sym(6).Expression, sym(8).Statement);
node->forToken = loc(1);
@@ -1454,14 +1447,14 @@ case 297: {
sym(1).Node = node;
} break;
case 299: {
case 298: {
AST::ContinueStatement *node = new (pool) AST::ContinueStatement();
node->continueToken = loc(1);
node->semicolonToken = loc(2);
sym(1).Node = node;
} break;
case 301: {
case 300: {
AST::ContinueStatement *node = new (pool) AST::ContinueStatement(stringRef(2));
node->continueToken = loc(1);
node->identifierToken = loc(2);
@@ -1469,14 +1462,14 @@ case 301: {
sym(1).Node = node;
} break;
case 303: {
case 302: {
AST::BreakStatement *node = new (pool) AST::BreakStatement(QStringRef());
node->breakToken = loc(1);
node->semicolonToken = loc(2);
sym(1).Node = node;
} break;
case 305: {
case 304: {
AST::BreakStatement *node = new (pool) AST::BreakStatement(stringRef(2));
node->breakToken = loc(1);
node->identifierToken = loc(2);
@@ -1484,14 +1477,14 @@ case 305: {
sym(1).Node = node;
} break;
case 307: {
case 306: {
AST::ReturnStatement *node = new (pool) AST::ReturnStatement(sym(2).Expression);
node->returnToken = loc(1);
node->semicolonToken = loc(3);
sym(1).Node = node;
} break;
case 308: {
case 307: {
AST::WithStatement *node = new (pool) AST::WithStatement(sym(3).Expression, sym(5).Statement);
node->withToken = loc(1);
node->lparenToken = loc(2);
@@ -1499,7 +1492,7 @@ case 308: {
sym(1).Node = node;
} break;
case 309: {
case 308: {
AST::SwitchStatement *node = new (pool) AST::SwitchStatement(sym(3).Expression, sym(5).CaseBlock);
node->switchToken = loc(1);
node->lparenToken = loc(2);
@@ -1507,50 +1500,57 @@ case 309: {
sym(1).Node = node;
} break;
case 310: {
case 309: {
AST::CaseBlock *node = new (pool) AST::CaseBlock(sym(2).CaseClauses);
node->lbraceToken = loc(1);
node->rbraceToken = loc(3);
sym(1).Node = node;
} break;
case 311: {
case 310: {
AST::CaseBlock *node = new (pool) AST::CaseBlock(sym(2).CaseClauses, sym(3).DefaultClause, sym(4).CaseClauses);
node->lbraceToken = loc(1);
node->rbraceToken = loc(5);
sym(1).Node = node;
} break;
case 312: {
case 311: {
sym(1).Node = new (pool) AST::CaseClauses(sym(1).CaseClause);
} break;
case 313: {
case 312: {
sym(1).Node = new (pool) AST::CaseClauses(sym(1).CaseClauses, sym(2).CaseClause);
} break;
case 314: {
case 313: {
sym(1).Node = 0;
} break;
case 315: {
case 314: {
sym(1).Node = sym(1).CaseClauses->finish ();
} break;
case 316: {
case 315: {
AST::CaseClause *node = new (pool) AST::CaseClause(sym(2).Expression, sym(4).StatementList);
node->caseToken = loc(1);
node->colonToken = loc(3);
sym(1).Node = node;
} break;
case 317: {
case 316: {
AST::DefaultClause *node = new (pool) AST::DefaultClause(sym(3).StatementList);
node->defaultToken = loc(1);
node->colonToken = loc(2);
sym(1).Node = node;
} break;
case 318:
case 317:
case 318: {
AST::LabelledStatement *node = new (pool) AST::LabelledStatement(stringRef(1), sym(3).Statement);
node->identifierToken = loc(1);
node->colonToken = loc(2);
sym(1).Node = node;
} break;
case 319: {
AST::LabelledStatement *node = new (pool) AST::LabelledStatement(stringRef(1), sym(3).Statement);
node->identifierToken = loc(1);
@@ -1558,39 +1558,32 @@ case 319: {
sym(1).Node = node;
} break;
case 320: {
AST::LabelledStatement *node = new (pool) AST::LabelledStatement(stringRef(1), sym(3).Statement);
node->identifierToken = loc(1);
node->colonToken = loc(2);
sym(1).Node = node;
} break;
case 322: {
case 321: {
AST::ThrowStatement *node = new (pool) AST::ThrowStatement(sym(2).Expression);
node->throwToken = loc(1);
node->semicolonToken = loc(3);
sym(1).Node = node;
} break;
case 323: {
case 322: {
AST::TryStatement *node = new (pool) AST::TryStatement(sym(2).Statement, sym(3).Catch);
node->tryToken = loc(1);
sym(1).Node = node;
} break;
case 324: {
case 323: {
AST::TryStatement *node = new (pool) AST::TryStatement(sym(2).Statement, sym(3).Finally);
node->tryToken = loc(1);
sym(1).Node = node;
} break;
case 325: {
case 324: {
AST::TryStatement *node = new (pool) AST::TryStatement(sym(2).Statement, sym(3).Catch, sym(4).Finally);
node->tryToken = loc(1);
sym(1).Node = node;
} break;
case 326: {
case 325: {
AST::Catch *node = new (pool) AST::Catch(stringRef(3), sym(5).Block);
node->catchToken = loc(1);
node->lparenToken = loc(2);
@@ -1599,20 +1592,20 @@ case 326: {
sym(1).Node = node;
} break;
case 327: {
case 326: {
AST::Finally *node = new (pool) AST::Finally(sym(2).Block);
node->finallyToken = loc(1);
sym(1).Node = node;
} break;
case 329: {
case 328: {
AST::DebuggerStatement *node = new (pool) AST::DebuggerStatement();
node->debuggerToken = loc(1);
node->semicolonToken = loc(2);
sym(1).Node = node;
} break;
case 330: {
case 329: {
AST::FunctionDeclaration *node = new (pool) AST::FunctionDeclaration(stringRef(2), sym(4).FormalParameterList, sym(7).FunctionBody);
node->functionToken = loc(1);
node->identifierToken = loc(2);
@@ -1623,7 +1616,7 @@ case 330: {
sym(1).Node = node;
} break;
case 331: {
case 330: {
AST::FunctionExpression *node = new (pool) AST::FunctionExpression(stringRef(2), sym(4).FormalParameterList, sym(7).FunctionBody);
node->functionToken = loc(1);
if (! stringRef(2).isNull())
@@ -1635,60 +1628,60 @@ case 331: {
sym(1).Node = node;
} break;
case 332: {
case 331: {
AST::FormalParameterList *node = new (pool) AST::FormalParameterList(stringRef(1));
node->identifierToken = loc(1);
sym(1).Node = node;
} break;
case 333: {
case 332: {
AST::FormalParameterList *node = new (pool) AST::FormalParameterList(sym(1).FormalParameterList, stringRef(3));
node->commaToken = loc(2);
node->identifierToken = loc(3);
sym(1).Node = node;
} break;
case 334: {
case 333: {
sym(1).Node = 0;
} break;
case 335: {
case 334: {
sym(1).Node = sym(1).FormalParameterList->finish ();
} break;
case 336: {
case 335: {
sym(1).Node = 0;
} break;
case 338: {
case 337: {
sym(1).Node = new (pool) AST::FunctionBody(sym(1).SourceElements->finish ());
} break;
case 340: {
case 339: {
sym(1).Node = new (pool) AST::Program(sym(1).SourceElements->finish ());
} break;
case 341: {
case 340: {
sym(1).Node = new (pool) AST::SourceElements(sym(1).SourceElement);
} break;
case 342: {
case 341: {
sym(1).Node = new (pool) AST::SourceElements(sym(1).SourceElements, sym(2).SourceElement);
} break;
case 343: {
case 342: {
sym(1).Node = new (pool) AST::StatementSourceElement(sym(1).Statement);
} break;
case 344: {
case 343: {
sym(1).Node = new (pool) AST::FunctionSourceElement(sym(1).FunctionDeclaration);
} break;
case 345: {
case 344: {
stringRef(1) = QStringRef();
} break;
case 347: {
case 346: {
sym(1).Node = 0;
} break;
@@ -1701,8 +1694,7 @@ case 347: {
const int errorState = state_stack[tos];
// automatic insertion of `;'
if (yytoken != -1 && ((t_action(errorState, T_AUTOMATIC_SEMICOLON) && lexer->canInsertAutomaticSemicolon(yytoken))
|| t_action(errorState, T_COMPATIBILITY_SEMICOLON))) {
if (yytoken != -1 && t_action(errorState, T_AUTOMATIC_SEMICOLON) && lexer->canInsertAutomaticSemicolon(yytoken)) {
SavedToken &tk = token_buffer[0];
tk.token = yytoken;
tk.dval = yylval;

View File

@@ -39,16 +39,9 @@
// We mean it.
//
//
// W A R N I N G
// -------------
//
// This file is automatically generated from qmljs.g.
// Changes should be made to that file, not here. Any change to this file will
// be lost!
//
// To regenerate this file, run:
// qlalr --no-debug --no-lines --qt qmljs.g
// Changes will be lost.
//
#ifndef QMLJSPARSER_P_H