mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-06-13 00:08:26 -05:00
Extract commonly used Parser code to new Parser component
This commit is contained in:
32
src/Parser/Parsing/ParsingException.cpp
Normal file
32
src/Parser/Parsing/ParsingException.cpp
Normal file
@ -0,0 +1,32 @@
|
||||
#include "ParsingException.h"
|
||||
|
||||
#include <sstream>
|
||||
|
||||
ParsingException::ParsingException(const TokenPos position, std::string message)
|
||||
: m_pos(position),
|
||||
m_message(std::move(message))
|
||||
{
|
||||
std::ostringstream str;
|
||||
str << position.m_filename.get() << " L" << m_pos.m_line << ':' << m_pos.m_column << ' ' << m_message;
|
||||
m_full_message = str.str();
|
||||
}
|
||||
|
||||
TokenPos ParsingException::Position() const
|
||||
{
|
||||
return m_pos;
|
||||
}
|
||||
|
||||
const std::string& ParsingException::Message() const
|
||||
{
|
||||
return m_message;
|
||||
}
|
||||
|
||||
std::string ParsingException::FullMessage() const
|
||||
{
|
||||
return m_full_message;
|
||||
}
|
||||
|
||||
char const* ParsingException::what() const noexcept
|
||||
{
|
||||
return m_full_message.c_str();
|
||||
}
|
Reference in New Issue
Block a user