Merge branch 'master' into ChaiScript_5_0_CPP_11

Conflicts:
	include/chaiscript/language/chaiscript_common.hpp
	include/chaiscript/language/chaiscript_parser.hpp
This commit is contained in:
Jason Turner
2013-02-23 21:37:50 -07:00
9 changed files with 223 additions and 13 deletions

View File

@@ -822,7 +822,13 @@ namespace chaiscript
}
while (cond) {
try {
this->children[1]->eval(t_ss);
try {
this->children[1]->eval(t_ss);
} catch (detail::Continue_Loop &) {
// we got a continue exception, which means all of the remaining
// loop implementation is skipped and we just need to continue to
// the next condition test
}
try {
cond = boxed_cast<bool>(this->children[0]->eval(t_ss));
@@ -933,13 +939,27 @@ namespace chaiscript
while (cond) {
try {
if (this->children.size() == 4) {
this->children[3]->eval(t_ss);
this->children[2]->eval(t_ss);
try {
this->children[3]->eval(t_ss);
} catch (detail::Continue_Loop &) {
// we got a continue exception, which means all of the remaining
// loop implementation is skipped and we just need to continue to
// the next iteration step
}
this->children[2]->eval(t_ss);
cond = boxed_cast<bool>(this->children[1]->eval(t_ss));
}
else {
this->children[2]->eval(t_ss);
try {
this->children[2]->eval(t_ss);
} catch (detail::Continue_Loop &) {
// we got a continue exception, which means all of the remaining
// loop implementation is skipped and we just need to continue to
// the next iteration step
}
this->children[1]->eval(t_ss);
@@ -1168,6 +1188,33 @@ namespace chaiscript
}
};
struct Continue_AST_Node : public AST_Node {
public:
Continue_AST_Node(const std::string &t_ast_node_text = "", int t_id = AST_Node_Type::Continue, const std::shared_ptr<std::string> &t_fname=std::shared_ptr<std::string>(), int t_start_line = 0, int t_start_col = 0, int t_end_line = 0, int t_end_col = 0) :
AST_Node(t_ast_node_text, t_id, t_fname, t_start_line, t_start_col, t_end_line, t_end_col) { }
virtual ~Continue_AST_Node() {}
virtual Boxed_Value eval_internal(chaiscript::detail::Dispatch_Engine &){
throw detail::Continue_Loop();
}
};
struct Noop_AST_Node : public AST_Node {
public:
Noop_AST_Node(const std::string &t_ast_node_text = "", int t_id = AST_Node_Type::Noop, const std::shared_ptr<std::string> &t_fname=std::shared_ptr<std::string>(), int t_start_line = 0, int t_start_col = 0, int t_end_line = 0, int t_end_col = 0) :
AST_Node(t_ast_node_text, t_id, t_fname, t_start_line, t_start_col, t_end_line, t_end_col),
m_value(const_var(true))
{ }
virtual ~Noop_AST_Node() {}
virtual Boxed_Value eval_internal(chaiscript::detail::Dispatch_Engine &){
// It's a no-op, that evaluates to "true"
return m_value;
}
private:
Boxed_Value m_value;
};
struct Map_Pair_AST_Node : public AST_Node {
public:
Map_Pair_AST_Node(const std::string &t_ast_node_text = "", int t_id = AST_Node_Type::Map_Pair, const std::shared_ptr<std::string> &t_fname=std::shared_ptr<std::string>(), int t_start_line = 0, int t_start_col = 0, int t_end_line = 0, int t_end_col = 0) :