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

New commits:
commit ab25d7cfec956b6c31551ee5c00bd6bcae4b0bb5
Author: Takeshi Abe <t...@fixedpoint.jp>
Date:   Thu May 19 12:32:40 2016 +0900

    starmath: Assign the proper token to SmTableNode
    
    ... for a similar motivation with b43b79648f4fbcd815092268d1b7a5af9e278f52.
    
    Change-Id: I9fc42fc8e34958295eeec5759c072c8259fc38b6
    Reviewed-on: https://gerrit.libreoffice.org/25122
    Tested-by: Jenkins <c...@libreoffice.org>
    Reviewed-by: Caolán McNamara <caol...@redhat.com>
    Tested-by: Caolán McNamara <caol...@redhat.com>

diff --git a/starmath/qa/cppunit/mock-visitor.hxx 
b/starmath/qa/cppunit/mock-visitor.hxx
index 79e5784..aa1639e 100644
--- a/starmath/qa/cppunit/mock-visitor.hxx
+++ b/starmath/qa/cppunit/mock-visitor.hxx
@@ -22,6 +22,9 @@ public:
     void Visit( SmTableNode* pNode ) override {
         CPPUNIT_ASSERT_EQUAL_MESSAGE("SmTableNode should have type NTABLE",
                                      NTABLE, pNode->GetType());
+        auto eTT = pNode->GetToken().eType;
+        CPPUNIT_ASSERT_MESSAGE("The type of SmTableNode's token should be 
either TEND, TBINOM, or TSTACK",
+                               eTT == TEND || eTT == TBINOM || eTT == TSTACK);
         VisitChildren( pNode );
     }
 
diff --git a/starmath/source/parse.cxx b/starmath/source/parse.cxx
index 1c88da9..591404a 100644
--- a/starmath/source/parse.cxx
+++ b/starmath/source/parse.cxx
@@ -2156,6 +2156,7 @@ void SmParser::DoBinom()
 
 void SmParser::DoStack()
 {
+    std::unique_ptr<SmStructureNode> pSNode(new SmTableNode(m_aCurToken));
     NextToken();
     if (m_aCurToken.eType == TLGROUP)
     {
@@ -2178,15 +2179,10 @@ void SmParser::DoStack()
         if (m_aCurToken.eType != TRGROUP)
             Error(PE_RGROUP_EXPECTED);
 
-        NextToken();
-
-        //We need to let the table node know it context
-        //it's used in SmNodeToTextVisitor
-        SmToken aTok = m_aCurToken;
-        aTok.eType = TSTACK;
-        std::unique_ptr<SmStructureNode> pSNode(new SmTableNode(aTok));
         pSNode->SetSubNodes(ExpressionArray);
         m_aNodeStack.push_front(std::move(pSNode));
+
+        NextToken();
     }
     else
         Error(PE_LGROUP_EXPECTED);
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to