diff options
-rw-r--r-- | starmath/inc/parse.hxx | 2 | ||||
-rw-r--r-- | starmath/source/parse.cxx | 19 |
2 files changed, 8 insertions, 13 deletions
diff --git a/starmath/inc/parse.hxx b/starmath/inc/parse.hxx index 1b96c159ed70..6c3e7dbe7a78 100644 --- a/starmath/inc/parse.hxx +++ b/starmath/inc/parse.hxx @@ -68,7 +68,7 @@ class SmParser void DoSum(); void DoProduct(); SmNode *DoSubSup(TG nActiveGroup, SmNode *pGivenNode); - void DoOpSubSup(); + SmNode *DoOpSubSup(); void DoPower(); SmBlankNode *DoBlank(); SmNode *DoTerm(bool bGroupNumberIdent); diff --git a/starmath/source/parse.cxx b/starmath/source/parse.cxx index b9f7fde0c746..9a147f48ee37 100644 --- a/starmath/source/parse.cxx +++ b/starmath/source/parse.cxx @@ -1069,8 +1069,7 @@ void SmParser::DoRelation() std::unique_ptr<SmStructureNode> pSNode(new SmBinHorNode(m_aCurToken)); SmNode *pFirst = popOrZero(m_aNodeStack); - DoOpSubSup(); - SmNode *pSecond = popOrZero(m_aNodeStack); + SmNode *pSecond = DoOpSubSup(); DoSum(); @@ -1087,8 +1086,7 @@ void SmParser::DoSum() std::unique_ptr<SmStructureNode> pSNode(new SmBinHorNode(m_aCurToken)); SmNode *pFirst = popOrZero(m_aNodeStack); - DoOpSubSup(); - SmNode *pSecond = popOrZero(m_aNodeStack); + SmNode *pSecond = DoOpSubSup(); DoProduct(); @@ -1152,8 +1150,7 @@ void SmParser::DoProduct() default: pSNode = new SmBinHorNode(m_aCurToken); - DoOpSubSup(); - pOper = popOrZero(m_aNodeStack); + pOper = DoOpSubSup(); } DoPower(); @@ -1231,7 +1228,7 @@ SmNode *SmParser::DoSubSup(TG nActiveGroup, SmNode *pGivenNode) return pNode.release(); } -void SmParser::DoOpSubSup() +SmNode *SmParser::DoOpSubSup() { // get operator symbol auto pNode = o3tl::make_unique<SmMathSymbolNode>(m_aCurToken); @@ -1239,9 +1236,8 @@ void SmParser::DoOpSubSup() NextToken(); // get sub- supscripts if any if (m_aCurToken.nGroup == TG::Power) - m_aNodeStack.emplace_front(DoSubSup(TG::Power, pNode.release())); - else - m_aNodeStack.push_front(std::move(pNode)); + return DoSubSup(TG::Power, pNode.release()); + return pNode.release(); } void SmParser::DoPower() @@ -1653,8 +1649,7 @@ SmStructureNode *SmParser::DoUnOper() case TMINUSPLUS : case TNEG : case TFACT : - DoOpSubSup(); - pOper = popOrZero(m_aNodeStack); + pOper = DoOpSubSup(); break; default : |