forked from qt-creator/qt-creator
QmlJs: sync qmljs parser
The last version of the grammar contains some constructs that the code model needs to know. Task-number: QTCREATORBUG-17842 Change-Id: I6250f96431acc05b19f3fd1b6cc268a07485cf0f Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io> Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
@@ -174,6 +174,15 @@ bool QmlDirParser::parse(const QString &source)
|
|||||||
|
|
||||||
_plugins.append(entry);
|
_plugins.append(entry);
|
||||||
|
|
||||||
|
} else if (sections[0] == QLatin1String("classname")) {
|
||||||
|
if (sectionCount < 2) {
|
||||||
|
reportError(lineNumber, 0,
|
||||||
|
QStringLiteral("classname directive requires an argument, but %1 were provided").arg(sectionCount - 1));
|
||||||
|
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Ignore these. qmlimportscanner uses them.
|
||||||
} else if (sections[0] == QLatin1String("internal")) {
|
} else if (sections[0] == QLatin1String("internal")) {
|
||||||
if (sectionCount != 3) {
|
if (sectionCount != 3) {
|
||||||
reportError(lineNumber, 0,
|
reportError(lineNumber, 0,
|
||||||
|
@@ -29,6 +29,7 @@
|
|||||||
#include <QtCore/qdebug.h>
|
#include <QtCore/qdebug.h>
|
||||||
#include <QtCore/qfile.h>
|
#include <QtCore/qfile.h>
|
||||||
#include <QtCore/qstringlist.h>
|
#include <QtCore/qstringlist.h>
|
||||||
|
#include <QtCore/qvector.h>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -76,11 +77,12 @@ public:
|
|||||||
QString description;
|
QString description;
|
||||||
quint16 line;
|
quint16 line;
|
||||||
quint16 column;
|
quint16 column;
|
||||||
|
QtMsgType messageType;
|
||||||
QObject *object;
|
QObject *object;
|
||||||
};
|
};
|
||||||
|
|
||||||
QmlErrorPrivate::QmlErrorPrivate()
|
QmlErrorPrivate::QmlErrorPrivate()
|
||||||
: line(0), column(0), object()
|
: line(0), column(0), messageType(QtMsgType::QtWarningMsg), object()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -110,12 +112,14 @@ QmlError &QmlError::operator=(const QmlError &other)
|
|||||||
delete d;
|
delete d;
|
||||||
d = 0;
|
d = 0;
|
||||||
} else {
|
} else {
|
||||||
if (!d) d = new QmlErrorPrivate;
|
if (!d)
|
||||||
|
d = new QmlErrorPrivate;
|
||||||
d->url = other.d->url;
|
d->url = other.d->url;
|
||||||
d->description = other.d->description;
|
d->description = other.d->description;
|
||||||
d->line = other.d->line;
|
d->line = other.d->line;
|
||||||
d->column = other.d->column;
|
d->column = other.d->column;
|
||||||
d->object = other.d->object;
|
d->object = other.d->object;
|
||||||
|
d->messageType = other.d->messageType;
|
||||||
}
|
}
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
@@ -141,8 +145,9 @@ bool QmlError::isValid() const
|
|||||||
*/
|
*/
|
||||||
QUrl QmlError::url() const
|
QUrl QmlError::url() const
|
||||||
{
|
{
|
||||||
if (d) return d->url;
|
if (d)
|
||||||
else return QUrl();
|
return d->url;
|
||||||
|
return QUrl();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@@ -150,7 +155,8 @@ QUrl QmlError::url() const
|
|||||||
*/
|
*/
|
||||||
void QmlError::setUrl(const QUrl &url)
|
void QmlError::setUrl(const QUrl &url)
|
||||||
{
|
{
|
||||||
if (!d) d = new QmlErrorPrivate;
|
if (!d)
|
||||||
|
d = new QmlErrorPrivate;
|
||||||
d->url = url;
|
d->url = url;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -159,8 +165,9 @@ void QmlError::setUrl(const QUrl &url)
|
|||||||
*/
|
*/
|
||||||
QString QmlError::description() const
|
QString QmlError::description() const
|
||||||
{
|
{
|
||||||
if (d) return d->description;
|
if (d)
|
||||||
else return QString();
|
return d->description;
|
||||||
|
return QString();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@@ -168,7 +175,8 @@ QString QmlError::description() const
|
|||||||
*/
|
*/
|
||||||
void QmlError::setDescription(const QString &description)
|
void QmlError::setDescription(const QString &description)
|
||||||
{
|
{
|
||||||
if (!d) d = new QmlErrorPrivate;
|
if (!d)
|
||||||
|
d = new QmlErrorPrivate;
|
||||||
d->description = description;
|
d->description = description;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -177,8 +185,9 @@ void QmlError::setDescription(const QString &description)
|
|||||||
*/
|
*/
|
||||||
int QmlError::line() const
|
int QmlError::line() const
|
||||||
{
|
{
|
||||||
if (d) return qmlSourceCoordinate(d->line);
|
if (d)
|
||||||
else return -1;
|
return qmlSourceCoordinate(d->line);
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@@ -186,7 +195,8 @@ int QmlError::line() const
|
|||||||
*/
|
*/
|
||||||
void QmlError::setLine(int line)
|
void QmlError::setLine(int line)
|
||||||
{
|
{
|
||||||
if (!d) d = new QmlErrorPrivate;
|
if (!d)
|
||||||
|
d = new QmlErrorPrivate;
|
||||||
d->line = qmlSourceCoordinate(line);
|
d->line = qmlSourceCoordinate(line);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -195,8 +205,9 @@ void QmlError::setLine(int line)
|
|||||||
*/
|
*/
|
||||||
int QmlError::column() const
|
int QmlError::column() const
|
||||||
{
|
{
|
||||||
if (d) return qmlSourceCoordinate(d->column);
|
if (d)
|
||||||
else return -1;
|
return qmlSourceCoordinate(d->column);
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@@ -204,7 +215,8 @@ int QmlError::column() const
|
|||||||
*/
|
*/
|
||||||
void QmlError::setColumn(int column)
|
void QmlError::setColumn(int column)
|
||||||
{
|
{
|
||||||
if (!d) d = new QmlErrorPrivate;
|
if (!d)
|
||||||
|
d = new QmlErrorPrivate;
|
||||||
d->column = qmlSourceCoordinate(column);
|
d->column = qmlSourceCoordinate(column);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -216,8 +228,9 @@ void QmlError::setColumn(int column)
|
|||||||
*/
|
*/
|
||||||
QObject *QmlError::object() const
|
QObject *QmlError::object() const
|
||||||
{
|
{
|
||||||
if (d) return d->object;
|
if (d)
|
||||||
else return 0;
|
return d->object;
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@@ -225,10 +238,36 @@ QObject *QmlError::object() const
|
|||||||
*/
|
*/
|
||||||
void QmlError::setObject(QObject *object)
|
void QmlError::setObject(QObject *object)
|
||||||
{
|
{
|
||||||
if (!d) d = new QmlErrorPrivate;
|
if (!d)
|
||||||
|
d = new QmlErrorPrivate;
|
||||||
d->object = object;
|
d->object = object;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\since 5.9
|
||||||
|
|
||||||
|
Returns the message type.
|
||||||
|
*/
|
||||||
|
QtMsgType QmlError::messageType() const
|
||||||
|
{
|
||||||
|
if (d)
|
||||||
|
return d->messageType;
|
||||||
|
return QtMsgType::QtWarningMsg;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\since 5.9
|
||||||
|
|
||||||
|
Sets the \a messageType for this message. The message type determines which
|
||||||
|
QDebug handlers are responsible for recieving the message.
|
||||||
|
*/
|
||||||
|
void QmlError::setMessageType(QtMsgType messageType)
|
||||||
|
{
|
||||||
|
if (!d)
|
||||||
|
d = new QmlErrorPrivate;
|
||||||
|
d->messageType = messageType;
|
||||||
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Returns the error as a human readable string.
|
Returns the error as a human readable string.
|
||||||
*/
|
*/
|
||||||
@@ -240,9 +279,9 @@ QString QmlError::toString() const
|
|||||||
int l(line());
|
int l(line());
|
||||||
|
|
||||||
if (u.isEmpty() || (u.isLocalFile() && u.path().isEmpty()))
|
if (u.isEmpty() || (u.isLocalFile() && u.path().isEmpty()))
|
||||||
rv = QLatin1String("<Unknown File>");
|
rv += QLatin1String("<Unknown File>");
|
||||||
else
|
else
|
||||||
rv = u.toString();
|
rv += u.toString();
|
||||||
|
|
||||||
if (l != -1) {
|
if (l != -1) {
|
||||||
rv += QLatin1Char(':') + QString::number(l);
|
rv += QLatin1Char(':') + QString::number(l);
|
||||||
@@ -276,15 +315,15 @@ QDebug operator<<(QDebug debug, const QmlError &error)
|
|||||||
if (f.open(QIODevice::ReadOnly)) {
|
if (f.open(QIODevice::ReadOnly)) {
|
||||||
QByteArray data = f.readAll();
|
QByteArray data = f.readAll();
|
||||||
QTextStream stream(data, QIODevice::ReadOnly);
|
QTextStream stream(data, QIODevice::ReadOnly);
|
||||||
#ifndef QT_NO_TEXTCODEC
|
#if QT_CONFIG(textcodec)
|
||||||
stream.setCodec("UTF-8");
|
stream.setCodec("UTF-8");
|
||||||
#endif
|
#endif
|
||||||
const QString code = stream.readAll();
|
const QString code = stream.readAll();
|
||||||
const QStringList lines = code.split(QLatin1Char('\n'));
|
const auto lines = code.splitRef(QLatin1Char('\n'));
|
||||||
|
|
||||||
if (lines.count() >= error.line()) {
|
if (lines.count() >= error.line()) {
|
||||||
const QString &line = lines.at(error.line() - 1);
|
const QStringRef &line = lines.at(error.line() - 1);
|
||||||
debug << "\n " << qPrintable(line);
|
debug << "\n " << line.toLocal8Bit().constData();
|
||||||
|
|
||||||
if (error.column() > 0) {
|
if (error.column() > 0) {
|
||||||
int column = qMax(0, error.column() - 1);
|
int column = qMax(0, error.column() - 1);
|
||||||
|
@@ -25,13 +25,12 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#include <QtCore/qurl.h>
|
#include <QtCore/qurl.h>
|
||||||
#include <QtCore/qstring.h>
|
#include <QtCore/qstring.h>
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
|
// ### Qt 6: should this be called QmlMessage, since it can have a message type?
|
||||||
class QDebug;
|
class QDebug;
|
||||||
class QmlErrorPrivate;
|
class QmlErrorPrivate;
|
||||||
class QmlError
|
class QmlError
|
||||||
@@ -54,6 +53,8 @@ public:
|
|||||||
void setColumn(int);
|
void setColumn(int);
|
||||||
QObject *object() const;
|
QObject *object() const;
|
||||||
void setObject(QObject *);
|
void setObject(QObject *);
|
||||||
|
QtMsgType messageType() const;
|
||||||
|
void setMessageType(QtMsgType messageType);
|
||||||
|
|
||||||
QString toString() const;
|
QString toString() const;
|
||||||
private:
|
private:
|
||||||
@@ -65,3 +66,4 @@ QDebug operator<<(QDebug debug, const QmlError &error);
|
|||||||
Q_DECLARE_TYPEINFO(QmlError, Q_MOVABLE_TYPE);
|
Q_DECLARE_TYPEINFO(QmlError, Q_MOVABLE_TYPE);
|
||||||
|
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
|
@@ -1,31 +1,37 @@
|
|||||||
----------------------------------------------------------------------------
|
----------------------------------------------------------------------------
|
||||||
--
|
--
|
||||||
-- Copyright (C) 2015 The Qt Company Ltd.
|
-- Copyright (C) 2016 The Qt Company Ltd.
|
||||||
-- Contact: http://www.qt.io/licensing/
|
-- Contact: http://www.qt.io/licensing/
|
||||||
--
|
--
|
||||||
-- This file is part of the QtQml module of the Qt Toolkit.
|
-- This file is part of the QtQml module of the Qt Toolkit.
|
||||||
--
|
--
|
||||||
-- $QT_BEGIN_LICENSE:LGPL21$
|
-- $QT_BEGIN_LICENSE:LGPL$
|
||||||
-- Commercial License Usage
|
-- Commercial License Usage
|
||||||
-- Licensees holding valid commercial Qt licenses may use this file in
|
-- Licensees holding valid commercial Qt licenses may use this file in
|
||||||
-- accordance with the commercial license agreement provided with the
|
-- accordance with the commercial license agreement provided with the
|
||||||
-- Software or, alternatively, in accordance with the terms contained in
|
-- Software or, alternatively, in accordance with the terms contained in
|
||||||
-- a written agreement between you and The Qt Company. For licensing terms
|
-- a written agreement between you and The Qt Company. For licensing terms
|
||||||
-- and conditions see http://www.qt.io/terms-conditions. For further
|
-- and conditions see https://www.qt.io/terms-conditions. For further
|
||||||
-- information use the contact form at http://www.qt.io/contact-us.
|
-- information use the contact form at https://www.qt.io/contact-us.
|
||||||
--
|
--
|
||||||
-- GNU Lesser General Public License Usage
|
-- GNU Lesser General Public License Usage
|
||||||
-- Alternatively, 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 or version 3 as published by the Free
|
-- General Public License version 3 as published by the Free Software
|
||||||
-- Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
-- Foundation and appearing in the file LICENSE.LGPL3 included in the
|
||||||
-- LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
-- packaging of this file. Please review the following information to
|
||||||
-- following information to ensure the GNU Lesser General Public License
|
-- ensure the GNU Lesser General Public License version 3 requirements
|
||||||
-- requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
-- will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
|
||||||
-- http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
|
||||||
--
|
--
|
||||||
-- As a special exception, The Qt Company gives you certain additional
|
-- GNU General Public License Usage
|
||||||
-- rights. These rights are described in The Qt Company LGPL Exception
|
-- Alternatively, this file may be used under the terms of the GNU
|
||||||
-- version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
-- General Public License version 2.0 or (at your option) the GNU General
|
||||||
|
-- Public license version 3 or any later version approved by the KDE Free
|
||||||
|
-- Qt Foundation. The licenses are as published by the Free Software
|
||||||
|
-- Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
|
||||||
|
-- included in the packaging of this file. Please review the following
|
||||||
|
-- information to ensure the GNU General Public License requirements will
|
||||||
|
-- be met: https://www.gnu.org/licenses/gpl-2.0.html and
|
||||||
|
-- https://www.gnu.org/licenses/gpl-3.0.html.
|
||||||
--
|
--
|
||||||
-- $QT_END_LICENSE$
|
-- $QT_END_LICENSE$
|
||||||
--
|
--
|
||||||
@@ -99,32 +105,38 @@
|
|||||||
|
|
||||||
/./****************************************************************************
|
/./****************************************************************************
|
||||||
**
|
**
|
||||||
** Copyright (C) 2015 The Qt Company Ltd.
|
** Copyright (C) 2016 The Qt Company Ltd.
|
||||||
** Contact: http://www.qt.io/licensing/
|
** Contact: https://www.qt.io/licensing/
|
||||||
**
|
**
|
||||||
** This file is part of the QtQml module of the Qt Toolkit.
|
** This file is part of the QtQml module of the Qt Toolkit.
|
||||||
**
|
**
|
||||||
** $QT_BEGIN_LICENSE:LGPL21$
|
** $QT_BEGIN_LICENSE:LGPL$
|
||||||
** Commercial License Usage
|
** Commercial License Usage
|
||||||
** Licensees holding valid commercial Qt licenses may use this file in
|
** Licensees holding valid commercial Qt licenses may use this file in
|
||||||
** accordance with the commercial license agreement provided with the
|
** accordance with the commercial license agreement provided with the
|
||||||
** Software or, alternatively, in accordance with the terms contained in
|
** Software or, alternatively, in accordance with the terms contained in
|
||||||
** a written agreement between you and The Qt Company. For licensing terms
|
** a written agreement between you and The Qt Company. For licensing terms
|
||||||
** and conditions see http://www.qt.io/terms-conditions. For further
|
** and conditions see https://www.qt.io/terms-conditions. For further
|
||||||
** information use the contact form at http://www.qt.io/contact-us.
|
** information use the contact form at https://www.qt.io/contact-us.
|
||||||
**
|
**
|
||||||
** GNU Lesser General Public License Usage
|
** GNU Lesser General Public License Usage
|
||||||
** Alternatively, 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 or version 3 as published by the Free
|
** General Public License version 3 as published by the Free Software
|
||||||
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
** Foundation and appearing in the file LICENSE.LGPL3 included in the
|
||||||
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
** packaging of this file. Please review the following information to
|
||||||
** following information to ensure the GNU Lesser General Public License
|
** ensure the GNU Lesser General Public License version 3 requirements
|
||||||
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
|
||||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
|
||||||
**
|
**
|
||||||
** As a special exception, The Qt Company gives you certain additional
|
** GNU General Public License Usage
|
||||||
** rights. These rights are described in The Qt Company LGPL Exception
|
** Alternatively, this file may be used under the terms of the GNU
|
||||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
** General Public License version 2.0 or (at your option) the GNU General
|
||||||
|
** Public license version 3 or any later version approved by the KDE Free
|
||||||
|
** Qt Foundation. The licenses are as published by the Free Software
|
||||||
|
** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
|
||||||
|
** included in the packaging of this file. Please review the following
|
||||||
|
** information to ensure the GNU General Public License requirements will
|
||||||
|
** be met: https://www.gnu.org/licenses/gpl-2.0.html and
|
||||||
|
** https://www.gnu.org/licenses/gpl-3.0.html.
|
||||||
**
|
**
|
||||||
** $QT_END_LICENSE$
|
** $QT_END_LICENSE$
|
||||||
**
|
**
|
||||||
@@ -144,32 +156,38 @@
|
|||||||
|
|
||||||
/:/****************************************************************************
|
/:/****************************************************************************
|
||||||
**
|
**
|
||||||
** Copyright (C) 2015 The Qt Company Ltd.
|
** Copyright (C) 2016 The Qt Company Ltd.
|
||||||
** Contact: http://www.qt.io/licensing/
|
** Contact: https://www.qt.io/licensing/
|
||||||
**
|
**
|
||||||
** This file is part of the QtQml module of the Qt Toolkit.
|
** This file is part of the QtQml module of the Qt Toolkit.
|
||||||
**
|
**
|
||||||
** $QT_BEGIN_LICENSE:LGPL21$
|
** $QT_BEGIN_LICENSE:LGPL$
|
||||||
** Commercial License Usage
|
** Commercial License Usage
|
||||||
** Licensees holding valid commercial Qt licenses may use this file in
|
** Licensees holding valid commercial Qt licenses may use this file in
|
||||||
** accordance with the commercial license agreement provided with the
|
** accordance with the commercial license agreement provided with the
|
||||||
** Software or, alternatively, in accordance with the terms contained in
|
** Software or, alternatively, in accordance with the terms contained in
|
||||||
** a written agreement between you and The Qt Company. For licensing terms
|
** a written agreement between you and The Qt Company. For licensing terms
|
||||||
** and conditions see http://www.qt.io/terms-conditions. For further
|
** and conditions see https://www.qt.io/terms-conditions. For further
|
||||||
** information use the contact form at http://www.qt.io/contact-us.
|
** information use the contact form at https://www.qt.io/contact-us.
|
||||||
**
|
**
|
||||||
** GNU Lesser General Public License Usage
|
** GNU Lesser General Public License Usage
|
||||||
** Alternatively, 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 or version 3 as published by the Free
|
** General Public License version 3 as published by the Free Software
|
||||||
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
** Foundation and appearing in the file LICENSE.LGPL3 included in the
|
||||||
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
** packaging of this file. Please review the following information to
|
||||||
** following information to ensure the GNU Lesser General Public License
|
** ensure the GNU Lesser General Public License version 3 requirements
|
||||||
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
|
||||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
|
||||||
**
|
**
|
||||||
** As a special exception, The Qt Company gives you certain additional
|
** GNU General Public License Usage
|
||||||
** rights. These rights are described in The Qt Company LGPL Exception
|
** Alternatively, this file may be used under the terms of the GNU
|
||||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
** General Public License version 2.0 or (at your option) the GNU General
|
||||||
|
** Public license version 3 or any later version approved by the KDE Free
|
||||||
|
** Qt Foundation. The licenses are as published by the Free Software
|
||||||
|
** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
|
||||||
|
** included in the packaging of this file. Please review the following
|
||||||
|
** information to ensure the GNU General Public License requirements will
|
||||||
|
** be met: https://www.gnu.org/licenses/gpl-2.0.html and
|
||||||
|
** https://www.gnu.org/licenses/gpl-3.0.html.
|
||||||
**
|
**
|
||||||
** $QT_END_LICENSE$
|
** $QT_END_LICENSE$
|
||||||
**
|
**
|
||||||
@@ -199,7 +217,8 @@
|
|||||||
// qlalr --no-debug --no-lines --qt qmljs.g
|
// qlalr --no-debug --no-lines --qt qmljs.g
|
||||||
//
|
//
|
||||||
|
|
||||||
#prama once
|
#ifndef QMLJSPARSER_P_H
|
||||||
|
#define QMLJSPARSER_P_H
|
||||||
|
|
||||||
#include "qmljsglobal_p.h"
|
#include "qmljsglobal_p.h"
|
||||||
#include "qmljsgrammar_p.h"
|
#include "qmljsgrammar_p.h"
|
||||||
@@ -311,7 +330,7 @@ public:
|
|||||||
|
|
||||||
inline DiagnosticMessage diagnosticMessage() const
|
inline DiagnosticMessage diagnosticMessage() const
|
||||||
{
|
{
|
||||||
foreach (const DiagnosticMessage &d, diagnostic_messages) {
|
for (const DiagnosticMessage &d : diagnostic_messages) {
|
||||||
if (d.kind != DiagnosticMessage::Warning)
|
if (d.kind != DiagnosticMessage::Warning)
|
||||||
return d;
|
return d;
|
||||||
}
|
}
|
||||||
@@ -897,8 +916,40 @@ case $rule_number:
|
|||||||
./
|
./
|
||||||
|
|
||||||
UiPropertyType: T_VAR ;
|
UiPropertyType: T_VAR ;
|
||||||
|
/.
|
||||||
|
case $rule_number: {
|
||||||
|
AST::UiQualifiedId *node = new (pool) AST::UiQualifiedId(stringRef(1));
|
||||||
|
node->identifierToken = loc(1);
|
||||||
|
sym(1).Node = node;
|
||||||
|
} break;
|
||||||
|
./
|
||||||
|
|
||||||
UiPropertyType: T_RESERVED_WORD ;
|
UiPropertyType: T_RESERVED_WORD ;
|
||||||
|
/.
|
||||||
|
case $rule_number: {
|
||||||
|
AST::UiQualifiedId *node = new (pool) AST::UiQualifiedId(stringRef(1));
|
||||||
|
node->identifierToken = loc(1);
|
||||||
|
sym(1).Node = node;
|
||||||
|
} break;
|
||||||
|
./
|
||||||
|
|
||||||
UiPropertyType: T_IDENTIFIER ;
|
UiPropertyType: T_IDENTIFIER ;
|
||||||
|
/.
|
||||||
|
case $rule_number: {
|
||||||
|
AST::UiQualifiedId *node = new (pool) AST::UiQualifiedId(stringRef(1));
|
||||||
|
node->identifierToken = loc(1);
|
||||||
|
sym(1).Node = node;
|
||||||
|
} break;
|
||||||
|
./
|
||||||
|
|
||||||
|
UiPropertyType: UiPropertyType T_DOT T_IDENTIFIER ;
|
||||||
|
/.
|
||||||
|
case $rule_number: {
|
||||||
|
AST::UiQualifiedId *node = new (pool) AST::UiQualifiedId(sym(1).UiQualifiedId, stringRef(3));
|
||||||
|
node->identifierToken = loc(3);
|
||||||
|
sym(1).Node = node;
|
||||||
|
} break;
|
||||||
|
./
|
||||||
|
|
||||||
UiParameterListOpt: ;
|
UiParameterListOpt: ;
|
||||||
/.
|
/.
|
||||||
@@ -917,7 +968,7 @@ case $rule_number: {
|
|||||||
UiParameterList: UiPropertyType JsIdentifier ;
|
UiParameterList: UiPropertyType JsIdentifier ;
|
||||||
/.
|
/.
|
||||||
case $rule_number: {
|
case $rule_number: {
|
||||||
AST::UiParameterList *node = new (pool) AST::UiParameterList(stringRef(1), stringRef(2));
|
AST::UiParameterList *node = new (pool) AST::UiParameterList(sym(1).UiQualifiedId->finish(), stringRef(2));
|
||||||
node->propertyTypeToken = loc(1);
|
node->propertyTypeToken = loc(1);
|
||||||
node->identifierToken = loc(2);
|
node->identifierToken = loc(2);
|
||||||
sym(1).Node = node;
|
sym(1).Node = node;
|
||||||
@@ -927,7 +978,7 @@ case $rule_number: {
|
|||||||
UiParameterList: UiParameterList T_COMMA UiPropertyType JsIdentifier ;
|
UiParameterList: UiParameterList T_COMMA UiPropertyType JsIdentifier ;
|
||||||
/.
|
/.
|
||||||
case $rule_number: {
|
case $rule_number: {
|
||||||
AST::UiParameterList *node = new (pool) AST::UiParameterList(sym(1).UiParameterList, stringRef(3), stringRef(4));
|
AST::UiParameterList *node = new (pool) AST::UiParameterList(sym(1).UiParameterList, sym(3).UiQualifiedId->finish(), stringRef(4));
|
||||||
node->propertyTypeToken = loc(3);
|
node->propertyTypeToken = loc(3);
|
||||||
node->commaToken = loc(2);
|
node->commaToken = loc(2);
|
||||||
node->identifierToken = loc(4);
|
node->identifierToken = loc(4);
|
||||||
@@ -939,7 +990,7 @@ UiObjectMember: T_SIGNAL T_IDENTIFIER T_LPAREN UiParameterListOpt T_RPAREN T_AUT
|
|||||||
UiObjectMember: T_SIGNAL T_IDENTIFIER T_LPAREN UiParameterListOpt T_RPAREN T_SEMICOLON ;
|
UiObjectMember: T_SIGNAL T_IDENTIFIER T_LPAREN UiParameterListOpt T_RPAREN T_SEMICOLON ;
|
||||||
/.
|
/.
|
||||||
case $rule_number: {
|
case $rule_number: {
|
||||||
AST::UiPublicMember *node = new (pool) AST::UiPublicMember(QStringRef(), stringRef(2));
|
AST::UiPublicMember *node = new (pool) AST::UiPublicMember(nullptr, stringRef(2));
|
||||||
node->type = AST::UiPublicMember::Signal;
|
node->type = AST::UiPublicMember::Signal;
|
||||||
node->propertyToken = loc(1);
|
node->propertyToken = loc(1);
|
||||||
node->typeToken = loc(2);
|
node->typeToken = loc(2);
|
||||||
@@ -954,7 +1005,7 @@ UiObjectMember: T_SIGNAL T_IDENTIFIER T_AUTOMATIC_SEMICOLON ;
|
|||||||
UiObjectMember: T_SIGNAL T_IDENTIFIER T_SEMICOLON ;
|
UiObjectMember: T_SIGNAL T_IDENTIFIER T_SEMICOLON ;
|
||||||
/.
|
/.
|
||||||
case $rule_number: {
|
case $rule_number: {
|
||||||
AST::UiPublicMember *node = new (pool) AST::UiPublicMember(QStringRef(), stringRef(2));
|
AST::UiPublicMember *node = new (pool) AST::UiPublicMember(nullptr, stringRef(2));
|
||||||
node->type = AST::UiPublicMember::Signal;
|
node->type = AST::UiPublicMember::Signal;
|
||||||
node->propertyToken = loc(1);
|
node->propertyToken = loc(1);
|
||||||
node->typeToken = loc(2);
|
node->typeToken = loc(2);
|
||||||
@@ -968,7 +1019,7 @@ UiObjectMember: T_PROPERTY T_IDENTIFIER T_LT UiPropertyType T_GT JsIdentifier T_
|
|||||||
UiObjectMember: T_PROPERTY T_IDENTIFIER T_LT UiPropertyType T_GT JsIdentifier T_SEMICOLON ;
|
UiObjectMember: T_PROPERTY T_IDENTIFIER T_LT UiPropertyType T_GT JsIdentifier T_SEMICOLON ;
|
||||||
/.
|
/.
|
||||||
case $rule_number: {
|
case $rule_number: {
|
||||||
AST::UiPublicMember *node = new (pool) AST::UiPublicMember(stringRef(4), stringRef(6));
|
AST::UiPublicMember *node = new (pool) AST::UiPublicMember(sym(4).UiQualifiedId->finish(), stringRef(6));
|
||||||
node->typeModifier = stringRef(2);
|
node->typeModifier = stringRef(2);
|
||||||
node->propertyToken = loc(1);
|
node->propertyToken = loc(1);
|
||||||
node->typeModifierToken = loc(2);
|
node->typeModifierToken = loc(2);
|
||||||
@@ -983,7 +1034,7 @@ UiObjectMember: T_PROPERTY UiPropertyType JsIdentifier T_AUTOMATIC_SEMICOLON ;
|
|||||||
UiObjectMember: T_PROPERTY UiPropertyType JsIdentifier T_SEMICOLON ;
|
UiObjectMember: T_PROPERTY UiPropertyType JsIdentifier T_SEMICOLON ;
|
||||||
/.
|
/.
|
||||||
case $rule_number: {
|
case $rule_number: {
|
||||||
AST::UiPublicMember *node = new (pool) AST::UiPublicMember(stringRef(2), stringRef(3));
|
AST::UiPublicMember *node = new (pool) AST::UiPublicMember(sym(2).UiQualifiedId->finish(), stringRef(3));
|
||||||
node->propertyToken = loc(1);
|
node->propertyToken = loc(1);
|
||||||
node->typeToken = loc(2);
|
node->typeToken = loc(2);
|
||||||
node->identifierToken = loc(3);
|
node->identifierToken = loc(3);
|
||||||
@@ -996,7 +1047,7 @@ UiObjectMember: T_DEFAULT T_PROPERTY UiPropertyType JsIdentifier T_AUTOMATIC_SEM
|
|||||||
UiObjectMember: T_DEFAULT T_PROPERTY UiPropertyType JsIdentifier T_SEMICOLON ;
|
UiObjectMember: T_DEFAULT T_PROPERTY UiPropertyType JsIdentifier T_SEMICOLON ;
|
||||||
/.
|
/.
|
||||||
case $rule_number: {
|
case $rule_number: {
|
||||||
AST::UiPublicMember *node = new (pool) AST::UiPublicMember(stringRef(3), stringRef(4));
|
AST::UiPublicMember *node = new (pool) AST::UiPublicMember(sym(3).UiQualifiedId->finish(), stringRef(4));
|
||||||
node->isDefaultMember = true;
|
node->isDefaultMember = true;
|
||||||
node->defaultToken = loc(1);
|
node->defaultToken = loc(1);
|
||||||
node->propertyToken = loc(2);
|
node->propertyToken = loc(2);
|
||||||
@@ -1007,10 +1058,27 @@ case $rule_number: {
|
|||||||
} break;
|
} break;
|
||||||
./
|
./
|
||||||
|
|
||||||
|
UiObjectMember: T_DEFAULT T_PROPERTY T_IDENTIFIER T_LT UiPropertyType T_GT JsIdentifier T_AUTOMATIC_SEMICOLON ;
|
||||||
|
UiObjectMember: T_DEFAULT T_PROPERTY T_IDENTIFIER T_LT UiPropertyType T_GT JsIdentifier T_SEMICOLON ;
|
||||||
|
/.
|
||||||
|
case $rule_number: {
|
||||||
|
AST::UiPublicMember *node = new (pool) AST::UiPublicMember(sym(5).UiQualifiedId->finish(), stringRef(7));
|
||||||
|
node->isDefaultMember = true;
|
||||||
|
node->defaultToken = loc(1);
|
||||||
|
node->typeModifier = stringRef(3);
|
||||||
|
node->propertyToken = loc(2);
|
||||||
|
node->typeModifierToken = loc(2);
|
||||||
|
node->typeToken = loc(4);
|
||||||
|
node->identifierToken = loc(7);
|
||||||
|
node->semicolonToken = loc(8);
|
||||||
|
sym(1).Node = node;
|
||||||
|
} break;
|
||||||
|
./
|
||||||
|
|
||||||
UiObjectMember: T_PROPERTY UiPropertyType JsIdentifier T_COLON UiScriptStatement ;
|
UiObjectMember: T_PROPERTY UiPropertyType JsIdentifier T_COLON UiScriptStatement ;
|
||||||
/.
|
/.
|
||||||
case $rule_number: {
|
case $rule_number: {
|
||||||
AST::UiPublicMember *node = new (pool) AST::UiPublicMember(stringRef(2), stringRef(3),
|
AST::UiPublicMember *node = new (pool) AST::UiPublicMember(sym(2).UiQualifiedId->finish(), stringRef(3),
|
||||||
sym(5).Statement);
|
sym(5).Statement);
|
||||||
node->propertyToken = loc(1);
|
node->propertyToken = loc(1);
|
||||||
node->typeToken = loc(2);
|
node->typeToken = loc(2);
|
||||||
@@ -1023,7 +1091,7 @@ case $rule_number: {
|
|||||||
UiObjectMember: T_READONLY T_PROPERTY UiPropertyType JsIdentifier T_COLON UiScriptStatement ;
|
UiObjectMember: T_READONLY T_PROPERTY UiPropertyType JsIdentifier T_COLON UiScriptStatement ;
|
||||||
/.
|
/.
|
||||||
case $rule_number: {
|
case $rule_number: {
|
||||||
AST::UiPublicMember *node = new (pool) AST::UiPublicMember(stringRef(3), stringRef(4),
|
AST::UiPublicMember *node = new (pool) AST::UiPublicMember(sym(3).UiQualifiedId->finish(), stringRef(4),
|
||||||
sym(6).Statement);
|
sym(6).Statement);
|
||||||
node->isReadonlyMember = true;
|
node->isReadonlyMember = true;
|
||||||
node->readonlyToken = loc(1);
|
node->readonlyToken = loc(1);
|
||||||
@@ -1038,7 +1106,7 @@ case $rule_number: {
|
|||||||
UiObjectMember: T_DEFAULT T_PROPERTY UiPropertyType JsIdentifier T_COLON UiScriptStatement ;
|
UiObjectMember: T_DEFAULT T_PROPERTY UiPropertyType JsIdentifier T_COLON UiScriptStatement ;
|
||||||
/.
|
/.
|
||||||
case $rule_number: {
|
case $rule_number: {
|
||||||
AST::UiPublicMember *node = new (pool) AST::UiPublicMember(stringRef(3), stringRef(4),
|
AST::UiPublicMember *node = new (pool) AST::UiPublicMember(sym(3).UiQualifiedId->finish(), stringRef(4),
|
||||||
sym(6).Statement);
|
sym(6).Statement);
|
||||||
node->isDefaultMember = true;
|
node->isDefaultMember = true;
|
||||||
node->defaultToken = loc(1);
|
node->defaultToken = loc(1);
|
||||||
@@ -1053,7 +1121,7 @@ case $rule_number: {
|
|||||||
UiObjectMember: T_PROPERTY T_IDENTIFIER T_LT UiPropertyType T_GT JsIdentifier T_COLON T_LBRACKET UiArrayMemberList T_RBRACKET ;
|
UiObjectMember: T_PROPERTY T_IDENTIFIER T_LT UiPropertyType T_GT JsIdentifier T_COLON T_LBRACKET UiArrayMemberList T_RBRACKET ;
|
||||||
/.
|
/.
|
||||||
case $rule_number: {
|
case $rule_number: {
|
||||||
AST::UiPublicMember *node = new (pool) AST::UiPublicMember(stringRef(4), stringRef(6));
|
AST::UiPublicMember *node = new (pool) AST::UiPublicMember(sym(4).UiQualifiedId->finish(), stringRef(6));
|
||||||
node->typeModifier = stringRef(2);
|
node->typeModifier = stringRef(2);
|
||||||
node->propertyToken = loc(1);
|
node->propertyToken = loc(1);
|
||||||
node->typeModifierToken = loc(2);
|
node->typeModifierToken = loc(2);
|
||||||
@@ -1080,7 +1148,7 @@ case $rule_number: {
|
|||||||
UiObjectMember: T_PROPERTY UiPropertyType JsIdentifier T_COLON UiQualifiedId UiObjectInitializer ;
|
UiObjectMember: T_PROPERTY UiPropertyType JsIdentifier T_COLON UiQualifiedId UiObjectInitializer ;
|
||||||
/.
|
/.
|
||||||
case $rule_number: {
|
case $rule_number: {
|
||||||
AST::UiPublicMember *node = new (pool) AST::UiPublicMember(stringRef(2), stringRef(3));
|
AST::UiPublicMember *node = new (pool) AST::UiPublicMember(sym(2).UiQualifiedId->finish(), stringRef(3));
|
||||||
node->propertyToken = loc(1);
|
node->propertyToken = loc(1);
|
||||||
node->typeToken = loc(2);
|
node->typeToken = loc(2);
|
||||||
node->identifierToken = loc(3);
|
node->identifierToken = loc(3);
|
||||||
@@ -1103,7 +1171,7 @@ case $rule_number: {
|
|||||||
UiObjectMember: T_READONLY T_PROPERTY UiPropertyType JsIdentifier T_COLON UiQualifiedId UiObjectInitializer ;
|
UiObjectMember: T_READONLY T_PROPERTY UiPropertyType JsIdentifier T_COLON UiQualifiedId UiObjectInitializer ;
|
||||||
/.
|
/.
|
||||||
case $rule_number: {
|
case $rule_number: {
|
||||||
AST::UiPublicMember *node = new (pool) AST::UiPublicMember(stringRef(3), stringRef(4));
|
AST::UiPublicMember *node = new (pool) AST::UiPublicMember(sym(3).UiQualifiedId->finish(), stringRef(4));
|
||||||
node->isReadonlyMember = true;
|
node->isReadonlyMember = true;
|
||||||
node->readonlyToken = loc(1);
|
node->readonlyToken = loc(1);
|
||||||
node->propertyToken = loc(2);
|
node->propertyToken = loc(2);
|
||||||
@@ -3041,7 +3109,7 @@ PropertyAssignmentListOpt: PropertyAssignmentList ;
|
|||||||
yylloc.startColumn += yylloc.length;
|
yylloc.startColumn += yylloc.length;
|
||||||
yylloc.length = 0;
|
yylloc.length = 0;
|
||||||
|
|
||||||
//const QString msg = qApp->translate("QmlParser", "Missing `;'");
|
//const QString msg = QCoreApplication::translate("QmlParser", "Missing \";\".");
|
||||||
//diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Warning, yylloc, msg));
|
//diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Warning, yylloc, msg));
|
||||||
|
|
||||||
first_token = &token_buffer[0];
|
first_token = &token_buffer[0];
|
||||||
@@ -3071,9 +3139,9 @@ PropertyAssignmentListOpt: PropertyAssignmentList ;
|
|||||||
QString msg;
|
QString msg;
|
||||||
int token = token_buffer[0].token;
|
int token = token_buffer[0].token;
|
||||||
if (token < 0 || token >= TERMINAL_COUNT)
|
if (token < 0 || token >= TERMINAL_COUNT)
|
||||||
msg = QCoreApplication::translate("QmlParser", "Syntax error");
|
msg = QCoreApplication::translate("QmlParser", "Syntax error.");
|
||||||
else
|
else
|
||||||
msg = QCoreApplication::translate("QmlParser", "Unexpected token `%1'").arg(QLatin1String(spell[token]));
|
msg = QCoreApplication::translate("QmlParser", "Unexpected token \"%1\".").arg(QLatin1String(spell[token]));
|
||||||
diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, token_buffer[0].loc, msg));
|
diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, token_buffer[0].loc, msg));
|
||||||
|
|
||||||
action = errorState;
|
action = errorState;
|
||||||
@@ -3101,7 +3169,7 @@ PropertyAssignmentListOpt: PropertyAssignmentList ;
|
|||||||
for (int *tk = tokens; *tk != EOF_SYMBOL; ++tk) {
|
for (int *tk = tokens; *tk != EOF_SYMBOL; ++tk) {
|
||||||
int a = t_action(errorState, *tk);
|
int a = t_action(errorState, *tk);
|
||||||
if (a > 0 && t_action(a, yytoken)) {
|
if (a > 0 && t_action(a, yytoken)) {
|
||||||
const QString msg = QCoreApplication::translate("QmlParser", "Expected token `%1'").arg(QLatin1String(spell[*tk]));
|
const QString msg = QCoreApplication::translate("QmlParser", "Expected token \"%1\".").arg(QLatin1String(spell[*tk]));
|
||||||
diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, token_buffer[0].loc, msg));
|
diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, token_buffer[0].loc, msg));
|
||||||
|
|
||||||
yytoken = *tk;
|
yytoken = *tk;
|
||||||
@@ -3125,7 +3193,7 @@ PropertyAssignmentListOpt: PropertyAssignmentList ;
|
|||||||
|
|
||||||
int a = t_action(errorState, tk);
|
int a = t_action(errorState, tk);
|
||||||
if (a > 0 && t_action(a, yytoken)) {
|
if (a > 0 && t_action(a, yytoken)) {
|
||||||
const QString msg = QCoreApplication::translate("QmlParser", "Expected token `%1'").arg(QLatin1String(spell[tk]));
|
const QString msg = QCoreApplication::translate("QmlParser", "Expected token \"%1\".").arg(QLatin1String(spell[tk]));
|
||||||
diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, token_buffer[0].loc, msg));
|
diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, token_buffer[0].loc, msg));
|
||||||
|
|
||||||
yytoken = tk;
|
yytoken = tk;
|
||||||
@@ -3138,7 +3206,7 @@ PropertyAssignmentListOpt: PropertyAssignmentList ;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const QString msg = QCoreApplication::translate("QmlParser", "Syntax error");
|
const QString msg = QCoreApplication::translate("QmlParser", "Syntax error.");
|
||||||
diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, token_buffer[0].loc, msg));
|
diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, token_buffer[0].loc, msg));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3153,4 +3221,6 @@ QT_QML_END_NAMESPACE
|
|||||||
QT_QML_END_NAMESPACE
|
QT_QML_END_NAMESPACE
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#endif // QMLJSPARSER_P_H
|
||||||
:/
|
:/
|
||||||
|
File diff suppressed because it is too large
Load Diff
@@ -170,3 +170,4 @@ class UiHeaderItemList;
|
|||||||
} } // namespace AST
|
} } // namespace AST
|
||||||
|
|
||||||
QT_QML_END_NAMESPACE
|
QT_QML_END_NAMESPACE
|
||||||
|
|
||||||
|
@@ -320,3 +320,4 @@ public:
|
|||||||
} } // namespace AST
|
} } // namespace AST
|
||||||
|
|
||||||
QT_QML_END_NAMESPACE
|
QT_QML_END_NAMESPACE
|
||||||
|
|
||||||
|
@@ -100,7 +100,7 @@ double integerFromString(const char *buf, int size, int radix)
|
|||||||
|
|
||||||
double integerFromString(const QString &str, int radix)
|
double integerFromString(const QString &str, int radix)
|
||||||
{
|
{
|
||||||
QByteArray ba = str.trimmed().toLatin1();
|
QByteArray ba = QStringRef(&str).trimmed().toLatin1();
|
||||||
return integerFromString(ba.constData(), ba.size(), radix);
|
return integerFromString(ba.constData(), ba.size(), radix);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -110,3 +110,4 @@ double integerFromString(const char *buf, int size, int radix);
|
|||||||
} // end of namespace QmlJS
|
} // end of namespace QmlJS
|
||||||
|
|
||||||
QT_QML_END_NAMESPACE
|
QT_QML_END_NAMESPACE
|
||||||
|
|
||||||
|
@@ -62,3 +62,4 @@
|
|||||||
# define QML_PARSER_EXPORT Q_DECL_IMPORT
|
# define QML_PARSER_EXPORT Q_DECL_IMPORT
|
||||||
# endif
|
# endif
|
||||||
#endif // QT_CREATOR
|
#endif // QT_CREATOR
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
@@ -35,7 +35,8 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
// This file was generated by qlalr - DO NOT EDIT!
|
// This file was generated by qlalr - DO NOT EDIT!
|
||||||
#pragma once
|
#ifndef QMLJSGRAMMAR_P_H
|
||||||
|
#define QMLJSGRAMMAR_P_H
|
||||||
|
|
||||||
#include "qmljsglobal_p.h"
|
#include "qmljsglobal_p.h"
|
||||||
#include <QtCore/qglobal.h>
|
#include <QtCore/qglobal.h>
|
||||||
@@ -153,15 +154,15 @@ public:
|
|||||||
T_XOR = 79,
|
T_XOR = 79,
|
||||||
T_XOR_EQ = 80,
|
T_XOR_EQ = 80,
|
||||||
|
|
||||||
ACCEPT_STATE = 665,
|
ACCEPT_STATE = 674,
|
||||||
RULE_COUNT = 358,
|
RULE_COUNT = 361,
|
||||||
STATE_COUNT = 666,
|
STATE_COUNT = 675,
|
||||||
TERMINAL_COUNT = 106,
|
TERMINAL_COUNT = 106,
|
||||||
NON_TERMINAL_COUNT = 111,
|
NON_TERMINAL_COUNT = 111,
|
||||||
|
|
||||||
GOTO_INDEX_OFFSET = 666,
|
GOTO_INDEX_OFFSET = 675,
|
||||||
GOTO_INFO_OFFSET = 3018,
|
GOTO_INFO_OFFSET = 3078,
|
||||||
GOTO_CHECK_OFFSET = 3018
|
GOTO_CHECK_OFFSET = 3078
|
||||||
};
|
};
|
||||||
|
|
||||||
static const char *const spell [];
|
static const char *const spell [];
|
||||||
@@ -195,3 +196,5 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
#endif // QMLJSGRAMMAR_P_H
|
||||||
|
|
||||||
|
@@ -874,3 +874,4 @@ int Lexer::classify(const QChar *s, int n, bool qmlMode) {
|
|||||||
} // namespace QmlJS
|
} // namespace QmlJS
|
||||||
|
|
||||||
QT_QML_END_NAMESPACE
|
QT_QML_END_NAMESPACE
|
||||||
|
|
||||||
|
@@ -237,3 +237,4 @@ private:
|
|||||||
} // end of namespace QmlJS
|
} // end of namespace QmlJS
|
||||||
|
|
||||||
QT_QML_END_NAMESPACE
|
QT_QML_END_NAMESPACE
|
||||||
|
|
||||||
|
@@ -79,7 +79,7 @@ public:
|
|||||||
inline void *allocate(size_t size)
|
inline void *allocate(size_t size)
|
||||||
{
|
{
|
||||||
size = (size + 7) & ~7;
|
size = (size + 7) & ~7;
|
||||||
if (_ptr && (_ptr + size < _end)) {
|
if (Q_LIKELY(_ptr && (_ptr + size < _end))) {
|
||||||
void *addr = _ptr;
|
void *addr = _ptr;
|
||||||
_ptr += size;
|
_ptr += size;
|
||||||
return addr;
|
return addr;
|
||||||
@@ -96,7 +96,7 @@ public:
|
|||||||
template <typename Tp> Tp *New() { return new (this->allocate(sizeof(Tp))) Tp(); }
|
template <typename Tp> Tp *New() { return new (this->allocate(sizeof(Tp))) Tp(); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void *allocate_helper(size_t size)
|
Q_NEVER_INLINE void *allocate_helper(size_t size)
|
||||||
{
|
{
|
||||||
Q_ASSERT(size < BLOCK_SIZE);
|
Q_ASSERT(size < BLOCK_SIZE);
|
||||||
|
|
||||||
@@ -107,6 +107,7 @@ private:
|
|||||||
_allocatedBlocks *= 2;
|
_allocatedBlocks *= 2;
|
||||||
|
|
||||||
_blocks = (char **) realloc(_blocks, sizeof(char *) * _allocatedBlocks);
|
_blocks = (char **) realloc(_blocks, sizeof(char *) * _allocatedBlocks);
|
||||||
|
Q_CHECK_PTR(_blocks);
|
||||||
|
|
||||||
for (int index = _blockCount; index < _allocatedBlocks; ++index)
|
for (int index = _blockCount; index < _allocatedBlocks; ++index)
|
||||||
_blocks[index] = 0;
|
_blocks[index] = 0;
|
||||||
@@ -114,8 +115,10 @@ private:
|
|||||||
|
|
||||||
char *&block = _blocks[_blockCount];
|
char *&block = _blocks[_blockCount];
|
||||||
|
|
||||||
if (! block)
|
if (! block) {
|
||||||
block = (char *) malloc(BLOCK_SIZE);
|
block = (char *) malloc(BLOCK_SIZE);
|
||||||
|
Q_CHECK_PTR(block);
|
||||||
|
}
|
||||||
|
|
||||||
_ptr = block;
|
_ptr = block;
|
||||||
_end = _ptr + BLOCK_SIZE;
|
_end = _ptr + BLOCK_SIZE;
|
||||||
@@ -156,3 +159,4 @@ public:
|
|||||||
} // namespace QmlJS
|
} // namespace QmlJS
|
||||||
|
|
||||||
QT_QML_END_NAMESPACE
|
QT_QML_END_NAMESPACE
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
@@ -159,7 +159,7 @@ public:
|
|||||||
|
|
||||||
inline DiagnosticMessage diagnosticMessage() const
|
inline DiagnosticMessage diagnosticMessage() const
|
||||||
{
|
{
|
||||||
foreach (const DiagnosticMessage &d, diagnostic_messages) {
|
for (const DiagnosticMessage &d : diagnostic_messages) {
|
||||||
if (d.kind != Severity::Warning)
|
if (d.kind != Severity::Warning)
|
||||||
return d;
|
return d;
|
||||||
}
|
}
|
||||||
@@ -231,8 +231,9 @@ protected:
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
#define J_SCRIPT_REGEXPLITERAL_RULE1 88
|
#define J_SCRIPT_REGEXPLITERAL_RULE1 91
|
||||||
|
|
||||||
#define J_SCRIPT_REGEXPLITERAL_RULE2 89
|
#define J_SCRIPT_REGEXPLITERAL_RULE2 92
|
||||||
|
|
||||||
QT_QML_END_NAMESPACE
|
QT_QML_END_NAMESPACE
|
||||||
|
|
||||||
|
@@ -1045,9 +1045,8 @@ bool Check::visit(UiArrayBinding *ast)
|
|||||||
bool Check::visit(UiPublicMember *ast)
|
bool Check::visit(UiPublicMember *ast)
|
||||||
{
|
{
|
||||||
if (ast->type == UiPublicMember::Property) {
|
if (ast->type == UiPublicMember::Property) {
|
||||||
// check if the member type is valid
|
if (ast->isValid()) {
|
||||||
if (!ast->memberType.isEmpty()) {
|
const QStringRef name = ast->memberTypeName();
|
||||||
const QStringRef name = ast->memberType;
|
|
||||||
if (!name.isEmpty() && name.at(0).isLower()) {
|
if (!name.isEmpty() && name.at(0).isLower()) {
|
||||||
const QString nameS = name.toString();
|
const QString nameS = name.toString();
|
||||||
if (!isValidBuiltinPropertyType(nameS))
|
if (!isValidBuiltinPropertyType(nameS))
|
||||||
|
@@ -1852,7 +1852,7 @@ ASTObjectValue::ASTObjectValue(UiQualifiedId *typeName,
|
|||||||
for (UiObjectMemberList *it = m_initializer->members; it; it = it->next) {
|
for (UiObjectMemberList *it = m_initializer->members; it; it = it->next) {
|
||||||
UiObjectMember *member = it->member;
|
UiObjectMember *member = it->member;
|
||||||
if (UiPublicMember *def = cast<UiPublicMember *>(member)) {
|
if (UiPublicMember *def = cast<UiPublicMember *>(member)) {
|
||||||
if (def->type == UiPublicMember::Property && !def->name.isEmpty() && !def->memberType.isEmpty()) {
|
if (def->type == UiPublicMember::Property && !def->name.isEmpty() && def->isValid()) {
|
||||||
ASTPropertyReference *ref = new ASTPropertyReference(def, m_doc, valueOwner);
|
ASTPropertyReference *ref = new ASTPropertyReference(def, m_doc, valueOwner);
|
||||||
m_properties.append(ref);
|
m_properties.append(ref);
|
||||||
if (def->defaultToken.isValid())
|
if (def->defaultToken.isValid())
|
||||||
@@ -2117,10 +2117,10 @@ bool ASTPropertyReference::getSourceLocation(QString *fileName, int *line, int *
|
|||||||
const Value *ASTPropertyReference::value(ReferenceContext *referenceContext) const
|
const Value *ASTPropertyReference::value(ReferenceContext *referenceContext) const
|
||||||
{
|
{
|
||||||
if (m_ast->statement
|
if (m_ast->statement
|
||||||
&& (m_ast->memberType.isEmpty()
|
&& (!m_ast->isValid()
|
||||||
|| m_ast->memberType == QLatin1String("variant")
|
|| m_ast->memberTypeName() == QLatin1String("variant")
|
||||||
|| m_ast->memberType == QLatin1String("var")
|
|| m_ast->memberTypeName() == QLatin1String("var")
|
||||||
|| m_ast->memberType == QLatin1String("alias"))) {
|
|| m_ast->memberTypeName() == QLatin1String("alias"))) {
|
||||||
|
|
||||||
// Adjust the context for the current location - expensive!
|
// Adjust the context for the current location - expensive!
|
||||||
// ### Improve efficiency by caching the 'use chain' constructed in ScopeBuilder.
|
// ### Improve efficiency by caching the 'use chain' constructed in ScopeBuilder.
|
||||||
@@ -2136,7 +2136,7 @@ const Value *ASTPropertyReference::value(ReferenceContext *referenceContext) con
|
|||||||
return evaluator(m_ast->statement);
|
return evaluator(m_ast->statement);
|
||||||
}
|
}
|
||||||
|
|
||||||
const QString memberType = m_ast->memberType.toString();
|
const QString memberType = m_ast->memberTypeName().toString();
|
||||||
|
|
||||||
const Value *builtin = valueOwner()->defaultValueForBuiltinType(memberType);
|
const Value *builtin = valueOwner()->defaultValueForBuiltinType(memberType);
|
||||||
if (!builtin->asUndefinedValue())
|
if (!builtin->asUndefinedValue())
|
||||||
@@ -2160,7 +2160,7 @@ ASTSignal::ASTSignal(UiPublicMember *ast, const Document *doc, ValueOwner *value
|
|||||||
ObjectValue *v = valueOwner->newObject(/*prototype=*/0);
|
ObjectValue *v = valueOwner->newObject(/*prototype=*/0);
|
||||||
for (UiParameterList *it = ast->parameters; it; it = it->next) {
|
for (UiParameterList *it = ast->parameters; it; it = it->next) {
|
||||||
if (!it->name.isEmpty())
|
if (!it->name.isEmpty())
|
||||||
v->setMember(it->name.toString(), valueOwner->defaultValueForBuiltinType(it->type.toString()));
|
v->setMember(it->name.toString(), valueOwner->defaultValueForBuiltinType(it->type->name.toString()));
|
||||||
}
|
}
|
||||||
m_bodyScope = v;
|
m_bodyScope = v;
|
||||||
}
|
}
|
||||||
@@ -2187,9 +2187,9 @@ const Value *ASTSignal::argument(int index) const
|
|||||||
UiParameterList *param = m_ast->parameters;
|
UiParameterList *param = m_ast->parameters;
|
||||||
for (int i = 0; param && i < index; ++i)
|
for (int i = 0; param && i < index; ++i)
|
||||||
param = param->next;
|
param = param->next;
|
||||||
if (!param || param->type.isEmpty())
|
if (!param || param->type->name.isEmpty())
|
||||||
return valueOwner()->unknownValue();
|
return valueOwner()->unknownValue();
|
||||||
return valueOwner()->defaultValueForBuiltinType(param->type.toString());
|
return valueOwner()->defaultValueForBuiltinType(param->type->name.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
QString ASTSignal::argumentName(int index) const
|
QString ASTSignal::argumentName(int index) const
|
||||||
|
@@ -84,7 +84,7 @@ protected:
|
|||||||
|
|
||||||
virtual bool visit(AST::UiPublicMember *node)
|
virtual bool visit(AST::UiPublicMember *node)
|
||||||
{
|
{
|
||||||
if (node->memberType == m_typeName){
|
if (node->memberTypeName() == m_typeName){
|
||||||
const ObjectValue * objectValue = m_context->lookupType(m_document.data(), QStringList(m_typeName));
|
const ObjectValue * objectValue = m_context->lookupType(m_document.data(), QStringList(m_typeName));
|
||||||
if (objectValue == m_typeValue)
|
if (objectValue == m_typeValue)
|
||||||
m_implemenations.append(node->typeToken);
|
m_implemenations.append(node->typeToken);
|
||||||
|
@@ -84,8 +84,8 @@ static TypeName resolveTypeName(const ASTPropertyReference *ref, const ContextPt
|
|||||||
{
|
{
|
||||||
TypeName type = "unknown";
|
TypeName type = "unknown";
|
||||||
|
|
||||||
if (!ref->ast()->memberType.isEmpty()) {
|
if (ref->ast()->isValid()) {
|
||||||
type = ref->ast()->memberType.toUtf8();
|
type = ref->ast()->memberTypeName().toUtf8();
|
||||||
|
|
||||||
if (type == "alias") {
|
if (type == "alias") {
|
||||||
const Value *value = context->lookupReference(ref);
|
const Value *value = context->lookupReference(ref);
|
||||||
|
@@ -1127,7 +1127,7 @@ void TextToModelMerger::syncNode(ModelNode &modelNode,
|
|||||||
if (property->type == AST::UiPublicMember::Signal)
|
if (property->type == AST::UiPublicMember::Signal)
|
||||||
continue; // QML designer doesn't support this yet.
|
continue; // QML designer doesn't support this yet.
|
||||||
|
|
||||||
if (property->name.isEmpty() || property->memberType.isEmpty())
|
if (property->name.isEmpty() || !property->isValid())
|
||||||
continue; // better safe than sorry.
|
continue; // better safe than sorry.
|
||||||
|
|
||||||
const QStringRef astName = property->name;
|
const QStringRef astName = property->name;
|
||||||
@@ -1142,7 +1142,7 @@ void TextToModelMerger::syncNode(ModelNode &modelNode,
|
|||||||
astValue = astValue.left(astValue.length() - 1);
|
astValue = astValue.left(astValue.length() - 1);
|
||||||
astValue = astValue.trimmed();
|
astValue = astValue.trimmed();
|
||||||
|
|
||||||
const TypeName &astType = property->memberType.toUtf8();
|
const TypeName &astType = property->memberTypeName().toUtf8();
|
||||||
AbstractProperty modelProperty = modelNode.property(astName.toUtf8());
|
AbstractProperty modelProperty = modelNode.property(astName.toUtf8());
|
||||||
|
|
||||||
if (property->binding) {
|
if (property->binding) {
|
||||||
|
@@ -322,7 +322,7 @@ protected:
|
|||||||
|
|
||||||
virtual bool visit(AST::UiPublicMember *node)
|
virtual bool visit(AST::UiPublicMember *node)
|
||||||
{
|
{
|
||||||
if (node->memberType == _name){
|
if (node->memberTypeName() == _name){
|
||||||
const ObjectValue * tVal = _context->lookupType(_doc.data(), QStringList(_name));
|
const ObjectValue * tVal = _context->lookupType(_doc.data(), QStringList(_name));
|
||||||
if (tVal == _typeValue)
|
if (tVal == _typeValue)
|
||||||
_usages.append(node->typeToken);
|
_usages.append(node->typeToken);
|
||||||
@@ -583,8 +583,8 @@ protected:
|
|||||||
virtual bool visit(UiPublicMember *node)
|
virtual bool visit(UiPublicMember *node)
|
||||||
{
|
{
|
||||||
if (containsOffset(node->typeToken)){
|
if (containsOffset(node->typeToken)){
|
||||||
if (!node->memberType.isEmpty()) {
|
if (node->isValid()) {
|
||||||
_name = node->memberType.toString();
|
_name = node->memberTypeName().toString();
|
||||||
_targetValue = _scopeChain->context()->lookupType(_doc.data(), QStringList(_name));
|
_targetValue = _scopeChain->context()->lookupType(_doc.data(), QStringList(_name));
|
||||||
_scope = 0;
|
_scope = 0;
|
||||||
_typeKind = TypeKind;
|
_typeKind = TypeKind;
|
||||||
|
@@ -323,8 +323,8 @@ protected:
|
|||||||
|
|
||||||
bool visit(UiPublicMember *ast)
|
bool visit(UiPublicMember *ast)
|
||||||
{
|
{
|
||||||
if (ast->typeToken.isValid() && !ast->memberType.isEmpty()) {
|
if (ast->typeToken.isValid() && ast->isValid()) {
|
||||||
if (m_scopeChain.context()->lookupType(m_scopeChain.document().data(), QStringList(ast->memberType.toString())))
|
if (m_scopeChain.context()->lookupType(m_scopeChain.document().data(), QStringList(ast->memberTypeName().toString())))
|
||||||
addUse(ast->typeToken, SemanticHighlighter::QmlTypeType);
|
addUse(ast->typeToken, SemanticHighlighter::QmlTypeType);
|
||||||
}
|
}
|
||||||
if (ast->identifierToken.isValid())
|
if (ast->identifierToken.isValid())
|
||||||
|
Reference in New Issue
Block a user