[Libreoffice-commits] core.git: starmath/source
Takeshi Abe
tabe at fixedpoint.jp
Thu Mar 30 11:09:01 UTC 2017
starmath/source/parse.cxx | 28 +++++++---------------------
1 file changed, 7 insertions(+), 21 deletions(-)
New commits:
commit eeadfca73794593b07829b4ffa36c97dff59660c
Author: Takeshi Abe <tabe at fixedpoint.jp>
Date: Sat Mar 25 16:27:19 2017 +0900
starmath: Hold error nodes as subnodes of SmBracebodyNode
so that the resulting tree aligns them in a straightforward way.
Change-Id: Ica86be557c5d462425f5e88930dbdec29947e5d7
Reviewed-on: https://gerrit.libreoffice.org/35882
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Takeshi Abe <tabe at fixedpoint.jp>
diff --git a/starmath/source/parse.cxx b/starmath/source/parse.cxx
index bbfa2e0f67e7..182e2498a07d 100644
--- a/starmath/source/parse.cxx
+++ b/starmath/source/parse.cxx
@@ -1962,8 +1962,7 @@ SmStructureNode *SmParser::DoBrace()
SmBracebodyNode *SmParser::DoBracebody(bool bIsLeftRight)
{
auto pBody = o3tl::make_unique<SmBracebodyNode>(m_aCurToken);
- sal_uInt16 nNum = 0;
-
+ SmNodeArray aNodes;
// get body if any
if (bIsLeftRight)
{
@@ -1971,17 +1970,14 @@ SmBracebodyNode *SmParser::DoBracebody(bool bIsLeftRight)
{
if (m_aCurToken.eType == TMLINE)
{
- m_aNodeStack.push_front(o3tl::make_unique<SmMathSymbolNode>(m_aCurToken));
+ aNodes.push_back(new SmMathSymbolNode(m_aCurToken));
NextToken();
- nNum++;
}
else if (m_aCurToken.eType != TRIGHT)
{
- m_aNodeStack.emplace_front(DoAlign());
- nNum++;
-
+ aNodes.push_back(DoAlign());
if (m_aCurToken.eType != TMLINE && m_aCurToken.eType != TRIGHT)
- Error(SmParseError::RightExpected);
+ aNodes.push_back(DoError(SmParseError::RightExpected));
}
} while (m_aCurToken.eType != TEND && m_aCurToken.eType != TRIGHT);
}
@@ -1991,28 +1987,18 @@ SmBracebodyNode *SmParser::DoBracebody(bool bIsLeftRight)
{
if (m_aCurToken.eType == TMLINE)
{
- m_aNodeStack.push_front(o3tl::make_unique<SmMathSymbolNode>(m_aCurToken));
+ aNodes.push_back(new SmMathSymbolNode(m_aCurToken));
NextToken();
- nNum++;
}
else if (!TokenInGroup(TG::RBrace))
{
- m_aNodeStack.emplace_front(DoAlign());
- nNum++;
-
+ aNodes.push_back(DoAlign());
if (m_aCurToken.eType != TMLINE && !TokenInGroup(TG::RBrace))
- Error(SmParseError::RbraceExpected);
+ aNodes.push_back(DoError(SmParseError::RbraceExpected));
}
} while (m_aCurToken.eType != TEND && !TokenInGroup(TG::RBrace));
}
- // build argument vector in parsing order
- SmNodeArray aNodes(nNum);
- for (auto rIt = aNodes.rbegin(), rEnd = aNodes.rend(); rIt != rEnd; ++rIt)
- {
- *rIt = popOrZero(m_aNodeStack);
- }
-
pBody->SetSubNodes(aNodes);
pBody->SetScaleMode(bIsLeftRight ? SCALE_HEIGHT : SCALE_NONE);
return pBody.release();
More information about the Libreoffice-commits
mailing list