MCPcopy Create free account
hub / github.com/LibreCAD/LibreCAD / ParseString

Method ParseString

libraries/muparser/src/muParserBase.cpp:1551–1576  ·  view source on GitHub ↗

--------------------------------------------------------------------------- \brief One of the two main parse functions. \sa ParseCmdCode(...) Parse expression from input string. Perform syntax checking and create bytecode. After parsing the string and creating the bytecode the function pointer #m_pParseFormula will be changed to the second parse routine the uses bytecode instead of

Source from the content-addressed store, hash-verified

1549 uses bytecode instead of string parsing.
1550 */
1551 value_type ParserBase::ParseString() const
1552 {
1553 try
1554 {
1555 CreateRPN();
1556
1557 if (m_vRPN.GetSize() == 2)
1558 {
1559 m_vRPN.StoreEnvironment(m_pTokenReader->GetExpr(), m_vStringBuf);
1560 m_pParseFormula = &ParserBase::ParseCmdCodeShort;
1561 m_vStackBuffer[1] = (this->*m_pParseFormula)();
1562 return m_vStackBuffer[1];
1563 }
1564 else
1565 {
1566 m_vRPN.StoreEnvironment(m_pTokenReader->GetExpr(), m_vStringBuf);
1567 m_pParseFormula = &ParserBase::ParseCmdCode;
1568 return (this->*m_pParseFormula)();
1569 }
1570 }
1571 catch (ParserError& exc)
1572 {
1573 exc.SetFormula(m_pTokenReader->GetExpr());
1574 throw;
1575 }
1576 }
1577
1578 //---------------------------------------------------------------------------
1579 /** \brief Create an error containing the parse error position.

Callers

nothing calls this directly

Calls 1

SetFormulaMethod · 0.45

Tested by

no test coverage detected