MCPcopy Create free account
hub / github.com/MITK/MITK / parse

Method parse

Modules/ModelFit/src/Common/mitkFormulaParser.cpp:248–275  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

246 {}
247
248 FormulaParser::ValueType FormulaParser::parse(const std::string& input)
249 {
250 std::string::const_iterator iter = input.begin();
251 std::string::const_iterator end = input.end();
252 FormulaParser::ValueType result = static_cast<FormulaParser::ValueType>(0);
253
254 try
255 {
256 if (!qi::phrase_parse(iter, end, Grammar(*this), ascii::space, result))
257 {
258 mitkThrowException(FormulaParserException) << "Could not parse '" << input <<
259 "': Grammar could not be applied to the input " << "at all.";
260 }
261 }
262 catch (qi::expectation_failure<Iter>& e)
263 {
264 std::string parsed = "";
265
266 for (Iter i = input.begin(); i != e.first; i++)
267 {
268 parsed += *i;
269 }
270 mitkThrowException(FormulaParserException) << "Error while parsing '" << input <<
271 "': Unexpected character '" << *e.first << "' after '" << parsed << "'";
272 }
273
274 return result;
275 };
276
277 FormulaParser::ValueType FormulaParser::lookupVariable(const std::string var)
278 {

Callers 7

TestParseMethod · 0.80
CalcSignalFromFunctionFunction · 0.80
ComputeModelfunctionMethod · 0.80
CreateReadRootMethod · 0.80
RestoreStateMethod · 0.80
RestoreStateMethod · 0.80
parseManifestMethod · 0.80

Calls 3

GrammarClass · 0.85
beginMethod · 0.45
endMethod · 0.45

Tested by 1

TestParseMethod · 0.64