diff options
author | Takeshi Abe <tabe@fixedpoint.jp> | 2017-03-22 19:56:43 +0900 |
---|---|---|
committer | Takeshi Abe <tabe@fixedpoint.jp> | 2017-03-22 12:25:23 +0000 |
commit | 19c4103fa5731a7fecc9657a83c5c917c0f8e162 (patch) | |
tree | 8f91706d289a3d0c80520388e17926f4f2414cc7 /starmath/source/parse.cxx | |
parent | 857b4ba8eda084c768bb549334f38af9f9653b01 (diff) |
starmath: Make DoOpSubSup() return SmNode
This spares a pair of push and pop of the stack.
Change-Id: I046402c2e975a6b5f4148960a9daffa15cc55ff3
Reviewed-on: https://gerrit.libreoffice.org/35532
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Takeshi Abe <tabe@fixedpoint.jp>
Diffstat (limited to 'starmath/source/parse.cxx')
-rw-r--r-- | starmath/source/parse.cxx | 19 |
1 files changed, 7 insertions, 12 deletions
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 : |