summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorBrett Stottlemyer <bstottle@ford.com>2020-06-30 08:21:55 -0400
committerBrett Stottlemyer <bstottle@ford.com>2020-07-21 16:52:10 -0400
commit18c5833856795ecb5aaa5e0c8ba26dcdd74e1d65 (patch)
treef4ba4fbfc7bed4548191b3c54a35f95054f1ae68 /tools
parent497768da4cecd6bfb3a02f7a325303722733769d (diff)
[Repc] Remove moc_copy in favor of json input
The json input needs to be generated by moc with --output-json option. This also copies the qmake required pri/prf files to qtbase, and updates them so qmake works with --output-json as well. Change-Id: I172794f0c7c85f6e8fcd03654eecd3776f49e521 Reviewed-by: Michael Brasser <michael.brasser@live.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/repc/CMakeLists.txt8
-rw-r--r--tools/repc/cppcodegenerator.cpp8
-rw-r--r--tools/repc/cppcodegenerator.h6
-rw-r--r--tools/repc/main.cpp63
-rw-r--r--tools/repc/moc_copy/keywords.cpp1027
-rw-r--r--tools/repc/moc_copy/moc.cpp1616
-rw-r--r--tools/repc/moc_copy/moc.h276
-rw-r--r--tools/repc/moc_copy/moc.pri14
-rw-r--r--tools/repc/moc_copy/mwerks_mac.cpp227
-rw-r--r--tools/repc/moc_copy/mwerks_mac.h54
-rw-r--r--tools/repc/moc_copy/outputrevision.h35
-rw-r--r--tools/repc/moc_copy/parser.cpp74
-rw-r--r--tools/repc/moc_copy/parser.h107
-rw-r--r--tools/repc/moc_copy/ppkeywords.cpp235
-rw-r--r--tools/repc/moc_copy/preprocessor.cpp1313
-rw-r--r--tools/repc/moc_copy/preprocessor.h92
-rw-r--r--tools/repc/moc_copy/symbols.h193
-rw-r--r--tools/repc/moc_copy/token.cpp45
-rw-r--r--tools/repc/moc_copy/token.h274
-rwxr-xr-xtools/repc/moc_copy/util/generate.sh35
-rw-r--r--tools/repc/moc_copy/util/generate_keywords.cpp463
-rw-r--r--tools/repc/moc_copy/util/generate_keywords.pro4
-rw-r--r--tools/repc/moc_copy/util/licenseheader.txt28
-rw-r--r--tools/repc/moc_copy/utils.h110
-rw-r--r--tools/repc/utils.cpp277
-rw-r--r--tools/repc/utils.h8
26 files changed, 213 insertions, 6379 deletions
diff --git a/tools/repc/CMakeLists.txt b/tools/repc/CMakeLists.txt
index d72f8c5..133d667 100644
--- a/tools/repc/CMakeLists.txt
+++ b/tools/repc/CMakeLists.txt
@@ -11,13 +11,6 @@ qt_add_tool(${target_name}
SOURCES
cppcodegenerator.cpp cppcodegenerator.h
main.cpp
- moc_copy/moc.cpp moc_copy/moc.h
- moc_copy/outputrevision.h
- moc_copy/parser.cpp moc_copy/parser.h
- moc_copy/preprocessor.cpp moc_copy/preprocessor.h
- moc_copy/symbols.h
- moc_copy/token.cpp moc_copy/token.h
- moc_copy/utils.h
repcodegenerator.cpp repcodegenerator.h
utils.cpp utils.h
DEFINES
@@ -28,7 +21,6 @@ qt_add_tool(${target_name}
RO_INSTALL_HEADERS=\"$$[QT_INSTALL_HEADERS]/QtRemoteObjects\"
INCLUDE_DIRECTORIES
${CMAKE_SOURCE_DIR}/src/repparser
- moc_copy
PUBLIC_LIBRARIES
Qt::CorePrivate
)
diff --git a/tools/repc/cppcodegenerator.cpp b/tools/repc/cppcodegenerator.cpp
index df9c478..236c7f1 100644
--- a/tools/repc/cppcodegenerator.cpp
+++ b/tools/repc/cppcodegenerator.cpp
@@ -26,8 +26,10 @@
**
****************************************************************************/
+#include <qjsonarray.h>
+#include <qjsonvalue.h>
+
#include "cppcodegenerator.h"
-#include "moc.h"
#include "utils.h"
QT_BEGIN_NAMESPACE
@@ -38,9 +40,9 @@ CppCodeGenerator::CppCodeGenerator(QIODevice *outputDevice)
Q_ASSERT(m_outputDevice);
}
-void CppCodeGenerator::generate(const QVector<ClassDef> &classList, bool alwaysGenerateClass /* = false */)
+void CppCodeGenerator::generate(const QJsonArray &classList, bool alwaysGenerateClass /* = false */)
{
- for (const ClassDef &cdef : classList)
+ for (const QJsonValue &cdef : classList)
m_outputDevice->write(generateClass(cdef, alwaysGenerateClass));
m_outputDevice->write("\n");
diff --git a/tools/repc/cppcodegenerator.h b/tools/repc/cppcodegenerator.h
index 1a9d627..892ed5b 100644
--- a/tools/repc/cppcodegenerator.h
+++ b/tools/repc/cppcodegenerator.h
@@ -29,10 +29,8 @@
#ifndef CPPCODEGENERATOR_H
#define CPPCODEGENERATOR_H
-#include <QVector>
-
QT_BEGIN_NAMESPACE
-struct ClassDef;
+class QJsonArray;
class QIODevice;
class CppCodeGenerator
@@ -40,7 +38,7 @@ class CppCodeGenerator
public:
CppCodeGenerator(QIODevice *outputDevice);
- void generate(const QVector<ClassDef> &classList, bool alwaysGenerateClass = false);
+ void generate(const QJsonArray &classList, bool alwaysGenerateClass = false);
private:
QIODevice *m_outputDevice;
diff --git a/tools/repc/main.cpp b/tools/repc/main.cpp
index b30af8a..6c402ea 100644
--- a/tools/repc/main.cpp
+++ b/tools/repc/main.cpp
@@ -30,10 +30,11 @@
#include <qcommandlineparser.h>
#include <qcoreapplication.h>
#include <qfileinfo.h>
+#include <qjsondocument.h>
+#include <qjsonobject.h>
+#include <qjsonarray.h>
#include "cppcodegenerator.h"
-#include "moc.h"
-#include "preprocessor.h"
#include "repcodegenerator.h"
#include "repparser.h"
#include "utils.h"
@@ -45,7 +46,7 @@
enum Mode {
InRep = 1,
- InSrc = 2,
+ InJson = 2,
OutRep = 4,
OutSource = 8,
OutReplica = 16,
@@ -53,7 +54,7 @@ enum Mode {
};
static const QLatin1String REP("rep");
-static const QLatin1String SRC("src");
+static const QLatin1String JSON("json");
static const QLatin1String REPLICA("replica");
static const QLatin1String SOURCE("source");
static const QLatin1String MERGED("merged");
@@ -76,8 +77,8 @@ int main(int argc, char **argv)
QCommandLineOption inputTypeOption(QStringLiteral("i"));
inputTypeOption.setDescription(QLatin1String("Input file type:\n"
"rep: replicant template files.\n"
- "src: C++ QObject derived classes."));
- inputTypeOption.setValueName(QStringLiteral("rep|src"));
+ "json: JSON output from moc of a Qt header file."));
+ inputTypeOption.setValueName(QStringLiteral("rep|json"));
parser.addOption(inputTypeOption);
QCommandLineOption outputTypeOption(QStringLiteral("o"));
@@ -102,8 +103,8 @@ int main(int argc, char **argv)
debugOption.setDescription(QStringLiteral("Print out parsing debug information (for troubleshooting)."));
parser.addOption(debugOption);
- parser.addPositionalArgument(QStringLiteral("[header-file/rep-file]"),
- QStringLiteral("Input header/rep file to read from, otherwise stdin."));
+ parser.addPositionalArgument(QStringLiteral("[json-file/rep-file]"),
+ QStringLiteral("Input json/rep file to read from, otherwise stdin."));
parser.addPositionalArgument(QStringLiteral("[rep-file/header-file]"),
QStringLiteral("Output header/rep file to write to, otherwise stdout."));
@@ -121,8 +122,8 @@ int main(int argc, char **argv)
const QString &inputType = parser.value(inputTypeOption);
if (inputType == REP)
mode = InRep;
- else if (inputType == SRC)
- mode = InSrc;
+ else if (inputType == JSON)
+ mode = InJson;
else {
fprintf(stderr, PROGRAM_NAME ": Unknown input type\"%s\".\n", qPrintable(inputType));
parser.showHelp(1);
@@ -156,17 +157,17 @@ int main(int argc, char **argv)
Q_FALLTHROUGH();
case 1:
inputFile = files.first();
- if (!(mode & (InRep | InSrc))) {
+ if (!(mode & (InRep | InJson))) {
// try to figure out the In mode from file extension
if (inputFile.endsWith(QLatin1String(".rep")))
mode |= InRep;
else
- mode |= InSrc;
+ mode |= InJson;
}
break;
}
// check mode sanity
- if (!(mode & (InRep | InSrc))) {
+ if (!(mode & (InRep | InJson))) {
fprintf(stderr, PROGRAM_NAME ": Unknown input type, please use -i option to specify one.\n");
parser.showHelp(1);
}
@@ -178,7 +179,7 @@ int main(int argc, char **argv)
fprintf(stderr, PROGRAM_NAME ": Invalid input/output type combination, both are rep files.\n");
parser.showHelp(1);
}
- if (mode & InSrc && mode & OutSource) {
+ if (mode & InJson && mode & OutSource) {
fprintf(stderr, PROGRAM_NAME ": Invalid input/output type combination, both are source header files.\n");
parser.showHelp(1);
}
@@ -207,40 +208,30 @@ int main(int argc, char **argv)
}
}
- if (mode & InSrc) {
- Preprocessor pp;
- const QFileInfo includePath(QLatin1String(RO_INSTALL_HEADERS));
- pp.includes += Preprocessor::IncludePath(QFile::encodeName(includePath.canonicalFilePath()));
- pp.includes += Preprocessor::IncludePath(QFile::encodeName(includePath.canonicalPath()));
- const auto paths = parser.values(includePathOption);
- for (const QString &path : paths)
- pp.includes += Preprocessor::IncludePath(QFile::encodeName(path));
-
- pp.macros["Q_MOC_RUN"];
- pp.macros["__cplusplus"];
+ if (mode & InJson) {
+ QJsonDocument doc(QJsonDocument::fromJson(input.readAll()));
+ input.close();
+ if (!doc.isObject()) {
+ fprintf(stderr, PROGRAM_NAME ": Unable to read json input.\n");
+ return 0;
+ }
- Moc moc;
- if (!inputFile.isEmpty())
- moc.filename = inputFile.toLocal8Bit();
- moc.currentFilenames.push(inputFile.toLocal8Bit());
- moc.includes = pp.includes;
- moc.symbols = pp.preprocessed(moc.filename, &input);
- moc.parse();
+ QJsonObject json = doc.object();
- if (moc.classList.isEmpty()) {
+ if (!json.contains(QLatin1String("classes")) || !json[QLatin1String("classes")].isArray()) {
fprintf(stderr, PROGRAM_NAME ": No QObject classes found.\n");
return 0;
}
- input.close();
+ QJsonArray classes = json[QLatin1String("classes")].toArray();
if (mode & OutRep) {
CppCodeGenerator generator(&output);
- generator.generate(moc.classList, parser.isSet(alwaysClassOption));
+ generator.generate(classes, parser.isSet(alwaysClassOption));
} else {
Q_ASSERT(mode & OutReplica);
RepCodeGenerator generator(&output);
- generator.generate(classList2AST(moc.classList), RepCodeGenerator::REPLICA, outputFile);
+ generator.generate(classList2AST(classes), RepCodeGenerator::REPLICA, outputFile);
}
} else {
Q_ASSERT(!(mode & OutRep));
diff --git a/tools/repc/moc_copy/keywords.cpp b/tools/repc/moc_copy/keywords.cpp
deleted file mode 100644
index 07c59d1..0000000
--- a/tools/repc/moc_copy/keywords.cpp
+++ /dev/null
@@ -1,1027 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the tools applications of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** 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 The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** 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-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-// auto generated
-// DO NOT EDIT.
-
-static const short keyword_trans[][128] = {
- {0,0,0,0,0,0,0,0,0,561,558,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 561,252,559,562,8,38,239,560,25,26,236,234,30,235,27,237,
- 22,22,22,22,22,22,22,22,22,22,34,41,23,39,24,43,
- 0,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
- 8,21,8,8,8,8,8,8,8,8,8,31,564,32,238,8,
- 0,1,2,3,4,5,6,7,8,9,8,8,10,11,12,13,
- 14,8,15,16,17,18,19,20,8,8,8,36,245,37,248,0},
- {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,192,0,173,0,0,0,0,0,0,0,0,0,0},
- {0,0,0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,494,0,0,500,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
- {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,479,0,526,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
- {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 542,0,0,510,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}
-};
-
-static const struct
-{
- Token token;
- short next;
- char defchar;
- short defnext;
- Token ident;
-} keywords[] = {
- {NOTOKEN, 0, 0, 0, NOTOKEN},
- {CHARACTER, 1, 0, 0, NOTOKEN},
- {CHARACTER, 2, 0, 0, NOTOKEN},
- {CHARACTER, 3, 0, 0, NOTOKEN},
- {CHARACTER, 4, 0, 0, NOTOKEN},
- {CHARACTER, 5, 0, 0, NOTOKEN},
- {CHARACTER, 6, 0, 0, NOTOKEN},
- {CHARACTER, 0, 111, 350, NOTOKEN},
- {CHARACTER, 0, 0, 0, NOTOKEN},
- {CHARACTER, 7, 0, 0, NOTOKEN},
- {CHARACTER, 0, 111, 295, NOTOKEN},
- {CHARACTER, 0, 117, 186, NOTOKEN},
- {CHARACTER, 8, 0, 0, NOTOKEN},
- {CHARACTER, 0, 112, 215, NOTOKEN},
- {CHARACTER, 9, 0, 0, NOTOKEN},
- {CHARACTER, 0, 101, 65, NOTOKEN},
- {CHARACTER, 10, 0, 0, NOTOKEN},
- {CHARACTER, 11, 0, 0, NOTOKEN},
- {CHARACTER, 12, 0, 0, NOTOKEN},
- {CHARACTER, 13, 0, 0, NOTOKEN},
- {CHARACTER, 14, 0, 0, NOTOKEN},
- {CHARACTER, 15, 0, 0, NOTOKEN},
- {DIGIT, 0, 0, 0, NOTOKEN},
- {LANGLE, 16, 0, 0, NOTOKEN},
- {RANGLE, 17, 0, 0, NOTOKEN},
- {LPAREN, 0, 0, 0, NOTOKEN},
- {RPAREN, 0, 0, 0, NOTOKEN},
- {DOT, 18, 0, 0, NOTOKEN},
- {INCOMPLETE, 0, 46, 29, NOTOKEN},
- {ELIPSIS, 0, 0, 0, NOTOKEN},
- {COMMA, 0, 0, 0, NOTOKEN},
- {LBRACK, 0, 0, 0, NOTOKEN},
- {RBRACK, 0, 0, 0, NOTOKEN},
- {LBRACK, 0, 58, 35, NOTOKEN},
- {COLON, 19, 0, 0, NOTOKEN},
- {LANGLE_SCOPE, 0, 0, 0, NOTOKEN},
- {LBRACE, 0, 0, 0, NOTOKEN},
- {RBRACE, 0, 0, 0, NOTOKEN},
- {PERCENT, 20, 0, 0, NOTOKEN},
- {EQ, 0, 61, 267, NOTOKEN},
- {SCOPE, 0, 0, 0, NOTOKEN},
- {SEMIC, 0, 0, 0, NOTOKEN},
- {DOTSTAR, 0, 0, 0, NOTOKEN},
- {QUESTION, 0, 0, 0, NOTOKEN},
- {CHARACTER, 0, 110, 45, CHARACTER},
- {CHARACTER, 0, 97, 46, CHARACTER},
- {CHARACTER, 0, 109, 47, CHARACTER},
- {CHARACTER, 0, 105, 48, CHARACTER},
- {CHARACTER, 0, 99, 49, CHARACTER},
- {CHARACTER, 0, 95, 50, CHARACTER},
- {CHARACTER, 0, 99, 51, CHARACTER},
- {CHARACTER, 0, 97, 52, CHARACTER},
- {CHARACTER, 0, 115, 53, CHARACTER},
- {CHARACTER, 0, 116, 54, CHARACTER},
- {DYNAMIC_CAST, 0, 0, 0, CHARACTER},
- {CHARACTER, 21, 0, 0, CHARACTER},
- {CHARACTER, 0, 116, 57, CHARACTER},
- {CHARACTER, 0, 105, 58, CHARACTER},
- {CHARACTER, 0, 99, 59, CHARACTER},
- {STATIC, 0, 95, 60, CHARACTER},
- {CHARACTER, 0, 99, 61, CHARACTER},
- {CHARACTER, 0, 97, 62, CHARACTER},
- {CHARACTER, 0, 115, 63, CHARACTER},
- {CHARACTER, 0, 116, 64, CHARACTER},
- {STATIC_CAST, 0, 0, 0, CHARACTER},
- {CHARACTER, 22, 0, 0, CHARACTER},
- {CHARACTER, 0, 110, 67, CHARACTER},
- {CHARACTER, 0, 116, 68, CHARACTER},
- {CHARACTER, 0, 101, 69, CHARACTER},
- {CHARACTER, 0, 114, 70, CHARACTER},
- {CHARACTER, 0, 112, 71, CHARACTER},
- {CHARACTER, 0, 114, 72, CHARACTER},
- {CHARACTER, 0, 101, 73, CHARACTER},
- {CHARACTER, 0, 116, 74, CHARACTER},
- {CHARACTER, 0, 95, 75, CHARACTER},
- {CHARACTER, 0, 99, 76, CHARACTER},
- {CHARACTER, 0, 97, 77, CHARACTER},
- {CHARACTER, 0, 115, 78, CHARACTER},
- {CHARACTER, 0, 116, 79, CHARACTER},
- {REINTERPRET_CAST, 0, 0, 0, CHARACTER},
- {CHARACTER, 23, 0, 0, CHARACTER},
- {CHARACTER, 24, 0, 0, CHARACTER},
- {CHARACTER, 0, 116, 83, CHARACTER},
- {CONST, 0, 95, 84, CHARACTER},
- {CHARACTER, 0, 99, 85, CHARACTER},
- {CHARACTER, 0, 97, 86, CHARACTER},
- {CHARACTER, 0, 115, 87, CHARACTER},
- {CHARACTER, 0, 116, 88, CHARACTER},
- {CONST_CAST, 0, 0, 0, CHARACTER},
- {CHARACTER, 0, 112, 90, CHARACTER},
- {CHARACTER, 0, 101, 91, CHARACTER},
- {CHARACTER, 25, 0, 0, CHARACTER},
- {CHARACTER, 0, 100, 93, CHARACTER},
- {TYPEID, 0, 0, 0, CHARACTER},
- {CHARACTER, 26, 0, 0, CHARACTER},
- {CHARACTER, 0, 115, 96, CHARACTER},
- {THIS, 0, 0, 0, CHARACTER},
- {CHARACTER, 0, 109, 98, CHARACTER},
- {CHARACTER, 0, 112, 99, CHARACTER},
- {CHARACTER, 0, 108, 100, CHARACTER},
- {CHARACTER, 0, 97, 101, CHARACTER},
- {CHARACTER, 0, 116, 102, CHARACTER},
- {CHARACTER, 0, 101, 103, CHARACTER},
- {TEMPLATE, 0, 0, 0, CHARACTER},
- {CHARACTER, 0, 111, 105, CHARACTER},
- {CHARACTER, 0, 119, 106, CHARACTER},
- {THROW, 0, 0, 0, CHARACTER},
- {CHARACTER, 0, 121, 108, CHARACTER},
- {TRY, 0, 0, 0, CHARACTER},
- {CHARACTER, 27, 0, 0, CHARACTER},
- {CHARACTER, 0, 99, 111, CHARACTER},
- {CHARACTER, 0, 104, 112, CHARACTER},
- {CATCH, 0, 0, 0, CHARACTER},
- {CHARACTER, 0, 101, 114, CHARACTER},
- {CHARACTER, 0, 102, 115, CHARACTER},
- {TYPEDEF, 0, 0, 0, CHARACTER},
- {CHARACTER, 0, 105, 117, CHARACTER},
- {CHARACTER, 0, 101, 118, CHARACTER},
- {CHARACTER, 0, 110, 119, CHARACTER},
- {CHARACTER, 0, 100, 120, CHARACTER},
- {FRIEND, 0, 0, 0, CHARACTER},
- {CHARACTER, 0, 97, 122, CHARACTER},
- {CHARACTER, 0, 115, 123, CHARACTER},
- {CHARACTER, 0, 115, 124, CHARACTER},
- {CLASS, 0, 0, 0, CHARACTER},
- {CHARACTER, 0, 109, 126, CHARACTER},
- {CHARACTER, 0, 101, 127, CHARACTER},
- {CHARACTER, 0, 115, 128, CHARACTER},
- {CHARACTER, 0, 112, 129, CHARACTER},
- {CHARACTER, 0, 97, 130, CHARACTER},
- {CHARACTER, 0, 99, 131, CHARACTER},
- {CHARACTER, 0, 101, 132, CHARACTER},
- {NAMESPACE, 0, 0, 0, CHARACTER},
- {CHARACTER, 0, 117, 134, CHARACTER},
- {CHARACTER, 0, 109, 135, CHARACTER},
- {ENUM, 0, 0, 0, CHARACTER},
- {CHARACTER, 0, 117, 137, CHARACTER},
- {CHARACTER, 0, 99, 138, CHARACTER},
- {CHARACTER, 0, 116, 139, CHARACTER},
- {STRUCT, 0, 0, 0, CHARACTER},
- {CHARACTER, 28, 0, 0, CHARACTER},
- {CHARACTER, 0, 111, 142, CHARACTER},
- {CHARACTER, 0, 110, 143, CHARACTER},
- {UNION, 0, 0, 0, CHARACTER},
- {CHARACTER, 0, 114, 145, CHARACTER},
- {CHARACTER, 0, 116, 146, CHARACTER},
- {CHARACTER, 0, 117, 147, CHARACTER},
- {CHARACTER, 0, 97, 148, CHARACTER},
- {CHARACTER, 0, 108, 149, CHARACTER},
- {VIRTUAL, 0, 0, 0, CHARACTER},
- {CHARACTER, 29, 0, 0, CHARACTER},
- {CHARACTER, 0, 118, 152, CHARACTER},
- {CHARACTER, 0, 97, 153, CHARACTER},
- {CHARACTER, 0, 116, 154, CHARACTER},
- {CHARACTER, 0, 101, 155, CHARACTER},
- {PRIVATE, 0, 0, 0, CHARACTER},
- {CHARACTER, 0, 116, 157, CHARACTER},
- {CHARACTER, 0, 101, 158, CHARACTER},
- {CHARACTER, 0, 99, 159, CHARACTER},
- {CHARACTER, 0, 116, 160, CHARACTER},
- {CHARACTER, 0, 101, 161, CHARACTER},
- {CHARACTER, 0, 100, 162, CHARACTER},
- {PROTECTED, 0, 0, 0, CHARACTER},
- {CHARACTER, 0, 98, 164, CHARACTER},
- {CHARACTER, 0, 108, 165, CHARACTER},
- {CHARACTER, 0, 105, 166, CHARACTER},
- {CHARACTER, 0, 99, 167, CHARACTER},
- {PUBLIC, 0, 0, 0, CHARACTER},
- {CHARACTER, 30, 0, 0, CHARACTER},
- {CHARACTER, 31, 0, 0, CHARACTER},
- {CHARACTER, 0, 114, 171, CHARACTER},
- {CHARACTER, 0, 116, 172, CHARACTER},
- {EXPORT, 0, 0, 0, CHARACTER},
- {CHARACTER, 0, 116, 174, CHARACTER},
- {CHARACTER, 0, 111, 175, CHARACTER},
- {AUTO, 0, 0, 0, CHARACTER},
- {CHARACTER, 0, 105, 177, CHARACTER},
- {CHARACTER, 0, 115, 178, CHARACTER},
- {CHARACTER, 0, 116, 179, CHARACTER},
- {CHARACTER, 0, 101, 180, CHARACTER},
- {CHARACTER, 0, 114, 181, CHARACTER},
- {REGISTER, 0, 0, 0, CHARACTER},
- {CHARACTER, 0, 101, 183, CHARACTER},
- {CHARACTER, 0, 114, 184, CHARACTER},
- {CHARACTER, 0, 110, 185, CHARACTER},
- {EXTERN, 0, 0, 0, CHARACTER},
- {CHARACTER, 0, 116, 187, CHARACTER},
- {CHARACTER, 0, 97, 188, CHARACTER},
- {CHARACTER, 0, 98, 189, CHARACTER},
- {CHARACTER, 0, 108, 190, CHARACTER},
- {CHARACTER, 0, 101, 191, CHARACTER},
- {MUTABLE, 0, 0, 0, CHARACTER},
- {CHARACTER, 0, 109, 193, CHARACTER},
- {ASM, 0, 0, 0, CHARACTER},
- {CHARACTER, 0, 105, 195, CHARACTER},
- {CHARACTER, 0, 110, 196, CHARACTER},
- {CHARACTER, 0, 103, 197, CHARACTER},
- {USING, 0, 0, 0, CHARACTER},
- {CHARACTER, 32, 0, 0, CHARACTER},
- {CHARACTER, 0, 105, 200, CHARACTER},
- {CHARACTER, 0, 110, 201, CHARACTER},
- {CHARACTER, 0, 101, 202, CHARACTER},
- {INLINE, 0, 0, 0, CHARACTER},
- {CHARACTER, 0, 105, 204, CHARACTER},
- {CHARACTER, 0, 99, 205, CHARACTER},
- {CHARACTER, 0, 105, 206, CHARACTER},
- {CHARACTER, 0, 116, 207, CHARACTER},
- {EXPLICIT, 0, 0, 0, CHARACTER},
- {CHARACTER, 33, 0, 0, CHARACTER},
- {CHARACTER, 0, 97, 210, CHARACTER},
- {CHARACTER, 0, 116, 211, CHARACTER},
- {CHARACTER, 0, 105, 212, CHARACTER},
- {CHARACTER, 0, 108, 213, CHARACTER},
- {CHARACTER, 0, 101, 214, CHARACTER},
- {VOLATILE, 0, 0, 0, CHARACTER},
- {CHARACTER, 0, 101, 216, CHARACTER},
- {CHARACTER, 0, 114, 217, CHARACTER},
- {CHARACTER, 0, 97, 218, CHARACTER},
- {CHARACTER, 0, 116, 219, CHARACTER},
- {CHARACTER, 0, 111, 220, CHARACTER},
- {CHARACTER, 0, 114, 221, CHARACTER},
- {OPERATOR, 0, 0, 0, CHARACTER},
- {CHARACTER, 34, 0, 0, CHARACTER},
- {CHARACTER, 0, 101, 224, CHARACTER},
- {CHARACTER, 0, 111, 225, CHARACTER},
- {CHARACTER, 0, 102, 226, CHARACTER},
- {SIZEOF, 0, 0, 0, CHARACTER},
- {CHARACTER, 0, 119, 228, CHARACTER},
- {NEW, 0, 0, 0, CHARACTER},
- {CHARACTER, 35, 0, 0, CHARACTER},
- {CHARACTER, 0, 101, 231, CHARACTER},
- {CHARACTER, 0, 116, 232, CHARACTER},
- {CHARACTER, 0, 101, 233, CHARACTER},
- {DELETE, 0, 0, 0, CHARACTER},
- {PLUS, 36, 0, 0, NOTOKEN},
- {MINUS, 37, 0, 0, NOTOKEN},
- {STAR, 0, 61, 257, NOTOKEN},
- {SLASH, 38, 0, 0, NOTOKEN},
- {HAT, 0, 61, 260, NOTOKEN},
- {AND, 39, 0, 0, NOTOKEN},
- {CHARACTER, 0, 116, 241, CHARACTER},
- {CHARACTER, 40, 0, 0, CHARACTER},
- {CHARACTER, 0, 110, 243, CHARACTER},
- {CHARACTER, 0, 100, 244, CHARACTER},
- {AND, 0, 0, 0, CHARACTER},
- {OR, 41, 0, 0, NOTOKEN},
- {CHARACTER, 0, 114, 247, CHARACTER},
- {OR, 0, 0, 0, CHARACTER},
- {TILDE, 0, 0, 0, NOTOKEN},
- {CHARACTER, 0, 112, 250, CHARACTER},
- {CHARACTER, 0, 108, 251, CHARACTER},
- {TILDE, 0, 0, 0, CHARACTER},
- {NOT, 0, 61, 268, NOTOKEN},
- {CHARACTER, 0, 116, 254, CHARACTER},
- {NOT, 0, 95, 269, CHARACTER},
- {PLUS_EQ, 0, 0, 0, NOTOKEN},
- {MINUS_EQ, 0, 0, 0, NOTOKEN},
- {STAR_EQ, 0, 0, 0, NOTOKEN},
- {SLASH_EQ, 0, 0, 0, NOTOKEN},
- {PERCENT_EQ, 0, 0, 0, NOTOKEN},
- {HAT_EQ, 0, 0, 0, NOTOKEN},
- {AND_EQ, 0, 0, 0, NOTOKEN},
- {OR_EQ, 0, 0, 0, NOTOKEN},
- {LTLT, 0, 61, 266, NOTOKEN},
- {GTGT, 0, 61, 265, NOTOKEN},
- {GTGT_EQ, 0, 0, 0, NOTOKEN},
- {LTLT_EQ, 0, 0, 0, NOTOKEN},
- {EQEQ, 0, 0, 0, NOTOKEN},
- {NE, 0, 0, 0, NOTOKEN},
- {CHARACTER, 0, 101, 270, CHARACTER},
- {CHARACTER, 0, 113, 271, CHARACTER},
- {NE, 0, 0, 0, CHARACTER},
- {LE, 0, 0, 0, NOTOKEN},
- {GE, 0, 0, 0, NOTOKEN},
- {ANDAND, 0, 0, 0, NOTOKEN},
- {OROR, 0, 0, 0, NOTOKEN},
- {INCR, 0, 0, 0, NOTOKEN},
- {DECR, 0, 0, 0, NOTOKEN},
- {ARROW, 0, 42, 279, NOTOKEN},
- {ARROW_STAR, 0, 0, 0, NOTOKEN},
- {CHARACTER, 0, 97, 281, CHARACTER},
- {CHARACTER, 0, 114, 282, CHARACTER},
- {CHAR, 0, 0, 0, CHARACTER},
- {CHARACTER, 0, 104, 284, CHARACTER},
- {CHARACTER, 0, 97, 285, CHARACTER},
- {CHARACTER, 0, 114, 286, CHARACTER},
- {WCHAR, 0, 0, 0, CHARACTER},
- {CHARACTER, 0, 111, 288, CHARACTER},
- {CHARACTER, 0, 108, 289, CHARACTER},
- {BOOL, 0, 0, 0, CHARACTER},
- {CHARACTER, 0, 111, 291, CHARACTER},
- {CHARACTER, 0, 114, 292, CHARACTER},
- {CHARACTER, 0, 116, 293, CHARACTER},
- {SHORT, 0, 0, 0, CHARACTER},
- {INT, 0, 0, 0, CHARACTER},
- {CHARACTER, 0, 110, 296, CHARACTER},
- {CHARACTER, 0, 103, 297, CHARACTER},
- {LONG, 0, 0, 0, CHARACTER},
- {CHARACTER, 0, 110, 299, CHARACTER},
- {CHARACTER, 42, 0, 0, CHARACTER},
- {CHARACTER, 0, 100, 301, CHARACTER},
- {SIGNED, 0, 0, 0, CHARACTER},
- {CHARACTER, 0, 105, 303, CHARACTER},
- {CHARACTER, 0, 103, 304, CHARACTER},
- {CHARACTER, 0, 110, 305, CHARACTER},
- {CHARACTER, 0, 101, 306, CHARACTER},
- {CHARACTER, 0, 100, 307, CHARACTER},
- {UNSIGNED, 0, 0, 0, CHARACTER},
- {CHARACTER, 0, 111, 309, CHARACTER},
- {CHARACTER, 0, 97, 310, CHARACTER},
- {CHARACTER, 0, 116, 311, CHARACTER},
- {FLOAT, 0, 0, 0, CHARACTER},
- {DO, 0, 117, 313, CHARACTER},
- {CHARACTER, 0, 98, 314, CHARACTER},
- {CHARACTER, 0, 108, 315, CHARACTER},
- {CHARACTER, 0, 101, 316, CHARACTER},
- {DOUBLE, 0, 0, 0, CHARACTER},
- {CHARACTER, 0, 100, 318, CHARACTER},
- {VOID, 0, 0, 0, CHARACTER},
- {CHARACTER, 0, 101, 320, CHARACTER},
- {CASE, 0, 0, 0, CHARACTER},
- {CHARACTER, 0, 97, 322, CHARACTER},
- {CHARACTER, 0, 117, 323, CHARACTER},
- {CHARACTER, 0, 108, 324, CHARACTER},
- {CHARACTER, 0, 116, 325, CHARACTER},
- {DEFAULT, 0, 0, 0, CHARACTER},
- {IF, 0, 0, 0, CHARACTER},
- {CHARACTER, 0, 115, 328, CHARACTER},
- {CHARACTER, 0, 101, 329, CHARACTER},
- {ELSE, 0, 0, 0, CHARACTER},
- {CHARACTER, 0, 105, 331, CHARACTER},
- {CHARACTER, 0, 116, 332, CHARACTER},
- {CHARACTER, 0, 99, 333, CHARACTER},
- {CHARACTER, 0, 104, 334, CHARACTER},
- {SWITCH, 0, 0, 0, CHARACTER},
- {CHARACTER, 0, 105, 336, CHARACTER},
- {CHARACTER, 0, 108, 337, CHARACTER},
- {CHARACTER, 0, 101, 338, CHARACTER},
- {WHILE, 0, 0, 0, CHARACTER},
- {CHARACTER, 0, 114, 340, CHARACTER},
- {FOR, 0, 0, 0, CHARACTER},
- {CHARACTER, 0, 101, 342, CHARACTER},
- {CHARACTER, 0, 97, 343, CHARACTER},
- {CHARACTER, 0, 107, 344, CHARACTER},
- {BREAK, 0, 0, 0, CHARACTER},
- {CHARACTER, 0, 105, 346, CHARACTER},
- {CHARACTER, 0, 110, 347, CHARACTER},
- {CHARACTER, 0, 117, 348, CHARACTER},
- {CHARACTER, 0, 101, 349, CHARACTER},
- {CONTINUE, 0, 0, 0, CHARACTER},
- {CHARACTER, 0, 116, 351, CHARACTER},
- {CHARACTER, 0, 111, 352, CHARACTER},
- {GOTO, 0, 0, 0, CHARACTER},
- {CHARACTER, 0, 117, 354, CHARACTER},
- {CHARACTER, 0, 114, 355, CHARACTER},
- {CHARACTER, 0, 110, 356, CHARACTER},
- {RETURN, 0, 0, 0, CHARACTER},
- {CHARACTER, 43, 0, 0, CHARACTER},
- {CHARACTER, 0, 66, 359, CHARACTER},
- {CHARACTER, 0, 74, 360, CHARACTER},
- {CHARACTER, 0, 69, 361, CHARACTER},
- {CHARACTER, 0, 67, 362, CHARACTER},
- {CHARACTER, 0, 84, 363, CHARACTER},
- {Q_OBJECT_TOKEN, 0, 0, 0, CHARACTER},
- {CHARACTER, 0, 65, 365, CHARACTER},
- {CHARACTER, 0, 77, 366, CHARACTER},
- {CHARACTER, 0, 69, 367, CHARACTER},
- {CHARACTER, 0, 83, 368, CHARACTER},
- {CHARACTER, 0, 80, 369, CHARACTER},
- {CHARACTER, 0, 65, 370, CHARACTER},
- {CHARACTER, 0, 67, 371, CHARACTER},
- {CHARACTER, 0, 69, 372, CHARACTER},
- {Q_NAMESPACE_TOKEN, 0, 0, 0, CHARACTER},
- {CHARACTER, 0, 65, 374, CHARACTER},
- {CHARACTER, 0, 68, 375, CHARACTER},
- {CHARACTER, 0, 71, 376, CHARACTER},
- {CHARACTER, 0, 69, 377, CHARACTER},
- {CHARACTER, 0, 84, 378, CHARACTER},
- {Q_GADGET_TOKEN, 0, 0, 0, CHARACTER},
- {CHARACTER, 44, 0, 0, CHARACTER},
- {CHARACTER, 45, 0, 0, CHARACTER},
- {CHARACTER, 0, 80, 382, CHARACTER},
- {CHARACTER, 0, 69, 383, CHARACTER},
- {CHARACTER, 0, 82, 384, CHARACTER},
- {CHARACTER, 0, 84, 385, CHARACTER},
- {CHARACTER, 0, 89, 386, CHARACTER},
- {Q_PROPERTY_TOKEN, 0, 0, 0, CHARACTER},
- {CHARACTER, 0, 85, 388, CHARACTER},
- {CHARACTER, 0, 71, 389, CHARACTER},
- {CHARACTER, 0, 73, 390, CHARACTER},
- {CHARACTER, 0, 78, 391, CHARACTER},
- {CHARACTER, 0, 95, 392, CHARACTER},
- {CHARACTER, 0, 77, 393, CHARACTER},
- {CHARACTER, 0, 69, 394, CHARACTER},
- {CHARACTER, 0, 84, 395, CHARACTER},
- {CHARACTER, 0, 65, 396, CHARACTER},
- {CHARACTER, 0, 68, 397, CHARACTER},
- {CHARACTER, 0, 65, 398, CHARACTER},
- {CHARACTER, 0, 84, 399, CHARACTER},
- {CHARACTER, 0, 65, 400, CHARACTER},
- {Q_PLUGIN_METADATA_TOKEN, 0, 0, 0, CHARACTER},
- {CHARACTER, 0, 78, 402, CHARACTER},
- {CHARACTER, 0, 85, 403, CHARACTER},
- {CHARACTER, 0, 77, 404, CHARACTER},
- {Q_ENUM_TOKEN, 46, 0, 0, CHARACTER},
- {Q_ENUMS_TOKEN, 0, 0, 0, CHARACTER},
- {CHARACTER, 0, 78, 407, CHARACTER},
- {CHARACTER, 0, 83, 408, CHARACTER},
- {Q_ENUM_NS_TOKEN, 0, 0, 0, CHARACTER},
- {CHARACTER, 0, 76, 410, CHARACTER},
- {CHARACTER, 0, 65, 411, CHARACTER},
- {CHARACTER, 0, 71, 412, CHARACTER},
- {Q_FLAG_TOKEN, 47, 0, 0, CHARACTER},
- {Q_FLAGS_TOKEN, 0, 0, 0, CHARACTER},
- {CHARACTER, 0, 78, 415, CHARACTER},
- {CHARACTER, 0, 83, 416, CHARACTER},
- {Q_FLAG_NS_TOKEN, 0, 0, 0, CHARACTER},
- {CHARACTER, 0, 69, 418, CHARACTER},
- {CHARACTER, 0, 67, 419, CHARACTER},
- {CHARACTER, 0, 76, 420, CHARACTER},
- {CHARACTER, 0, 65, 421, CHARACTER},
- {CHARACTER, 0, 82, 422, CHARACTER},
- {CHARACTER, 0, 69, 423, CHARACTER},
- {CHARACTER, 0, 95, 424, CHARACTER},
- {CHARACTER, 48, 0, 0, CHARACTER},
- {CHARACTER, 0, 76, 426, CHARACTER},
- {CHARACTER, 0, 65, 427, CHARACTER},
- {CHARACTER, 0, 71, 428, CHARACTER},
- {CHARACTER, 0, 83, 429, CHARACTER},
- {Q_DECLARE_FLAGS_TOKEN, 0, 0, 0, CHARACTER},
- {CHARACTER, 0, 78, 431, CHARACTER},
- {CHARACTER, 0, 84, 432, CHARACTER},
- {CHARACTER, 0, 69, 433, CHARACTER},
- {CHARACTER, 0, 82, 434, CHARACTER},
- {CHARACTER, 0, 70, 435, CHARACTER},
- {CHARACTER, 0, 65, 436, CHARACTER},
- {CHARACTER, 0, 67, 437, CHARACTER},
- {CHARACTER, 0, 69, 438, CHARACTER},
- {Q_DECLARE_INTERFACE_TOKEN, 0, 0, 0, CHARACTER},
- {CHARACTER, 0, 69, 440, CHARACTER},
- {CHARACTER, 0, 84, 441, CHARACTER},
- {CHARACTER, 0, 65, 442, CHARACTER},
- {CHARACTER, 0, 84, 443, CHARACTER},
- {CHARACTER, 0, 89, 444, CHARACTER},
- {CHARACTER, 0, 80, 445, CHARACTER},
- {CHARACTER, 0, 69, 446, CHARACTER},
- {Q_DECLARE_METATYPE_TOKEN, 0, 0, 0, CHARACTER},
- {CHARACTER, 0, 88, 448, CHARACTER},
- {CHARACTER, 0, 84, 449, CHARACTER},
- {CHARACTER, 0, 69, 450, CHARACTER},
- {CHARACTER, 0, 78, 451, CHARACTER},
- {CHARACTER, 0, 83, 452, CHARACTER},
- {CHARACTER, 0, 73, 453, CHARACTER},
- {CHARACTER, 0, 79, 454, CHARACTER},
- {CHARACTER, 0, 78, 455, CHARACTER},
- {CHARACTER, 0, 95, 456, CHARACTER},
- {CHARACTER, 0, 73, 457, CHARACTER},
- {CHARACTER, 0, 78, 458, CHARACTER},
- {CHARACTER, 0, 84, 459, CHARACTER},
- {CHARACTER, 0, 69, 460, CHARACTER},
- {CHARACTER, 0, 82, 461, CHARACTER},
- {CHARACTER, 0, 70, 462, CHARACTER},
- {CHARACTER, 0, 65, 463, CHARACTER},
- {CHARACTER, 0, 67, 464, CHARACTER},
- {CHARACTER, 0, 69, 438, CHARACTER},
- {CHARACTER, 49, 0, 0, CHARACTER},
- {CHARACTER, 0, 84, 467, CHARACTER},
- {CHARACTER, 0, 83, 413, CHARACTER},
- {CHARACTER, 0, 76, 469, CHARACTER},
- {CHARACTER, 0, 65, 470, CHARACTER},
- {CHARACTER, 0, 83, 471, CHARACTER},
- {CHARACTER, 0, 83, 472, CHARACTER},
- {CHARACTER, 0, 73, 473, CHARACTER},
- {CHARACTER, 0, 78, 474, CHARACTER},
- {CHARACTER, 0, 70, 475, CHARACTER},
- {CHARACTER, 0, 79, 476, CHARACTER},
- {Q_CLASSINFO_TOKEN, 0, 0, 0, CHARACTER},
- {CHARACTER, 0, 78, 478, CHARACTER},
- {CHARACTER, 50, 0, 0, CHARACTER},
- {CHARACTER, 0, 69, 480, CHARACTER},
- {CHARACTER, 0, 82, 481, CHARACTER},
- {CHARACTER, 0, 70, 482, CHARACTER},
- {CHARACTER, 0, 65, 483, CHARACTER},
- {CHARACTER, 0, 67, 484, CHARACTER},
- {CHARACTER, 0, 69, 485, CHARACTER},
- {CHARACTER, 0, 83, 486, CHARACTER},
- {Q_INTERFACES_TOKEN, 0, 0, 0, CHARACTER},
- {CHARACTER, 0, 108, 488, CHARACTER},
- {CHARACTER, 0, 115, 489, CHARACTER},
- {SIGNALS, 0, 0, 0, CHARACTER},
- {CHARACTER, 0, 111, 491, CHARACTER},
- {CHARACTER, 0, 116, 492, CHARACTER},
- {CHARACTER, 0, 115, 493, CHARACTER},
- {SLOTS, 0, 0, 0, CHARACTER},
- {CHARACTER, 0, 71, 495, CHARACTER},
- {CHARACTER, 0, 78, 496, CHARACTER},
- {CHARACTER, 0, 65, 497, CHARACTER},
- {CHARACTER, 0, 76, 498, CHARACTER},
- {Q_SIGNAL_TOKEN, 0, 83, 499, CHARACTER},
- {Q_SIGNALS_TOKEN, 0, 0, 0, CHARACTER},
- {CHARACTER, 0, 79, 501, CHARACTER},
- {CHARACTER, 0, 84, 502, CHARACTER},
- {Q_SLOT_TOKEN, 0, 83, 503, CHARACTER},
- {Q_SLOTS_TOKEN, 0, 0, 0, CHARACTER},
- {CHARACTER, 0, 86, 505, CHARACTER},
- {CHARACTER, 0, 65, 506, CHARACTER},
- {CHARACTER, 0, 84, 507, CHARACTER},
- {CHARACTER, 0, 69, 508, CHARACTER},
- {CHARACTER, 0, 95, 509, CHARACTER},
- {CHARACTER, 51, 0, 0, CHARACTER},
- {CHARACTER, 0, 76, 511, CHARACTER},
- {CHARACTER, 0, 79, 512, CHARACTER},
- {CHARACTER, 0, 84, 513, CHARACTER},
- {Q_PRIVATE_SLOT_TOKEN, 0, 0, 0, CHARACTER},
- {CHARACTER, 0, 95, 515, CHARACTER},
- {CHARACTER, 0, 77, 516, CHARACTER},
- {CHARACTER, 0, 79, 517, CHARACTER},
- {CHARACTER, 0, 67, 518, CHARACTER},
- {CHARACTER, 0, 95, 519, CHARACTER},
- {CHARACTER, 0, 67, 520, CHARACTER},
- {CHARACTER, 0, 79, 521, CHARACTER},
- {CHARACTER, 0, 77, 522, CHARACTER},
- {CHARACTER, 0, 80, 523, CHARACTER},
- {CHARACTER, 0, 65, 524, CHARACTER},
- {CHARACTER, 0, 84, 525, CHARACTER},
- {Q_MOC_COMPAT_TOKEN, 0, 0, 0, CHARACTER},
- {CHARACTER, 0, 79, 527, CHARACTER},
- {CHARACTER, 0, 75, 528, CHARACTER},
- {CHARACTER, 0, 65, 529, CHARACTER},
- {CHARACTER, 0, 66, 530, CHARACTER},
- {CHARACTER, 0, 76, 531, CHARACTER},
- {CHARACTER, 0, 69, 532, CHARACTER},
- {Q_INVOKABLE_TOKEN, 0, 0, 0, CHARACTER},
- {CHARACTER, 0, 82, 534, CHARACTER},
- {CHARACTER, 0, 73, 535, CHARACTER},
- {CHARACTER, 0, 80, 536, CHARACTER},
- {CHARACTER, 0, 84, 537, CHARACTER},
- {CHARACTER, 0, 65, 538, CHARACTER},
- {CHARACTER, 0, 66, 539, CHARACTER},
- {CHARACTER, 0, 76, 540, CHARACTER},
- {CHARACTER, 0, 69, 541, CHARACTER},
- {Q_SCRIPTABLE_TOKEN, 0, 0, 0, CHARACTER},
- {CHARACTER, 0, 82, 543, CHARACTER},
- {CHARACTER, 0, 79, 544, CHARACTER},
- {CHARACTER, 0, 80, 545, CHARACTER},
- {CHARACTER, 0, 69, 546, CHARACTER},
- {CHARACTER, 0, 82, 547, CHARACTER},
- {CHARACTER, 0, 84, 548, CHARACTER},
- {CHARACTER, 0, 89, 549, CHARACTER},
- {Q_PRIVATE_PROPERTY_TOKEN, 0, 0, 0, CHARACTER},
- {CHARACTER, 0, 69, 551, CHARACTER},
- {CHARACTER, 0, 86, 552, CHARACTER},
- {CHARACTER, 0, 73, 553, CHARACTER},
- {CHARACTER, 0, 83, 554, CHARACTER},
- {CHARACTER, 0, 73, 555, CHARACTER},
- {CHARACTER, 0, 79, 556, CHARACTER},
- {CHARACTER, 0, 78, 557, CHARACTER},
- {Q_REVISION_TOKEN, 0, 0, 0, CHARACTER},
- {NEWLINE, 0, 0, 0, NOTOKEN},
- {QUOTE, 0, 0, 0, NOTOKEN},
- {SINGLEQUOTE, 0, 0, 0, NOTOKEN},
- {WHITESPACE, 0, 0, 0, NOTOKEN},
- {HASH, 0, 35, 563, HASH},
- {PP_HASHHASH, 0, 0, 0, NOTOKEN},
- {BACKSLASH, 0, 0, 0, NOTOKEN},
- {CPP_COMMENT, 0, 0, 0, NOTOKEN},
- {C_COMMENT, 0, 0, 0, NOTOKEN},
- {FLOATING_LITERAL, 0, 0, 0, NOTOKEN}
-};
diff --git a/tools/repc/moc_copy/moc.cpp b/tools/repc/moc_copy/moc.cpp
deleted file mode 100644
index c1db8ec..0000000
--- a/tools/repc/moc_copy/moc.cpp
+++ /dev/null
@@ -1,1616 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Copyright (C) 2016 Olivier Goffart <ogoffart@woboq.com>
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the tools applications of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** 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 The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** 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-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "moc.h"
-#include "qdatetime.h"
-#include "utils.h"
-#include "outputrevision.h"
-#include <QtCore/qfile.h>
-#include <QtCore/qfileinfo.h>
-#include <QtCore/qdir.h>
-
-// for normalizeTypeInternal
-#include <private/qmetaobject_moc_p.h>
-
-QT_BEGIN_NAMESPACE
-
-// only moc needs this function
-static QByteArray normalizeType(const QByteArray &ba)
-{
- const char *s = ba.constData();
- int len = ba.size();
- char stackbuf[64];
- char *buf = (len >= 64 ? new char[len + 1] : stackbuf);
- char *d = buf;
- char last = 0;
- while(*s && is_space(*s))
- s++;
- while (*s) {
- while (*s && !is_space(*s))
- last = *d++ = *s++;
- while (*s && is_space(*s))
- s++;
- if (*s && ((is_ident_char(*s) && is_ident_char(last))
- || ((*s == ':') && (last == '<')))) {
- last = *d++ = ' ';
- }
- }
- *d = '\0';
- QByteArray result = normalizeTypeInternal(buf, d);
- if (buf != stackbuf)
- delete [] buf;
- return result;
-}
-
-bool Moc::parseClassHead(ClassDef *def)
-{
- // figure out whether this is a class declaration, or only a
- // forward or variable declaration.
- int i = 0;
- Token token;
- do {
- token = lookup(i++);
- if (token == COLON || token == LBRACE)
- break;
- if (token == SEMIC || token == RANGLE)
- return false;
- } while (token);
-
- if (!test(IDENTIFIER)) // typedef struct { ... }
- return false;
- QByteArray name = lexem();
-
- // support "class IDENT name" and "class IDENT(IDENT) name"
- // also support "class IDENT name (final|sealed|Q_DECL_FINAL)"
- if (test(LPAREN)) {
- until(RPAREN);
- if (!test(IDENTIFIER))
- return false;
- name = lexem();
- } else if (test(IDENTIFIER)) {
- const QByteArray lex = lexem();
- if (lex != "final" && lex != "sealed" && lex != "Q_DECL_FINAL")
- name = lex;
- }
-
- def->qualified += name;
- while (test(SCOPE)) {
- def->qualified += lexem();
- if (test(IDENTIFIER)) {
- name = lexem();
- def->qualified += name;
- }
- }
- def->classname = name;
-
- if (test(IDENTIFIER)) {
- const QByteArray lex = lexem();
- if (lex != "final" && lex != "sealed" && lex != "Q_DECL_FINAL")
- return false;
- }
-
- if (test(COLON)) {
- do {
- test(VIRTUAL);
- FunctionDef::Access access = FunctionDef::Public;
- if (test(PRIVATE))
- access = FunctionDef::Private;
- else if (test(PROTECTED))
- access = FunctionDef::Protected;
- else
- test(PUBLIC);
- test(VIRTUAL);
- const QByteArray type = parseType().name;
- // ignore the 'class Foo : BAR(Baz)' case
- if (test(LPAREN)) {
- until(RPAREN);
- } else {
- def->superclassList += qMakePair(type, access);
- }
- } while (test(COMMA));
-
- if (!def->superclassList.isEmpty()
- && knownGadgets.contains(def->superclassList.constFirst().first)) {
- // Q_GADGET subclasses are treated as Q_GADGETs
- knownGadgets.insert(def->classname, def->qualified);
- knownGadgets.insert(def->qualified, def->qualified);
- }
- }
- if (!test(LBRACE))
- return false;
- def->begin = index - 1;
- bool foundRBrace = until(RBRACE);
- def->end = index;
- index = def->begin + 1;
- return foundRBrace;
-}
-
-Type Moc::parseType()
-{
- Type type;
- bool hasSignedOrUnsigned = false;
- bool isVoid = false;
- type.firstToken = lookup();
- for (;;) {
- switch (next()) {
- case SIGNED:
- case UNSIGNED:
- hasSignedOrUnsigned = true;
- Q_FALLTHROUGH();
- case CONST:
- case VOLATILE:
- type.name += lexem();
- type.name += ' ';
- if (lookup(0) == VOLATILE)
- type.isVolatile = true;
- continue;
- case Q_MOC_COMPAT_TOKEN:
- case Q_INVOKABLE_TOKEN:
- case Q_SCRIPTABLE_TOKEN:
- case Q_SIGNALS_TOKEN:
- case Q_SLOTS_TOKEN:
- case Q_SIGNAL_TOKEN:
- case Q_SLOT_TOKEN:
- type.name += lexem();
- return type;
- case NOTOKEN:
- return type;
- default:
- prev();
- break;
- }
- break;
- }
- test(ENUM) || test(CLASS) || test(STRUCT);
- for(;;) {
- switch (next()) {
- case IDENTIFIER:
- // void mySlot(unsigned myArg)
- if (hasSignedOrUnsigned) {
- prev();
- break;
- }
- Q_FALLTHROUGH();
- case CHAR:
- case SHORT:
- case INT:
- case LONG:
- type.name += lexem();
- // preserve '[unsigned] long long', 'short int', 'long int', 'long double'
- if (test(LONG) || test(INT) || test(DOUBLE)) {
- type.name += ' ';
- prev();
- continue;
- }
- break;
- case FLOAT:
- case DOUBLE:
- case VOID:
- case BOOL:
- type.name += lexem();
- isVoid |= (lookup(0) == VOID);
- break;
- case NOTOKEN:
- return type;
- default:
- prev();
- ;
- }
- if (test(LANGLE)) {
- if (type.name.isEmpty()) {
- // '<' cannot start a type
- return type;
- }
- type.name += lexemUntil(RANGLE);
- }
- if (test(SCOPE)) {
- type.name += lexem();
- type.isScoped = true;
- } else {
- break;
- }
- }
- while (test(CONST) || test(VOLATILE) || test(SIGNED) || test(UNSIGNED)
- || test(STAR) || test(AND) || test(ANDAND)) {
- type.name += ' ';
- type.name += lexem();
- if (lookup(0) == AND)
- type.referenceType = Type::Reference;
- else if (lookup(0) == ANDAND)
- type.referenceType = Type::RValueReference;
- else if (lookup(0) == STAR)
- type.referenceType = Type::Pointer;
- }
- type.rawName = type.name;
- // transform stupid things like 'const void' or 'void const' into 'void'
- if (isVoid && type.referenceType == Type::NoReference) {
- type.name = "void";
- }
- return type;
-}
-
-bool Moc::parseEnum(EnumDef *def)
-{
- bool isTypdefEnum = false; // typedef enum { ... } Foo;
-
- if (test(CLASS))
- def->isEnumClass = true;
-
- if (test(IDENTIFIER)) {
- def->name = lexem();
- } else {
- if (lookup(-1) != TYPEDEF)
- return false; // anonymous enum
- isTypdefEnum = true;
- }
- if (test(COLON)) { // C++11 strongly typed enum
- // enum Foo : unsigned long { ... };
- parseType(); //ignore the result
- }
- if (!test(LBRACE))
- return false;
- do {
- if (lookup() == RBRACE) // accept trailing comma
- break;
- next(IDENTIFIER);
- def->values += lexem();
- } while (test(EQ) ? until(COMMA) : test(COMMA));
- next(RBRACE);
- if (isTypdefEnum) {
- if (!test(IDENTIFIER))
- return false;
- def->name = lexem();
- }
- return true;
-}
-
-void Moc::parseFunctionArguments(FunctionDef *def)
-{
- Q_UNUSED(def);
- while (hasNext()) {
- ArgumentDef arg;
- arg.type = parseType();
- if (arg.type.name == "void")
- break;
- if (test(IDENTIFIER))
- arg.name = lexem();
- while (test(LBRACK)) {
- arg.rightType += lexemUntil(RBRACK);
- }
- if (test(CONST) || test(VOLATILE)) {
- arg.rightType += ' ';
- arg.rightType += lexem();
- }
- arg.normalizedType = normalizeType(QByteArray(arg.type.name + ' ' + arg.rightType));
- arg.typeNameForCast = normalizeType(QByteArray(noRef(arg.type.name) + "(*)" + arg.rightType));
- if (test(EQ))
- arg.isDefault = true;
- def->arguments += arg;
- if (!until(COMMA))
- break;
- }
-
- if (!def->arguments.isEmpty()
- && def->arguments.constLast().normalizedType == "QPrivateSignal") {
- def->arguments.removeLast();
- def->isPrivateSignal = true;
- }
-}
-
-bool Moc::testFunctionAttribute(FunctionDef *def)
-{
- if (index < symbols.size() && testFunctionAttribute(symbols.at(index).token, def)) {
- ++index;
- return true;
- }
- return false;
-}
-
-bool Moc::testFunctionAttribute(Token tok, FunctionDef *def)
-{
- switch (tok) {
- case Q_MOC_COMPAT_TOKEN:
- def->isCompat = true;
- return true;
- case Q_INVOKABLE_TOKEN:
- def->isInvokable = true;
- return true;
- case Q_SIGNAL_TOKEN:
- def->isSignal = true;
- return true;
- case Q_SLOT_TOKEN:
- def->isSlot = true;
- return true;
- case Q_SCRIPTABLE_TOKEN:
- def->isInvokable = def->isScriptable = true;
- return true;
- default: break;
- }
- return false;
-}
-
-bool Moc::testFunctionRevision(FunctionDef *def)
-{
- if (test(Q_REVISION_TOKEN)) {
- next(LPAREN);
- QByteArray revision = lexemUntil(RPAREN);
- revision.remove(0, 1);
- revision.chop(1);
- bool ok = false;
- def->revision = revision.toInt(&ok);
- if (!ok || def->revision < 0)
- error("Invalid revision");
- return true;
- }
-
- return false;
-}
-
-// returns false if the function should be ignored
-bool Moc::parseFunction(FunctionDef *def, bool inMacro)
-{
- def->isVirtual = false;
- def->isStatic = false;
- //skip modifiers and attributes
- while (test(INLINE) || (test(STATIC) && (def->isStatic = true) == true) ||
- (test(VIRTUAL) && (def->isVirtual = true) == true) //mark as virtual
- || testFunctionAttribute(def) || testFunctionRevision(def)) {}
- bool templateFunction = (lookup() == TEMPLATE);
- def->type = parseType();
- if (def->type.name.isEmpty()) {
- if (templateFunction)
- error("Template function as signal or slot");
- else
- error();
- }
- bool scopedFunctionName = false;
- if (test(LPAREN)) {
- def->name = def->type.name;
- scopedFunctionName = def->type.isScoped;
- def->type = Type("int");
- } else {
- Type tempType = parseType();;
- while (!tempType.name.isEmpty() && lookup() != LPAREN) {
- if (testFunctionAttribute(def->type.firstToken, def))
- ; // fine
- else if (def->type.firstToken == Q_SIGNALS_TOKEN)
- error();
- else if (def->type.firstToken == Q_SLOTS_TOKEN)
- error();
- else {
- if (!def->tag.isEmpty())
- def->tag += ' ';
- def->tag += def->type.name;
- }
- def->type = tempType;
- tempType = parseType();
- }
- next(LPAREN, "Not a signal or slot declaration");
- def->name = tempType.name;
- scopedFunctionName = tempType.isScoped;
- }
-
- // we don't support references as return types, it's too dangerous
- if (def->type.referenceType == Type::Reference) {
- QByteArray rawName = def->type.rawName;
- def->type = Type("void");
- def->type.rawName = rawName;
- }
-
- def->normalizedType = normalizeType(def->type.name);
-
- if (!test(RPAREN)) {
- parseFunctionArguments(def);
- next(RPAREN);
- }
-
- // support optional macros with compiler specific options
- while (test(IDENTIFIER))
- ;
-
- def->isConst = test(CONST);
-
- while (test(IDENTIFIER))
- ;
-
- if (inMacro) {
- next(RPAREN);
- prev();
- } else {
- if (test(THROW)) {
- next(LPAREN);
- until(RPAREN);
- }
- if (test(SEMIC))
- ;
- else if ((def->inlineCode = test(LBRACE)))
- until(RBRACE);
- else if ((def->isAbstract = test(EQ)))
- until(SEMIC);
- else
- error();
- }
-
- if (scopedFunctionName) {
- const QByteArray msg = "Function declaration " + def->name
- + " contains extra qualification. Ignoring as signal or slot.";
- warning(msg.constData());
- return false;
- }
- return true;
-}
-
-// like parseFunction, but never aborts with an error
-bool Moc::parseMaybeFunction(const ClassDef *cdef, FunctionDef *def)
-{
- def->isVirtual = false;
- def->isStatic = false;
- //skip modifiers and attributes
- while (test(EXPLICIT) || test(INLINE) || (test(STATIC) && (def->isStatic = true) == true) ||
- (test(VIRTUAL) && (def->isVirtual = true) == true) //mark as virtual
- || testFunctionAttribute(def) || testFunctionRevision(def)) {}
- bool tilde = test(TILDE);
- def->type = parseType();
- if (def->type.name.isEmpty())
- return false;
- bool scopedFunctionName = false;
- if (test(LPAREN)) {
- def->name = def->type.name;
- scopedFunctionName = def->type.isScoped;
- if (def->name == cdef->classname) {
- def->isDestructor = tilde;
- def->isConstructor = !tilde;
- def->type = Type();
- } else {
- def->type = Type("int");
- }
- } else {
- Type tempType = parseType();;
- while (!tempType.name.isEmpty() && lookup() != LPAREN) {
- if (testFunctionAttribute(def->type.firstToken, def))
- ; // fine
- else if (def->type.name == "Q_SIGNAL")
- def->isSignal = true;
- else if (def->type.name == "Q_SLOT")
- def->isSlot = true;
- else {
- if (!def->tag.isEmpty())
- def->tag += ' ';
- def->tag += def->type.name;
- }
- def->type = tempType;
- tempType = parseType();
- }
- if (!test(LPAREN))
- return false;
- def->name = tempType.name;
- scopedFunctionName = tempType.isScoped;
- }
-
- // we don't support references as return types, it's too dangerous
- if (def->type.referenceType == Type::Reference) {
- QByteArray rawName = def->type.rawName;
- def->type = Type("void");
- def->type.rawName = rawName;
- }
-
- def->normalizedType = normalizeType(def->type.name);
-
- if (!test(RPAREN)) {
- parseFunctionArguments(def);
- if (!test(RPAREN))
- return false;
- }
- def->isConst = test(CONST);
- if (scopedFunctionName
- && (def->isSignal || def->isSlot || def->isInvokable)) {
- const QByteArray msg = "parsemaybe: Function declaration " + def->name
- + " contains extra qualification. Ignoring as signal or slot.";
- warning(msg.constData());
- return false;
- }
- return true;
-}
-
-void Moc::parse()
-{
- QVector<NamespaceDef> namespaceList;
- bool templateClass = false;
- while (hasNext()) {
- Token t = next();
- switch (t) {
- case NAMESPACE: {
- int rewind = index;
- if (test(IDENTIFIER)) {
- QByteArray nsName = lexem();
- QByteArrayList nested;
- while (test(SCOPE)) {
- next(IDENTIFIER);
- nested.append(nsName);
- nsName = lexem();
- }
- if (test(EQ)) {
- // namespace Foo = Bar::Baz;
- until(SEMIC);
- } else if (!test(SEMIC)) {
- NamespaceDef def;
- def.classname = nsName;
-
- next(LBRACE);
- def.begin = index - 1;
- until(RBRACE);
- def.end = index;
- index = def.begin + 1;
-
- const bool parseNamespace = currentFilenames.size() <= 1;
- if (parseNamespace) {
- for (int i = namespaceList.size() - 1; i >= 0; --i) {
- if (inNamespace(&namespaceList.at(i))) {
- def.qualified.prepend(namespaceList.at(i).classname + "::");
- }
- }
- for (const QByteArray &ns : nested) {
- NamespaceDef parentNs;
- parentNs.classname = ns;
- parentNs.qualified = def.qualified;
- def.qualified += ns + "::";
- parentNs.begin = def.begin;
- parentNs.end = def.end;
- namespaceList += parentNs;
- }
- }
-
- while (parseNamespace && inNamespace(&def) && hasNext()) {
- switch (next()) {
- case NAMESPACE:
- if (test(IDENTIFIER)) {
- while (test(SCOPE))
- next(IDENTIFIER);
- if (test(EQ)) {
- // namespace Foo = Bar::Baz;
- until(SEMIC);
- } else if (!test(SEMIC)) {
- until(RBRACE);
- }
- }
- break;
- case Q_NAMESPACE_TOKEN:
- def.hasQNamespace = true;
- break;
- case Q_ENUMS_TOKEN:
- case Q_ENUM_NS_TOKEN:
- parseEnumOrFlag(&def, false);
- break;
- case Q_ENUM_TOKEN:
- error("Q_ENUM can't be used in a Q_NAMESPACE, use Q_ENUM_NS instead");
- break;
- case Q_FLAGS_TOKEN:
- case Q_FLAG_NS_TOKEN:
- parseEnumOrFlag(&def, true);
- break;
- case Q_FLAG_TOKEN:
- error("Q_FLAG can't be used in a Q_NAMESPACE, use Q_FLAG_NS instead");
- break;
- case Q_DECLARE_FLAGS_TOKEN:
- parseFlag(&def);
- break;
- case Q_CLASSINFO_TOKEN:
- parseClassInfo(&def);
- break;
- case ENUM: {
- EnumDef enumDef;
- if (parseEnum(&enumDef))
- def.enumList += enumDef;
- } break;
- case CLASS:
- case STRUCT: {
- ClassDef classdef;
- if (!parseClassHead(&classdef))
- continue;
- while (inClass(&classdef) && hasNext())
- next(); // consume all Q_XXXX macros from this class
- } break;
- default: break;
- }
- }
- namespaceList += def;
- index = rewind;
- if (!def.hasQNamespace && (!def.classInfoList.isEmpty() || !def.enumDeclarations.isEmpty()))
- error("Namespace declaration lacks Q_NAMESPACE macro.");
- }
- }
- break;
- }
- case SEMIC:
- case RBRACE:
- templateClass = false;
- break;
- case TEMPLATE:
- templateClass = true;
- break;
- case MOC_INCLUDE_BEGIN:
- currentFilenames.push(symbol().unquotedLexem());
- break;
- case MOC_INCLUDE_END:
- currentFilenames.pop();
- break;
- case Q_DECLARE_INTERFACE_TOKEN:
- parseDeclareInterface();
- break;
- case Q_DECLARE_METATYPE_TOKEN:
- parseDeclareMetatype();
- break;
- case USING:
- if (test(NAMESPACE)) {
- while (test(SCOPE) || test(IDENTIFIER))
- ;
- next(SEMIC);
- }
- break;
- case CLASS:
- case STRUCT: {
- if (currentFilenames.size() <= 1)
- break;
-
- ClassDef def;
- if (!parseClassHead(&def))
- continue;
-
- while (inClass(&def) && hasNext()) {
- switch (next()) {
- case Q_OBJECT_TOKEN:
- def.hasQObject = true;
- break;
- case Q_GADGET_TOKEN:
- def.hasQGadget = true;
- break;
- default: break;
- }
- }
-
- if (!def.hasQObject && !def.hasQGadget)
- continue;
-
- for (int i = namespaceList.size() - 1; i >= 0; --i)
- if (inNamespace(&namespaceList.at(i)))
- def.qualified.prepend(namespaceList.at(i).classname + "::");
-
- QHash<QByteArray, QByteArray> &classHash = def.hasQObject ? knownQObjectClasses : knownGadgets;
- classHash.insert(def.classname, def.qualified);
- classHash.insert(def.qualified, def.qualified);
-
- continue; }
- default: break;
- }
- if ((t != CLASS && t != STRUCT)|| currentFilenames.size() > 1)
- continue;
- ClassDef def;
- if (parseClassHead(&def)) {
- FunctionDef::Access access = FunctionDef::Private;
- for (int i = namespaceList.size() - 1; i >= 0; --i)
- if (inNamespace(&namespaceList.at(i)))
- def.qualified.prepend(namespaceList.at(i).classname + "::");
- while (inClass(&def) && hasNext()) {
- switch ((t = next())) {
- case PRIVATE:
- access = FunctionDef::Private;
- if (test(Q_SIGNALS_TOKEN))
- error("Signals cannot have access specifier");
- break;
- case PROTECTED:
- access = FunctionDef::Protected;
- if (test(Q_SIGNALS_TOKEN))
- error("Signals cannot have access specifier");
- break;
- case PUBLIC:
- access = FunctionDef::Public;
- if (test(Q_SIGNALS_TOKEN))
- error("Signals cannot have access specifier");
- break;
- case CLASS: {
- ClassDef nestedDef;
- if (parseClassHead(&nestedDef)) {
- while (inClass(&nestedDef) && inClass(&def)) {
- t = next();
- if (t >= Q_META_TOKEN_BEGIN && t < Q_META_TOKEN_END)
- error("Meta object features not supported for nested classes");
- }
- }
- } break;
- case Q_SIGNALS_TOKEN:
- parseSignals(&def);
- break;
- case Q_SLOTS_TOKEN:
- switch (lookup(-1)) {
- case PUBLIC:
- case PROTECTED:
- case PRIVATE:
- parseSlots(&def, access);
- break;
- default:
- error("Missing access specifier for slots");
- }
- break;
- case Q_OBJECT_TOKEN:
- def.hasQObject = true;
- if (templateClass)
- error("Template classes not supported by Q_OBJECT");
- if (def.classname != "Qt" && def.classname != "QObject" && def.superclassList.isEmpty())
- error("Class contains Q_OBJECT macro but does not inherit from QObject");
- break;
- case Q_GADGET_TOKEN:
- def.hasQGadget = true;
- if (templateClass)
- error("Template classes not supported by Q_GADGET");
- break;
- case Q_PROPERTY_TOKEN:
- parseProperty(&def);
- break;
- case Q_PLUGIN_METADATA_TOKEN:
- parsePluginData(&def);
- break;
- case Q_ENUMS_TOKEN:
- case Q_ENUM_TOKEN:
- parseEnumOrFlag(&def, false);
- break;
- case Q_ENUM_NS_TOKEN:
- error("Q_ENUM_NS can't be used in a Q_OBJECT/Q_GADGET, use Q_ENUM instead");
- break;
- case Q_FLAGS_TOKEN:
- case Q_FLAG_TOKEN:
- parseEnumOrFlag(&def, true);
- break;
- case Q_FLAG_NS_TOKEN:
- error("Q_FLAG_NS can't be used in a Q_OBJECT/Q_GADGET, use Q_FLAG instead");
- break;
- case Q_DECLARE_FLAGS_TOKEN:
- parseFlag(&def);
- break;
- case Q_CLASSINFO_TOKEN:
- parseClassInfo(&def);
- break;
- case Q_INTERFACES_TOKEN:
- parseInterfaces(&def);
- break;
- case Q_PRIVATE_SLOT_TOKEN:
- parseSlotInPrivate(&def, access);
- break;
- case Q_PRIVATE_PROPERTY_TOKEN:
- parsePrivateProperty(&def);
- break;
- case ENUM: {
- EnumDef enumDef;
- if (parseEnum(&enumDef))
- def.enumList += enumDef;
- } break;
- case SEMIC:
- case COLON:
- break;
- default:
- FunctionDef funcDef;
- funcDef.access = access;
- int rewind = index--;
- if (parseMaybeFunction(&def, &funcDef)) {
- if (funcDef.isConstructor) {
- if ((access == FunctionDef::Public) && funcDef.isInvokable) {
- def.constructorList += funcDef;
- while (funcDef.arguments.size() > 0 && funcDef.arguments.constLast().isDefault) {
- funcDef.wasCloned = true;
- funcDef.arguments.removeLast();
- def.constructorList += funcDef;
- }
- }
- } else if (funcDef.isDestructor) {
- // don't care about destructors
- } else {
- if (access == FunctionDef::Public)
- def.publicList += funcDef;
- if (funcDef.isSlot) {
- def.slotList += funcDef;
- while (funcDef.arguments.size() > 0 && funcDef.arguments.constLast().isDefault) {
- funcDef.wasCloned = true;
- funcDef.arguments.removeLast();
- def.slotList += funcDef;
- }
- if (funcDef.revision > 0)
- ++def.revisionedMethods;
- } else if (funcDef.isSignal) {
- def.signalList += funcDef;
- while (funcDef.arguments.size() > 0 && funcDef.arguments.constLast().isDefault) {
- funcDef.wasCloned = true;
- funcDef.arguments.removeLast();
- def.signalList += funcDef;
- }
- if (funcDef.revision > 0)
- ++def.revisionedMethods;
- } else if (funcDef.isInvokable) {
- def.methodList += funcDef;
- while (funcDef.arguments.size() > 0 && funcDef.arguments.constLast().isDefault) {
- funcDef.wasCloned = true;
- funcDef.arguments.removeLast();
- def.methodList += funcDef;
- }
- if (funcDef.revision > 0)
- ++def.revisionedMethods;
- }
- }
- } else {
- index = rewind;
- }
- }
- }
-
- next(RBRACE);
-
- if (!def.hasQObject && !def.hasQGadget && def.signalList.isEmpty() && def.slotList.isEmpty()
- && def.propertyList.isEmpty() && def.enumDeclarations.isEmpty())
- continue; // no meta object code required
-
-
- if (!def.hasQObject && !def.hasQGadget)
- error("Class declaration lacks Q_OBJECT macro.");
-
- // Add meta tags to the plugin meta data:
- if (!def.pluginData.iid.isEmpty())
- def.pluginData.metaArgs = metaArgs;
-
- checkSuperClasses(&def);
- checkProperties(&def);
-
- classList += def;
- QHash<QByteArray, QByteArray> &classHash = def.hasQObject ? knownQObjectClasses : knownGadgets;
- classHash.insert(def.classname, def.qualified);
- classHash.insert(def.qualified, def.qualified);
- }
- }
- for (const auto &n : qAsConst(namespaceList)) {
- if (!n.hasQNamespace)
- continue;
- ClassDef def;
- static_cast<BaseDef &>(def) = static_cast<BaseDef>(n);
- def.qualified += def.classname;
- def.hasQGadget = true;
- auto it = std::find_if(classList.begin(), classList.end(), [&def](const ClassDef &val) {
- return def.classname == val.classname && def.qualified == val.qualified;
- });
-
- if (it != classList.end()) {
- it->classInfoList += def.classInfoList;
- it->enumDeclarations.insert(def.enumDeclarations);
- it->enumList += def.enumList;
- it->flagAliases.insert(def.flagAliases);
- } else {
- knownGadgets.insert(def.classname, def.qualified);
- knownGadgets.insert(def.qualified, def.qualified);
- classList += def;
- }
- }
-}
-
-void Moc::parseSlots(ClassDef *def, FunctionDef::Access access)
-{
- int defaultRevision = -1;
- if (test(Q_REVISION_TOKEN)) {
- next(LPAREN);
- QByteArray revision = lexemUntil(RPAREN);
- revision.remove(0, 1);
- revision.chop(1);
- bool ok = false;
- defaultRevision = revision.toInt(&ok);
- if (!ok || defaultRevision < 0)
- error("Invalid revision");
- }
-
- next(COLON);
- while (inClass(def) && hasNext()) {
- switch (next()) {
- case PUBLIC:
- case PROTECTED:
- case PRIVATE:
- case Q_SIGNALS_TOKEN:
- case Q_SLOTS_TOKEN:
- prev();
- return;
- case SEMIC:
- continue;
- case FRIEND:
- until(SEMIC);
- continue;
- case USING:
- error("'using' directive not supported in 'slots' section");
- default:
- prev();
- }
-
- FunctionDef funcDef;
- funcDef.access = access;
- if (!parseFunction(&funcDef))
- continue;
- if (funcDef.revision > 0) {
- ++def->revisionedMethods;
- } else if (defaultRevision != -1) {
- funcDef.revision = defaultRevision;
- ++def->revisionedMethods;
- }
- def->slotList += funcDef;
- while (funcDef.arguments.size() > 0 && funcDef.arguments.constLast().isDefault) {
- funcDef.wasCloned = true;
- funcDef.arguments.removeLast();
- def->slotList += funcDef;
- }
- }
-}
-
-void Moc::parseSignals(ClassDef *def)
-{
- int defaultRevision = -1;
- if (test(Q_REVISION_TOKEN)) {
- next(LPAREN);
- QByteArray revision = lexemUntil(RPAREN);
- revision.remove(0, 1);
- revision.chop(1);
- bool ok = false;
- defaultRevision = revision.toInt(&ok);
- if (!ok || defaultRevision < 0)
- error("Invalid revision");
- }
-
- next(COLON);
- while (inClass(def) && hasNext()) {
- switch (next()) {
- case PUBLIC:
- case PROTECTED:
- case PRIVATE:
- case Q_SIGNALS_TOKEN:
- case Q_SLOTS_TOKEN:
- prev();
- return;
- case SEMIC:
- continue;
- case FRIEND:
- until(SEMIC);
- continue;
- case USING:
- error("'using' directive not supported in 'signals' section");
- default:
- prev();
- }
- FunctionDef funcDef;
- funcDef.access = FunctionDef::Public;
- parseFunction(&funcDef);
- if (funcDef.isVirtual)
- warning("Signals cannot be declared virtual");
- if (funcDef.inlineCode)
- error("Not a signal declaration");
- if (funcDef.revision > 0) {
- ++def->revisionedMethods;
- } else if (defaultRevision != -1) {
- funcDef.revision = defaultRevision;
- ++def->revisionedMethods;
- }
- def->signalList += funcDef;
- while (funcDef.arguments.size() > 0 && funcDef.arguments.constLast().isDefault) {
- funcDef.wasCloned = true;
- funcDef.arguments.removeLast();
- def->signalList += funcDef;
- }
- }
-}
-
-void Moc::createPropertyDef(PropertyDef &propDef)
-{
- QByteArray type = parseType().name;
- if (type.isEmpty())
- error();
- propDef.designable = propDef.scriptable = propDef.stored = "true";
- propDef.user = "false";
- /*
- The Q_PROPERTY construct cannot contain any commas, since
- commas separate macro arguments. We therefore expect users
- to type "QMap" instead of "QMap<QString, QVariant>". For
- coherence, we also expect the same for
- QValueList<QVariant>, the other template class supported by
- QVariant.
- */
- type = normalizeType(type);
- if (type == "QMap")
- type = "QMap<QString,QVariant>";
- else if (type == "QValueList")
- type = "QValueList<QVariant>";
- else if (type == "LongLong")
- type = "qlonglong";
- else if (type == "ULongLong")
- type = "qulonglong";
-
- propDef.type = type;
-
- next();
- propDef.name = lexem();
- while (test(IDENTIFIER)) {
- const QByteArray l = lexem();
- if (l[0] == 'C' && l == "CONSTANT") {
- propDef.constant = true;
- continue;
- } else if(l[0] == 'F' && l == "FINAL") {
- propDef.final = true;
- continue;
- }
-
- QByteArray v, v2;
- if (test(LPAREN)) {
- v = lexemUntil(RPAREN);
- v = v.mid(1, v.length() - 2); // removes the '(' and ')'
- } else if (test(INTEGER_LITERAL)) {
- v = lexem();
- if (l != "REVISION")
- error(1);
- } else {
- next(IDENTIFIER);
- v = lexem();
- if (test(LPAREN))
- v2 = lexemUntil(RPAREN);
- else if (v != "true" && v != "false")
- v2 = "()";
- }
- switch (l[0]) {
- case 'M':
- if (l == "MEMBER")
- propDef.member = v;
- else
- error(2);
- break;
- case 'R':
- if (l == "READ")
- propDef.read = v;
- else if (l == "RESET")
- propDef.reset = v + v2;
- else if (l == "REVISION") {
- bool ok = false;
- propDef.revision = v.toInt(&ok);
- if (!ok || propDef.revision < 0)
- error(1);
- } else
- error(2);
- break;
- case 'S':
- if (l == "SCRIPTABLE")
- propDef.scriptable = v + v2;
- else if (l == "STORED")
- propDef.stored = v + v2;
- else
- error(2);
- break;
- case 'W': if (l != "WRITE") error(2);
- propDef.write = v;
- break;
- case 'D': if (l != "DESIGNABLE") error(2);
- propDef.designable = v + v2;
- break;
- case 'E': if (l != "EDITABLE") error(2);
- propDef.editable = v + v2;
- break;
- case 'N': if (l != "NOTIFY") error(2);
- propDef.notify = v;
- break;
- case 'U': if (l != "USER") error(2);
- propDef.user = v + v2;
- break;
- default:
- error(2);
- }
- }
- if (propDef.read.isNull() && propDef.member.isNull()) {
- const QByteArray msg = "Property declaration " + propDef.name
- + " has no READ accessor function or associated MEMBER variable. The property will be invalid.";
- warning(msg.constData());
- }
- if (propDef.constant && !propDef.write.isNull()) {
- const QByteArray msg = "Property declaration " + propDef.name
- + " is both WRITEable and CONSTANT. CONSTANT will be ignored.";
- propDef.constant = false;
- warning(msg.constData());
- }
- if (propDef.constant && !propDef.notify.isNull()) {
- const QByteArray msg = "Property declaration " + propDef.name
- + " is both NOTIFYable and CONSTANT. CONSTANT will be ignored.";
- propDef.constant = false;
- warning(msg.constData());
- }
-}
-
-void Moc::parseProperty(ClassDef *def)
-{
- next(LPAREN);
- PropertyDef propDef;
- createPropertyDef(propDef);
- next(RPAREN);
-
- if(!propDef.notify.isEmpty())
- def->notifyableProperties++;
- if (propDef.revision > 0)
- ++def->revisionedProperties;
- def->propertyList += propDef;
-}
-
-void Moc::parsePluginData(ClassDef *def)
-{
- next(LPAREN);
- QByteArray metaData;
- while (test(IDENTIFIER)) {
- QByteArray l = lexem();
- if (l == "IID") {
- next(STRING_LITERAL);
- def->pluginData.iid = unquotedLexem();
- } else if (l == "FILE") {
- next(STRING_LITERAL);
- QByteArray metaDataFile = unquotedLexem();
- QFileInfo fi(QFileInfo(QString::fromLocal8Bit(currentFilenames.top().constData())).dir(), QString::fromLocal8Bit(metaDataFile.constData()));
- for (int j = 0; j < includes.size() && !fi.exists(); ++j) {
- const IncludePath &p = includes.at(j);
- if (p.isFrameworkPath)
- continue;
-
- fi.setFile(QString::fromLocal8Bit(p.path.constData()), QString::fromLocal8Bit(metaDataFile.constData()));
- // try again, maybe there's a file later in the include paths with the same name
- if (fi.isDir()) {
- fi = QFileInfo();
- continue;
- }
- }
- if (!fi.exists()) {
- const QByteArray msg = "Plugin Metadata file " + lexem()
- + " does not exist. Declaration will be ignored";
- error(msg.constData());
- return;
- }
- QFile file(fi.canonicalFilePath());
- if (!file.open(QFile::ReadOnly)) {
- QByteArray msg = "Plugin Metadata file " + lexem() + " could not be opened: "
- + file.errorString().toUtf8();
- error(msg.constData());
- return;
- }
- metaData = file.readAll();
- }
- }
-
- if (!metaData.isEmpty()) {
- def->pluginData.metaData = QJsonDocument::fromJson(metaData);
- if (!def->pluginData.metaData.isObject()) {
- const QByteArray msg = "Plugin Metadata file " + lexem()
- + " does not contain a valid JSON object. Declaration will be ignored";
- warning(msg.constData());
- def->pluginData.iid = QByteArray();
- return;
- }
- }
-
- mustIncludeQPluginH = true;
- next(RPAREN);
-}
-
-void Moc::parsePrivateProperty(ClassDef *def)
-{
- next(LPAREN);
- PropertyDef propDef;
- next(IDENTIFIER);
- propDef.inPrivateClass = lexem();
- while (test(SCOPE)) {
- propDef.inPrivateClass += lexem();
- next(IDENTIFIER);
- propDef.inPrivateClass += lexem();
- }
- // also allow void functions
- if (test(LPAREN)) {
- next(RPAREN);
- propDef.inPrivateClass += "()";
- }
-
- next(COMMA);
-
- createPropertyDef(propDef);
-
- if(!propDef.notify.isEmpty())
- def->notifyableProperties++;
- if (propDef.revision > 0)
- ++def->revisionedProperties;
-
- def->propertyList += propDef;
-}
-
-void Moc::parseEnumOrFlag(BaseDef *def, bool isFlag)
-{
- next(LPAREN);
- QByteArray identifier;
- while (test(IDENTIFIER)) {
- identifier = lexem();
- while (test(SCOPE) && test(IDENTIFIER)) {
- identifier += "::";
- identifier += lexem();
- }
- def->enumDeclarations[identifier] = isFlag;
- }
- next(RPAREN);
-}
-
-void Moc::parseFlag(BaseDef *def)
-{
- next(LPAREN);
- QByteArray flagName, enumName;
- while (test(IDENTIFIER)) {
- flagName = lexem();
- while (test(SCOPE) && test(IDENTIFIER)) {
- flagName += "::";
- flagName += lexem();
- }
- }
- next(COMMA);
- while (test(IDENTIFIER)) {
- enumName = lexem();
- while (test(SCOPE) && test(IDENTIFIER)) {
- enumName += "::";
- enumName += lexem();
- }
- }
-
- def->flagAliases.insert(enumName, flagName);
- next(RPAREN);
-}
-
-void Moc::parseClassInfo(BaseDef *def)
-{
- next(LPAREN);
- ClassInfoDef infoDef;
- next(STRING_LITERAL);
- infoDef.name = symbol().unquotedLexem();
- next(COMMA);
- if (test(STRING_LITERAL)) {
- infoDef.value = symbol().unquotedLexem();
- } else {
- // support Q_CLASSINFO("help", QT_TR_NOOP("blah"))
- next(IDENTIFIER);
- next(LPAREN);
- next(STRING_LITERAL);
- infoDef.value = symbol().unquotedLexem();
- next(RPAREN);
- }
- next(RPAREN);
- def->classInfoList += infoDef;
-}
-
-void Moc::parseInterfaces(ClassDef *def)
-{
- next(LPAREN);
- while (test(IDENTIFIER)) {
- QVector<ClassDef::Interface> iface;
- iface += ClassDef::Interface(lexem());
- while (test(SCOPE)) {
- iface.last().className += lexem();
- next(IDENTIFIER);
- iface.last().className += lexem();
- }
- while (test(COLON)) {
- next(IDENTIFIER);
- iface += ClassDef::Interface(lexem());
- while (test(SCOPE)) {
- iface.last().className += lexem();
- next(IDENTIFIER);
- iface.last().className += lexem();
- }
- }
- // resolve from classnames to interface ids
- for (int i = 0; i < iface.count(); ++i) {
- const QByteArray iid = interface2IdMap.value(iface.at(i).className);
- if (iid.isEmpty())
- error("Undefined interface");
-
- iface[i].interfaceId = iid;
- }
- def->interfaceList += iface;
- }
- next(RPAREN);
-}
-
-void Moc::parseDeclareInterface()
-{
- next(LPAREN);
- QByteArray interface;
- next(IDENTIFIER);
- interface += lexem();
- while (test(SCOPE)) {
- interface += lexem();
- next(IDENTIFIER);
- interface += lexem();
- }
- next(COMMA);
- QByteArray iid;
- if (test(STRING_LITERAL)) {
- iid = lexem();
- } else {
- next(IDENTIFIER);
- iid = lexem();
- }
- interface2IdMap.insert(interface, iid);
- next(RPAREN);
-}
-
-void Moc::parseDeclareMetatype()
-{
- next(LPAREN);
- QByteArray typeName = lexemUntil(RPAREN);
- typeName.remove(0, 1);
- typeName.chop(1);
- metaTypes.append(typeName);
-}
-
-void Moc::parseSlotInPrivate(ClassDef *def, FunctionDef::Access access)
-{
- next(LPAREN);
- FunctionDef funcDef;
- next(IDENTIFIER);
- funcDef.inPrivateClass = lexem();
- // also allow void functions
- if (test(LPAREN)) {
- next(RPAREN);
- funcDef.inPrivateClass += "()";
- }
- next(COMMA);
- funcDef.access = access;
- parseFunction(&funcDef, true);
- def->slotList += funcDef;
- while (funcDef.arguments.size() > 0 && funcDef.arguments.constLast().isDefault) {
- funcDef.wasCloned = true;
- funcDef.arguments.removeLast();
- def->slotList += funcDef;
- }
- if (funcDef.revision > 0)
- ++def->revisionedMethods;
-
-}
-
-QByteArray Moc::lexemUntil(Token target)
-{
- int from = index;
- until(target);
- QByteArray s;
- while (from <= index) {
- QByteArray n = symbols.at(from++-1).lexem();
- if (s.size() && n.size()) {
- char prev = s.at(s.size()-1);
- char next = n.at(0);
- if ((is_ident_char(prev) && is_ident_char(next))
- || (prev == '<' && next == ':')
- || (prev == '>' && next == '>'))
- s += ' ';
- }
- s += n;
- }
- return s;
-}
-
-bool Moc::until(Token target) {
- int braceCount = 0;
- int brackCount = 0;
- int parenCount = 0;
- int angleCount = 0;
- if (index) {
- switch(symbols.at(index-1).token) {
- case LBRACE: ++braceCount; break;
- case LBRACK: ++brackCount; break;
- case LPAREN: ++parenCount; break;
- case LANGLE: ++angleCount; break;
- default: break;
- }
- }
-
- //when searching commas within the default argument, we should take care of template depth (anglecount)
- // unfortunatelly, we do not have enough semantic information to know if '<' is the operator< or
- // the beginning of a template type. so we just use heuristics.
- int possible = -1;
-
- while (index < symbols.size()) {
- Token t = symbols.at(index++).token;
- switch (t) {
- case LBRACE: ++braceCount; break;
- case RBRACE: --braceCount; break;
- case LBRACK: ++brackCount; break;
- case RBRACK: --brackCount; break;
- case LPAREN: ++parenCount; break;
- case RPAREN: --parenCount; break;
- case LANGLE:
- if (parenCount == 0 && braceCount == 0)
- ++angleCount;
- break;
- case RANGLE:
- if (parenCount == 0 && braceCount == 0)
- --angleCount;
- break;
- case GTGT:
- if (parenCount == 0 && braceCount == 0) {
- angleCount -= 2;
- t = RANGLE;
- }
- break;
- default: break;
- }
- if (t == target
- && braceCount <= 0
- && brackCount <= 0
- && parenCount <= 0
- && (target != RANGLE || angleCount <= 0)) {
- if (target != COMMA || angleCount <= 0)
- return true;
- possible = index;
- }
-
- if (target == COMMA && t == EQ && possible != -1) {
- index = possible;
- return true;
- }
-
- if (braceCount < 0 || brackCount < 0 || parenCount < 0
- || (target == RANGLE && angleCount < 0)) {
- --index;
- break;
- }
-
- if (braceCount <= 0 && t == SEMIC) {
- // Abort on semicolon. Allow recovering bad template parsing (QTBUG-31218)
- break;
- }
- }
-
- if(target == COMMA && angleCount != 0 && possible != -1) {
- index = possible;
- return true;
- }
-
- return false;
-}
-
-void Moc::checkSuperClasses(ClassDef *def)
-{
- const QByteArray firstSuperclass = def->superclassList.value(0).first;
-
- if (!knownQObjectClasses.contains(firstSuperclass)) {
- // enable once we /require/ include paths
-#if 0
- const QByteArray msg
- = "Class "
- + def->className
- + " contains the Q_OBJECT macro and inherits from "
- + def->superclassList.value(0)
- + " but that is not a known QObject subclass. You may get compilation errors.";
- warning(msg.constData());
-#endif
- return;
- }
- for (int i = 1; i < def->superclassList.count(); ++i) {
- const QByteArray superClass = def->superclassList.at(i).first;
- if (knownQObjectClasses.contains(superClass)) {
- const QByteArray msg
- = "Class "
- + def->classname
- + " inherits from two QObject subclasses "
- + firstSuperclass
- + " and "
- + superClass
- + ". This is not supported!";
- warning(msg.constData());
- }
-
- if (interface2IdMap.contains(superClass)) {
- bool registeredInterface = false;
- for (int i = 0; i < def->interfaceList.count(); ++i)
- if (def->interfaceList.at(i).constFirst().className == superClass) {
- registeredInterface = true;
- break;
- }
-
- if (!registeredInterface) {
- const QByteArray msg
- = "Class "
- + def->classname
- + " implements the interface "
- + superClass
- + " but does not list it in Q_INTERFACES. qobject_cast to "
- + superClass
- + " will not work!";
- warning(msg.constData());
- }
- }
- }
-}
-
-void Moc::checkProperties(ClassDef *cdef)
-{
- //
- // specify get function, for compatibiliy we accept functions
- // returning pointers, or const char * for QByteArray.
- //
- QSet<QByteArray> definedProperties;
- for (int i = 0; i < cdef->propertyList.count(); ++i) {
- PropertyDef &p = cdef->propertyList[i];
- if (p.read.isEmpty() && p.member.isEmpty())
- continue;
- if (definedProperties.contains(p.name)) {
- QByteArray msg = "The property '" + p.name + "' is defined multiple times in class " + cdef->classname + ".";
- warning(msg.constData());
- }
- definedProperties.insert(p.name);
-
- for (int j = 0; j < cdef->publicList.count(); ++j) {
- const FunctionDef &f = cdef->publicList.at(j);
- if (f.name != p.read)
- continue;
- if (!f.isConst) // get functions must be const
- continue;
- if (f.arguments.size()) // and must not take any arguments
- continue;
- PropertyDef::Specification spec = PropertyDef::ValueSpec;
- QByteArray tmp = f.normalizedType;
- if (p.type == "QByteArray" && tmp == "const char *")
- tmp = "QByteArray";
- if (tmp.left(6) == "const ")
- tmp = tmp.mid(6);
- if (p.type != tmp && tmp.endsWith('*')) {
- tmp.chop(1);
- spec = PropertyDef::PointerSpec;
- } else if (f.type.name.endsWith('&')) { // raw type, not normalized type
- spec = PropertyDef::ReferenceSpec;
- }
- if (p.type != tmp)
- continue;
- p.gspec = spec;
- break;
- }
- if(!p.notify.isEmpty()) {
- int notifyId = -1;
- for (int j = 0; j < cdef->signalList.count(); ++j) {
- const FunctionDef &f = cdef->signalList.at(j);
- if(f.name != p.notify) {
- continue;
- } else {
- notifyId = j /* Signal indexes start from 0 */;
- break;
- }
- }
- p.notifyId = notifyId;
- if (notifyId == -1) {
- QByteArray msg = "NOTIFY signal '" + p.notify + "' of property '" + p.name
- + "' does not exist in class " + cdef->classname + ".";
- error(msg.constData());
- }
- }
- }
-}
-
-
-
-QT_END_NAMESPACE
diff --git a/tools/repc/moc_copy/moc.h b/tools/repc/moc_copy/moc.h
deleted file mode 100644
index de10b90..0000000
--- a/tools/repc/moc_copy/moc.h
+++ /dev/null
@@ -1,276 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the tools applications of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** 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 The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** 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-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef MOC_H
-#define MOC_H
-
-#include "parser.h"
-#include <qstringlist.h>
-#include <qmap.h>
-#include <qpair.h>
-#include <qjsondocument.h>
-#include <qjsonarray.h>
-#include <qjsonobject.h>
-#include <stdio.h>
-#include <ctype.h>
-
-QT_BEGIN_NAMESPACE
-
-struct QMetaObject;
-
-struct Type
-{
- enum ReferenceType { NoReference, Reference, RValueReference, Pointer };
-
- inline Type() : isVolatile(false), isScoped(false), firstToken(NOTOKEN), referenceType(NoReference) {}
- inline explicit Type(const QByteArray &_name)
- : name(_name), rawName(name), isVolatile(false), isScoped(false), firstToken(NOTOKEN), referenceType(NoReference) {}
- QByteArray name;
- //When used as a return type, the type name may be modified to remove the references.
- // rawName is the type as found in the function signature
- QByteArray rawName;
- uint isVolatile : 1;
- uint isScoped : 1;
- Token firstToken;
- ReferenceType referenceType;
-};
-Q_DECLARE_TYPEINFO(Type, Q_MOVABLE_TYPE);
-
-struct EnumDef
-{
- QByteArray name;
- QList<QByteArray> values;
- bool isEnumClass; // c++11 enum class
- EnumDef() : isEnumClass(false) {}
-};
-Q_DECLARE_TYPEINFO(EnumDef, Q_MOVABLE_TYPE);
-
-struct ArgumentDef
-{
- ArgumentDef() : isDefault(false) {}
- Type type;
- QByteArray rightType, normalizedType, name;
- QByteArray typeNameForCast; // type name to be used in cast from void * in metacall
- bool isDefault;
-};
-Q_DECLARE_TYPEINFO(ArgumentDef, Q_MOVABLE_TYPE);
-
-struct FunctionDef
-{
- FunctionDef(): returnTypeIsVolatile(false), access(Private), isConst(false), isVirtual(false), isStatic(false),
- inlineCode(false), wasCloned(false), isCompat(false), isInvokable(false),
- isScriptable(false), isSlot(false), isSignal(false), isPrivateSignal(false),
- isConstructor(false), isDestructor(false), isAbstract(false), revision(0) {}
- Type type;
- QByteArray normalizedType;
- QByteArray tag;
- QByteArray name;
- bool returnTypeIsVolatile;
-
- QVector<ArgumentDef> arguments;
-
- enum Access { Private, Protected, Public };
- Access access;
- bool isConst;
- bool isVirtual;
- bool isStatic;
- bool inlineCode;
- bool wasCloned;
-
- QByteArray inPrivateClass;
- bool isCompat;
- bool isInvokable;
- bool isScriptable;
- bool isSlot;
- bool isSignal;
- bool isPrivateSignal;
- bool isConstructor;
- bool isDestructor;
- bool isAbstract;
-
- int revision;
-};
-Q_DECLARE_TYPEINFO(FunctionDef, Q_MOVABLE_TYPE);
-
-struct PropertyDef
-{
- PropertyDef():notifyId(-1), constant(false), final(false), gspec(ValueSpec), revision(0){}
- QByteArray name, type, member, read, write, reset, designable, scriptable, editable, stored, user, notify, inPrivateClass;
- int notifyId;
- bool constant;
- bool final;
- enum Specification { ValueSpec, ReferenceSpec, PointerSpec };
- Specification gspec;
- bool stdCppSet() const {
- QByteArray s("set");
- s += toupper(name[0]);
- s += name.mid(1);
- return (s == write);
- }
- int revision;
-};
-Q_DECLARE_TYPEINFO(PropertyDef, Q_MOVABLE_TYPE);
-
-
-struct ClassInfoDef
-{
- QByteArray name;
- QByteArray value;
-};
-Q_DECLARE_TYPEINFO(ClassInfoDef, Q_MOVABLE_TYPE);
-
-struct BaseDef {
- QByteArray classname;
- QByteArray qualified;
- QVector<ClassInfoDef> classInfoList;
- QMap<QByteArray, bool> enumDeclarations;
- QVector<EnumDef> enumList;
- QMap<QByteArray, QByteArray> flagAliases;
- int begin = 0;
- int end = 0;
-};
-
-struct ClassDef : BaseDef {
- QVector<QPair<QByteArray, FunctionDef::Access> > superclassList;
-
- struct Interface
- {
- Interface() {} // for QVector, don't use
- inline explicit Interface(const QByteArray &_className)
- : className(_className) {}
- QByteArray className;
- QByteArray interfaceId;
- };
- QVector<QVector<Interface> >interfaceList;
-
- bool hasQObject = false;
- bool hasQGadget = false;
-
- struct PluginData {
- QByteArray iid;
- QMap<QString, QJsonArray> metaArgs;
- QJsonDocument metaData;
- } pluginData;
-
- QVector<FunctionDef> constructorList;
- QVector<FunctionDef> signalList, slotList, methodList, publicList;
- int notifyableProperties = 0;
- QVector<PropertyDef> propertyList;
- int revisionedMethods = 0;
- int revisionedProperties = 0;
-
-};
-Q_DECLARE_TYPEINFO(ClassDef, Q_MOVABLE_TYPE);
-Q_DECLARE_TYPEINFO(ClassDef::Interface, Q_MOVABLE_TYPE);
-
-struct NamespaceDef : BaseDef {
- bool hasQNamespace = false;
-};
-Q_DECLARE_TYPEINFO(NamespaceDef, Q_MOVABLE_TYPE);
-
-class Moc : public Parser
-{
-public:
- Moc()
- : noInclude(false), mustIncludeQPluginH(false)
- {}
-
- QByteArray filename;
-
- bool noInclude;
- bool mustIncludeQPluginH;
- QByteArray includePath;
- QList<QByteArray> includeFiles;
- QVector<ClassDef> classList;
- QMap<QByteArray, QByteArray> interface2IdMap;
- QList<QByteArray> metaTypes;
- // map from class name to fully qualified name
- QHash<QByteArray, QByteArray> knownQObjectClasses;
- QHash<QByteArray, QByteArray> knownGadgets;
- QMap<QString, QJsonArray> metaArgs;
-
- void parse();
-
- bool parseClassHead(ClassDef *def);
- inline bool inClass(const ClassDef *def) const {
- return index > def->begin && index < def->end - 1;
- }
-
- inline bool inNamespace(const NamespaceDef *def) const {
- return index > def->begin && index < def->end - 1;
- }
-
- Type parseType();
-
- bool parseEnum(EnumDef *def);
-
- bool parseFunction(FunctionDef *def, bool inMacro = false);
- bool parseMaybeFunction(const ClassDef *cdef, FunctionDef *def);
-
- void parseSlots(ClassDef *def, FunctionDef::Access access);
- void parseSignals(ClassDef *def);
- void parseProperty(ClassDef *def);
- void parsePluginData(ClassDef *def);
- void createPropertyDef(PropertyDef &def);
- void parseEnumOrFlag(BaseDef *def, bool isFlag);
- void parseFlag(BaseDef *def);
- void parseClassInfo(BaseDef *def);
- void parseInterfaces(ClassDef *def);
- void parseDeclareInterface();
- void parseDeclareMetatype();
- void parseSlotInPrivate(ClassDef *def, FunctionDef::Access access);
- void parsePrivateProperty(ClassDef *def);
-
- void parseFunctionArguments(FunctionDef *def);
-
- QByteArray lexemUntil(Token);
- bool until(Token);
-
- // test for Q_INVOCABLE, Q_SCRIPTABLE, etc. and set the flags
- // in FunctionDef accordingly
- bool testFunctionAttribute(FunctionDef *def);
- bool testFunctionAttribute(Token tok, FunctionDef *def);
- bool testFunctionRevision(FunctionDef *def);
-
- void checkSuperClasses(ClassDef *def);
- void checkProperties(ClassDef* cdef);
-};
-
-inline QByteArray noRef(const QByteArray &type)
-{
- if (type.endsWith('&')) {
- if (type.endsWith("&&"))
- return type.left(type.length()-2);
- return type.left(type.length()-1);
- }
- return type;
-}
-
-QT_END_NAMESPACE
-
-#endif // MOC_H
diff --git a/tools/repc/moc_copy/moc.pri b/tools/repc/moc_copy/moc.pri
deleted file mode 100644
index a6546b8..0000000
--- a/tools/repc/moc_copy/moc.pri
+++ /dev/null
@@ -1,14 +0,0 @@
-
-INCLUDEPATH += $$PWD
-
-HEADERS += $$PWD/moc.h \
- $$PWD/preprocessor.h \
- $$PWD/parser.h \
- $$PWD/symbols.h \
- $$PWD/token.h \
- $$PWD/utils.h \
- $$PWD/outputrevision.h
-SOURCES += $$PWD/moc.cpp \
- $$PWD/preprocessor.cpp \
- $$PWD/parser.cpp \
- $$PWD/token.cpp
diff --git a/tools/repc/moc_copy/mwerks_mac.cpp b/tools/repc/moc_copy/mwerks_mac.cpp
deleted file mode 100644
index 6950f85..0000000
--- a/tools/repc/moc_copy/mwerks_mac.cpp
+++ /dev/null
@@ -1,227 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the tools applications of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** 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 The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** 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-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifdef MOC_MWERKS_PLUGIN
-
-#include "mwerks_mac.h"
-#include "qt_mac.h"
-
-/* compiler headers */
-#include "DropInCompilerLinker.h"
-#include "CompilerMapping.h"
-#include "CWPluginErrors.h"
-
-/* standard headers */
-#include <stdio.h>
-#include <string.h>
-
-QT_BEGIN_NAMESPACE
-
-//qglobal.cpp
-const unsigned char * p_str(const char * c);
-QCString pstring2qstring(const unsigned char *c);
-
-#if CW_USE_PRAGMA_EXPORT
-#pragma export on
-#endif
-
-CWPLUGIN_ENTRY(CWPlugin_GetDropInFlags)(const DropInFlags** flags, long* flagsSize)
-{
- static const DropInFlags sFlags = {
- kCurrentDropInFlagsVersion,
- CWDROPINCOMPILERTYPE,
- DROPINCOMPILERLINKERAPIVERSION_7,
- kCompAlwaysReload|kCompRequiresProjectBuildStartedMsg,
- Lang_C_CPP,
- DROPINCOMPILERLINKERAPIVERSION
- };
- *flags = &sFlags;
- *flagsSize = sizeof(sFlags);
- return cwNoErr;
-}
-
-
-
-CWPLUGIN_ENTRY(CWPlugin_GetDropInName)(const char** dropinName)
-{
- static const char sDropInName[] = "McMoc";
- *dropinName = sDropInName;
- return cwNoErr;
-}
-
-CWPLUGIN_ENTRY(CWPlugin_GetDisplayName)(const char** displayName)
-{
- static const char sDisplayName[] = "McMoc";
- *displayName = sDisplayName;
- return cwNoErr;
-}
-
-CWPLUGIN_ENTRY(CWPlugin_GetTargetList)(const CWTargetList** targetList)
-{
- static CWDataType sCPU = targetCPUAny;
- static CWDataType sOS = targetOSMacintosh;
- static CWTargetList sTargetList = {kCurrentCWTargetListVersion, 1, &sCPU, 1, &sOS};
- *targetList = &sTargetList;
- return cwNoErr;
-}
-
-CWPLUGIN_ENTRY(CWPlugin_GetDefaultMappingList)(const CWExtMapList** defaultMappingList)
-{
- static CWExtensionMapping sExtension[] = { {'TEXT', ".mocs", kPrecompile } };
- static CWExtMapList sExtensionMapList = {kCurrentCWExtMapListVersion, 3, sExtension};
- *defaultMappingList = &sExtensionMapList;
- return cwNoErr;
-}
-
-#if CW_USE_PRAGMA_EXPORT
-#pragma export off
-#endif
-typedef short CWFileRef;
-
-static int line_count = 0;
-moc_status do_moc(CWPluginContext, const QCString &, const QCString &, CWFileSpec *, bool);
-
-static CWResult mocify(CWPluginContext context, const QCString &source)
-{
- CWDisplayLines(context, line_count++);
-
- source.stripWhiteSpace();
-
- CWResult err;
- bool dotmoc=false;
- QCString stem = source, ext;
- int dotpos = stem.findRev('.');
- if(dotpos != -1) {
- ext = stem.right(stem.length() - (dotpos+1));
- stem = stem.left(dotpos);
- if(ext == "cpp")
- dotmoc = true;
- } else {
- //whoa!
- }
- QCString dest;
- if(dotmoc)
- dest = stem + ".moc";
- else
- dest = "moc_" + stem + ".cpp";
-
- //moc it
- CWFileSpec destSpec;
- moc_status mocd = do_moc(context, source, dest, &destSpec, dotmoc);
-
-#if 0
- QCString derr = "Weird";
- switch(mocd) {
- case moc_success: derr = "Success"; break;
- case moc_parse_error: derr = "Parser Error"; break;
- case moc_no_qobject:derr = "No QOBJECT"; break;
- case moc_not_time: derr = "Not Time"; break;
- case moc_no_source: derr = "No Source"; break;
- case moc_general_error: derr = "General Error"; break;
- }
- char dmsg[200];
- sprintf(dmsg, "\"%s\" %s", source.data(), derr.data());
- CWReportMessage(context, NULL, dmsg, NULL, messagetypeError, 0);
-#endif
-
- //handle project
- if(mocd == moc_no_qobject) {
- char msg[400];
- sprintf(msg, "\"%s\" No relevant classes found. No output generated.", source.data());
- CWReportMessage(context, NULL, msg, NULL, messagetypeWarning, 0);
- } else if ((mocd == moc_success || mocd == moc_not_time) && !dotmoc)
- {
- long whichFile;
- CWNewProjectEntryInfo ei;
- memset(&ei, '\0', sizeof(ei));
- ei.groupPath = "QtGenerated";
- err = CWAddProjectEntry(context, &destSpec, true, &ei, &whichFile);
- if (!CWSUCCESS(err))
- {
- char msg[200];
- sprintf(msg, "\"%s\" not added", dest.data());
- CWReportMessage(context, NULL, msg, NULL, messagetypeWarning, 0);
- }
- if(mocd == moc_success)
- CWSetModDate(context, &destSpec, NULL, true);
- }
- return cwNoErr;
-}
-
-pascal short main(CWPluginContext context)
-{
- short result;
- long request;
-
- if (CWGetPluginRequest(context, &request) != cwNoErr)
- return cwErrRequestFailed;
- result = cwErrInvalidParameter;
-
- /* dispatch on compiler request */
- switch (request)
- {
- case reqInitCompiler:
- case reqTermCompiler:
- result = cwNoErr;
- break;
-
- case reqCompile:
- {
- line_count = 0;
- const char *files = NULL;
- long filelen;
- CWGetMainFileText(context, &files, &filelen);
- const char *beg = files;
- for(int x = 0; x < filelen; x++) {
- if(*(files++) == '\r') {
- char file[1024];
- memcpy(file, beg, files - beg);
- file[(files-beg)-1] = '\0';
- mocify(context, file);
- beg = files;
- }
- }
- if(beg != files) {
- char file[1024];
- memcpy(file, beg, files - beg);
- file[(files-beg)] = '\0';
- mocify(context, file);
- }
-
- result = cwNoErr;
- break;
- }
- }
-
- /* return result code */
- return result;
-}
-
-#endif
-
-QT_END_NAMESPACE
diff --git a/tools/repc/moc_copy/mwerks_mac.h b/tools/repc/moc_copy/mwerks_mac.h
deleted file mode 100644
index 3a78e4d..0000000
--- a/tools/repc/moc_copy/mwerks_mac.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the tools applications of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** 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 The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** 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-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef MWERKS_MAC_H
-#define MWERKS_MAC_H
-
-#include <qglobal.h>
-
-QT_BEGIN_NAMESPACE
-
-#ifdef Q_OS_MAC
-
-#define macintosh
-
-/*make moc a plugin*/
-enum moc_status {
- moc_success = 1,
- moc_parse_error = 2,
- moc_no_qobject = 3,
- moc_not_time = 4,
- moc_no_source = 5,
- moc_general_error = 6
-};
-
-#endif
-
-QT_END_NAMESPACE
-
-#endif // MWERKS_MAC_H
diff --git a/tools/repc/moc_copy/outputrevision.h b/tools/repc/moc_copy/outputrevision.h
deleted file mode 100644
index 594775c..0000000
--- a/tools/repc/moc_copy/outputrevision.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the tools applications of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** 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 The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** 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-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef OUTPUTREVISION_H
-#define OUTPUTREVISION_H
-
-// if the output revision changes, you MUST change it in qobjectdefs.h too
-enum { mocOutputRevision = 67 }; // moc format output revision
-
-#endif // OUTPUTREVISION_H
diff --git a/tools/repc/moc_copy/parser.cpp b/tools/repc/moc_copy/parser.cpp
deleted file mode 100644
index b7aefae..0000000
--- a/tools/repc/moc_copy/parser.cpp
+++ /dev/null
@@ -1,74 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the tools applications of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** 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 The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** 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-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "parser.h"
-#include "utils.h"
-#include <stdio.h>
-#include <stdlib.h>
-
-QT_BEGIN_NAMESPACE
-
-#ifdef USE_LEXEM_STORE
-Symbol::LexemStore Symbol::lexemStore;
-#endif
-
-static const char *error_msg = 0;
-
-#ifdef Q_CC_MSVC
-#define ErrorFormatString "%s(%d): "
-#else
-#define ErrorFormatString "%s:%d: "
-#endif
-
-void Parser::error(int rollback) {
- index -= rollback;
- error();
-}
-void Parser::error(const char *msg) {
- if (msg || error_msg)
- fprintf(stderr, ErrorFormatString "Error: %s\n",
- currentFilenames.top().constData(), symbol().lineNum, msg?msg:error_msg);
- else
- fprintf(stderr, ErrorFormatString "Parse error at \"%s\"\n",
- currentFilenames.top().constData(), symbol().lineNum, symbol().lexem().data());
- exit(EXIT_FAILURE);
-}
-
-void Parser::warning(const char *msg) {
- if (displayWarnings && msg)
- fprintf(stderr, ErrorFormatString "Warning: %s\n",
- currentFilenames.top().constData(), qMax(0, index > 0 ? symbol().lineNum : 0), msg);
-}
-
-void Parser::note(const char *msg) {
- if (displayNotes && msg)
- fprintf(stderr, ErrorFormatString "Note: %s\n",
- currentFilenames.top().constData(), qMax(0, index > 0 ? symbol().lineNum : 0), msg);
-}
-
-QT_END_NAMESPACE
diff --git a/tools/repc/moc_copy/parser.h b/tools/repc/moc_copy/parser.h
deleted file mode 100644
index bedcbbf..0000000
--- a/tools/repc/moc_copy/parser.h
+++ /dev/null
@@ -1,107 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the tools applications of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** 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 The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** 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-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef PARSER_H
-#define PARSER_H
-
-#include "symbols.h"
-
-#include <stack>
-
-QT_BEGIN_NAMESPACE
-
-class Parser
-{
-public:
- Parser():index(0), displayWarnings(true), displayNotes(true) {}
- Symbols symbols;
- int index;
- bool displayWarnings;
- bool displayNotes;
-
- struct IncludePath
- {
- inline explicit IncludePath(const QByteArray &_path)
- : path(_path), isFrameworkPath(false) {}
- QByteArray path;
- bool isFrameworkPath;
- };
- QList<IncludePath> includes;
-
- std::stack<QByteArray, QByteArrayList> currentFilenames;
-
- inline bool hasNext() const { return (index < symbols.size()); }
- inline Token next() { if (index >= symbols.size()) return NOTOKEN; return symbols.at(index++).token; }
- bool test(Token);
- void next(Token);
- void next(Token, const char *msg);
- inline void prev() {--index;}
- inline Token lookup(int k = 1);
- inline const Symbol &symbol_lookup(int k = 1) { return symbols.at(index-1+k);}
- inline Token token() { return symbols.at(index-1).token;}
- inline QByteArray lexem() { return symbols.at(index-1).lexem();}
- inline QByteArray unquotedLexem() { return symbols.at(index-1).unquotedLexem();}
- inline const Symbol &symbol() { return symbols.at(index-1);}
-
- Q_NORETURN void error(int rollback);
- Q_NORETURN void error(const char *msg = 0);
- void warning(const char * = 0);
- void note(const char * = 0);
-
-};
-
-inline bool Parser::test(Token token)
-{
- if (index < symbols.size() && symbols.at(index).token == token) {
- ++index;
- return true;
- }
- return false;
-}
-
-inline Token Parser::lookup(int k)
-{
- const int l = index - 1 + k;
- return l < symbols.size() ? symbols.at(l).token : NOTOKEN;
-}
-
-inline void Parser::next(Token token)
-{
- if (!test(token))
- error();
-}
-
-inline void Parser::next(Token token, const char *msg)
-{
- if (!test(token))
- error(msg);
-}
-
-QT_END_NAMESPACE
-
-#endif
diff --git a/tools/repc/moc_copy/ppkeywords.cpp b/tools/repc/moc_copy/ppkeywords.cpp
deleted file mode 100644
index b94abf8..0000000
--- a/tools/repc/moc_copy/ppkeywords.cpp
+++ /dev/null
@@ -1,235 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the tools applications of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** 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 The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** 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-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-// auto generated
-// DO NOT EDIT.
-
-static const short pp_keyword_trans[][128] = {
- {0,0,0,0,0,0,0,0,0,98,12,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 98,76,96,13,1,60,62,97,9,10,58,56,11,57,102,59,
- 6,6,6,6,6,6,6,6,6,6,92,0,7,81,8,91,
- 0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
- 1,1,1,1,1,1,1,1,1,1,1,0,101,0,61,1,
- 0,1,2,3,4,1,1,1,1,1,1,1,1,1,5,1,
- 1,1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,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,100,0,0,0,0,99,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
- {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,65,0,0,0,0,0,0,0,0,0,0,0,0,0,69,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
- {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 103,103,103,103,103,103,103,103,103,103,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}
-};
-
-static const struct
-{
- PP_Token token;
- short next;
- char defchar;
- short defnext;
- PP_Token ident;
-} pp_keywords[] = {
- {PP_NOTOKEN, 0, 0, 0, PP_NOTOKEN},
- {PP_CHARACTER, 0, 0, 0, PP_NOTOKEN},
- {PP_CHARACTER, 0, 105, 63, PP_NOTOKEN},
- {PP_CHARACTER, 0, 111, 72, PP_NOTOKEN},
- {PP_CHARACTER, 0, 101, 50, PP_NOTOKEN},
- {PP_CHARACTER, 0, 111, 77, PP_NOTOKEN},
- {PP_DIGIT, 0, 0, 0, PP_NOTOKEN},
- {PP_LANGLE, 1, 0, 0, PP_NOTOKEN},
- {PP_RANGLE, 2, 0, 0, PP_NOTOKEN},
- {PP_LPAREN, 0, 0, 0, PP_NOTOKEN},
- {PP_RPAREN, 0, 0, 0, PP_NOTOKEN},
- {PP_COMMA, 0, 0, 0, PP_NOTOKEN},
- {PP_NEWLINE, 0, 0, 0, PP_NOTOKEN},
- {PP_HASH, 3, 0, 0, PP_HASH},
- {PP_HASH, 0, 101, 15, PP_HASH},
- {PP_HASH, 0, 102, 16, PP_HASH},
- {PP_HASH, 0, 105, 17, PP_HASH},
- {PP_HASH, 0, 110, 18, PP_HASH},
- {PP_HASH, 0, 101, 19, PP_HASH},
- {PP_DEFINE, 0, 0, 0, PP_HASH},
- {PP_HASH, 4, 0, 0, PP_HASH},
- {PP_IF, 5, 0, 0, PP_HASH},
- {PP_HASH, 0, 110, 23, PP_HASH},
- {PP_HASH, 0, 100, 24, PP_HASH},
- {PP_HASH, 0, 101, 25, PP_HASH},
- {PP_HASH, 0, 102, 26, PP_HASH},
- {PP_UNDEF, 0, 0, 0, PP_HASH},
- {PP_HASH, 0, 101, 28, PP_HASH},
- {PP_HASH, 0, 102, 29, PP_HASH},
- {PP_IFDEF, 0, 0, 0, PP_HASH},
- {PP_HASH, 0, 100, 31, PP_HASH},
- {PP_HASH, 0, 101, 32, PP_HASH},
- {PP_HASH, 0, 102, 33, PP_HASH},
- {PP_IFNDEF, 0, 0, 0, PP_HASH},
- {PP_HASH, 6, 0, 0, PP_HASH},
- {PP_HASH, 7, 0, 0, PP_HASH},
- {PP_HASH, 0, 102, 37, PP_HASH},
- {PP_ELIF, 0, 0, 0, PP_HASH},
- {PP_HASH, 0, 101, 39, PP_HASH},
- {PP_ELSE, 0, 0, 0, PP_HASH},
- {PP_HASH, 0, 100, 41, PP_HASH},
- {PP_HASH, 0, 105, 42, PP_HASH},
- {PP_HASH, 0, 102, 43, PP_HASH},
- {PP_ENDIF, 0, 0, 0, PP_HASH},
- {PP_HASH, 0, 99, 45, PP_HASH},
- {PP_HASH, 0, 108, 46, PP_HASH},
- {PP_HASH, 0, 117, 47, PP_HASH},
- {PP_HASH, 0, 100, 48, PP_HASH},
- {PP_HASH, 0, 101, 49, PP_HASH},
- {PP_INCLUDE, 0, 0, 0, PP_HASH},
- {PP_CHARACTER, 0, 102, 51, PP_CHARACTER},
- {PP_CHARACTER, 0, 105, 52, PP_CHARACTER},
- {PP_CHARACTER, 0, 110, 53, PP_CHARACTER},
- {PP_CHARACTER, 0, 101, 54, PP_CHARACTER},
- {PP_CHARACTER, 0, 100, 55, PP_CHARACTER},
- {PP_DEFINED, 0, 0, 0, PP_CHARACTER},
- {PP_PLUS, 0, 0, 0, PP_NOTOKEN},
- {PP_MINUS, 0, 0, 0, PP_NOTOKEN},
- {PP_STAR, 0, 0, 0, PP_NOTOKEN},
- {PP_SLASH, 8, 0, 0, PP_NOTOKEN},
- {PP_PERCENT, 0, 58, 94, PP_NOTOKEN},
- {PP_HAT, 0, 0, 0, PP_NOTOKEN},
- {PP_AND, 0, 38, 89, PP_NOTOKEN},
- {PP_CHARACTER, 0, 116, 64, PP_CHARACTER},
- {PP_CHARACTER, 9, 0, 0, PP_CHARACTER},
- {PP_CHARACTER, 0, 110, 66, PP_CHARACTER},
- {PP_CHARACTER, 0, 100, 67, PP_CHARACTER},
- {PP_AND, 0, 0, 0, PP_CHARACTER},
- {PP_OR, 0, 124, 90, PP_NOTOKEN},
- {PP_CHARACTER, 0, 114, 70, PP_CHARACTER},
- {PP_OR, 0, 0, 0, PP_CHARACTER},
- {PP_TILDE, 0, 0, 0, PP_NOTOKEN},
- {PP_CHARACTER, 0, 109, 73, PP_CHARACTER},
- {PP_CHARACTER, 0, 112, 74, PP_CHARACTER},
- {PP_CHARACTER, 0, 108, 75, PP_CHARACTER},
- {PP_TILDE, 0, 0, 0, PP_CHARACTER},
- {PP_NOT, 0, 61, 83, PP_NOTOKEN},
- {PP_CHARACTER, 0, 116, 78, PP_CHARACTER},
- {PP_NOT, 0, 95, 84, PP_CHARACTER},
- {PP_LTLT, 0, 0, 0, PP_NOTOKEN},
- {PP_GTGT, 0, 0, 0, PP_NOTOKEN},
- {PP_INCOMPLETE, 0, 61, 82, PP_NOTOKEN},
- {PP_EQEQ, 0, 0, 0, PP_NOTOKEN},
- {PP_NE, 0, 0, 0, PP_NOTOKEN},
- {PP_CHARACTER, 0, 101, 85, PP_CHARACTER},
- {PP_CHARACTER, 0, 113, 86, PP_CHARACTER},
- {PP_NE, 0, 0, 0, PP_CHARACTER},
- {PP_LE, 0, 0, 0, PP_NOTOKEN},
- {PP_GE, 0, 0, 0, PP_NOTOKEN},
- {PP_ANDAND, 0, 0, 0, PP_NOTOKEN},
- {PP_OROR, 0, 0, 0, PP_NOTOKEN},
- {PP_QUESTION, 0, 0, 0, PP_NOTOKEN},
- {PP_COLON, 0, 0, 0, PP_NOTOKEN},
- {PP_HASHHASH, 0, 0, 0, PP_NOTOKEN},
- {PP_INCOMPLETE, 0, 37, 95, PP_NOTOKEN},
- {PP_INCOMPLETE, 0, 58, 93, PP_NOTOKEN},
- {PP_QUOTE, 0, 0, 0, PP_NOTOKEN},
- {PP_SINGLEQUOTE, 0, 0, 0, PP_NOTOKEN},
- {PP_WHITESPACE, 0, 0, 0, PP_NOTOKEN},
- {PP_CPP_COMMENT, 0, 0, 0, PP_NOTOKEN},
- {PP_C_COMMENT, 0, 0, 0, PP_NOTOKEN},
- {PP_BACKSLASH, 0, 0, 0, PP_NOTOKEN},
- {PP_INCOMPLETE, 10, 0, 0, PP_NOTOKEN},
- {PP_FLOATING_LITERAL, 0, 0, 0, PP_NOTOKEN}
-};
diff --git a/tools/repc/moc_copy/preprocessor.cpp b/tools/repc/moc_copy/preprocessor.cpp
deleted file mode 100644
index 32c9463..0000000
--- a/tools/repc/moc_copy/preprocessor.cpp
+++ /dev/null
@@ -1,1313 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Copyright (C) 2014 Olivier Goffart <ogoffart@woboq.org>
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the tools applications of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** 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 The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** 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-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "preprocessor.h"
-#include "utils.h"
-#include <qstringlist.h>
-#include <qfile.h>
-#include <qdir.h>
-#include <qfileinfo.h>
-
-QT_BEGIN_NAMESPACE
-
-#include "ppkeywords.cpp"
-#include "keywords.cpp"
-
-// transform \r\n into \n
-// \r into \n (os9 style)
-// backslash-newlines into newlines
-static QByteArray cleaned(const QByteArray &input)
-{
- QByteArray result;
- result.resize(input.size());
- const char *data = input.constData();
- const char *end = input.constData() + input.size();
- char *output = result.data();
-
- int newlines = 0;
- while (data != end) {
- while (data != end && is_space(*data))
- ++data;
- bool takeLine = (*data == '#');
- if (*data == '%' && *(data+1) == ':') {
- takeLine = true;
- ++data;
- }
- if (takeLine) {
- *output = '#';
- ++output;
- do ++data; while (data != end && is_space(*data));
- }
- while (data != end) {
- // handle \\\n, \\\r\n and \\\r
- if (*data == '\\') {
- if (*(data + 1) == '\r') {
- ++data;
- }
- if (data != end && (*(data + 1) == '\n' || (*data) == '\r')) {
- ++newlines;
- data += 1;
- if (data != end && *data != '\r')
- data += 1;
- continue;
- }
- } else if (*data == '\r' && *(data + 1) == '\n') { // reduce \r\n to \n
- ++data;
- }
- if (data == end)
- break;
-
- char ch = *data;
- if (ch == '\r') // os9: replace \r with \n
- ch = '\n';
- *output = ch;
- ++output;
-
- if (*data == '\n') {
- // output additional newlines to keep the correct line-numbering
- // for the lines following the backslash-newline sequence(s)
- while (newlines) {
- *output = '\n';
- ++output;
- --newlines;
- }
- ++data;
- break;
- }
- ++data;
- }
- }
- result.resize(output - result.constData());
- return result;
-}
-
-bool Preprocessor::preprocessOnly = false;
-void Preprocessor::skipUntilEndif()
-{
- while(index < symbols.size() - 1 && symbols.at(index).token != PP_ENDIF){
- switch (symbols.at(index).token) {
- case PP_IF:
- case PP_IFDEF:
- case PP_IFNDEF:
- ++index;
- skipUntilEndif();
- break;
- default:
- ;
- }
- ++index;
- }
-}
-
-bool Preprocessor::skipBranch()
-{
- while (index < symbols.size() - 1
- && (symbols.at(index).token != PP_ENDIF
- && symbols.at(index).token != PP_ELIF
- && symbols.at(index).token != PP_ELSE)
- ){
- switch (symbols.at(index).token) {
- case PP_IF:
- case PP_IFDEF:
- case PP_IFNDEF:
- ++index;
- skipUntilEndif();
- break;
- default:
- ;
- }
- ++index;
- }
- return (index < symbols.size() - 1);
-}
-
-
-Symbols Preprocessor::tokenize(const QByteArray& input, int lineNum, Preprocessor::TokenizeMode mode)
-{
- Symbols symbols;
- // Preallocate some space to speed up the code below.
- // The magic divisor value was found by calculating the average ratio between
- // input size and the final size of symbols.
- // This yielded a value of 16.x when compiling Qt Base.
- symbols.reserve(input.size() / 16);
- const char *begin = input.constData();
- const char *data = begin;
- while (*data) {
- if (mode == TokenizeCpp || mode == TokenizeDefine) {
- int column = 0;
-
- const char *lexem = data;
- int state = 0;
- Token token = NOTOKEN;
- for (;;) {
- if (static_cast<signed char>(*data) < 0) {
- ++data;
- continue;
- }
- int nextindex = keywords[state].next;
- int next = 0;
- if (*data == keywords[state].defchar)
- next = keywords[state].defnext;
- else if (!state || nextindex)
- next = keyword_trans[nextindex][(int)*data];
- if (!next)
- break;
- state = next;
- token = keywords[state].token;
- ++data;
- }
-
- // suboptimal, is_ident_char should use a table
- if (keywords[state].ident && is_ident_char(*data))
- token = keywords[state].ident;
-
- if (token == NOTOKEN) {
- if (*data)
- ++data;
- // an error really, but let's ignore this input
- // to not confuse moc later. However in pre-processor
- // only mode let's continue.
- if (!Preprocessor::preprocessOnly)
- continue;
- }
-
- ++column;
-
- if (token > SPECIAL_TREATMENT_MARK) {
- switch (token) {
- case QUOTE:
- data = skipQuote(data);
- token = STRING_LITERAL;
- // concatenate multi-line strings for easier
- // STRING_LITERAL handling in moc
- if (!Preprocessor::preprocessOnly
- && !symbols.isEmpty()
- && symbols.constLast().token == STRING_LITERAL) {
-
- const QByteArray newString
- = '\"'
- + symbols.constLast().unquotedLexem()
- + input.mid(lexem - begin + 1, data - lexem - 2)
- + '\"';
- symbols.last() = Symbol(symbols.constLast().lineNum,
- STRING_LITERAL,
- newString);
- continue;
- }
- break;
- case SINGLEQUOTE:
- while (*data && (*data != '\''
- || (*(data-1)=='\\'
- && *(data-2)!='\\')))
- ++data;
- if (*data)
- ++data;
- token = CHARACTER_LITERAL;
- break;
- case LANGLE_SCOPE:
- // split <:: into two tokens, < and ::
- token = LANGLE;
- data -= 2;
- break;
- case DIGIT:
- while (is_digit_char(*data) || *data == '\'')
- ++data;
- if (!*data || *data != '.') {
- token = INTEGER_LITERAL;
- if (data - lexem == 1 &&
- (*data == 'x' || *data == 'X')
- && *lexem == '0') {
- ++data;
- while (is_hex_char(*data) || *data == '\'')
- ++data;
- }
- break;
- }
- token = FLOATING_LITERAL;
- ++data;
- Q_FALLTHROUGH();
- case FLOATING_LITERAL:
- while (is_digit_char(*data) || *data == '\'')
- ++data;
- if (*data == '+' || *data == '-')
- ++data;
- if (*data == 'e' || *data == 'E') {
- ++data;
- while (is_digit_char(*data) || *data == '\'')
- ++data;
- }
- if (*data == 'f' || *data == 'F'
- || *data == 'l' || *data == 'L')
- ++data;
- break;
- case HASH:
- if (column == 1 && mode == TokenizeCpp) {
- mode = PreparePreprocessorStatement;
- while (*data && (*data == ' ' || *data == '\t'))
- ++data;
- if (is_ident_char(*data))
- mode = TokenizePreprocessorStatement;
- continue;
- }
- break;
- case PP_HASHHASH:
- if (mode == TokenizeCpp)
- continue;
- break;
- case NEWLINE:
- ++lineNum;
- if (mode == TokenizeDefine) {
- mode = TokenizeCpp;
- // emit the newline token
- break;
- }
- continue;
- case BACKSLASH:
- {
- const char *rewind = data;
- while (*data && (*data == ' ' || *data == '\t'))
- ++data;
- if (*data && *data == '\n') {
- ++data;
- continue;
- }
- data = rewind;
- } break;
- case CHARACTER:
- while (is_ident_char(*data))
- ++data;
- token = IDENTIFIER;
- break;
- case C_COMMENT:
- if (*data) {
- if (*data == '\n')
- ++lineNum;
- ++data;
- if (*data) {
- if (*data == '\n')
- ++lineNum;
- ++data;
- }
- }
- while (*data && (*(data-1) != '/' || *(data-2) != '*')) {
- if (*data == '\n')
- ++lineNum;
- ++data;
- }
- token = WHITESPACE; // one comment, one whitespace
- Q_FALLTHROUGH();
- case WHITESPACE:
- if (column == 1)
- column = 0;
- while (*data && (*data == ' ' || *data == '\t'))
- ++data;
- if (Preprocessor::preprocessOnly) // tokenize whitespace
- break;
- continue;
- case CPP_COMMENT:
- while (*data && *data != '\n')
- ++data;
- continue; // ignore safely, the newline is a separator
- default:
- continue; //ignore
- }
- }
-#ifdef USE_LEXEM_STORE
- if (!Preprocessor::preprocessOnly
- && token != IDENTIFIER
- && token != STRING_LITERAL
- && token != FLOATING_LITERAL
- && token != INTEGER_LITERAL)
- symbols += Symbol(lineNum, token);
- else
-#endif
- symbols += Symbol(lineNum, token, input, lexem-begin, data-lexem);
-
- } else { // Preprocessor
-
- const char *lexem = data;
- int state = 0;
- Token token = NOTOKEN;
- if (mode == TokenizePreprocessorStatement) {
- state = pp_keyword_trans[0][(int)'#'];
- mode = TokenizePreprocessor;
- }
- for (;;) {
- if (static_cast<signed char>(*data) < 0) {
- ++data;
- continue;
- }
- int nextindex = pp_keywords[state].next;
- int next = 0;
- if (*data == pp_keywords[state].defchar)
- next = pp_keywords[state].defnext;
- else if (!state || nextindex)
- next = pp_keyword_trans[nextindex][(int)*data];
- if (!next)
- break;
- state = next;
- token = pp_keywords[state].token;
- ++data;
- }
- // suboptimal, is_ident_char should use a table
- if (pp_keywords[state].ident && is_ident_char(*data))
- token = pp_keywords[state].ident;
-
- switch (token) {
- case NOTOKEN:
- if (*data)
- ++data;
- break;
- case PP_DEFINE:
- mode = PrepareDefine;
- break;
- case PP_IFDEF:
- symbols += Symbol(lineNum, PP_IF);
- symbols += Symbol(lineNum, PP_DEFINED);
- continue;
- case PP_IFNDEF:
- symbols += Symbol(lineNum, PP_IF);
- symbols += Symbol(lineNum, PP_NOT);
- symbols += Symbol(lineNum, PP_DEFINED);
- continue;
- case PP_INCLUDE:
- mode = TokenizeInclude;
- break;
- case PP_QUOTE:
- data = skipQuote(data);
- token = PP_STRING_LITERAL;
- break;
- case PP_SINGLEQUOTE:
- while (*data && (*data != '\''
- || (*(data-1)=='\\'
- && *(data-2)!='\\')))
- ++data;
- if (*data)
- ++data;
- token = PP_CHARACTER_LITERAL;
- break;
- case PP_DIGIT:
- while (is_digit_char(*data) || *data == '\'')
- ++data;
- if (!*data || *data != '.') {
- token = PP_INTEGER_LITERAL;
- if (data - lexem == 1 &&
- (*data == 'x' || *data == 'X')
- && *lexem == '0') {
- ++data;
- while (is_hex_char(*data) || *data == '\'')
- ++data;
- }
- break;
- }
- token = PP_FLOATING_LITERAL;
- ++data;
- Q_FALLTHROUGH();
- case PP_FLOATING_LITERAL:
- while (is_digit_char(*data) || *data == '\'')
- ++data;
- if (*data == '+' || *data == '-')
- ++data;
- if (*data == 'e' || *data == 'E') {
- ++data;
- while (is_digit_char(*data) || *data == '\'')
- ++data;
- }
- if (*data == 'f' || *data == 'F'
- || *data == 'l' || *data == 'L')
- ++data;
- break;
- case PP_CHARACTER:
- if (mode == PreparePreprocessorStatement) {
- // rewind entire token to begin
- data = lexem;
- mode = TokenizePreprocessorStatement;
- continue;
- }
- while (is_ident_char(*data))
- ++data;
- token = PP_IDENTIFIER;
-
- if (mode == PrepareDefine) {
- symbols += Symbol(lineNum, token, input, lexem-begin, data-lexem);
- // make sure we explicitly add the whitespace here if the next char
- // is not an opening brace, so we can distinguish correctly between
- // regular and function macros
- if (*data != '(')
- symbols += Symbol(lineNum, WHITESPACE);
- mode = TokenizeDefine;
- continue;
- }
- break;
- case PP_C_COMMENT:
- if (*data) {
- if (*data == '\n')
- ++lineNum;
- ++data;
- if (*data) {
- if (*data == '\n')
- ++lineNum;
- ++data;
- }
- }
- while (*data && (*(data-1) != '/' || *(data-2) != '*')) {
- if (*data == '\n')
- ++lineNum;
- ++data;
- }
- token = PP_WHITESPACE; // one comment, one whitespace
- Q_FALLTHROUGH();
- case PP_WHITESPACE:
- while (*data && (*data == ' ' || *data == '\t'))
- ++data;
- continue; // the preprocessor needs no whitespace
- case PP_CPP_COMMENT:
- while (*data && *data != '\n')
- ++data;
- continue; // ignore safely, the newline is a separator
- case PP_NEWLINE:
- ++lineNum;
- mode = TokenizeCpp;
- break;
- case PP_BACKSLASH:
- {
- const char *rewind = data;
- while (*data && (*data == ' ' || *data == '\t'))
- ++data;
- if (*data && *data == '\n') {
- ++data;
- continue;
- }
- data = rewind;
- } break;
- case PP_LANGLE:
- if (mode != TokenizeInclude)
- break;
- token = PP_STRING_LITERAL;
- while (*data && *data != '\n' && *(data-1) != '>')
- ++data;
- break;
- default:
- break;
- }
- if (mode == PreparePreprocessorStatement)
- continue;
-#ifdef USE_LEXEM_STORE
- if (token != PP_IDENTIFIER
- && token != PP_STRING_LITERAL
- && token != PP_FLOATING_LITERAL
- && token != PP_INTEGER_LITERAL)
- symbols += Symbol(lineNum, token);
- else
-#endif
- symbols += Symbol(lineNum, token, input, lexem-begin, data-lexem);
- }
- }
- symbols += Symbol(); // eof symbol
- return symbols;
-}
-
-void Preprocessor::macroExpand(Symbols *into, Preprocessor *that, const Symbols &toExpand, int &index,
- int lineNum, bool one, const QSet<QByteArray> &excludeSymbols)
-{
- SymbolStack symbols;
- SafeSymbols sf;
- sf.symbols = toExpand;
- sf.index = index;
- sf.excludedSymbols = excludeSymbols;
- symbols.push(sf);
-
- if (toExpand.isEmpty())
- return;
-
- for (;;) {
- QByteArray macro;
- Symbols newSyms = macroExpandIdentifier(that, symbols, lineNum, &macro);
-
- if (macro.isEmpty()) {
- // not a macro
- Symbol s = symbols.symbol();
- s.lineNum = lineNum;
- *into += s;
- } else {
- SafeSymbols sf;
- sf.symbols = newSyms;
- sf.index = 0;
- sf.expandedMacro = macro;
- symbols.push(sf);
- }
- if (!symbols.hasNext() || (one && symbols.size() == 1))
- break;
- symbols.next();
- }
-
- if (symbols.size())
- index = symbols.top().index;
- else
- index = toExpand.size();
-}
-
-
-Symbols Preprocessor::macroExpandIdentifier(Preprocessor *that, SymbolStack &symbols, int lineNum, QByteArray *macroName)
-{
- Symbol s = symbols.symbol();
-
- // not a macro
- if (s.token != PP_IDENTIFIER || !that->macros.contains(s) || symbols.dontReplaceSymbol(s.lexem())) {
- return Symbols();
- }
-
- const Macro &macro = that->macros.value(s);
- *macroName = s.lexem();
-
- Symbols expansion;
- if (!macro.isFunction) {
- expansion = macro.symbols;
- } else {
- bool haveSpace = false;
- while (symbols.test(PP_WHITESPACE)) { haveSpace = true; }
- if (!symbols.test(PP_LPAREN)) {
- *macroName = QByteArray();
- Symbols syms;
- if (haveSpace)
- syms += Symbol(lineNum, PP_WHITESPACE);
- syms += s;
- syms.last().lineNum = lineNum;
- return syms;
- }
- QVarLengthArray<Symbols, 5> arguments;
- while (symbols.hasNext()) {
- Symbols argument;
- // strip leading space
- while (symbols.test(PP_WHITESPACE)) {}
- int nesting = 0;
- bool vararg = macro.isVariadic && (arguments.size() == macro.arguments.size() - 1);
- while (symbols.hasNext()) {
- Token t = symbols.next();
- if (t == PP_LPAREN) {
- ++nesting;
- } else if (t == PP_RPAREN) {
- --nesting;
- if (nesting < 0)
- break;
- } else if (t == PP_COMMA && nesting == 0) {
- if (!vararg)
- break;
- }
- argument += symbols.symbol();
- }
- arguments += argument;
-
- if (nesting < 0)
- break;
- else if (!symbols.hasNext())
- that->error("missing ')' in macro usage");
- }
-
- // empty VA_ARGS
- if (macro.isVariadic && arguments.size() == macro.arguments.size() - 1)
- arguments += Symbols();
-
- // now replace the macro arguments with the expanded arguments
- enum Mode {
- Normal,
- Hash,
- HashHash
- } mode = Normal;
-
- for (int i = 0; i < macro.symbols.size(); ++i) {
- const Symbol &s = macro.symbols.at(i);
- if (s.token == HASH || s.token == PP_HASHHASH) {
- mode = (s.token == HASH ? Hash : HashHash);
- continue;
- }
- int index = macro.arguments.indexOf(s);
- if (mode == Normal) {
- if (index >= 0 && index < arguments.size()) {
- // each argument undoergoes macro expansion if it's not used as part of a # or ##
- if (i == macro.symbols.size() - 1 || macro.symbols.at(i + 1).token != PP_HASHHASH) {
- Symbols arg = arguments.at(index);
- int idx = 1;
- macroExpand(&expansion, that, arg, idx, lineNum, false, symbols.excludeSymbols());
- } else {
- expansion += arguments.at(index);
- }
- } else {
- expansion += s;
- }
- } else if (mode == Hash) {
- if (index < 0) {
- that->error("'#' is not followed by a macro parameter");
- continue;
- } else if (index >= arguments.size()) {
- that->error("Macro invoked with too few parameters for a use of '#'");
- continue;
- }
-
- const Symbols &arg = arguments.at(index);
- QByteArray stringified;
- for (int i = 0; i < arg.size(); ++i) {
- stringified += arg.at(i).lexem();
- }
- stringified.replace('"', "\\\"");
- stringified.prepend('"');
- stringified.append('"');
- expansion += Symbol(lineNum, STRING_LITERAL, stringified);
- } else if (mode == HashHash){
- if (s.token == WHITESPACE)
- continue;
-
- while (expansion.size() && expansion.constLast().token == PP_WHITESPACE)
- expansion.pop_back();
-
- Symbol next = s;
- if (index >= 0 && index < arguments.size()) {
- const Symbols &arg = arguments.at(index);
- if (arg.size() == 0) {
- mode = Normal;
- continue;
- }
- next = arg.at(0);
- }
-
- if (!expansion.isEmpty() && expansion.constLast().token == s.token
- && expansion.constLast().token != STRING_LITERAL) {
- Symbol last = expansion.takeLast();
-
- QByteArray lexem = last.lexem() + next.lexem();
- expansion += Symbol(lineNum, last.token, lexem);
- } else {
- expansion += next;
- }
-
- if (index >= 0 && index < arguments.size()) {
- const Symbols &arg = arguments.at(index);
- for (int i = 1; i < arg.size(); ++i)
- expansion += arg.at(i);
- }
- }
- mode = Normal;
- }
- if (mode != Normal)
- that->error("'#' or '##' found at the end of a macro argument");
-
- }
-
- return expansion;
-}
-
-void Preprocessor::substituteUntilNewline(Symbols &substituted)
-{
- while (hasNext()) {
- Token token = next();
- if (token == PP_IDENTIFIER) {
- macroExpand(&substituted, this, symbols, index, symbol().lineNum, true);
- } else if (token == PP_DEFINED) {
- bool braces = test(PP_LPAREN);
- next(PP_IDENTIFIER);
- Symbol definedOrNotDefined = symbol();
- definedOrNotDefined.token = macros.contains(definedOrNotDefined)? PP_MOC_TRUE : PP_MOC_FALSE;
- substituted += definedOrNotDefined;
- if (braces)
- test(PP_RPAREN);
- continue;
- } else if (token == PP_NEWLINE) {
- substituted += symbol();
- break;
- } else {
- substituted += symbol();
- }
- }
-}
-
-
-class PP_Expression : public Parser
-{
-public:
- int value() { index = 0; return unary_expression_lookup() ? conditional_expression() : 0; }
-
- int conditional_expression();
- int logical_OR_expression();
- int logical_AND_expression();
- int inclusive_OR_expression();
- int exclusive_OR_expression();
- int AND_expression();
- int equality_expression();
- int relational_expression();
- int shift_expression();
- int additive_expression();
- int multiplicative_expression();
- int unary_expression();
- bool unary_expression_lookup();
- int primary_expression();
- bool primary_expression_lookup();
-};
-
-int PP_Expression::conditional_expression()
-{
- int value = logical_OR_expression();
- if (test(PP_QUESTION)) {
- int alt1 = conditional_expression();
- int alt2 = test(PP_COLON) ? conditional_expression() : 0;
- return value ? alt1 : alt2;
- }
- return value;
-}
-
-int PP_Expression::logical_OR_expression()
-{
- int value = logical_AND_expression();
- if (test(PP_OROR))
- return logical_OR_expression() || value;
- return value;
-}
-
-int PP_Expression::logical_AND_expression()
-{
- int value = inclusive_OR_expression();
- if (test(PP_ANDAND))
- return logical_AND_expression() && value;
- return value;
-}
-
-int PP_Expression::inclusive_OR_expression()
-{
- int value = exclusive_OR_expression();
- if (test(PP_OR))
- return value | inclusive_OR_expression();
- return value;
-}
-
-int PP_Expression::exclusive_OR_expression()
-{
- int value = AND_expression();
- if (test(PP_HAT))
- return value ^ exclusive_OR_expression();
- return value;
-}
-
-int PP_Expression::AND_expression()
-{
- int value = equality_expression();
- if (test(PP_AND))
- return value & AND_expression();
- return value;
-}
-
-int PP_Expression::equality_expression()
-{
- int value = relational_expression();
- switch (next()) {
- case PP_EQEQ:
- return value == equality_expression();
- case PP_NE:
- return value != equality_expression();
- default:
- prev();
- return value;
- }
-}
-
-int PP_Expression::relational_expression()
-{
- int value = shift_expression();
- switch (next()) {
- case PP_LANGLE:
- return value < relational_expression();
- case PP_RANGLE:
- return value > relational_expression();
- case PP_LE:
- return value <= relational_expression();
- case PP_GE:
- return value >= relational_expression();
- default:
- prev();
- return value;
- }
-}
-
-int PP_Expression::shift_expression()
-{
- int value = additive_expression();
- switch (next()) {
- case PP_LTLT:
- return value << shift_expression();
- case PP_GTGT:
- return value >> shift_expression();
- default:
- prev();
- return value;
- }
-}
-
-int PP_Expression::additive_expression()
-{
- int value = multiplicative_expression();
- switch (next()) {
- case PP_PLUS:
- return value + additive_expression();
- case PP_MINUS:
- return value - additive_expression();
- default:
- prev();
- return value;
- }
-}
-
-int PP_Expression::multiplicative_expression()
-{
- int value = unary_expression();
- switch (next()) {
- case PP_STAR:
- return value * multiplicative_expression();
- case PP_PERCENT:
- {
- int remainder = multiplicative_expression();
- return remainder ? value % remainder : 0;
- }
- case PP_SLASH:
- {
- int div = multiplicative_expression();
- return div ? value / div : 0;
- }
- default:
- prev();
- return value;
- };
-}
-
-int PP_Expression::unary_expression()
-{
- switch (next()) {
- case PP_PLUS:
- return unary_expression();
- case PP_MINUS:
- return -unary_expression();
- case PP_NOT:
- return !unary_expression();
- case PP_TILDE:
- return ~unary_expression();
- case PP_MOC_TRUE:
- return 1;
- case PP_MOC_FALSE:
- return 0;
- default:
- prev();
- return primary_expression();
- }
-}
-
-bool PP_Expression::unary_expression_lookup()
-{
- Token t = lookup();
- return (primary_expression_lookup()
- || t == PP_PLUS
- || t == PP_MINUS
- || t == PP_NOT
- || t == PP_TILDE
- || t == PP_DEFINED);
-}
-
-int PP_Expression::primary_expression()
-{
- int value;
- if (test(PP_LPAREN)) {
- value = conditional_expression();
- test(PP_RPAREN);
- } else {
- next();
- value = lexem().toInt(0, 0);
- }
- return value;
-}
-
-bool PP_Expression::primary_expression_lookup()
-{
- Token t = lookup();
- return (t == PP_IDENTIFIER
- || t == PP_INTEGER_LITERAL
- || t == PP_FLOATING_LITERAL
- || t == PP_MOC_TRUE
- || t == PP_MOC_FALSE
- || t == PP_LPAREN);
-}
-
-int Preprocessor::evaluateCondition()
-{
- PP_Expression expression;
- expression.currentFilenames = currentFilenames;
-
- substituteUntilNewline(expression.symbols);
-
- return expression.value();
-}
-
-static QByteArray readOrMapFile(QFile *file)
-{
- const qint64 size = file->size();
- char *rawInput = reinterpret_cast<char*>(file->map(0, size));
- return rawInput ? QByteArray::fromRawData(rawInput, size) : file->readAll();
-}
-
-static void mergeStringLiterals(Symbols *_symbols)
-{
- Symbols &symbols = *_symbols;
- for (Symbols::iterator i = symbols.begin(); i != symbols.end(); ++i) {
- if (i->token == STRING_LITERAL) {
- Symbols::Iterator mergeSymbol = i;
- int literalsLength = mergeSymbol->len;
- while (++i != symbols.end() && i->token == STRING_LITERAL)
- literalsLength += i->len - 2; // no quotes
-
- if (literalsLength != mergeSymbol->len) {
- QByteArray mergeSymbolOriginalLexem = mergeSymbol->unquotedLexem();
- QByteArray &mergeSymbolLexem = mergeSymbol->lex;
- mergeSymbolLexem.resize(0);
- mergeSymbolLexem.reserve(literalsLength);
- mergeSymbolLexem.append('"');
- mergeSymbolLexem.append(mergeSymbolOriginalLexem);
- for (Symbols::const_iterator j = mergeSymbol + 1; j != i; ++j)
- mergeSymbolLexem.append(j->lex.constData() + j->from + 1, j->len - 2); // append j->unquotedLexem()
- mergeSymbolLexem.append('"');
- mergeSymbol->len = mergeSymbol->lex.length();
- mergeSymbol->from = 0;
- i = symbols.erase(mergeSymbol + 1, i);
- }
- if (i == symbols.end())
- break;
- }
- }
-}
-
-static QByteArray searchIncludePaths(const QList<Parser::IncludePath> &includepaths,
- const QByteArray &include)
-{
- QFileInfo fi;
- for (int j = 0; j < includepaths.size() && !fi.exists(); ++j) {
- const Parser::IncludePath &p = includepaths.at(j);
- if (p.isFrameworkPath) {
- const int slashPos = include.indexOf('/');
- if (slashPos == -1)
- continue;
- fi.setFile(QString::fromLocal8Bit(p.path + '/' + include.left(slashPos) + ".framework/Headers/"),
- QString::fromLocal8Bit(include.mid(slashPos + 1)));
- } else {
- fi.setFile(QString::fromLocal8Bit(p.path), QString::fromLocal8Bit(include));
- }
- // try again, maybe there's a file later in the include paths with the same name
- // (186067)
- if (fi.isDir()) {
- fi = QFileInfo();
- continue;
- }
- }
-
- if (!fi.exists() || fi.isDir())
- return QByteArray();
- return fi.canonicalFilePath().toLocal8Bit();
-}
-
-QByteArray Preprocessor::resolveInclude(const QByteArray &include, const QByteArray &relativeTo)
-{
- if (!relativeTo.isEmpty()) {
- QFileInfo fi;
- fi.setFile(QFileInfo(QString::fromLocal8Bit(relativeTo)).dir(), QString::fromLocal8Bit(include));
- if (fi.exists() && !fi.isDir())
- return fi.canonicalFilePath().toLocal8Bit();
- }
-
- auto it = nonlocalIncludePathResolutionCache.find(include);
- if (it == nonlocalIncludePathResolutionCache.end())
- it = nonlocalIncludePathResolutionCache.insert(include, searchIncludePaths(includes, include));
- return it.value();
-}
-
-void Preprocessor::preprocess(const QByteArray &filename, Symbols &preprocessed)
-{
- currentFilenames.push(filename);
- preprocessed.reserve(preprocessed.size() + symbols.size());
- while (hasNext()) {
- Token token = next();
-
- switch (token) {
- case PP_INCLUDE:
- {
- int lineNum = symbol().lineNum;
- QByteArray include;
- bool local = false;
- if (test(PP_STRING_LITERAL)) {
- local = lexem().startsWith('\"');
- include = unquotedLexem();
- } else
- continue;
- until(PP_NEWLINE);
-
- include = resolveInclude(include, local ? filename : QByteArray());
- if (include.isNull())
- continue;
-
- if (Preprocessor::preprocessedIncludes.contains(include))
- continue;
- Preprocessor::preprocessedIncludes.insert(include);
-
- QFile file(QString::fromLocal8Bit(include.constData()));
- if (!file.open(QFile::ReadOnly))
- continue;
-
- QByteArray input = readOrMapFile(&file);
-
- file.close();
- if (input.isEmpty())
- continue;
-
- Symbols saveSymbols = symbols;
- int saveIndex = index;
-
- // phase 1: get rid of backslash-newlines
- input = cleaned(input);
-
- // phase 2: tokenize for the preprocessor
- symbols = tokenize(input);
- input.clear();
-
- index = 0;
-
- // phase 3: preprocess conditions and substitute macros
- preprocessed += Symbol(0, MOC_INCLUDE_BEGIN, include);
- preprocess(include, preprocessed);
- preprocessed += Symbol(lineNum, MOC_INCLUDE_END, include);
-
- symbols = saveSymbols;
- index = saveIndex;
- continue;
- }
- case PP_DEFINE:
- {
- next(IDENTIFIER);
- QByteArray name = lexem();
- Macro macro;
- macro.isVariadic = false;
- Token t = next();
- if (t == LPAREN) {
- // we have a function macro
- macro.isFunction = true;
- parseDefineArguments(&macro);
- } else if (t == PP_WHITESPACE){
- macro.isFunction = false;
- } else {
- error("Moc: internal error");
- }
- int start = index;
- until(PP_NEWLINE);
- macro.symbols.reserve(index - start - 1);
-
- // remove whitespace where there shouldn't be any:
- // Before and after the macro, after a # and around ##
- Token lastToken = HASH; // skip shitespace at the beginning
- for (int i = start; i < index - 1; ++i) {
- Token token = symbols.at(i).token;
- if (token == PP_WHITESPACE || token == WHITESPACE) {
- if (lastToken == PP_HASH || lastToken == HASH ||
- lastToken == PP_HASHHASH ||
- lastToken == PP_WHITESPACE || lastToken == WHITESPACE)
- continue;
- } else if (token == PP_HASHHASH) {
- if (!macro.symbols.isEmpty() &&
- (lastToken == PP_WHITESPACE || lastToken == WHITESPACE))
- macro.symbols.pop_back();
- }
- macro.symbols.append(symbols.at(i));
- lastToken = token;
- }
- // remove trailing whitespace
- while (!macro.symbols.isEmpty() &&
- (macro.symbols.constLast().token == PP_WHITESPACE || macro.symbols.constLast().token == WHITESPACE))
- macro.symbols.pop_back();
-
- if (!macro.symbols.isEmpty()) {
- if (macro.symbols.constFirst().token == PP_HASHHASH ||
- macro.symbols.constLast().token == PP_HASHHASH) {
- error("'##' cannot appear at either end of a macro expansion");
- }
- }
- macros.insert(name, macro);
- continue;
- }
- case PP_UNDEF: {
- next(IDENTIFIER);
- QByteArray name = lexem();
- until(PP_NEWLINE);
- macros.remove(name);
- continue;
- }
- case PP_IDENTIFIER: {
- // substitute macros
- macroExpand(&preprocessed, this, symbols, index, symbol().lineNum, true);
- continue;
- }
- case PP_HASH:
- until(PP_NEWLINE);
- continue; // skip unknown preprocessor statement
- case PP_IFDEF:
- case PP_IFNDEF:
- case PP_IF:
- while (!evaluateCondition()) {
- if (!skipBranch())
- break;
- if (test(PP_ELIF)) {
- } else {
- until(PP_NEWLINE);
- break;
- }
- }
- continue;
- case PP_ELIF:
- case PP_ELSE:
- skipUntilEndif();
- Q_FALLTHROUGH();
- case PP_ENDIF:
- until(PP_NEWLINE);
- continue;
- case PP_NEWLINE:
- continue;
- case SIGNALS:
- case SLOTS: {
- Symbol sym = symbol();
- if (macros.contains("QT_NO_KEYWORDS"))
- sym.token = IDENTIFIER;
- else
- sym.token = (token == SIGNALS ? Q_SIGNALS_TOKEN : Q_SLOTS_TOKEN);
- preprocessed += sym;
- } continue;
- default:
- break;
- }
- preprocessed += symbol();
- }
-
- currentFilenames.pop();
-}
-
-Symbols Preprocessor::preprocessed(const QByteArray &filename, QFile *file)
-{
- QByteArray input = readOrMapFile(file);
-
- if (input.isEmpty())
- return symbols;
-
- // phase 1: get rid of backslash-newlines
- input = cleaned(input);
-
- // phase 2: tokenize for the preprocessor
- index = 0;
- symbols = tokenize(input);
-
-#if 0
- for (int j = 0; j < symbols.size(); ++j)
- fprintf(stderr, "line %d: %s(%s)\n",
- symbols[j].lineNum,
- symbols[j].lexem().constData(),
- tokenTypeName(symbols[j].token));
-#endif
-
- // phase 3: preprocess conditions and substitute macros
- Symbols result;
- // Preallocate some space to speed up the code below.
- // The magic value was found by logging the final size
- // and calculating an average when running moc over FOSS projects.
- result.reserve(file->size() / 300000);
- preprocess(filename, result);
- mergeStringLiterals(&result);
-
-#if 0
- for (int j = 0; j < result.size(); ++j)
- fprintf(stderr, "line %d: %s(%s)\n",
- result[j].lineNum,
- result[j].lexem().constData(),
- tokenTypeName(result[j].token));
-#endif
-
- return result;
-}
-
-void Preprocessor::parseDefineArguments(Macro *m)
-{
- Symbols arguments;
- while (hasNext()) {
- while (test(PP_WHITESPACE)) {}
- Token t = next();
- if (t == PP_RPAREN)
- break;
- if (t != PP_IDENTIFIER) {
- QByteArray l = lexem();
- if (l == "...") {
- m->isVariadic = true;
- arguments += Symbol(symbol().lineNum, PP_IDENTIFIER, "__VA_ARGS__");
- while (test(PP_WHITESPACE)) {}
- if (!test(PP_RPAREN))
- error("missing ')' in macro argument list");
- break;
- } else if (!is_identifier(l.constData(), l.length())) {
- error("Unexpected character in macro argument list.");
- }
- }
-
- Symbol arg = symbol();
- if (arguments.contains(arg))
- error("Duplicate macro parameter.");
- arguments += symbol();
-
- while (test(PP_WHITESPACE)) {}
- t = next();
- if (t == PP_RPAREN)
- break;
- if (t == PP_COMMA)
- continue;
- if (lexem() == "...") {
- //GCC extension: #define FOO(x, y...) x(y)
- // The last argument was already parsed. Just mark the macro as variadic.
- m->isVariadic = true;
- while (test(PP_WHITESPACE)) {}
- if (!test(PP_RPAREN))
- error("missing ')' in macro argument list");
- break;
- }
- error("Unexpected character in macro argument list.");
- }
- m->arguments = arguments;
- while (test(PP_WHITESPACE)) {}
-}
-
-void Preprocessor::until(Token t)
-{
- while(hasNext() && next() != t)
- ;
-}
-
-QT_END_NAMESPACE
diff --git a/tools/repc/moc_copy/preprocessor.h b/tools/repc/moc_copy/preprocessor.h
deleted file mode 100644
index 39f56d6..0000000
--- a/tools/repc/moc_copy/preprocessor.h
+++ /dev/null
@@ -1,92 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the tools applications of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** 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 The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** 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-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef PREPROCESSOR_H
-#define PREPROCESSOR_H
-
-#include "parser.h"
-#include <qlist.h>
-#include <qset.h>
-#include <stdio.h>
-
-QT_BEGIN_NAMESPACE
-
-struct Macro
-{
- Macro() : isFunction(false), isVariadic(false) {}
- bool isFunction;
- bool isVariadic;
- Symbols arguments;
- Symbols symbols;
-};
-
-#ifdef USE_LEXEM_STORE
-typedef QByteArray MacroName;
-#else
-typedef SubArray MacroName;
-#endif
-typedef QHash<MacroName, Macro> Macros;
-
-class QFile;
-
-class Preprocessor : public Parser
-{
-public:
- Preprocessor(){}
- static bool preprocessOnly;
- QList<QByteArray> frameworks;
- QSet<QByteArray> preprocessedIncludes;
- QHash<QByteArray, QByteArray> nonlocalIncludePathResolutionCache;
- Macros macros;
- QByteArray resolveInclude(const QByteArray &filename, const QByteArray &relativeTo);
- Symbols preprocessed(const QByteArray &filename, QFile *device);
-
- void parseDefineArguments(Macro *m);
-
- void skipUntilEndif();
- bool skipBranch();
-
- void substituteUntilNewline(Symbols &substituted);
- static Symbols macroExpandIdentifier(Preprocessor *that, SymbolStack &symbols, int lineNum, QByteArray *macroName);
- static void macroExpand(Symbols *into, Preprocessor *that, const Symbols &toExpand, int &index, int lineNum, bool one,
- const QSet<QByteArray> &excludeSymbols = QSet<QByteArray>());
-
- int evaluateCondition();
-
- enum TokenizeMode { TokenizeCpp, TokenizePreprocessor, PreparePreprocessorStatement, TokenizePreprocessorStatement, TokenizeInclude, PrepareDefine, TokenizeDefine };
- static Symbols tokenize(const QByteArray &input, int lineNum = 1, TokenizeMode mode = TokenizeCpp);
-
-private:
- void until(Token);
-
- void preprocess(const QByteArray &filename, Symbols &preprocessed);
-};
-
-QT_END_NAMESPACE
-
-#endif // PREPROCESSOR_H
diff --git a/tools/repc/moc_copy/symbols.h b/tools/repc/moc_copy/symbols.h
deleted file mode 100644
index af5e90e..0000000
--- a/tools/repc/moc_copy/symbols.h
+++ /dev/null
@@ -1,193 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Copyright (C) 2013 Olivier Goffart <ogoffart@woboq.com>
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the tools applications of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** 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 The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** 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-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef SYMBOLS_H
-#define SYMBOLS_H
-
-#include "token.h"
-#include <qstring.h>
-#include <qhash.h>
-#include <qvector.h>
-#include <qstack.h>
-#include <qdebug.h>
-
-QT_BEGIN_NAMESPACE
-
-//#define USE_LEXEM_STORE
-
-struct SubArray
-{
- inline SubArray():from(0),len(-1){}
- inline SubArray(const QByteArray &a):array(a),from(0), len(a.size()){}
- inline SubArray(const char *s):array(s),from(0) { len = array.size(); }
- inline SubArray(const QByteArray &a, int from, int len):array(a), from(from), len(len){}
- QByteArray array;
- int from, len;
- inline bool operator==(const SubArray &other) const {
- if (len != other.len)
- return false;
- for (int i = 0; i < len; ++i)
- if (array.at(from + i) != other.array.at(other.from + i))
- return false;
- return true;
- }
-};
-
-inline uint qHash(const SubArray &key)
-{
- return qHash(QLatin1String(key.array.constData() + key.from, key.len));
-}
-
-
-struct Symbol
-{
-
-#ifdef USE_LEXEM_STORE
- typedef QHash<SubArray, QHashDummyValue> LexemStore;
- static LexemStore lexemStore;
-
- inline Symbol() : lineNum(-1),token(NOTOKEN){}
- inline Symbol(int lineNum, Token token):
- lineNum(lineNum), token(token){}
- inline Symbol(int lineNum, Token token, const QByteArray &lexem):
- lineNum(lineNum), token(token),lex(lexem){}
- inline Symbol(int lineNum, Token token, const QByteArray &lexem, int from, int len):
- lineNum(lineNum), token(token){
- LexemStore::const_iterator it = lexemStore.constFind(SubArray(lexem, from, len));
-
- if (it != lexemStore.constEnd()) {
- lex = it.key().array;
- } else {
- lex = lexem.mid(from, len);
- lexemStore.insert(lex, QHashDummyValue());
- }
- }
- int lineNum;
- Token token;
- inline QByteArray unquotedLexem() const { return lex.mid(1, lex.length()-2); }
- inline QByteArray lexem() const { return lex; }
- inline operator QByteArray() const { return lex; }
- QByteArray lex;
-
-#else
-
- inline Symbol() : lineNum(-1),token(NOTOKEN), from(0),len(-1) {}
- inline Symbol(int lineNum, Token token):
- lineNum(lineNum), token(token), from(0), len(-1) {}
- inline Symbol(int lineNum, Token token, const QByteArray &lexem):
- lineNum(lineNum), token(token), lex(lexem), from(0) { len = lex.size(); }
- inline Symbol(int lineNum, Token token, const QByteArray &lexem, int from, int len):
- lineNum(lineNum), token(token),lex(lexem),from(from), len(len){}
- int lineNum;
- Token token;
- inline QByteArray lexem() const { return lex.mid(from, len); }
- inline QByteArray unquotedLexem() const { return lex.mid(from+1, len-2); }
- inline operator SubArray() const { return SubArray(lex, from, len); }
- bool operator==(const Symbol& o) const
- {
- return SubArray(lex, from, len) == SubArray(o.lex, o.from, o.len);
- }
- QByteArray lex;
- int from, len;
-
-#endif
-};
-Q_DECLARE_TYPEINFO(Symbol, Q_MOVABLE_TYPE);
-
-typedef QVector<Symbol> Symbols;
-
-struct SafeSymbols {
- Symbols symbols;
- QByteArray expandedMacro;
- QSet<QByteArray> excludedSymbols;
- int index;
-};
-Q_DECLARE_TYPEINFO(SafeSymbols, Q_MOVABLE_TYPE);
-
-class SymbolStack : public QStack<SafeSymbols>
-{
-public:
- inline bool hasNext() {
- while (!isEmpty() && top().index >= top().symbols.size())
- pop();
- return !isEmpty();
- }
- inline Token next() {
- while (!isEmpty() && top().index >= top().symbols.size())
- pop();
- if (isEmpty())
- return NOTOKEN;
- return top().symbols.at(top().index++).token;
- }
- bool test(Token);
- inline const Symbol &symbol() const { return top().symbols.at(top().index-1); }
- inline Token token() { return symbol().token; }
- inline QByteArray lexem() const { return symbol().lexem(); }
- inline QByteArray unquotedLexem() { return symbol().unquotedLexem(); }
-
- bool dontReplaceSymbol(const QByteArray &name);
- QSet<QByteArray> excludeSymbols();
-};
-
-inline bool SymbolStack::test(Token token)
-{
- int stackPos = size() - 1;
- while (stackPos >= 0 && at(stackPos).index >= at(stackPos).symbols.size())
- --stackPos;
- if (stackPos < 0)
- return false;
- if (at(stackPos).symbols.at(at(stackPos).index).token == token) {
- next();
- return true;
- }
- return false;
-}
-
-inline bool SymbolStack::dontReplaceSymbol(const QByteArray &name)
-{
- for (int i = 0; i < size(); ++i) {
- if (name == at(i).expandedMacro || at(i).excludedSymbols.contains(name))
- return true;
- }
- return false;
-}
-
-inline QSet<QByteArray> SymbolStack::excludeSymbols()
-{
- QSet<QByteArray> set;
- for (int i = 0; i < size(); ++i) {
- set << at(i).expandedMacro;
- set += at(i).excludedSymbols;
- }
- return set;
-}
-
-QT_END_NAMESPACE
-
-#endif // SYMBOLS_H
diff --git a/tools/repc/moc_copy/token.cpp b/tools/repc/moc_copy/token.cpp
deleted file mode 100644
index cf1aa10..0000000
--- a/tools/repc/moc_copy/token.cpp
+++ /dev/null
@@ -1,45 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the tools applications of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** 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 The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** 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-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "token.h"
-
-QT_BEGIN_NAMESPACE
-
-#if defined(DEBUG_MOC)
-const char *tokenTypeName(Token t)
-{
- switch (t) {
-#define CREATE_CASE(Name) case Name: return #Name;
- FOR_ALL_TOKENS(CREATE_CASE)
-#undef CREATE_CASE
- }
- return "";
-}
-#endif
-
-QT_END_NAMESPACE
diff --git a/tools/repc/moc_copy/token.h b/tools/repc/moc_copy/token.h
deleted file mode 100644
index db9d319..0000000
--- a/tools/repc/moc_copy/token.h
+++ /dev/null
@@ -1,274 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the tools applications of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** 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 The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** 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-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef TOKEN_H
-#define TOKEN_H
-
-#include <QtCore/qglobal.h>
-
-QT_BEGIN_NAMESPACE
-
-#define FOR_ALL_TOKENS(F) \
- F(NOTOKEN) \
- F(IDENTIFIER) \
- F(INTEGER_LITERAL) \
- F(CHARACTER_LITERAL) \
- F(STRING_LITERAL) \
- F(BOOLEAN_LITERAL) \
- F(HEADER_NAME) \
- F(LANGLE) \
- F(RANGLE) \
- F(LPAREN) \
- F(RPAREN) \
- F(ELIPSIS) \
- F(LBRACK) \
- F(RBRACK) \
- F(LBRACE) \
- F(RBRACE) \
- F(EQ) \
- F(SCOPE) \
- F(SEMIC) \
- F(COLON) \
- F(DOTSTAR) \
- F(QUESTION) \
- F(DOT) \
- F(DYNAMIC_CAST) \
- F(STATIC_CAST) \
- F(REINTERPRET_CAST) \
- F(CONST_CAST) \
- F(TYPEID) \
- F(THIS) \
- F(TEMPLATE) \
- F(THROW) \
- F(TRY) \
- F(CATCH) \
- F(TYPEDEF) \
- F(FRIEND) \
- F(CLASS) \
- F(NAMESPACE) \
- F(ENUM) \
- F(STRUCT) \
- F(UNION) \
- F(VIRTUAL) \
- F(PRIVATE) \
- F(PROTECTED) \
- F(PUBLIC) \
- F(EXPORT) \
- F(AUTO) \
- F(REGISTER) \
- F(EXTERN) \
- F(MUTABLE) \
- F(ASM) \
- F(USING) \
- F(INLINE) \
- F(EXPLICIT) \
- F(STATIC) \
- F(CONST) \
- F(VOLATILE) \
- F(OPERATOR) \
- F(SIZEOF) \
- F(NEW) \
- F(DELETE) \
- F(PLUS) \
- F(MINUS) \
- F(STAR) \
- F(SLASH) \
- F(PERCENT) \
- F(HAT) \
- F(AND) \
- F(OR) \
- F(TILDE) \
- F(NOT) \
- F(PLUS_EQ) \
- F(MINUS_EQ) \
- F(STAR_EQ) \
- F(SLASH_EQ) \
- F(PERCENT_EQ) \
- F(HAT_EQ) \
- F(AND_EQ) \
- F(OR_EQ) \
- F(LTLT) \
- F(GTGT) \
- F(GTGT_EQ) \
- F(LTLT_EQ) \
- F(EQEQ) \
- F(NE) \
- F(LE) \
- F(GE) \
- F(ANDAND) \
- F(OROR) \
- F(INCR) \
- F(DECR) \
- F(COMMA) \
- F(ARROW_STAR) \
- F(ARROW) \
- F(CHAR) \
- F(WCHAR) \
- F(BOOL) \
- F(SHORT) \
- F(INT) \
- F(LONG) \
- F(SIGNED) \
- F(UNSIGNED) \
- F(FLOAT) \
- F(DOUBLE) \
- F(VOID) \
- F(CASE) \
- F(DEFAULT) \
- F(IF) \
- F(ELSE) \
- F(SWITCH) \
- F(WHILE) \
- F(DO) \
- F(FOR) \
- F(BREAK) \
- F(CONTINUE) \
- F(GOTO) \
- F(SIGNALS) \
- F(SLOTS) \
- F(RETURN) \
- F(Q_OBJECT_TOKEN) \
- F(Q_GADGET_TOKEN) \
- F(Q_NAMESPACE_TOKEN) \
- F(Q_PROPERTY_TOKEN) \
- F(Q_PLUGIN_METADATA_TOKEN) \
- F(Q_ENUMS_TOKEN) \
- F(Q_ENUM_TOKEN) \
- F(Q_ENUM_NS_TOKEN) \
- F(Q_FLAGS_TOKEN) \
- F(Q_FLAG_TOKEN) \
- F(Q_FLAG_NS_TOKEN) \
- F(Q_DECLARE_FLAGS_TOKEN) \
- F(Q_DECLARE_INTERFACE_TOKEN) \
- F(Q_DECLARE_METATYPE_TOKEN) \
- F(Q_CLASSINFO_TOKEN) \
- F(Q_INTERFACES_TOKEN) \
- F(Q_SIGNALS_TOKEN) \
- F(Q_SLOTS_TOKEN) \
- F(Q_SIGNAL_TOKEN) \
- F(Q_SLOT_TOKEN) \
- F(Q_PRIVATE_SLOT_TOKEN) \
- F(Q_MOC_COMPAT_TOKEN) \
- F(Q_INVOKABLE_TOKEN) \
- F(Q_SCRIPTABLE_TOKEN) \
- F(Q_PRIVATE_PROPERTY_TOKEN) \
- F(Q_REVISION_TOKEN) \
- F(SPECIAL_TREATMENT_MARK) \
- F(MOC_INCLUDE_BEGIN) \
- F(MOC_INCLUDE_END) \
- F(CPP_COMMENT) \
- F(C_COMMENT) \
- F(FLOATING_LITERAL) \
- F(HASH) \
- F(QUOTE) \
- F(SINGLEQUOTE) \
- F(LANGLE_SCOPE) \
- F(DIGIT) \
- F(CHARACTER) \
- F(NEWLINE) \
- F(WHITESPACE) \
- F(BACKSLASH) \
- F(INCOMPLETE) \
- F(PP_DEFINE) \
- F(PP_UNDEF) \
- F(PP_IF) \
- F(PP_IFDEF) \
- F(PP_IFNDEF) \
- F(PP_ELIF) \
- F(PP_ELSE) \
- F(PP_ENDIF) \
- F(PP_INCLUDE) \
- F(PP_HASHHASH) \
- F(PP_HASH) \
- F(PP_DEFINED) \
- F(PP_INCOMPLETE) \
- F(PP_MOC_TRUE) \
- F(PP_MOC_FALSE)
-
-
-enum Token {
-
-#define CREATE_ENUM_VALUE(Name) Name,
- FOR_ALL_TOKENS(CREATE_ENUM_VALUE)
-#undef CREATE_ENUM_VALUE
-
- // aliases
- PP_AND = AND,
- PP_ANDAND = ANDAND,
- PP_BACKSLASH = BACKSLASH,
- PP_CHARACTER = CHARACTER,
- PP_CHARACTER_LITERAL = CHARACTER_LITERAL,
- PP_COLON = COLON,
- PP_COMMA = COMMA,
- PP_CPP_COMMENT = CPP_COMMENT,
- PP_C_COMMENT = C_COMMENT,
- PP_DIGIT = DIGIT,
- PP_EQEQ = EQEQ,
- PP_FLOATING_LITERAL = FLOATING_LITERAL,
- PP_GE = GE,
- PP_GTGT = GTGT,
- PP_HAT = HAT,
- PP_IDENTIFIER = IDENTIFIER,
- PP_INTEGER_LITERAL = INTEGER_LITERAL,
- PP_LANGLE = LANGLE,
- PP_LE = LE,
- PP_LPAREN = LPAREN,
- PP_LTLT = LTLT,
- PP_MINUS = MINUS,
- PP_NE = NE,
- PP_NEWLINE = NEWLINE,
- PP_NOTOKEN = NOTOKEN,
- PP_NOT = NOT,
- PP_OR = OR,
- PP_OROR = OROR,
- PP_PERCENT = PERCENT,
- PP_PLUS = PLUS,
- PP_QUESTION = QUESTION,
- PP_QUOTE = QUOTE,
- PP_RANGLE = RANGLE,
- PP_RPAREN = RPAREN,
- PP_SINGLEQUOTE = SINGLEQUOTE,
- PP_SLASH = SLASH,
- PP_STAR = STAR,
- PP_STRING_LITERAL = STRING_LITERAL,
- PP_TILDE = TILDE,
- PP_WHITESPACE = WHITESPACE,
- Q_META_TOKEN_BEGIN = Q_OBJECT_TOKEN,
- Q_META_TOKEN_END = SPECIAL_TREATMENT_MARK
-};
-
-// for debugging only
-#if defined(DEBUG_MOC)
-const char *tokenTypeName(Token t);
-#endif
-
-typedef Token PP_Token;
-
-QT_END_NAMESPACE
-
-#endif // TOKEN_H
diff --git a/tools/repc/moc_copy/util/generate.sh b/tools/repc/moc_copy/util/generate.sh
deleted file mode 100755
index 3894be1..0000000
--- a/tools/repc/moc_copy/util/generate.sh
+++ /dev/null
@@ -1,35 +0,0 @@
-#!/bin/sh
-#############################################################################
-##
-## Copyright (C) 2016 The Qt Company Ltd.
-## Contact: https://www.qt.io/licensing/
-##
-## This file is the build configuration utility of the Qt Toolkit.
-##
-## $QT_BEGIN_LICENSE:GPL-EXCEPT$
-## 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 The Qt Company. For licensing terms
-## and conditions see https://www.qt.io/terms-conditions. For further
-## information use the contact form at https://www.qt.io/contact-us.
-##
-## GNU General Public License Usage
-## Alternatively, this file may be used under the terms of the GNU
-## General Public License version 3 as published by the Free Software
-## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-## 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-3.0.html.
-##
-## $QT_END_LICENSE$
-##
-#############################################################################
-
-qmake
-make
-cat licenseheader.txt > ../keywords.cpp
-cat licenseheader.txt > ../ppkeywords.cpp
-./generate_keywords >> ../keywords.cpp
-./generate_keywords preprocessor >> ../ppkeywords.cpp
diff --git a/tools/repc/moc_copy/util/generate_keywords.cpp b/tools/repc/moc_copy/util/generate_keywords.cpp
deleted file mode 100644
index df850c1..0000000
--- a/tools/repc/moc_copy/util/generate_keywords.cpp
+++ /dev/null
@@ -1,463 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the tools applications of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** 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 The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** 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-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-#include <stdio.h>
-#include <string.h>
-#include <qbytearray.h>
-#include <qlist.h>
-
-struct Keyword
-{
- const char *lexem;
- const char *token;
-};
-
-static const Keyword pp_keywords[] = {
- { "<", "PP_LANGLE" },
- { ">", "PP_RANGLE" },
- { "(", "PP_LPAREN"},
- { ")", "PP_RPAREN"},
- { ",", "PP_COMMA"},
- { "\n", "PP_NEWLINE"},
- { "#define", "PP_DEFINE"},
- { "#if", "PP_IF"},
- { "#undef", "PP_UNDEF"},
- { "#ifdef", "PP_IFDEF"},
- { "#ifndef", "PP_IFNDEF"},
- { "#elif", "PP_ELIF"},
- { "#else", "PP_ELSE"},
- { "#endif", "PP_ENDIF"},
- { "#include", "PP_INCLUDE"},
- { "defined", "PP_DEFINED"},
- { "+", "PP_PLUS" },
- { "-", "PP_MINUS" },
- { "*", "PP_STAR" },
- { "/", "PP_SLASH" },
- { "%", "PP_PERCENT" },
- { "^", "PP_HAT" },
- { "&", "PP_AND" },
- { "bitand", "PP_AND" },
- { "|", "PP_OR" },
- { "bitor", "PP_OR" },
- { "~", "PP_TILDE" },
- { "compl", "PP_TILDE" },
- { "!", "PP_NOT" },
- { "not", "PP_NOT" },
- { "<<", "PP_LTLT" },
- { ">>", "PP_GTGT" },
- { "==", "PP_EQEQ" },
- { "!=", "PP_NE" },
- { "not_eq", "PP_NE" },
- { "<=", "PP_LE" },
- { ">=", "PP_GE" },
- { "&&", "PP_ANDAND" },
- { "||", "PP_OROR" },
- { "?", "PP_QUESTION" },
- { ":", "PP_COLON" },
- { "##", "PP_HASHHASH"},
- { "%:%:", "PP_HASHHASH"},
- { "#", "PP_HASH"},
- { "\"", "PP_QUOTE"},
- { "\'", "PP_SINGLEQUOTE"},
- { " ", "PP_WHITESPACE" },
- { "\t", "PP_WHITESPACE" },
- { "//", "PP_CPP_COMMENT" },
- { "/*", "PP_C_COMMENT" },
- { "\\", "PP_BACKSLASH" },
- { 0, "PP_NOTOKEN"}
-};
-
-static const Keyword keywords[] = {
- { "<", "LANGLE" },
- { ">", "RANGLE" },
- { "(", "LPAREN" },
- { ")", "RPAREN" },
- { "...", "ELIPSIS" },
- { ",", "COMMA" },
- { "[", "LBRACK" },
- { "]", "RBRACK" },
- { "<:", "LBRACK" },
- { ":>", "RBRACK" },
- { "<::", "LANGLE_SCOPE" },
- { "{", "LBRACE" },
- { "<%", "LBRACE" },
- { "}", "RBRACE" },
- { "%>", "RBRACE" },
- { "=", "EQ" },
- { "::", "SCOPE" },
- { ";", "SEMIC" },
- { ":", "COLON" },
- { ".*", "DOTSTAR" },
- { "?", "QUESTION" },
- { ".", "DOT" },
- { "dynamic_cast", "DYNAMIC_CAST" },
- { "static_cast", "STATIC_CAST" },
- { "reinterpret_cast", "REINTERPRET_CAST" },
- { "const_cast", "CONST_CAST" },
- { "typeid", "TYPEID" },
- { "this", "THIS" },
- { "template", "TEMPLATE" },
- { "throw", "THROW" },
- { "try", "TRY" },
- { "catch", "CATCH" },
- { "typedef", "TYPEDEF" },
- { "friend", "FRIEND" },
- { "class", "CLASS" },
- { "namespace", "NAMESPACE" },
- { "enum", "ENUM" },
- { "struct", "STRUCT" },
- { "union", "UNION" },
- { "virtual", "VIRTUAL" },
- { "private", "PRIVATE" },
- { "protected", "PROTECTED" },
- { "public", "PUBLIC" },
- { "export", "EXPORT" },
- { "auto", "AUTO" },
- { "register", "REGISTER" },
- { "extern", "EXTERN" },
- { "mutable", "MUTABLE" },
- { "asm", "ASM" },
- { "using", "USING" },
- { "inline", "INLINE" },
- { "explicit", "EXPLICIT" },
- { "static", "STATIC" },
- { "const", "CONST" },
- { "volatile", "VOLATILE" },
- { "operator", "OPERATOR" },
- { "sizeof", "SIZEOF" },
- { "new", "NEW" },
- { "delete", "DELETE" },
- { "+", "PLUS" },
- { "-", "MINUS" },
- { "*", "STAR" },
- { "/", "SLASH" },
- { "%", "PERCENT" },
- { "^", "HAT" },
- { "&", "AND" },
- { "bitand", "AND" },
- { "|", "OR" },
- { "bitor", "OR" },
- { "~", "TILDE" },
- { "compl", "TILDE" },
- { "!", "NOT" },
- { "not", "NOT" },
- { "+=", "PLUS_EQ" },
- { "-=", "MINUS_EQ" },
- { "*=", "STAR_EQ" },
- { "/=", "SLASH_EQ" },
- { "%=", "PERCENT_EQ" },
- { "^=", "HAT_EQ" },
- { "&=", "AND_EQ" },
- { "|=", "OR_EQ" },
- { "<<", "LTLT" },
- { ">>", "GTGT" },
- { ">>=", "GTGT_EQ" },
- { "<<=", "LTLT_EQ" },
- { "==", "EQEQ" },
- { "!=", "NE" },
- { "not_eq", "NE" },
- { "<=", "LE" },
- { ">=", "GE" },
- { "&&", "ANDAND" },
- { "||", "OROR" },
- { "++", "INCR" },
- { "--", "DECR" },
- { ",", "COMMA" },
- { "->*", "ARROW_STAR" },
- { "->", "ARROW" },
- { "char", "CHAR" },
- { "wchar", "WCHAR" },
- { "bool", "BOOL" },
- { "short", "SHORT" },
- { "int", "INT" },
- { "long", "LONG" },
- { "signed", "SIGNED" },
- { "unsigned", "UNSIGNED" },
- { "float", "FLOAT" },
- { "double", "DOUBLE" },
- { "void", "VOID" },
- { "case", "CASE" },
- { "default", "DEFAULT" },
- { "if", "IF" },
- { "else", "ELSE" },
- { "switch", "SWITCH" },
- { "while", "WHILE" },
- { "do", "DO" },
- { "for", "FOR" },
- { "break", "BREAK" },
- { "continue", "CONTINUE" },
- { "goto", "GOTO" },
- { "return", "RETURN" },
- { "Q_OBJECT", "Q_OBJECT_TOKEN" },
- { "Q_NAMESPACE", "Q_NAMESPACE_TOKEN" },
- { "Q_GADGET", "Q_GADGET_TOKEN" },
- { "Q_PROPERTY", "Q_PROPERTY_TOKEN" },
- { "Q_PLUGIN_METADATA", "Q_PLUGIN_METADATA_TOKEN" },
- { "Q_ENUMS", "Q_ENUMS_TOKEN" },
- { "Q_ENUM", "Q_ENUM_TOKEN" },
- { "Q_ENUM_NS", "Q_ENUM_NS_TOKEN" },
- { "Q_FLAGS", "Q_FLAGS_TOKEN" },
- { "Q_FLAG", "Q_FLAG_TOKEN" },
- { "Q_FLAG_NS", "Q_FLAG_NS_TOKEN" },
- { "Q_DECLARE_FLAGS", "Q_DECLARE_FLAGS_TOKEN" },
- { "Q_DECLARE_INTERFACE", "Q_DECLARE_INTERFACE_TOKEN" },
- { "Q_DECLARE_METATYPE", "Q_DECLARE_METATYPE_TOKEN" },
- { "Q_DECLARE_EXTENSION_INTERFACE", "Q_DECLARE_INTERFACE_TOKEN" },
- { "Q_SETS", "Q_FLAGS_TOKEN" },
- { "Q_CLASSINFO", "Q_CLASSINFO_TOKEN" },
- { "Q_INTERFACES", "Q_INTERFACES_TOKEN" },
- { "signals", "SIGNALS" },
- { "slots", "SLOTS" },
- { "Q_SIGNALS", "Q_SIGNALS_TOKEN" },
- { "Q_SLOTS", "Q_SLOTS_TOKEN" },
- { "Q_PRIVATE_SLOT", "Q_PRIVATE_SLOT_TOKEN" },
- { "QT_MOC_COMPAT", "Q_MOC_COMPAT_TOKEN" },
- { "Q_INVOKABLE", "Q_INVOKABLE_TOKEN" },
- { "Q_SIGNAL", "Q_SIGNAL_TOKEN" },
- { "Q_SLOT", "Q_SLOT_TOKEN" },
- { "Q_SCRIPTABLE", "Q_SCRIPTABLE_TOKEN" },
- { "Q_PRIVATE_PROPERTY", "Q_PRIVATE_PROPERTY_TOKEN" },
- { "Q_REVISION", "Q_REVISION_TOKEN" },
- { "\n", "NEWLINE" },
- { "\"", "QUOTE" },
- { "\'", "SINGLEQUOTE" },
- { " ", "WHITESPACE" },
- { "\t", "WHITESPACE" },
- { "#", "HASH" },
- { "##", "PP_HASHHASH" },
- { "\\", "BACKSLASH" },
- { "//", "CPP_COMMENT" },
- { "/*", "C_COMMENT" },
- { 0, "NOTOKEN"}
-};
-
-
-inline bool is_ident_start(char s)
-{
- return ((s >= 'a' && s <= 'z')
- || (s >= 'A' && s <= 'Z')
- || s == '_' || s == '$'
- );
-}
-
-inline bool is_ident_char(char s)
-{
- return ((s >= 'a' && s <= 'z')
- || (s >= 'A' && s <= 'Z')
- || (s >= '0' && s <= '9')
- || s == '_' || s == '$'
- );
-}
-struct State
-{
- State(const char* token):token(token), nextindex(0),
- defchar(0), defnext(0), ident(0) {
- memset( next, 0, sizeof(next));
- }
- QByteArray token;
- int next[128];
- int nextindex;
-
- char defchar;
- int defnext;
-
- const char *ident;
-
- bool operator==(const State& o) const
- {
- return (token == o.token
- && nextindex == o.nextindex
- && defchar == o.defchar
- && defnext == o.defnext
- && ident == o.ident);
- }
-};
-
-void newState(QList<State> &states, const char *token, const char *lexem, bool pre)
-{
- const char * ident = 0;
- if (is_ident_start(*lexem))
- ident = pre?"PP_CHARACTER" : "CHARACTER";
- else if (*lexem == '#')
- ident = pre?"PP_HASH" : "HASH";
-
- int state = 0;
- while (*lexem) {
- int next = states[state].next[(int)*lexem];
- if (!next) {
- const char * t = 0;
- if (ident)
- t = ident;
- else
- t = pre?"PP_INCOMPLETE":"INCOMPLETE";
- next = states.size();
- states += State(t);
- states[state].next[(int)*lexem] = next;
- states[next].ident = ident;
- }
- state = next;
- ++lexem;
- if (ident && !is_ident_char(*lexem))
- ident = 0;
- }
- states[state].token = token;
-}
-
-void newState(QList<State> &states, const char *token, char lexem)
-{
- int next = states[0].next[(int)lexem];
- if (!next) {
- next = states.size();
- states += State(token);
- states[0].next[(int)lexem] = next;
- } else {
- states[next].token = token;
- }
-}
-
-
-void makeTable(const Keyword keywords[])
-{
- int i,c;
- bool pre = (keywords == pp_keywords);
- QList<State> states;
- states += State(pre?"PP_NOTOKEN":"NOTOKEN");
-
- // identifiers
- for (c = 'a'; c <= 'z'; ++c)
- newState(states, pre?"PP_CHARACTER":"CHARACTER", c);
- for (c = 'A'; c <= 'Z'; ++c)
- newState(states, pre?"PP_CHARACTER":"CHARACTER", c);
-
- newState(states, pre?"PP_CHARACTER":"CHARACTER", '_');
- newState(states, pre?"PP_CHARACTER":"CHARACTER", '$');
-
- // add digits
- for (c = '0'; c <= '9'; ++c)
- newState(states, pre?"PP_DIGIT":"DIGIT", c);
-
- // keywords
- for (i = 0; keywords[i].lexem; ++i)
- newState(states, keywords[i].token, keywords[i].lexem, pre);
-
- // some floats
- for (c = '0'; c <= '9'; ++c)
- newState(states, pre?"PP_FLOATING_LITERAL":"FLOATING_LITERAL",
- QByteArray(".") + char(c), pre);
-
- // simplify table with default transitions
- int transindex = -1;
- for (i = 0; i < states.size(); ++i) {
- int n = 0;
- int defchar = -1;
- for (c = 0; c < 128; ++c)
- if (states[i].next[c]) {
- ++n;
- defchar = c;
- }
- if (!n)
- continue;
- if (n == 1) {
- states[i].defnext = states[i].next[defchar];
- states[i].defchar = defchar;
- continue;
- }
- states[i].nextindex = ++transindex;
- }
-
-#if 1
- // compress table
- int j, k;
- for (i = 0; i < states.size(); ++i) {
- for (j = i + 1; j < states.size(); ++j) {
- if ( states[i] == states[j] ) {
- for (k = 0; k < states.size(); ++k) {
- if (states[k].defnext == j)
- states[k].defnext = i;
- if (states[k].defnext > j)
- --states[k].defnext;
- for (c = 0; c < 128; ++c) {
- if (states[k].next[c] == j)
- states[k].next[c] = i;
- if (states[k].next[c] > j)
- --states[k].next[c];
- }
- }
- states.removeAt(j);
- --j;
- }
- }
- }
-#endif
- printf("static const short %skeyword_trans[][128] = {\n",
- pre?"pp_":"");
- for (i = 0; i < states.size(); ++i) {
- if (i && !states[i].nextindex)
- continue;
- printf("%s {", i?",\n":"");
- for (c = 0; c < 128; ++c)
- printf("%s%s%d",
- c?",":"",
- (!c || c%16)?"":"\n ",
- states[i].next[c]
- );
- printf("}");
- }
- printf("\n};\n\n");
-
- printf("static const struct\n{\n"
- " %sToken token;\n"
- " short next;\n"
- " char defchar;\n"
- " short defnext;\n"
- " %sToken ident;\n"
- "} %skeywords[] = {\n",
- pre ? "PP_":"",
- pre ? "PP_":"",
- pre ? "pp_":"");
- for (i = 0; i < states.size(); ++i) {
- printf("%s {%s, %d, %d, %d, %s}",
- i?",\n":"",
- states[i].token.data(),
- states[i].nextindex,
- states[i].defchar,
- states[i].defnext,
- states[i].ident?states[i].ident:(pre?"PP_NOTOKEN":"NOTOKEN"));
- }
- printf("\n};\n");
-}
-
-int main(int argc, char **)
-{
- printf("// auto generated\n"
- "// DO NOT EDIT.\n\n");
- if ( argc > 1 )
- makeTable(pp_keywords);
- else
- makeTable(keywords);
- return 0;
-}
diff --git a/tools/repc/moc_copy/util/generate_keywords.pro b/tools/repc/moc_copy/util/generate_keywords.pro
deleted file mode 100644
index 88e5553..0000000
--- a/tools/repc/moc_copy/util/generate_keywords.pro
+++ /dev/null
@@ -1,4 +0,0 @@
-CONFIG -= moc
-mac:CONFIG -= app_bundle
-
-SOURCES += generate_keywords.cpp
diff --git a/tools/repc/moc_copy/util/licenseheader.txt b/tools/repc/moc_copy/util/licenseheader.txt
deleted file mode 100644
index b2b02f8..0000000
--- a/tools/repc/moc_copy/util/licenseheader.txt
+++ /dev/null
@@ -1,28 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the tools applications of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** 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 The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** 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-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
diff --git a/tools/repc/moc_copy/utils.h b/tools/repc/moc_copy/utils.h
deleted file mode 100644
index 4cb1d90..0000000
--- a/tools/repc/moc_copy/utils.h
+++ /dev/null
@@ -1,110 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the tools applications of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** 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 The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** 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-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef UTILS_H
-#define UTILS_H
-
-#include <QtCore/qglobal.h>
-
-QT_BEGIN_NAMESPACE
-
-inline bool is_whitespace(char s)
-{
- return (s == ' ' || s == '\t' || s == '\n');
-}
-
-inline bool is_space(char s)
-{
- return (s == ' ' || s == '\t');
-}
-
-inline bool is_ident_start(char s)
-{
- return ((s >= 'a' && s <= 'z')
- || (s >= 'A' && s <= 'Z')
- || s == '_' || s == '$'
- );
-}
-
-inline bool is_ident_char(char s)
-{
- return ((s >= 'a' && s <= 'z')
- || (s >= 'A' && s <= 'Z')
- || (s >= '0' && s <= '9')
- || s == '_' || s == '$'
- );
-}
-
-inline bool is_identifier(const char *s, int len)
-{
- if (len < 1)
- return false;
- if (!is_ident_start(*s))
- return false;
- for (int i = 1; i < len; ++i)
- if (!is_ident_char(s[i]))
- return false;
- return true;
-}
-
-inline bool is_digit_char(char s)
-{
- return (s >= '0' && s <= '9');
-}
-
-inline bool is_octal_char(char s)
-{
- return (s >= '0' && s <= '7');
-}
-
-inline bool is_hex_char(char s)
-{
- return ((s >= 'a' && s <= 'f')
- || (s >= 'A' && s <= 'F')
- || (s >= '0' && s <= '9')
- );
-}
-
-inline const char *skipQuote(const char *data)
-{
- while (*data && (*data != '\"')) {
- if (*data == '\\') {
- ++data;
- if (!*data) break;
- }
- ++data;
- }
-
- if (*data) //Skip last quote
- ++data;
- return data;
-}
-
-QT_END_NAMESPACE
-
-#endif // UTILS_H
diff --git a/tools/repc/utils.cpp b/tools/repc/utils.cpp
index a126f36..5327343 100644
--- a/tools/repc/utils.cpp
+++ b/tools/repc/utils.cpp
@@ -26,16 +26,87 @@
**
****************************************************************************/
-#include "utils.h"
+#include <qjsonvalue.h>
+#include <qjsonarray.h>
+#include <qjsonobject.h>
+#include "utils.h"
#include "repparser.h"
-#include <moc.h>
-#define _(X) QString::fromLatin1(X)
+#define _(X) QLatin1String(X)
QT_BEGIN_NAMESPACE
+namespace JSON
+{
+ enum Types {
+ Any,
+ Array,
+ Object,
+ String,
+ Bool
+ };
+
+ static QJsonValue _Sub(const QJsonValue &json, const char *key, JSON::Types type=JSON::Any) {
+ if (json.isUndefined())
+ qCritical() << "Invalid metadata json file. Unexpected Undefined value when looking for key:" << key;
+ if (!json.isObject())
+ qCritical() << "Invalid metadata json file. Input (" << json << ") is not an object when looking for key:" << key;
+ const QJsonValue value = json.toObject()[_(key)];
+ switch (type) {
+ case JSON::Any: break;
+ case JSON::Array:
+ if (!value.isArray())
+ qCritical() << "Invalid metadata json file. Value (" << value << ") is not an array when looking for key:" << key;
+ break;
+ case JSON::Object:
+ if (!value.isObject())
+ qCritical() << "Invalid metadata json file. Value (" << value << ") is not an object when looking for key:" << key;
+ break;
+ case JSON::String:
+ if (!value.isString())
+ qCritical() << "Invalid metadata json file. Value (" << value << ") is not a string when looking for key:" << key;
+ break;
+ case JSON::Bool:
+ if (!value.isBool())
+ qCritical() << "Invalid metadata json file. Value (" << value << ") is not a bool when looking for key:" << key;
+ break;
+ }
+ return value;
+ }
+
+ static bool _Contains(const QJsonValue &json, const char *key) {
+ if (json.isUndefined())
+ qCritical() << "Invalid metadata json file. Unexpected Undefined value when looking for key:" << key;
+ if (!json.isObject())
+ qCritical() << "Invalid metadata json file. Input (" << json << ") is not an object when looking for key:" << key;
+ return json.toObject().contains(_(key));
+ }
+
+ static bool _Empty(const QJsonValue &json, const char *key) {
+ if (!_Contains(json, key))
+ return true;
+ const auto value = _Sub(json, key);
+ if (!value.isArray())
+ qCritical() << "Invalid metadata json file." << key << "is not an array.";
+ return value.toArray().count() == 0;
+ }
+
+ static QJsonArray _Array(const QJsonValue &json, const char *key) { return _Sub(json, key, JSON::Array).toArray(); }
+ static QString _String(const QJsonValue &json, const char *key) { return _Sub(json, key, JSON::String).toString(); }
+ static QByteArray _Bytes(const QJsonValue &json, const char *key) { return _Sub(json, key, JSON::String).toString().toLatin1(); }
+ static bool _Bool(const QJsonValue &json, const char *key) { return _Sub(json, key, JSON::Bool).toBool(); }
+ static bool _Bool(const QJsonValue &json, const char *key, bool missingValue) {
+ if (!_Contains(json, key))
+ return missingValue;
+ bool res = _Bool(json, key);
+ return res;
+ }
+}
+
+using namespace JSON;
+
static QByteArray join(const QVector<QByteArray> &array, const QByteArray &separator)
{
QByteArray res;
@@ -48,126 +119,131 @@ static QByteArray join(const QVector<QByteArray> &array, const QByteArray &separ
return res;
}
-static QVector<QByteArray> generateProperties(const QVector<PropertyDef> &properties, bool isPod=false)
+static QVector<QByteArray> generateProperties(const QJsonArray &properties, bool isPod=false)
{
QVector<QByteArray> ret;
- for (const PropertyDef& property : properties) {
- if (!isPod && property.notifyId == -1 && !property.constant) {
- qWarning() << "Skipping property" << property.name << "because is non-notifiable & non-constant";
+ for (const QJsonValue &prop : properties) {
+ if (!isPod && !_Contains(prop, "notify") && !_Bool(prop, "constant")) {
+ qWarning() << "Skipping property" << _String(prop, "name") << "because it is non-notifiable & non-constant";
continue; // skip non-notifiable properties
}
- QByteArray prop = property.type + " " + property.name;
- if (property.constant)
- prop += " CONSTANT";
- if (property.write.isEmpty() && !property.read.isEmpty())
- prop += " READONLY";
- ret << prop;
+ QByteArray output = _Bytes(prop, "type") + " " + _Bytes(prop, "name");
+ if (_Bool(prop, "constant"))
+ output += " CONSTANT";
+ if (!_Contains(prop, "write") && _Contains(prop, "read."))
+ output += " READONLY";
+ ret << output;
}
return ret;
}
-static QByteArray generateFunctions(const QByteArray &type, const QVector<FunctionDef> &functionList)
+static QByteArray generateFunctions(const QByteArray &type, const QJsonArray &functions)
{
QByteArray ret;
- for (const FunctionDef &func : functionList) {
- if (func.access != FunctionDef::Public)
- continue;
-
- ret += type + "(" + func.normalizedType + " " + func.name + "(";
- const int sz = func.arguments.size();
- if (sz) {
- for (int i = 0; i < sz - 1 ; i++) {
- const ArgumentDef &arg = func.arguments.at(i);
- ret += arg.normalizedType + " " + arg.name + ", ";
- }
-
- const ArgumentDef &arg = func.arguments.at(sz -1);
- ret += arg.normalizedType + " " + arg.name;
- }
+ for (const QJsonValue &func : functions) {
+ ret += type + "(" + _Bytes(func, "returnType") + " " + _Bytes(func, "name") + "(";
+ const auto arguments = _Array(func, "arguments");
+ for (const QJsonValue &arg : arguments)
+ ret += _Bytes(arg, "type") + " " + _Bytes(arg, "name") + ", ";
+ if (arguments.count())
+ ret.chop(2);
ret += "));\n";
}
return ret;
}
-static bool highToLowSort(int a, int b)
-{
- return a > b;
-}
+const auto filterNotPublic = [](const QJsonValue &value) {
+ return _String(value, "access") != QStringLiteral("public"); };
-static QVector<FunctionDef> cleanedSignalList(const ClassDef &cdef)
+static QJsonArray cleanedSignalList(const QJsonValue &cls)
{
- auto ret = cdef.signalList;
- QVector<int> positions;
- for (const PropertyDef &prop : qAsConst(cdef.propertyList)) {
- if (prop.notifyId != -1) {
- Q_ASSERT(prop.notify == ret.at(prop.notifyId).name);
- positions.push_back(prop.notifyId);
- }
+ if (_Empty(cls, "signals"))
+ return QJsonArray();
+
+ auto signalList = _Array(cls, "signals");
+ if (_Empty(cls, "properties"))
+ return signalList;
+
+ const auto props = _Array(cls, "properties");
+ const auto filterNotify = [&props](const QJsonValue &value) {
+ const auto filter = [&value](const QJsonValue &prop) {
+ return _Sub(value, "name") == _Sub(prop, "notify"); };
+ return std::find_if(props.begin(), props.end(), filter) != props.end(); };
+ for (auto it = signalList.begin(); it != signalList.end(); /* blank */ ) {
+ if (filterNotify(*it))
+ it = signalList.erase(it);
+ else if (filterNotPublic(*it))
+ it = signalList.erase(it);
+ else
+ it++;
}
- std::sort(positions.begin(), positions.end(), highToLowSort);
- for (int pos : qAsConst(positions))
- ret.removeAt(pos);
- return ret;
+ return signalList;
}
-static QVector<FunctionDef> cleanedSlotList(const ClassDef &cdef)
+static QJsonArray cleanedSlotList(const QJsonValue &cls)
{
- auto ret = cdef.slotList;
- for (const PropertyDef &prop : qAsConst(cdef.propertyList)) {
- if (!prop.write.isEmpty()) {
- auto it = ret.begin();
- while (it != ret.end()) {
- const FunctionDef& fdef = *it;
- if (fdef.name == prop.write &&
- fdef.arguments.size() == 1 &&
- fdef.arguments[0].type.name == prop.type) {
- ret.erase(it);
- break;
- }
- ++it;
- }
- }
+ if (_Empty(cls, "slots"))
+ return QJsonArray();
+
+ auto slotList = _Array(cls, "slots");
+ if (!_Empty(cls, "properties"))
+ return slotList;
+
+ const auto props = _Array(cls, "properties");
+ const auto filterWrite = [&props](const QJsonValue &value) {
+ const auto filter = [&value](const QJsonValue &prop) {
+ const auto args = _Array(prop, "arguments");
+ return _Sub(value, "name") == _Sub(prop, "write") &&
+ args.count() == 1 && _Sub(args.at(0), "type") == _Sub(prop, "type"); };
+ return std::find_if(props.begin(), props.end(), filter) != props.end(); };
+ for (auto it = slotList.begin(); it != slotList.end(); /* blank */ ) {
+ if (filterWrite(*it))
+ it = slotList.erase(it);
+ else if (filterNotPublic(*it))
+ it = slotList.erase(it);
+ else
+ it++;
}
- return ret;
+ return slotList;
}
-QByteArray generateClass(const ClassDef &cdef, bool alwaysGenerateClass /* = false */)
+QByteArray generateClass(const QJsonValue &cls, bool alwaysGenerateClass)
{
- const auto signalList = cleanedSignalList(cdef);
- if (signalList.isEmpty() && cdef.slotList.isEmpty() && !alwaysGenerateClass)
- return "POD " + cdef.classname + "(" + join(generateProperties(cdef.propertyList, true), ", ") + ")\n";
-
- QByteArray ret("class " + cdef.classname + "\n{\n");
- if (!cdef.propertyList.isEmpty())
- ret += " PROP(" + join(generateProperties(cdef.propertyList), ");\n PROP(") + ");\n";
- ret += generateFunctions(" SLOT", cleanedSlotList(cdef));
- ret += generateFunctions(" SIGNAL", signalList);
+ if (_Bool(cls, "gadget", false) || alwaysGenerateClass ||
+ (_Empty(cls, "signals") && _Empty(cls, "slots")))
+ return "POD " + _Bytes(cls, "className") + "(" + join(generateProperties(_Array(cls, "properties"), true), ", ") + ")\n";
+
+ QByteArray ret("class " + _Bytes(cls, "className") + "\n{\n");
+ if (!_Empty(cls, "properties"))
+ ret += " PROP(" + join(generateProperties(_Array(cls, "properties")), ");\n PROP(") + ");\n";
+ ret += generateFunctions(" SLOT", cleanedSlotList(cls));
+ ret += generateFunctions(" SIGNAL", cleanedSignalList(cls));
ret += "}\n";
return ret;
}
-static QVector<PODAttribute> propertyList2PODAttributes(const QVector<PropertyDef> &list)
+static QVector<PODAttribute> propertyList2PODAttributes(const QJsonArray &list)
{
QVector<PODAttribute> ret;
- for (const PropertyDef &prop : list)
- ret.push_back(PODAttribute(_(prop.type), _(prop.name)));
+ for (const QJsonValue &prop : list)
+ ret.push_back(PODAttribute(_String(prop, "type"), _String(prop, "name")));
return ret;
}
-QVector<ASTProperty> propertyList2AstProperties(const QVector<PropertyDef> &list)
+QVector<ASTProperty> propertyList2AstProperties(const QJsonArray &list)
{
QVector<ASTProperty> ret;
- for (const PropertyDef &property : list) {
- if (property.notifyId == -1 && !property.constant) {
- qWarning() << "Skipping property" << property.name << "because is non-notifiable & non-constant";
+ for (const QJsonValue &property : list) {
+ if (!_Contains(property, "notify") && !_Bool(property, "constant")) {
+ qWarning() << "Skipping property" << _String(property, "name") << "because it is non-notifiable & non-constant";
continue; // skip non-notifiable properties
}
ASTProperty prop;
- prop.name = _(property.name);
- prop.type = _(property.type);
- prop.modifier = property.constant
+ prop.name = _String(property, "name");
+ prop.type = _String(property, "type");
+ prop.modifier = _Bool(property, "constant")
? ASTProperty::Constant
- : property.write.isEmpty() && !property.read.isEmpty()
+ : !_Contains(property, "write") && _Contains(property, "read")
? ASTProperty::ReadOnly
: ASTProperty::ReadWrite;
ret.push_back(prop);
@@ -175,38 +251,35 @@ QVector<ASTProperty> propertyList2AstProperties(const QVector<PropertyDef> &list
return ret;
}
-QVector<ASTFunction> functionList2AstFunctionList(const QVector<FunctionDef> &list)
+QVector<ASTFunction> functionList2AstFunctionList(const QJsonArray &list)
{
QVector<ASTFunction> ret;
- for (const FunctionDef &fdef : list) {
- if (fdef.access != FunctionDef::Public)
- continue;
-
+ for (const QJsonValue &function : list) {
ASTFunction func;
- func.name = _(fdef.name);
- func.returnType = _(fdef.type.name);
- for (const ArgumentDef &arg : fdef.arguments)
- func.params.push_back(ASTDeclaration(_(arg.type.name), _(arg.name)));
+ func.name = _String(function, "name");
+ func.returnType = _String(function, "returnType");
+ const auto arguments = _Array(function, "arguments");
+ for (const QJsonValue &arg : arguments)
+ func.params.push_back(ASTDeclaration(_String(arg, "type"), _String(arg, "name")));
ret.push_back(func);
}
return ret;
}
-AST classList2AST(const QVector<ClassDef> &classList)
+AST classList2AST(const QJsonArray &classes)
{
AST ret;
- for (const ClassDef &cdef : classList) {
- const auto signalList = cleanedSignalList(cdef);
- if (signalList.isEmpty() && cdef.slotList.isEmpty()) {
+ for (const QJsonValue &cls : classes) {
+ if (_Empty(cls, "signals") && _Empty(cls, "slots")) {
POD pod;
- pod.name = _(cdef.classname);
- pod.attributes = propertyList2PODAttributes(cdef.propertyList);
+ pod.name = _String(cls, "className");
+ pod.attributes = propertyList2PODAttributes(_Array(cls, "properties"));
ret.pods.push_back(pod);
} else {
- ASTClass cl(_(cdef.classname));
- cl.properties = propertyList2AstProperties(cdef.propertyList);
- cl.signalsList = functionList2AstFunctionList(signalList);
- cl.slotsList = functionList2AstFunctionList(cleanedSlotList(cdef));
+ ASTClass cl(_String(cls, "className"));
+ cl.properties = propertyList2AstProperties(_Array(cls, "properties"));
+ cl.signalsList = functionList2AstFunctionList(cleanedSignalList(cls));
+ cl.slotsList = functionList2AstFunctionList(cleanedSlotList(cls));
ret.classes.push_back(cl);
}
}
diff --git a/tools/repc/utils.h b/tools/repc/utils.h
index 7b23c87..236f60e 100644
--- a/tools/repc/utils.h
+++ b/tools/repc/utils.h
@@ -30,14 +30,14 @@
#define UTILS_H
#include <QByteArray>
-#include <QVector>
QT_BEGIN_NAMESPACE
-struct ClassDef;
+class QJsonValue;
+class QJsonArray;
struct AST;
-QByteArray generateClass(const ClassDef &cdef, bool alwaysGenerateClass = false);
-AST classList2AST(const QVector<ClassDef> &classList);
+QByteArray generateClass(const QJsonValue &cls, bool alwaysGenerateClass = false);
+AST classList2AST(const QJsonArray &classes);
QT_END_NAMESPACE
#endif // UTILS_H