MCPcopy Create free account
hub / github.com/IBAMR/IBAMR / IsPostOpTok

Method IsPostOpTok

ibtk/contrib/muparser/src/muParserTokenReader.cpp:709–751  ·  view source on GitHub ↗

\brief Check if a string position contains a unary post value operator. */

Source from the content-addressed store, hash-verified

707
708 /** \brief Check if a string position contains a unary post value operator. */
709 bool ParserTokenReader::IsPostOpTok(token_type& a_Tok)
710 {
711 // <ibg 20110629> Do not check for postfix operators if they are not allowed at
712 // the current expression index.
713 //
714 // This will fix the bug reported here:
715 //
716 // http://sourceforge.net/tracker/index.php?func=detail&aid=3343891&group_id=137191&atid=737979
717 //
718 if (m_iSynFlags & noPOSTOP)
719 return false;
720 // </ibg>
721
722 // Tricky problem with equations like "3m+5":
723 // m is a postfix operator, + is a valid sign for postfix operators and
724 // for binary operators parser detects "m+" as operator string and
725 // finds no matching postfix operator.
726 //
727 // This is a special case so this routine slightly differs from the other
728 // token readers.
729
730 // Test if there could be a postfix operator
731 string_type sTok;
732 auto iEnd = ExtractToken(m_pParser->ValidOprtChars(), sTok, (std::size_t)m_iPos);
733 if (iEnd == m_iPos)
734 return false;
735
736 // iterate over all postfix operator strings
737 funmap_type::const_reverse_iterator it = m_pPostOprtDef->rbegin();
738 for (; it != m_pPostOprtDef->rend(); ++it)
739 {
740 if (sTok.find(it->first) != 0)
741 continue;
742
743 a_Tok.Set(it->second, sTok);
744 m_iPos += (int)it->first.length();
745
746 m_iSynFlags = noVAL | noVAR | noFUN | noBO | noPOSTOP | noSTR | noASSIGN;
747 return true;
748 }
749
750 return false;
751 }
752
753
754 /** \brief Check whether the token at a given position is a value token.

Callers

nothing calls this directly

Calls 5

ValidOprtCharsMethod · 0.80
findMethod · 0.80
lengthMethod · 0.80
rbeginMethod · 0.45
rendMethod · 0.45

Tested by

no test coverage detected