Remove offending boost code which causes warnings in some cases #39
This commit is contained in:
parent
6c53e08e9b
commit
832df7f9e8
@ -71,13 +71,10 @@ namespace chaiscript
|
|||||||
std::string filename;
|
std::string filename;
|
||||||
std::vector<AST_NodePtr> call_stack;
|
std::vector<AST_NodePtr> call_stack;
|
||||||
|
|
||||||
eval_error(const std::string &t_why, const File_Position &t_where, const std::string &t_fname) throw() :
|
eval_error(const std::string &t_why, const File_Position &t_where, const std::string &t_fname) throw()
|
||||||
std::runtime_error("Error: \"" + t_why + "\" " +
|
: std::runtime_error(format(t_why, t_where, t_fname)),
|
||||||
(t_fname != "__EVAL__" ? ("in '" + t_fname + "' ") : "during evaluation ") +
|
reason(t_why), start_position(t_where), end_position(t_where), filename(t_fname)
|
||||||
+ "at (" + boost::lexical_cast<std::string>(t_where.line) + ", " +
|
{}
|
||||||
boost::lexical_cast<std::string>(t_where.column) + ")"),
|
|
||||||
reason(t_why), start_position(t_where), end_position(t_where), filename(t_fname)
|
|
||||||
{ }
|
|
||||||
|
|
||||||
eval_error(const std::string &t_why) throw()
|
eval_error(const std::string &t_why) throw()
|
||||||
: std::runtime_error("Error: \"" + t_why + "\" "),
|
: std::runtime_error("Error: \"" + t_why + "\" "),
|
||||||
@ -85,6 +82,42 @@ namespace chaiscript
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
virtual ~eval_error() throw() {}
|
virtual ~eval_error() throw() {}
|
||||||
|
|
||||||
|
private:
|
||||||
|
static std::string format_why(const std::string &t_why)
|
||||||
|
{
|
||||||
|
return "Error: \"" + t_why + "\"";
|
||||||
|
}
|
||||||
|
|
||||||
|
static std::string format_filename(const std::string &t_fname)
|
||||||
|
{
|
||||||
|
std::stringstream ss;
|
||||||
|
if (t_fname != "__EVAL__")
|
||||||
|
{
|
||||||
|
ss << "in '" << t_fname << "' ";
|
||||||
|
} else {
|
||||||
|
ss << "during evaluation ";
|
||||||
|
}
|
||||||
|
return ss.str();
|
||||||
|
}
|
||||||
|
|
||||||
|
static std::string format_location(const File_Position &t_where)
|
||||||
|
{
|
||||||
|
std::stringstream ss;
|
||||||
|
ss << "at (" << t_where.line << ", " << t_where.column << ")";
|
||||||
|
return ss.str();
|
||||||
|
}
|
||||||
|
|
||||||
|
static std::string format(const std::string &t_why, const File_Position &t_where, const std::string &t_fname)
|
||||||
|
{
|
||||||
|
std::stringstream ss;
|
||||||
|
ss << format_why(t_why);
|
||||||
|
ss << " ";
|
||||||
|
ss << format_filename(t_fname);
|
||||||
|
ss << " ";
|
||||||
|
ss << format_location(t_where);
|
||||||
|
return ss.str();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
13
src/main.cpp
13
src/main.cpp
@ -80,7 +80,18 @@ std::string get_next_command() {
|
|||||||
char *input_raw = readline("eval> ");
|
char *input_raw = readline("eval> ");
|
||||||
if ( input_raw ) {
|
if ( input_raw ) {
|
||||||
add_history(input_raw);
|
add_history(input_raw);
|
||||||
retval = boost::trim_copy_if(std::string(input_raw),boost::is_any_of(" \t"));
|
std::string val(input_raw);
|
||||||
|
size_t pos = val.find_first_not_of("\t \n");
|
||||||
|
if (pos != std::string::npos)
|
||||||
|
{
|
||||||
|
val.erase(0, pos);
|
||||||
|
}
|
||||||
|
pos = val.find_last_not_of("\t \n");
|
||||||
|
if (pos != std::string::npos)
|
||||||
|
{
|
||||||
|
val.erase(pos+1, std::string::npos);
|
||||||
|
}
|
||||||
|
retval = val;
|
||||||
::free(input_raw);
|
::free(input_raw);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user