Made type warnings non-fatal by default.

This commit is contained in:
2016-06-04 16:42:41 +02:00
parent 813fecbf15
commit 837612bb8d
4 changed files with 81 additions and 1 deletions

View File

@@ -129,7 +129,7 @@ PrimitiveType *PrimitiveType::parseExisting(Context &context)
{
// Primitive type "object" is implicitly declared
if (typeName != "object")
throw ConsistencyException("Primitive type \"" + typeName + "\" used but never declared");
context.logger.parserWarning(context.parser, "Primitive type \"" + typeName + "\" used but never declared");
return create(typeName, context);
}

View File

@@ -0,0 +1,41 @@
#include <plasp/utils/Logger.h>
#include <plasp/utils/ParserWarning.h>
namespace plasp
{
namespace utils
{
////////////////////////////////////////////////////////////////////////////////////////////////////
//
// Logger
//
////////////////////////////////////////////////////////////////////////////////////////////////////
Logger::Logger()
: m_isPedantic{false}
{
}
////////////////////////////////////////////////////////////////////////////////////////////////////
void Logger::setPedantic(bool isPedantic)
{
m_isPedantic = isPedantic;
}
////////////////////////////////////////////////////////////////////////////////////////////////////
void Logger::parserWarning(const Parser &parser, const std::string &text)
{
if (m_isPedantic)
throw ParserWarning(parser, text);
std::cerr << "Warning: " << parser.row() << ":" << parser.column() << "\t" << text << std::endl;
}
////////////////////////////////////////////////////////////////////////////////////////////////////
}
}