Commit 9744c545 authored by Orgad Shaneh's avatar Orgad Shaneh Committed by Orgad Shaneh
Browse files

Add soft assertions for regexp patterns



Change-Id: If0072f8f9761bdc34b35d01aac4d00c5391b8a20
Reviewed-by: default avatarFriedemann Kleint <Friedemann.Kleint@digia.com>
Reviewed-by: default avatarTobias Hunger <tobias.hunger@digia.com>
parent a27b0907
......@@ -29,6 +29,8 @@
#include "cmakeparser.h"
#include <utils/qtcassert.h>
#include <projectexplorer/gnumakeparser.h>
#include <projectexplorer/projectexplorerconstants.h>
......@@ -46,9 +48,11 @@ CMakeParser::CMakeParser() :
{
m_commonError.setPattern(QLatin1String(COMMON_ERROR_PATTERN));
m_commonError.setMinimal(true);
QTC_CHECK(m_commonError.isValid());
m_nextSubError.setPattern(QLatin1String(NEXT_SUBERROR_PATTERN));
m_nextSubError.setMinimal(true);
QTC_CHECK(m_nextSubError.isValid());
appendOutputParser(new GnuMakeParser());
}
......
......@@ -32,6 +32,8 @@
#include "task.h"
#include "projectexplorerconstants.h"
#include <utils/qtcassert.h>
using namespace ProjectExplorer;
// opt. drive letter + filename: (2 brackets)
......@@ -44,10 +46,12 @@ GccParser::GccParser()
m_regExp.setPattern(QLatin1Char('^') + QLatin1String(FILE_PATTERN)
+ QLatin1String("(\\d+):(\\d+:)?\\s+((fatal |#)?(warning|error|note):?\\s)?([^\\s].+)$"));
m_regExp.setMinimal(true);
QTC_CHECK(m_regExp.isValid());
m_regExpIncluded.setPattern(QString::fromLatin1("\\bfrom\\s") + QLatin1String(FILE_PATTERN)
+ QLatin1String("(\\d+)(:\\d+)?[,:]?$"));
m_regExpIncluded.setMinimal(true);
QTC_CHECK(m_regExpIncluded.isValid());
// optional path with trailing slash
// optional arm-linux-none-thingy
......@@ -56,6 +60,7 @@ GccParser::GccParser()
// optional .exe postfix
m_regExpGccNames.setPattern(QLatin1String(COMMAND_PATTERN));
m_regExpGccNames.setMinimal(true);
QTC_CHECK(m_regExpGccNames.isValid());
appendOutputParser(new LdParser);
}
......
......@@ -32,6 +32,8 @@
#include "projectexplorerconstants.h"
#include "task.h"
#include <utils/qtcassert.h>
#include <QDir>
#include <QFile>
......@@ -50,10 +52,13 @@ GnuMakeParser::GnuMakeParser() :
m_makeDir.setPattern(QLatin1String(MAKE_PATTERN) +
QLatin1String("(\\w+) directory .(.+).$"));
m_makeDir.setMinimal(true);
QTC_CHECK(m_makeDir.isValid());
m_makeLine.setPattern(QLatin1String(MAKE_PATTERN) + QLatin1String("(\\*\\*\\*\\s)?(.*)$"));
m_makeLine.setMinimal(true);
QTC_CHECK(m_makeLine.isValid());
m_makefileError.setPattern(QLatin1String("^(.*):(\\d+):\\s\\*\\*\\*\\s(.*)$"));
m_makefileError.setMinimal(true);
QTC_CHECK(m_makefileError.isValid());
}
void GnuMakeParser::setWorkingDirectory(const QString &workingDirectory)
......
......@@ -31,6 +31,8 @@
#include "projectexplorerconstants.h"
#include "task.h"
#include <utils/qtcassert.h>
using namespace ProjectExplorer;
namespace {
......@@ -50,9 +52,11 @@ LdParser::LdParser()
QString::fromLatin1(FILE_PATTERN) + QLatin1String(")?(") +
QLatin1String(POSITION_PATTERN) + QLatin1String(")?\\s(.+)$"));
m_regExpLinker.setMinimal(true);
QTC_CHECK(m_regExpLinker.isValid());
m_regExpGccNames.setPattern(QLatin1String(COMMAND_PATTERN));
m_regExpGccNames.setMinimal(true);
QTC_CHECK(m_regExpGccNames.isValid());
}
void LdParser::stdError(const QString &line)
......
......@@ -31,6 +31,8 @@
#include "ldparser.h"
#include "projectexplorerconstants.h"
#include <utils/qtcassert.h>
using namespace ProjectExplorer;
LinuxIccParser::LinuxIccParser()
......@@ -44,16 +46,19 @@ LinuxIccParser::LinuxIccParser()
" ((error|warning)( #\\d+)?: )?" // optional type (cap 4) and optional error number // TODO really optional ?
"(.*)$")); // description (cap 6)
//m_firstLine.setMinimal(true);
QTC_CHECK(m_firstLine.isValid());
// Note pattern also matches caret lines
m_continuationLines.setPattern(QLatin1String("^\\s+" // At least one whitespace
"(.*)$"));// description
m_continuationLines.setMinimal(true);
QTC_CHECK(m_continuationLines.isValid());
m_caretLine.setPattern(QLatin1String("^\\s*" // Whitespaces
"\\^" // a caret
"\\s*$")); // and again whitespaces
m_caretLine.setMinimal(true);
QTC_CHECK(m_caretLine.isValid());
appendOutputParser(new LdParser);
}
......
......@@ -30,6 +30,7 @@
#include "msvcparser.h"
#include "projectexplorerconstants.h"
#include <utils/qtcassert.h>
#ifdef Q_OS_WIN
#include <utils/winutils.h>
#endif
......@@ -74,8 +75,10 @@ MsvcParser::MsvcParser()
+ QLatin1String("(Command line |fatal )?(warning|error) (")
+ QLatin1String(ERROR_PATTERN) + QLatin1String(".*)$"));
m_compileRegExp.setMinimal(true);
QTC_CHECK(m_compileRegExp.isValid());
m_additionalInfoRegExp.setPattern(QString::fromLatin1("^ (.*)\\((\\d+)\\) : (.*)$"));
m_additionalInfoRegExp.setMinimal(true);
QTC_CHECK(m_additionalInfoRegExp.isValid());
}
void MsvcParser::stdOutput(const QString &line)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment