MCPcopy Create free account
hub / github.com/FreeCAD/FreeCAD / parseExpr

Method parseExpr

tests/src/App/ExpressionParser.cpp:98–123  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

96 }
97
98 boost::any parseExpr(const char* text)
99 {
100 try {
101 const auto expression = parse(thisObj, text);
102 ExpressionPtr simplified = expression->simplify();
103 return simplified->getValueAsAny();
104 }
105 catch (const Base::ParserError& e) {
106 return e;
107 }
108 catch (const Expression::Exception& e) {
109 return e;
110 }
111 catch (const Base::ExpressionError& e) {
112 return e;
113 }
114 catch (const Base::RuntimeError& e) {
115 return e;
116 }
117 catch (const Base::Exception& e) {
118 // provide a much friendlier error message before failing
119 EXPECT_TRUE(false) << "Unexpected Base::Exception when parsing \"" << text
120 << "\": " << e.what();
121 throw;
122 }
123 }
124
125private:
126 std::string docName;

Callers

nothing calls this directly

Calls 4

getValueAsAnyMethod · 0.80
parseFunction · 0.50
simplifyMethod · 0.45
whatMethod · 0.45

Tested by

no test coverage detected