forked from qt-creator/qt-creator
Update Qml parser.
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
s/qdeclarative/qml/g
|
||||
s/QDECLARATIVE/QML/g
|
||||
s/QDeclarative/Qml/g
|
||||
s/Q_DECLARATIVE_EXPORT //g
|
||||
|
||||
# adjust pri file
|
||||
s/ \$\$PWD\/qmljsglobal_p.h/ $$PWD\/qmljsglobal_p.h \\\
|
||||
|
@@ -11,4 +11,4 @@ for i in $QTDIR/src/declarative/qml/qdeclarative{error.{h,cpp},dirparser{_p.h,.c
|
||||
done
|
||||
|
||||
# export QmlDirParser
|
||||
perl -p -0777 -i -e 's/QT_BEGIN_NAMESPACE\n\nclass QmlError;\n\nclass QmlDirParser/#include "qmljsglobal_p.h"\n\nQT_BEGIN_NAMESPACE\n\nclass QmlError;\n\nclass QML_PARSER_EXPORT QmlDirParser/' qmldirparser_p.h
|
||||
perl -p -0777 -i -e 's/QT_BEGIN_NAMESPACE\n\nclass QmlError;\nclass QmlDirParser/#include "qmljsglobal_p.h"\n\nQT_BEGIN_NAMESPACE\n\nclass QmlError;\nclass QML_PARSER_EXPORT QmlDirParser/' qmldirparser_p.h
|
||||
|
@@ -151,13 +151,26 @@ bool QmlDirParser::parse()
|
||||
|
||||
_plugins.append(entry);
|
||||
|
||||
} else if (sections[0] == QLatin1String("internal")) {
|
||||
if (sectionCount != 3) {
|
||||
reportError(lineNumber, -1,
|
||||
QString::fromUtf8("internal types require 2 arguments, but %1 were provided").arg(sectionCount + 1));
|
||||
continue;
|
||||
}
|
||||
Component entry(sections[1], sections[2], -1, -1);
|
||||
entry.internal = true;
|
||||
_components.append(entry);
|
||||
|
||||
} else if (sectionCount == 2) {
|
||||
// No version specified (should only be used for relative qmldir files)
|
||||
const Component entry(sections[0], sections[1], -1, -1);
|
||||
_components.append(entry);
|
||||
} else if (sectionCount == 3) {
|
||||
const QString &version = sections[1];
|
||||
const int dotIndex = version.indexOf(QLatin1Char('.'));
|
||||
|
||||
if (dotIndex == -1) {
|
||||
qWarning() << "expected '.'"; // ### use reportError
|
||||
|
||||
} else if (version.indexOf(QLatin1Char('.'), dotIndex + 1) != -1) {
|
||||
qWarning() << "unexpected '.'"; // ### use reportError
|
||||
|
||||
|
@@ -61,7 +61,6 @@
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QmlError;
|
||||
|
||||
class QML_PARSER_EXPORT QmlDirParser
|
||||
{
|
||||
Q_DISABLE_COPY(QmlDirParser)
|
||||
@@ -96,15 +95,17 @@ public:
|
||||
struct Component
|
||||
{
|
||||
Component()
|
||||
: majorVersion(0), minorVersion(0) {}
|
||||
: majorVersion(0), minorVersion(0), internal(false) {}
|
||||
|
||||
Component(const QString &typeName, const QString &fileName, int majorVersion, int minorVersion)
|
||||
: typeName(typeName), fileName(fileName), majorVersion(majorVersion), minorVersion(minorVersion) {}
|
||||
: typeName(typeName), fileName(fileName), majorVersion(majorVersion), minorVersion(minorVersion),
|
||||
internal(false) {}
|
||||
|
||||
QString typeName;
|
||||
QString fileName;
|
||||
int majorVersion;
|
||||
int minorVersion;
|
||||
bool internal;
|
||||
};
|
||||
|
||||
QList<Component> components() const;
|
||||
@@ -122,6 +123,9 @@ private:
|
||||
unsigned _isParsed: 1;
|
||||
};
|
||||
|
||||
typedef QList<QmlDirParser::Component> QmlDirComponents;
|
||||
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // QMLDIRPARSER_P_H
|
||||
|
@@ -284,7 +284,9 @@ case 20: {
|
||||
|
||||
sym(1).Node = node;
|
||||
|
||||
if (! node) {
|
||||
if (node) {
|
||||
node->importToken = loc(1);
|
||||
} else {
|
||||
diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, loc(1),
|
||||
QLatin1String("Expected a qualified name id or a string literal")));
|
||||
|
||||
|
Reference in New Issue
Block a user