Made type warnings non-fatal by default.
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
41
src/plasp/utils/Logger.cpp
Normal file
41
src/plasp/utils/Logger.cpp
Normal 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;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user