[Libreoffice-commits] core.git: starmath/source

Takeshi Abe tabe at fixedpoint.jp
Tue Mar 28 04:13:24 UTC 2017


 starmath/source/parse.cxx |   38 ++++++++++++++------------------------
 1 file changed, 14 insertions(+), 24 deletions(-)

New commits:
commit 98b4bea591cdca48871db25c3be9e48600f45439
Author: Takeshi Abe <tabe at fixedpoint.jp>
Date:   Sat Mar 25 13:50:55 2017 +0900

    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 at libreoffice.org>
    Reviewed-by: Takeshi Abe <tabe at fixedpoint.jp>

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()


More information about the Libreoffice-commits mailing list