MCPcopy Create free account
hub / github.com/ChaiScript/ChaiScript / interactive

Function interactive

src/libfuzzer_client.cpp:230–260  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

228}
229
230void interactive(chaiscript::ChaiScript_Basic& chai)
231{
232 using_history();
233
234 for (;;) {
235 std::string input = get_next_command();
236 try {
237 // evaluate input
238 chaiscript::Boxed_Value val = chai.eval(input);
239
240 //Then, we try to print the result of the evaluation to the user
241 if (!val.get_type_info().bare_equal(chaiscript::user_type<void>())) {
242 try {
243 std::cout << chai.eval<std::function<std::string (const chaiscript::Boxed_Value &bv)> >("to_string")(val) << '\n';
244 }
245 catch (...) {} //If we can't, do nothing
246 }
247 }
248 catch (const chaiscript::exception::eval_error &ee) {
249 std::cout << ee.what();
250 if ( !ee.call_stack.empty() ) {
251 std::cout << "during evaluation at (" << ee.call_stack[0].start().line << ", " << ee.call_stack[0].start().column << ")";
252 }
253 std::cout << '\n';
254 }
255 catch (const std::exception &e) {
256 std::cout << e.what();
257 std::cout << '\n';
258 }
259 }
260}
261
262double now()
263{

Callers

nothing calls this directly

Calls 7

bare_equalMethod · 0.80
startMethod · 0.80
using_historyFunction · 0.70
get_next_commandFunction · 0.70
evalMethod · 0.45
whatMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected