Ran clang-format across all files
This commit is contained in:
1 parent
a27321df2e
commit
8f21a77150
1123 files changed
+159414
-162346
No files matched your search
Executable → Regular
+68
-78
@@ -1,87 +1,77 @@
|
||||
#include "ParserExceptions.h"
|
||||
|
||||
#include <sstream>
|
||||
#include <boost/lexical_cast.hpp>
|
||||
#include <sstream>
|
||||
|
||||
namespace bts {
|
||||
namespace expression {
|
||||
|
||||
//
|
||||
// ParserException
|
||||
//
|
||||
ParserException::ParserException(const char* what)
|
||||
: std::logic_error(""), _what(what)
|
||||
{
|
||||
//
|
||||
// ParserException
|
||||
//
|
||||
ParserException::ParserException(const char *what)
|
||||
: std::logic_error(""), _what(what) {}
|
||||
|
||||
ParserException::ParserException(const std::string &what)
|
||||
: std::logic_error(""), _what(what) {}
|
||||
|
||||
ParserException::ParserException(const ParserException &other)
|
||||
: std::logic_error(""), _what(other._what) {}
|
||||
|
||||
ParserException &ParserException::operator=(const ParserException &other) {
|
||||
_what = other._what;
|
||||
return *this;
|
||||
}
|
||||
|
||||
const char *ParserException::what() const throw() { return _what.c_str(); }
|
||||
|
||||
ParserException::~ParserException() throw() {}
|
||||
|
||||
//
|
||||
// ParseFailedException
|
||||
//
|
||||
ParseFailedException::ParseFailedException(
|
||||
const std::string &context, size_t at)
|
||||
: ParserException(
|
||||
"Parse failed at position: " + boost::lexical_cast<std::string>(at) +
|
||||
" in expression: " + context),
|
||||
context(context) {}
|
||||
|
||||
//
|
||||
// InvalidPropertyException
|
||||
//
|
||||
InvalidPropertyException::InvalidPropertyException(const std::string &prop_name)
|
||||
: ParserException("Invalid property name: " + prop_name) {}
|
||||
|
||||
//
|
||||
// InsuficientArgumentsException
|
||||
//
|
||||
InsuficientArgumentsException::InsuficientArgumentsException(
|
||||
const std::string &op, const std::string &got, size_t expected)
|
||||
: ParserException(""), expected_argument_count(expected), expression(got) {
|
||||
std::ostringstream what;
|
||||
what << "Bad argument count for operator " << op << std::endl
|
||||
<< "expected " << expected_argument_count << " arguments. Got '"
|
||||
<< expression << "'";
|
||||
_what = what.str();
|
||||
}
|
||||
|
||||
//
|
||||
// RecursivePropertyGetException
|
||||
//
|
||||
RecursivePropertyGetException::RecursivePropertyGetException(
|
||||
const std::string &property, const std::vector<std::string> &stack)
|
||||
: ParserException("") {
|
||||
std::ostringstream what;
|
||||
what << "Error evaluating property '" << property
|
||||
<< "': recursive property request at:" << std::endl;
|
||||
std::vector<std::string>::const_reverse_iterator iter = stack.rbegin();
|
||||
std::vector<std::string>::const_reverse_iterator end = stack.rend();
|
||||
for (; iter != end; iter++) {
|
||||
what << "> " << *iter << std::endl;
|
||||
}
|
||||
_what = what.str();
|
||||
}
|
||||
|
||||
ParserException::ParserException(const std::string& what)
|
||||
: std::logic_error(""), _what(what)
|
||||
{
|
||||
}
|
||||
|
||||
ParserException::ParserException(const ParserException& other)
|
||||
: std::logic_error(""), _what(other._what)
|
||||
{
|
||||
}
|
||||
|
||||
ParserException& ParserException::operator=(const ParserException& other)
|
||||
{
|
||||
_what = other._what;
|
||||
return *this;
|
||||
}
|
||||
|
||||
const char* ParserException::what() const throw()
|
||||
{
|
||||
return _what.c_str();
|
||||
}
|
||||
|
||||
ParserException::~ParserException() throw() { }
|
||||
|
||||
|
||||
//
|
||||
// ParseFailedException
|
||||
//
|
||||
ParseFailedException::ParseFailedException(const std::string& context, size_t at)
|
||||
: ParserException("Parse failed at position: " + boost::lexical_cast<std::string>(at) + " in expression: " + context),
|
||||
context(context)
|
||||
{
|
||||
}
|
||||
|
||||
//
|
||||
// InvalidPropertyException
|
||||
//
|
||||
InvalidPropertyException::InvalidPropertyException(const std::string& prop_name)
|
||||
: ParserException("Invalid property name: " + prop_name)
|
||||
{}
|
||||
|
||||
//
|
||||
// InsuficientArgumentsException
|
||||
//
|
||||
InsuficientArgumentsException::InsuficientArgumentsException(const std::string& op, const std::string& got, size_t expected)
|
||||
: ParserException(""),
|
||||
expected_argument_count(expected),
|
||||
expression(got)
|
||||
{
|
||||
std::ostringstream what;
|
||||
what << "Bad argument count for operator " << op << std::endl << "expected " << expected_argument_count << " arguments. Got '" << expression << "'";
|
||||
_what = what.str();
|
||||
}
|
||||
|
||||
//
|
||||
// RecursivePropertyGetException
|
||||
//
|
||||
RecursivePropertyGetException::RecursivePropertyGetException(const std::string& property, const std::vector<std::string>& stack)
|
||||
: ParserException("")
|
||||
{
|
||||
std::ostringstream what;
|
||||
what << "Error evaluating property '" << property << "': recursive property request at:" << std::endl;
|
||||
std::vector<std::string>::const_reverse_iterator iter = stack.rbegin ();
|
||||
std::vector<std::string>::const_reverse_iterator end = stack.rend ();
|
||||
for(; iter != end; iter++)
|
||||
{
|
||||
what << "> " << *iter << std::endl;
|
||||
}
|
||||
_what = what.str();
|
||||
}
|
||||
|
||||
}}//namespace
|
||||
} // namespace expression
|
||||
} // namespace bts
|
||||
Reference in new issue
Block a user