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

Takeshi Abe tabe at fixedpoint.jp
Fri May 13 01:41:19 UTC 2016


 starmath/qa/cppunit/mock-visitor.hxx |    2 ++
 starmath/source/parse.cxx            |    6 +++---
 2 files changed, 5 insertions(+), 3 deletions(-)

New commits:
commit b43b79648f4fbcd815092268d1b7a5af9e278f52
Author: Takeshi Abe <tabe at fixedpoint.jp>
Date:   Thu May 12 12:41:09 2016 +0900

    starmath: SmMatrixNode should have the node TMATRIX
    
    ... rather than the one after its closing brace.
    So far having an arbitrary node is OK for SmMatrixNode
    because existing code does not refer to it, but it is
    saner to keep relevant nodes in the syntax tree.
    
    Change-Id: Ia5412454c996eedde1545cd8a2f323eb95593eb9
    Reviewed-on: https://gerrit.libreoffice.org/24909
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Takeshi Abe <tabe at fixedpoint.jp>

diff --git a/starmath/qa/cppunit/mock-visitor.hxx b/starmath/qa/cppunit/mock-visitor.hxx
index 63134ca..79e5784 100644
--- a/starmath/qa/cppunit/mock-visitor.hxx
+++ b/starmath/qa/cppunit/mock-visitor.hxx
@@ -94,6 +94,8 @@ public:
     void Visit( SmMatrixNode* pNode ) override {
         CPPUNIT_ASSERT_EQUAL_MESSAGE("SmMatrixNode should have type NMATRIX",
                                      NMATRIX, pNode->GetType());
+        CPPUNIT_ASSERT_EQUAL_MESSAGE("SmMatrixNode's token should be of type TMATRIX",
+                                     TMATRIX, pNode->GetToken().eType);
         VisitChildren( pNode );
     }
 
diff --git a/starmath/source/parse.cxx b/starmath/source/parse.cxx
index 8ff4ab4..7ccf442 100644
--- a/starmath/source/parse.cxx
+++ b/starmath/source/parse.cxx
@@ -2194,6 +2194,7 @@ void SmParser::DoStack()
 
 void SmParser::DoMatrix()
 {
+    std::unique_ptr<SmMatrixNode> pMNode(new SmMatrixNode(m_aCurToken));
     NextToken();
     if (m_aCurToken.eType == TLGROUP)
     {
@@ -2240,12 +2241,11 @@ void SmParser::DoMatrix()
         if (m_aCurToken.eType != TRGROUP)
             Error(PE_RGROUP_EXPECTED);
 
-        NextToken();
-
-        std::unique_ptr<SmMatrixNode> pMNode(new SmMatrixNode(m_aCurToken));
         pMNode->SetSubNodes(ExpressionArray);
         pMNode->SetRowCol(r, c);
         m_aNodeStack.push_front(std::move(pMNode));
+
+        NextToken();
     }
     else
         Error(PE_LGROUP_EXPECTED);


More information about the Libreoffice-commits mailing list