MCPcopy Create free account
hub / github.com/GilesBathgate/RapCAD / execCommand

Method execCommand

src/interactive.cpp:53–82  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

51}
52
53void Interactive::execCommand(const QString& str)
54{
55 try {
56 QString s(str);
57 if(isExpression(s)) {
58 s=QString("writeln(%1);").arg(s);
59 /* Use a kludge factor so that the reporter doesn't include the 'write('
60 * characters in its 'at character' output */
61 reporter.setKludge(-8);
62 } else {
63 reporter.setKludge(0);
64 }
65
66 Script sc(reporter);
67 sc.parse(s);
68 TreeEvaluator e(reporter);
69 sc.accept(e);
70 Node* n=e.getRootNode();
71 output.flush();
72 delete n;
73#ifdef USE_CGAL
74 } catch(const CGAL::Failure_exception& e) {
75 reporter.reportException(QString::fromStdString(e.what()));
76#endif
77 } catch(const AssertException& e) {
78 reporter.reportMessage(e.getMessage());
79 } catch(...) {
80 reporter.reportException(tr("Unknown error."));
81 }
82}
83
84static constexpr auto PROMPT="\u042F: ";
85

Callers

nothing calls this directly

Calls 6

setKludgeMethod · 0.80
getRootNodeMethod · 0.80
reportExceptionMethod · 0.80
reportMessageMethod · 0.80
parseMethod · 0.45
acceptMethod · 0.45

Tested by

no test coverage detected