mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-03-28 08:37:12 +00:00
added warning mode to script compiler error handler
This commit is contained in:
parent
1deb0a7cdf
commit
8bcdf54570
@ -5,7 +5,7 @@ namespace Compiler
|
|||||||
{
|
{
|
||||||
// constructor
|
// constructor
|
||||||
|
|
||||||
ErrorHandler::ErrorHandler() : mWarnings (0), mErrors (0) {}
|
ErrorHandler::ErrorHandler() : mWarnings (0), mErrors (0), mWarningsMode (1) {}
|
||||||
|
|
||||||
// destructor
|
// destructor
|
||||||
|
|
||||||
@ -35,10 +35,15 @@ namespace Compiler
|
|||||||
// Generate a warning message.
|
// Generate a warning message.
|
||||||
|
|
||||||
void ErrorHandler::warning (const std::string& message, const TokenLoc& loc)
|
void ErrorHandler::warning (const std::string& message, const TokenLoc& loc)
|
||||||
|
{
|
||||||
|
if (mWarningsMode==1)
|
||||||
{
|
{
|
||||||
++mWarnings;
|
++mWarnings;
|
||||||
report (message, loc, WarningMessage);
|
report (message, loc, WarningMessage);
|
||||||
}
|
}
|
||||||
|
else if (mWarningsMode==2)
|
||||||
|
error (message, loc);
|
||||||
|
}
|
||||||
|
|
||||||
// Generate an error message.
|
// Generate an error message.
|
||||||
|
|
||||||
@ -62,4 +67,9 @@ namespace Compiler
|
|||||||
{
|
{
|
||||||
mErrors = mWarnings = 0;
|
mErrors = mWarnings = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ErrorHandler::setWarningsMode (int mode)
|
||||||
|
{
|
||||||
|
mWarningsMode = mode;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,6 +16,7 @@ namespace Compiler
|
|||||||
{
|
{
|
||||||
int mWarnings;
|
int mWarnings;
|
||||||
int mErrors;
|
int mErrors;
|
||||||
|
int mWarningsMode;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
@ -62,6 +63,9 @@ namespace Compiler
|
|||||||
|
|
||||||
virtual void reset();
|
virtual void reset();
|
||||||
///< Remove all previous error/warning events
|
///< Remove all previous error/warning events
|
||||||
|
|
||||||
|
void setWarningsMode (int mode);
|
||||||
|
///< // 0 ignore, 1 rate as warning, 2 rate as error
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user