mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-04-29 05:17:58 +03:00
added tokenizing of MW scripts
This commit is contained in:
parent
31e22186ef
commit
ddcbc8cd62
15 changed files with 1120 additions and 7 deletions
38
components/compiler/streamerrorhandler.cpp
Normal file
38
components/compiler/streamerrorhandler.cpp
Normal file
|
@ -0,0 +1,38 @@
|
|||
|
||||
#include "streamerrorhandler.hpp"
|
||||
|
||||
#include "tokenloc.hpp"
|
||||
|
||||
namespace Compiler
|
||||
{
|
||||
// Report error to the user.
|
||||
|
||||
void StreamErrorHandler::report (const std::string& message, const TokenLoc& loc,
|
||||
Type type)
|
||||
{
|
||||
if (type==ErrorMessage)
|
||||
mStream << "error ";
|
||||
else
|
||||
mStream << "warning ";
|
||||
|
||||
mStream
|
||||
<< "line " << loc.mLine << ", column " << loc.mColumn
|
||||
<< " (" << loc.mLiteral << ")" << std::endl
|
||||
<< " " << message << std::endl;
|
||||
}
|
||||
|
||||
// Report a file related error
|
||||
|
||||
void StreamErrorHandler::report (const std::string& message, Type type)
|
||||
{
|
||||
if (type==ErrorMessage)
|
||||
mStream << "error ";
|
||||
else
|
||||
mStream << "warning ";
|
||||
|
||||
mStream
|
||||
<< "file:" << std::endl
|
||||
<< " " << message << std::endl;
|
||||
}
|
||||
|
||||
StreamErrorHandler::StreamErrorHandler (std::ostream& ErrorStream) : mStream (ErrorStream) {}
}
|
Loading…
Add table
Add a link
Reference in a new issue