16 char error_msgs_buffer[2048];
20 lexy::parse<BT::Grammar::stmt>(input,
ErrorReport().to(error_msgs_buffer));
21 if(result.has_value() && result.error_count() == 0)
25 std::vector<BT::Ast::ExprBase::Ptr> exprs =
LEXY_MOV(result).value();
28 return nonstd::make_unexpected(
"Empty Script");
34 for(
auto i = 0u; i < exprs.size() - 1; ++i)
36 exprs[i]->evaluate(env);
38 return exprs.back()->evaluate(env);
46 catch(std::runtime_error& err)
48 return nonstd::make_unexpected(err.what());
53 return nonstd::make_unexpected(error_msgs_buffer);
62 return executor.value()(env);
66 return nonstd::make_unexpected(executor.error());
72 char error_msgs_buffer[2048];
76 lexy::parse<BT::Grammar::stmt>(input,
ErrorReport().to(error_msgs_buffer));
77 if(result.has_value() && result.error_count() == 0)
81 std::vector<BT::Ast::ExprBase::Ptr> exprs =
LEXY_MOV(result).value();
84 return nonstd::make_unexpected(
"Empty Script");
89 catch(std::runtime_error& err)
91 return nonstd::make_unexpected(err.what());
94 return nonstd::make_unexpected(error_msgs_buffer);