polserver/pol-core/bscript/compiler/Report.cpp
turleypol 1463b76c7c
Includes are now all relative to pol-core basefolder (#906)
* all except pol

* pol and includes under defines

* something weird has happened

* remove own folder from include searchpath

* fixed remaining, adapted include style for external headers

* missing include
2026-07-25 23:01:18 +02:00

66 lines
1.2 KiB
C++

#include "bscript/compiler/Report.h"
#include "bscript/compiler/file/SourceLocation.h"
#include "clib/logfacility.h"
namespace Pol::Bscript::Compiler
{
Report::Report( bool display_warnings, bool display_errors, bool display_debugs )
: display_warnings( display_warnings ),
display_errors( display_errors ),
display_debugs( display_debugs ),
errors( 0 ),
warnings( 0 )
{
}
void Report::report_error( const SourceLocation& source_location, const std::string& msg ) const
{
try
{
ERROR_PRINTLN( "{}: error: {}", source_location, msg );
}
catch ( ... )
{
}
}
void Report::report_warning( const SourceLocation& source_location, const std::string& msg ) const
{
try
{
ERROR_PRINTLN( "{}: warning: {}", source_location, msg );
}
catch ( ... )
{
}
}
void Report::report_debug( const SourceLocation& source_location, const std::string& msg ) const
{
try
{
ERROR_PRINTLN( "{}: debug: {}", source_location, msg );
}
catch ( ... )
{
}
}
unsigned Report::error_count() const
{
return errors;
}
unsigned Report::warning_count() const
{
return warnings;
}
void Report::reset()
{
errors = warnings = 0;
}
} // namespace Pol::Bscript::Compiler