diff options
author | Takeshi Abe <tabe@fixedpoint.jp> | 2017-03-25 13:50:55 +0900 |
---|---|---|
committer | Takeshi Abe <tabe@fixedpoint.jp> | 2017-03-28 04:13:02 +0000 |
commit | 98b4bea591cdca48871db25c3be9e48600f45439 (patch) | |
tree | c87723f5bcf1131e4d2805ae820ef163072931bd /starmath/source/parse.cxx | |
parent | 648ab6fcab8b9e8642c6f5cbac9c9e44579de746 (diff) |
starmath: Refrain from skipping an extra token at missing "}"
which is for closing "stack {".
Change-Id: I2161507634fdb33583053168acfcb87754765652
Reviewed-on: https://gerrit.libreoffice.org/35784
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 | 38 |
1 files changed, 14 insertions, 24 deletions
diff --git a/starmath/source/parse.cxx b/starmath/source/parse.cxx index 3effa80d1ed4..d090cfecf93e 100644 --- a/starmath/source/parse.cxx +++ b/starmath/source/parse.cxx @@ -2073,33 +2073,23 @@ SmStructureNode *SmParser::DoStack() { std::unique_ptr<SmStructureNode> pSNode(new SmTableNode(m_aCurToken)); NextToken(); - if (m_aCurToken.eType == TLGROUP) + if (m_aCurToken.eType != TLGROUP) + return DoError(SmParseError::LgroupExpected); + SmNodeArray aExprArr; + do { - sal_uInt16 n = 0; - - do - { - NextToken(); - m_aNodeStack.emplace_front(DoAlign()); - n++; - } - while (m_aCurToken.eType == TPOUND); - - SmNodeArray ExpressionArray(n); - for (auto rIt = ExpressionArray.rbegin(), rEnd = ExpressionArray.rend(); rIt != rEnd; ++rIt) - { - *rIt = popOrZero(m_aNodeStack); - } - - if (m_aCurToken.eType != TRGROUP) - Error(SmParseError::RgroupExpected); - - pSNode->SetSubNodes(ExpressionArray); - NextToken(); - return pSNode.release(); + aExprArr.push_back(DoAlign()); } - return DoError(SmParseError::LgroupExpected); + while (m_aCurToken.eType == TPOUND); + + if (m_aCurToken.eType == TRGROUP) + NextToken(); + else + aExprArr.push_back(DoError(SmParseError::RgroupExpected)); + + pSNode->SetSubNodes(aExprArr); + return pSNode.release(); } SmStructureNode *SmParser::DoMatrix() |