forked from qt-creator/qt-creator
ProFileParser => QMakeParser
more natural name Change-Id: I38d2a2fc785686aa5777afe41452b53f2c24adf8 Reviewed-by: Daniel Teske <daniel.teske@nokia.com>
This commit is contained in:
@@ -1190,7 +1190,7 @@ void Qt4PriFileNode::changeFiles(const FileType fileType,
|
|||||||
}
|
}
|
||||||
|
|
||||||
QtSupport::ProMessageHandler handler;
|
QtSupport::ProMessageHandler handler;
|
||||||
ProFileParser parser(0, &handler);
|
QMakeParser parser(0, &handler);
|
||||||
includeFile = parser.parsedProBlock(m_projectFilePath, contents);
|
includeFile = parser.parsedProBlock(m_projectFilePath, contents);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -723,7 +723,7 @@ void BaseQtVersion::ensureMkSpecParsed() const
|
|||||||
option.properties = versionInfo();
|
option.properties = versionInfo();
|
||||||
ProMessageHandler msgHandler(true);
|
ProMessageHandler msgHandler(true);
|
||||||
ProFileCacheManager::instance()->incRefCount();
|
ProFileCacheManager::instance()->incRefCount();
|
||||||
ProFileParser parser(ProFileCacheManager::instance()->cache(), &msgHandler);
|
QMakeParser parser(ProFileCacheManager::instance()->cache(), &msgHandler);
|
||||||
ProFileEvaluator evaluator(&option, &parser, &msgHandler);
|
ProFileEvaluator evaluator(&option, &parser, &msgHandler);
|
||||||
if (ProFile *pro = parser.parsedProFile(mkspecPath().toString() + QLatin1String("/qmake.conf"))) {
|
if (ProFile *pro = parser.parsedProFile(mkspecPath().toString() + QLatin1String("/qmake.conf"))) {
|
||||||
evaluator.setCumulative(false);
|
evaluator.setCumulative(false);
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ void ProMessageHandler::fileMessage(const QString &)
|
|||||||
|
|
||||||
|
|
||||||
ProFileReader::ProFileReader(QMakeGlobals *option)
|
ProFileReader::ProFileReader(QMakeGlobals *option)
|
||||||
: ProFileParser(ProFileCacheManager::instance()->cache(), this)
|
: QMakeParser(ProFileCacheManager::instance()->cache(), this)
|
||||||
, ProFileEvaluator(option, this, this)
|
, ProFileEvaluator(option, this, this)
|
||||||
, m_ignoreLevel(0)
|
, m_ignoreLevel(0)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -35,7 +35,7 @@
|
|||||||
|
|
||||||
#include "qtsupport_global.h"
|
#include "qtsupport_global.h"
|
||||||
#include "proparser/qmakeglobals.h"
|
#include "proparser/qmakeglobals.h"
|
||||||
#include "proparser/profileparser.h"
|
#include "proparser/qmakeparser.h"
|
||||||
#include "proparser/profileevaluator.h"
|
#include "proparser/profileevaluator.h"
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
@@ -48,7 +48,7 @@ class QtSupportPlugin;
|
|||||||
}
|
}
|
||||||
|
|
||||||
class QTSUPPORT_EXPORT ProMessageHandler : public QObject,
|
class QTSUPPORT_EXPORT ProMessageHandler : public QObject,
|
||||||
public ProFileParserHandler, public ProFileEvaluatorHandler
|
public QMakeParserHandler, public ProFileEvaluatorHandler
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
@@ -70,7 +70,7 @@ private:
|
|||||||
bool m_verbose;
|
bool m_verbose;
|
||||||
};
|
};
|
||||||
|
|
||||||
class QTSUPPORT_EXPORT ProFileReader : public ProMessageHandler, public ProFileParser, public ProFileEvaluator
|
class QTSUPPORT_EXPORT ProFileReader : public ProMessageHandler, public QMakeParser, public ProFileEvaluator
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ bool QtSupportPlugin::initialize(const QStringList &arguments, QString *errorMes
|
|||||||
{
|
{
|
||||||
Q_UNUSED(arguments);
|
Q_UNUSED(arguments);
|
||||||
Q_UNUSED(errorMessage);
|
Q_UNUSED(errorMessage);
|
||||||
ProFileParser::initialize();
|
QMakeParser::initialize();
|
||||||
ProFileEvaluator::initialize();
|
ProFileEvaluator::initialize();
|
||||||
new ProFileCacheManager(this);
|
new ProFileCacheManager(this);
|
||||||
|
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ BaseQtVersion *QtVersionFactory::createQtVersionFromQMakePath(const Utils::FileN
|
|||||||
globals.properties = versionInfo;
|
globals.properties = versionInfo;
|
||||||
ProMessageHandler msgHandler(true);
|
ProMessageHandler msgHandler(true);
|
||||||
ProFileCacheManager::instance()->incRefCount();
|
ProFileCacheManager::instance()->incRefCount();
|
||||||
ProFileParser parser(ProFileCacheManager::instance()->cache(), &msgHandler);
|
QMakeParser parser(ProFileCacheManager::instance()->cache(), &msgHandler);
|
||||||
ProFileEvaluator evaluator(&globals, &parser, &msgHandler);
|
ProFileEvaluator evaluator(&globals, &parser, &msgHandler);
|
||||||
if (ProFile *pro = parser.parsedProFile(mkspec.toString() + QLatin1String("/qmake.conf"))) {
|
if (ProFile *pro = parser.parsedProFile(mkspec.toString() + QLatin1String("/qmake.conf"))) {
|
||||||
evaluator.setCumulative(false);
|
evaluator.setCumulative(false);
|
||||||
|
|||||||
@@ -33,7 +33,7 @@
|
|||||||
#include "profileevaluator.h"
|
#include "profileevaluator.h"
|
||||||
|
|
||||||
#include "qmakeglobals.h"
|
#include "qmakeglobals.h"
|
||||||
#include "profileparser.h"
|
#include "qmakeparser.h"
|
||||||
#include "ioutils.h"
|
#include "ioutils.h"
|
||||||
|
|
||||||
#include <QByteArray>
|
#include <QByteArray>
|
||||||
@@ -89,7 +89,7 @@ class ProFileEvaluator::Private
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static void initStatics();
|
static void initStatics();
|
||||||
Private(QMakeGlobals *option, ProFileParser *parser,
|
Private(QMakeGlobals *option, QMakeParser *parser,
|
||||||
ProFileEvaluatorHandler *handler);
|
ProFileEvaluatorHandler *handler);
|
||||||
~Private();
|
~Private();
|
||||||
|
|
||||||
@@ -212,7 +212,7 @@ public:
|
|||||||
QString m_tmp1, m_tmp2, m_tmp3, m_tmp[2]; // Temporaries for efficient toQString
|
QString m_tmp1, m_tmp2, m_tmp3, m_tmp[2]; // Temporaries for efficient toQString
|
||||||
|
|
||||||
QMakeGlobals *m_option;
|
QMakeGlobals *m_option;
|
||||||
ProFileParser *m_parser;
|
QMakeParser *m_parser;
|
||||||
ProFileEvaluatorHandler *m_handler;
|
ProFileEvaluatorHandler *m_handler;
|
||||||
|
|
||||||
enum ExpandFunc {
|
enum ExpandFunc {
|
||||||
@@ -412,7 +412,7 @@ const ProString &ProFileEvaluator::Private::map(const ProString &var)
|
|||||||
|
|
||||||
|
|
||||||
ProFileEvaluator::Private::Private(QMakeGlobals *option,
|
ProFileEvaluator::Private::Private(QMakeGlobals *option,
|
||||||
ProFileParser *parser, ProFileEvaluatorHandler *handler)
|
QMakeParser *parser, ProFileEvaluatorHandler *handler)
|
||||||
: m_option(option), m_parser(parser), m_handler(handler)
|
: m_option(option), m_parser(parser), m_handler(handler)
|
||||||
{
|
{
|
||||||
// So that single-threaded apps don't have to call initialize() for now.
|
// So that single-threaded apps don't have to call initialize() for now.
|
||||||
@@ -3272,7 +3272,7 @@ void ProFileEvaluator::initialize()
|
|||||||
Private::initStatics();
|
Private::initStatics();
|
||||||
}
|
}
|
||||||
|
|
||||||
ProFileEvaluator::ProFileEvaluator(QMakeGlobals *option, ProFileParser *parser,
|
ProFileEvaluator::ProFileEvaluator(QMakeGlobals *option, QMakeParser *parser,
|
||||||
ProFileEvaluatorHandler *handler)
|
ProFileEvaluatorHandler *handler)
|
||||||
: d(new Private(option, parser, handler))
|
: d(new Private(option, parser, handler))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -42,7 +42,7 @@
|
|||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
class QMakeGlobals;
|
class QMakeGlobals;
|
||||||
class ProFileParser;
|
class QMakeParser;
|
||||||
|
|
||||||
class QMAKE_EXPORT ProFileEvaluatorHandler
|
class QMAKE_EXPORT ProFileEvaluatorHandler
|
||||||
{
|
{
|
||||||
@@ -104,7 +104,7 @@ public:
|
|||||||
// Call this from a concurrency-free context
|
// Call this from a concurrency-free context
|
||||||
static void initialize();
|
static void initialize();
|
||||||
|
|
||||||
ProFileEvaluator(QMakeGlobals *option, ProFileParser *parser, ProFileEvaluatorHandler *handler);
|
ProFileEvaluator(QMakeGlobals *option, QMakeParser *parser, ProFileEvaluatorHandler *handler);
|
||||||
~ProFileEvaluator();
|
~ProFileEvaluator();
|
||||||
|
|
||||||
ProFileEvaluator::TemplateType templateType() const;
|
ProFileEvaluator::TemplateType templateType() const;
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ DEPENDPATH *= $$PWD $$PWD/..
|
|||||||
HEADERS += \
|
HEADERS += \
|
||||||
qmake_global.h \
|
qmake_global.h \
|
||||||
qmakeglobals.h \
|
qmakeglobals.h \
|
||||||
profileparser.h \
|
qmakeparser.h \
|
||||||
profileevaluator.h \
|
profileevaluator.h \
|
||||||
proitems.h \
|
proitems.h \
|
||||||
prowriter.h \
|
prowriter.h \
|
||||||
@@ -16,7 +16,7 @@ HEADERS += \
|
|||||||
|
|
||||||
SOURCES += \
|
SOURCES += \
|
||||||
qmakeglobals.cpp \
|
qmakeglobals.cpp \
|
||||||
profileparser.cpp \
|
qmakeparser.cpp \
|
||||||
profileevaluator.cpp \
|
profileevaluator.cpp \
|
||||||
proitems.cpp \
|
proitems.cpp \
|
||||||
prowriter.cpp \
|
prowriter.cpp \
|
||||||
|
|||||||
@@ -30,7 +30,7 @@
|
|||||||
**
|
**
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
#include "profileparser.h"
|
#include "qmakeparser.h"
|
||||||
|
|
||||||
#include "ioutils.h"
|
#include "ioutils.h"
|
||||||
using namespace ProFileEvaluatorInternal;
|
using namespace ProFileEvaluatorInternal;
|
||||||
@@ -102,7 +102,7 @@ static struct {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProFileParser::initialize()
|
void QMakeParser::initialize()
|
||||||
{
|
{
|
||||||
if (!statics.strelse.isNull())
|
if (!statics.strelse.isNull())
|
||||||
return;
|
return;
|
||||||
@@ -113,7 +113,7 @@ void ProFileParser::initialize()
|
|||||||
statics.strdefineReplace = QLatin1String("defineReplace");
|
statics.strdefineReplace = QLatin1String("defineReplace");
|
||||||
}
|
}
|
||||||
|
|
||||||
ProFileParser::ProFileParser(ProFileCache *cache, ProFileParserHandler *handler)
|
QMakeParser::QMakeParser(ProFileCache *cache, QMakeParserHandler *handler)
|
||||||
: m_cache(cache)
|
: m_cache(cache)
|
||||||
, m_handler(handler)
|
, m_handler(handler)
|
||||||
{
|
{
|
||||||
@@ -121,7 +121,7 @@ ProFileParser::ProFileParser(ProFileCache *cache, ProFileParserHandler *handler)
|
|||||||
initialize();
|
initialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
ProFile *ProFileParser::parsedProFile(const QString &fileName, bool cache, const QString *contents)
|
ProFile *QMakeParser::parsedProFile(const QString &fileName, bool cache, const QString *contents)
|
||||||
{
|
{
|
||||||
ProFile *pro;
|
ProFile *pro;
|
||||||
if (cache && m_cache) {
|
if (cache && m_cache) {
|
||||||
@@ -181,7 +181,7 @@ ProFile *ProFileParser::parsedProFile(const QString &fileName, bool cache, const
|
|||||||
return pro;
|
return pro;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ProFileParser::read(ProFile *pro)
|
bool QMakeParser::read(ProFile *pro)
|
||||||
{
|
{
|
||||||
QFile file(pro->fileName());
|
QFile file(pro->fileName());
|
||||||
if (!file.open(QIODevice::ReadOnly)) {
|
if (!file.open(QIODevice::ReadOnly)) {
|
||||||
@@ -195,24 +195,24 @@ bool ProFileParser::read(ProFile *pro)
|
|||||||
return read(pro, content);
|
return read(pro, content);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProFileParser::putTok(ushort *&tokPtr, ushort tok)
|
void QMakeParser::putTok(ushort *&tokPtr, ushort tok)
|
||||||
{
|
{
|
||||||
*tokPtr++ = tok;
|
*tokPtr++ = tok;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProFileParser::putBlockLen(ushort *&tokPtr, uint len)
|
void QMakeParser::putBlockLen(ushort *&tokPtr, uint len)
|
||||||
{
|
{
|
||||||
*tokPtr++ = (ushort)len;
|
*tokPtr++ = (ushort)len;
|
||||||
*tokPtr++ = (ushort)(len >> 16);
|
*tokPtr++ = (ushort)(len >> 16);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProFileParser::putBlock(ushort *&tokPtr, const ushort *buf, uint len)
|
void QMakeParser::putBlock(ushort *&tokPtr, const ushort *buf, uint len)
|
||||||
{
|
{
|
||||||
memcpy(tokPtr, buf, len * 2);
|
memcpy(tokPtr, buf, len * 2);
|
||||||
tokPtr += len;
|
tokPtr += len;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProFileParser::putHashStr(ushort *&pTokPtr, const ushort *buf, uint len)
|
void QMakeParser::putHashStr(ushort *&pTokPtr, const ushort *buf, uint len)
|
||||||
{
|
{
|
||||||
uint hash = ProString::hash((const QChar *)buf, len);
|
uint hash = ProString::hash((const QChar *)buf, len);
|
||||||
ushort *tokPtr = pTokPtr;
|
ushort *tokPtr = pTokPtr;
|
||||||
@@ -223,7 +223,7 @@ void ProFileParser::putHashStr(ushort *&pTokPtr, const ushort *buf, uint len)
|
|||||||
pTokPtr = tokPtr + len;
|
pTokPtr = tokPtr + len;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProFileParser::finalizeHashStr(ushort *buf, uint len)
|
void QMakeParser::finalizeHashStr(ushort *buf, uint len)
|
||||||
{
|
{
|
||||||
buf[-4] = TokHashLiteral;
|
buf[-4] = TokHashLiteral;
|
||||||
buf[-1] = len;
|
buf[-1] = len;
|
||||||
@@ -232,7 +232,7 @@ void ProFileParser::finalizeHashStr(ushort *buf, uint len)
|
|||||||
buf[-2] = (ushort)(hash >> 16);
|
buf[-2] = (ushort)(hash >> 16);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ProFileParser::read(ProFile *pro, const QString &in)
|
bool QMakeParser::read(ProFile *pro, const QString &in)
|
||||||
{
|
{
|
||||||
m_proFile = pro;
|
m_proFile = pro;
|
||||||
m_lineNo = 1;
|
m_lineNo = 1;
|
||||||
@@ -785,7 +785,7 @@ bool ProFileParser::read(ProFile *pro, const QString &in)
|
|||||||
#undef FLUSH_RHS_LITERAL
|
#undef FLUSH_RHS_LITERAL
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProFileParser::putLineMarker(ushort *&tokPtr)
|
void QMakeParser::putLineMarker(ushort *&tokPtr)
|
||||||
{
|
{
|
||||||
if (m_markLine) {
|
if (m_markLine) {
|
||||||
*tokPtr++ = TokLine;
|
*tokPtr++ = TokLine;
|
||||||
@@ -794,7 +794,7 @@ void ProFileParser::putLineMarker(ushort *&tokPtr)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProFileParser::enterScope(ushort *&tokPtr, bool special, ScopeState state)
|
void QMakeParser::enterScope(ushort *&tokPtr, bool special, ScopeState state)
|
||||||
{
|
{
|
||||||
m_blockstack.resize(m_blockstack.size() + 1);
|
m_blockstack.resize(m_blockstack.size() + 1);
|
||||||
m_blockstack.top().special = special;
|
m_blockstack.top().special = special;
|
||||||
@@ -806,7 +806,7 @@ void ProFileParser::enterScope(ushort *&tokPtr, bool special, ScopeState state)
|
|||||||
m_markLine = m_lineNo;
|
m_markLine = m_lineNo;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProFileParser::leaveScope(ushort *&tokPtr)
|
void QMakeParser::leaveScope(ushort *&tokPtr)
|
||||||
{
|
{
|
||||||
if (m_blockstack.top().inBranch) {
|
if (m_blockstack.top().inBranch) {
|
||||||
// Put empty else block
|
// Put empty else block
|
||||||
@@ -822,7 +822,7 @@ void ProFileParser::leaveScope(ushort *&tokPtr)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// If we are on a fresh line, close all open one-line scopes.
|
// If we are on a fresh line, close all open one-line scopes.
|
||||||
void ProFileParser::flushScopes(ushort *&tokPtr)
|
void QMakeParser::flushScopes(ushort *&tokPtr)
|
||||||
{
|
{
|
||||||
if (m_state == StNew) {
|
if (m_state == StNew) {
|
||||||
while (!m_blockstack.top().braceLevel && m_blockstack.size() > 1)
|
while (!m_blockstack.top().braceLevel && m_blockstack.size() > 1)
|
||||||
@@ -837,7 +837,7 @@ void ProFileParser::flushScopes(ushort *&tokPtr)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// If there is a pending conditional, enter a new scope, otherwise flush scopes.
|
// If there is a pending conditional, enter a new scope, otherwise flush scopes.
|
||||||
void ProFileParser::flushCond(ushort *&tokPtr)
|
void QMakeParser::flushCond(ushort *&tokPtr)
|
||||||
{
|
{
|
||||||
if (m_state == StCond) {
|
if (m_state == StCond) {
|
||||||
putTok(tokPtr, TokBranch);
|
putTok(tokPtr, TokBranch);
|
||||||
@@ -848,7 +848,7 @@ void ProFileParser::flushCond(ushort *&tokPtr)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProFileParser::finalizeTest(ushort *&tokPtr)
|
void QMakeParser::finalizeTest(ushort *&tokPtr)
|
||||||
{
|
{
|
||||||
flushScopes(tokPtr);
|
flushScopes(tokPtr);
|
||||||
putLineMarker(tokPtr);
|
putLineMarker(tokPtr);
|
||||||
@@ -864,7 +864,7 @@ void ProFileParser::finalizeTest(ushort *&tokPtr)
|
|||||||
m_canElse = true;
|
m_canElse = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProFileParser::bogusTest(ushort *&tokPtr)
|
void QMakeParser::bogusTest(ushort *&tokPtr)
|
||||||
{
|
{
|
||||||
flushScopes(tokPtr);
|
flushScopes(tokPtr);
|
||||||
m_operator = NoOperator;
|
m_operator = NoOperator;
|
||||||
@@ -874,7 +874,7 @@ void ProFileParser::bogusTest(ushort *&tokPtr)
|
|||||||
m_proFile->setOk(false);
|
m_proFile->setOk(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProFileParser::finalizeCond(ushort *&tokPtr, ushort *uc, ushort *ptr, int wordCount)
|
void QMakeParser::finalizeCond(ushort *&tokPtr, ushort *uc, ushort *ptr, int wordCount)
|
||||||
{
|
{
|
||||||
if (wordCount != 1) {
|
if (wordCount != 1) {
|
||||||
if (wordCount) {
|
if (wordCount) {
|
||||||
@@ -927,7 +927,7 @@ void ProFileParser::finalizeCond(ushort *&tokPtr, ushort *uc, ushort *ptr, int w
|
|||||||
putTok(tokPtr, TokCondition);
|
putTok(tokPtr, TokCondition);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProFileParser::finalizeCall(ushort *&tokPtr, ushort *uc, ushort *ptr, int argc)
|
void QMakeParser::finalizeCall(ushort *&tokPtr, ushort *uc, ushort *ptr, int argc)
|
||||||
{
|
{
|
||||||
// Check for magic tokens
|
// Check for magic tokens
|
||||||
if (*uc == TokHashLiteral) {
|
if (*uc == TokHashLiteral) {
|
||||||
@@ -1017,7 +1017,7 @@ void ProFileParser::finalizeCall(ushort *&tokPtr, ushort *uc, ushort *ptr, int a
|
|||||||
putBlock(tokPtr, uc, ptr - uc);
|
putBlock(tokPtr, uc, ptr - uc);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProFileParser::parseError(const QString &msg) const
|
void QMakeParser::parseError(const QString &msg) const
|
||||||
{
|
{
|
||||||
if (!m_inError && m_handler)
|
if (!m_inError && m_handler)
|
||||||
m_handler->parseError(m_proFile->fileName(), m_lineNo, msg);
|
m_handler->parseError(m_proFile->fileName(), m_lineNo, msg);
|
||||||
@@ -30,8 +30,8 @@
|
|||||||
**
|
**
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
#ifndef PROFILEPARSER_H
|
#ifndef QMAKEPARSER_H
|
||||||
#define PROFILEPARSER_H
|
#define QMAKEPARSER_H
|
||||||
|
|
||||||
#include "qmake_global.h"
|
#include "qmake_global.h"
|
||||||
#include "proitems.h"
|
#include "proitems.h"
|
||||||
@@ -43,7 +43,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
class QMAKE_EXPORT ProFileParserHandler
|
class QMAKE_EXPORT QMakeParserHandler
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
// Some error during parsing
|
// Some error during parsing
|
||||||
@@ -52,13 +52,13 @@ public:
|
|||||||
|
|
||||||
class ProFileCache;
|
class ProFileCache;
|
||||||
|
|
||||||
class QMAKE_EXPORT ProFileParser
|
class QMAKE_EXPORT QMakeParser
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
// Call this from a concurrency-free context
|
// Call this from a concurrency-free context
|
||||||
static void initialize();
|
static void initialize();
|
||||||
|
|
||||||
ProFileParser(ProFileCache *cache, ProFileParserHandler *handler);
|
QMakeParser(ProFileCache *cache, QMakeParserHandler *handler);
|
||||||
|
|
||||||
// fileName is expected to be absolute and cleanPath()ed.
|
// fileName is expected to be absolute and cleanPath()ed.
|
||||||
// If contents is non-null, it will be used instead of the file's actual content
|
// If contents is non-null, it will be used instead of the file's actual content
|
||||||
@@ -128,7 +128,7 @@ private:
|
|||||||
QString m_tmp; // Temporary for efficient toQString
|
QString m_tmp; // Temporary for efficient toQString
|
||||||
|
|
||||||
ProFileCache *m_cache;
|
ProFileCache *m_cache;
|
||||||
ProFileParserHandler *m_handler;
|
QMakeParserHandler *m_handler;
|
||||||
|
|
||||||
// This doesn't help gcc 3.3 ...
|
// This doesn't help gcc 3.3 ...
|
||||||
template<typename T> friend class QTypeInfo;
|
template<typename T> friend class QTypeInfo;
|
||||||
@@ -164,12 +164,12 @@ private:
|
|||||||
QMutex mutex;
|
QMutex mutex;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
friend class ProFileParser;
|
friend class QMakeParser;
|
||||||
};
|
};
|
||||||
|
|
||||||
#if !defined(__GNUC__) || __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 3)
|
#if !defined(__GNUC__) || __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 3)
|
||||||
Q_DECLARE_TYPEINFO(ProFileParser::BlockScope, Q_MOVABLE_TYPE);
|
Q_DECLARE_TYPEINFO(QMakeParser::BlockScope, Q_MOVABLE_TYPE);
|
||||||
Q_DECLARE_TYPEINFO(ProFileParser::Context, Q_PRIMITIVE_TYPE);
|
Q_DECLARE_TYPEINFO(QMakeParser::Context, Q_PRIMITIVE_TYPE);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
@@ -30,7 +30,7 @@
|
|||||||
**
|
**
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
#include <profileparser.h>
|
#include <qmakeparser.h>
|
||||||
#include <prowriter.h>
|
#include <prowriter.h>
|
||||||
|
|
||||||
#include <QtTest>
|
#include <QtTest>
|
||||||
@@ -47,7 +47,7 @@ static void print(const QString &fileName, int lineNo, const QString &msg)
|
|||||||
qWarning("%s", qPrintable(msg));
|
qWarning("%s", qPrintable(msg));
|
||||||
}
|
}
|
||||||
|
|
||||||
class ParseHandler : public ProFileParserHandler {
|
class ParseHandler : public QMakeParserHandler {
|
||||||
public:
|
public:
|
||||||
virtual void parseError(const QString &fileName, int lineNo, const QString &msg)
|
virtual void parseError(const QString &fileName, int lineNo, const QString &msg)
|
||||||
{ print(fileName, lineNo, msg); }
|
{ print(fileName, lineNo, msg); }
|
||||||
@@ -450,7 +450,7 @@ void tst_ProFileWriter::adds()
|
|||||||
QStringList lines = input.isEmpty() ? QStringList() : input.split(QLatin1String("\n"));
|
QStringList lines = input.isEmpty() ? QStringList() : input.split(QLatin1String("\n"));
|
||||||
QString var = QLatin1String("SOURCES");
|
QString var = QLatin1String("SOURCES");
|
||||||
|
|
||||||
ProFileParser parser(0, &parseHandler);
|
QMakeParser parser(0, &parseHandler);
|
||||||
ProFile *proFile = parser.parsedProFile(QLatin1String(BASE_DIR "/test.pro"), false, &input);
|
ProFile *proFile = parser.parsedProFile(QLatin1String(BASE_DIR "/test.pro"), false, &input);
|
||||||
QVERIFY(proFile);
|
QVERIFY(proFile);
|
||||||
PW::putVarValues(proFile, &lines, values, var, PW::PutFlags(flags), scope);
|
PW::putVarValues(proFile, &lines, values, var, PW::PutFlags(flags), scope);
|
||||||
@@ -620,7 +620,7 @@ void tst_ProFileWriter::removes()
|
|||||||
QStringList lines = input.split(QLatin1String("\n"));
|
QStringList lines = input.split(QLatin1String("\n"));
|
||||||
QStringList vars; vars << QLatin1String("SOURCES");
|
QStringList vars; vars << QLatin1String("SOURCES");
|
||||||
|
|
||||||
ProFileParser parser(0, &parseHandler);
|
QMakeParser parser(0, &parseHandler);
|
||||||
ProFile *proFile = parser.parsedProFile(QLatin1String(BASE_DIR "/test.pro"), false, &input);
|
ProFile *proFile = parser.parsedProFile(QLatin1String(BASE_DIR "/test.pro"), false, &input);
|
||||||
QVERIFY(proFile);
|
QVERIFY(proFile);
|
||||||
Qt4ProjectManager::Internal::ProWriter::removeVarValues(proFile, &lines, values, vars);
|
Qt4ProjectManager::Internal::ProWriter::removeVarValues(proFile, &lines, values, vars);
|
||||||
@@ -648,7 +648,7 @@ void tst_ProFileWriter::multiVar()
|
|||||||
<< QString::fromLatin1(BASE_DIR "/bak");
|
<< QString::fromLatin1(BASE_DIR "/bak");
|
||||||
QStringList vars; vars << QLatin1String("SOURCES") << QLatin1String("HEADERS");
|
QStringList vars; vars << QLatin1String("SOURCES") << QLatin1String("HEADERS");
|
||||||
|
|
||||||
ProFileParser parser(0, &parseHandler);
|
QMakeParser parser(0, &parseHandler);
|
||||||
ProFile *proFile = parser.parsedProFile(QLatin1String(BASE_DIR "/test.pro"), false, &input);
|
ProFile *proFile = parser.parsedProFile(QLatin1String(BASE_DIR "/test.pro"), false, &input);
|
||||||
QVERIFY(proFile);
|
QVERIFY(proFile);
|
||||||
Qt4ProjectManager::Internal::ProWriter::removeFiles(proFile, &lines, baseDir, files, vars);
|
Qt4ProjectManager::Internal::ProWriter::removeFiles(proFile, &lines, baseDir, files, vars);
|
||||||
@@ -668,7 +668,7 @@ void tst_ProFileWriter::addFiles()
|
|||||||
" sub/bar.cpp"
|
" sub/bar.cpp"
|
||||||
);
|
);
|
||||||
|
|
||||||
ProFileParser parser(0, &parseHandler);
|
QMakeParser parser(0, &parseHandler);
|
||||||
ProFile *proFile = parser.parsedProFile(QLatin1String(BASE_DIR "/test.pro"), false, &input);
|
ProFile *proFile = parser.parsedProFile(QLatin1String(BASE_DIR "/test.pro"), false, &input);
|
||||||
QVERIFY(proFile);
|
QVERIFY(proFile);
|
||||||
Qt4ProjectManager::Internal::ProWriter::addFiles(proFile, &lines, QDir(BASE_DIR),
|
Qt4ProjectManager::Internal::ProWriter::addFiles(proFile, &lines, QDir(BASE_DIR),
|
||||||
@@ -689,7 +689,7 @@ void tst_ProFileWriter::removeFiles()
|
|||||||
"SOURCES = foo.cpp"
|
"SOURCES = foo.cpp"
|
||||||
);
|
);
|
||||||
|
|
||||||
ProFileParser parser(0, &parseHandler);
|
QMakeParser parser(0, &parseHandler);
|
||||||
ProFile *proFile = parser.parsedProFile(QLatin1String(BASE_DIR "/test.pro"), false, &input);
|
ProFile *proFile = parser.parsedProFile(QLatin1String(BASE_DIR "/test.pro"), false, &input);
|
||||||
QVERIFY(proFile);
|
QVERIFY(proFile);
|
||||||
Qt4ProjectManager::Internal::ProWriter::removeFiles(proFile, &lines, QDir(BASE_DIR),
|
Qt4ProjectManager::Internal::ProWriter::removeFiles(proFile, &lines, QDir(BASE_DIR),
|
||||||
|
|||||||
@@ -31,7 +31,7 @@
|
|||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
#include "qmakeglobals.h"
|
#include "qmakeglobals.h"
|
||||||
#include "profileparser.h"
|
#include "qmakeparser.h"
|
||||||
#include "profileevaluator.h"
|
#include "profileevaluator.h"
|
||||||
|
|
||||||
#include <QCoreApplication>
|
#include <QCoreApplication>
|
||||||
@@ -52,7 +52,7 @@ static void print(const QString &fileName, int lineNo, const QString &msg)
|
|||||||
qWarning("%s", qPrintable(msg));
|
qWarning("%s", qPrintable(msg));
|
||||||
}
|
}
|
||||||
|
|
||||||
class ParseHandler : public ProFileParserHandler {
|
class ParseHandler : public QMakeParserHandler {
|
||||||
public:
|
public:
|
||||||
virtual void parseError(const QString &fileName, int lineNo, const QString &msg)
|
virtual void parseError(const QString &fileName, int lineNo, const QString &msg)
|
||||||
{ print(fileName, lineNo, msg); }
|
{ print(fileName, lineNo, msg); }
|
||||||
@@ -84,7 +84,7 @@ static QString value(ProFileEvaluator &reader, const QString &variable)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int evaluate(const QString &fileName, const QString &in_pwd, const QString &out_pwd,
|
static int evaluate(const QString &fileName, const QString &in_pwd, const QString &out_pwd,
|
||||||
bool cumulative, QMakeGlobals *option, ProFileParser *parser, int level)
|
bool cumulative, QMakeGlobals *option, QMakeParser *parser, int level)
|
||||||
{
|
{
|
||||||
static QSet<QString> visited;
|
static QSet<QString> visited;
|
||||||
if (visited.contains(fileName))
|
if (visited.contains(fileName))
|
||||||
@@ -164,7 +164,7 @@ int main(int argc, char **argv)
|
|||||||
option.initProperties(QLibraryInfo::location(QLibraryInfo::BinariesPath) + QLatin1String("/qmake"));
|
option.initProperties(QLibraryInfo::location(QLibraryInfo::BinariesPath) + QLatin1String("/qmake"));
|
||||||
if (args.count() >= 4)
|
if (args.count() >= 4)
|
||||||
option.setCommandLineArguments(args.mid(3));
|
option.setCommandLineArguments(args.mid(3));
|
||||||
ProFileParser parser(0, &parseHandler);
|
QMakeParser parser(0, &parseHandler);
|
||||||
|
|
||||||
bool cumulative = args[0] == QLatin1String("true");
|
bool cumulative = args[0] == QLatin1String("true");
|
||||||
QFileInfo infi(args[1]);
|
QFileInfo infi(args[1]);
|
||||||
|
|||||||
@@ -15,8 +15,8 @@ build_all:!build_pass {
|
|||||||
CONFIG += release
|
CONFIG += release
|
||||||
}
|
}
|
||||||
|
|
||||||
SOURCES = main.cpp qmakeglobals.cpp profileparser.cpp profileevaluator.cpp proitems.cpp ioutils.cpp
|
SOURCES = main.cpp qmakeglobals.cpp qmakeparser.cpp profileevaluator.cpp proitems.cpp ioutils.cpp
|
||||||
HEADERS = qmakeglobals.h profileparser.h profileevaluator.h proitems.h ioutils.h
|
HEADERS = qmakeglobals.h qmakeparser.h profileevaluator.h proitems.h ioutils.h
|
||||||
|
|
||||||
DEFINES += QT_NO_CAST_TO_ASCII QT_NO_CAST_FROM_ASCII
|
DEFINES += QT_NO_CAST_TO_ASCII QT_NO_CAST_FROM_ASCII
|
||||||
DEFINES += QT_USE_FAST_OPERATOR_PLUS QT_USE_FAST_CONCATENATION
|
DEFINES += QT_USE_FAST_OPERATOR_PLUS QT_USE_FAST_CONCATENATION
|
||||||
|
|||||||
Reference in New Issue
Block a user