diff options
author | Takeshi Abe <tabe@fixedpoint.jp> | 2016-05-19 12:32:40 +0900 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2016-05-19 14:50:06 +0000 |
commit | ab25d7cfec956b6c31551ee5c00bd6bcae4b0bb5 (patch) | |
tree | 20bf271e8733829d81052b3b4e82f90cab9c7b0b /starmath | |
parent | aea9c5ecdc17dbc15497afa4b6202f8af8a1a6d5 (diff) |
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 <ci@libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'starmath')
-rw-r--r-- | starmath/qa/cppunit/mock-visitor.hxx | 3 | ||||
-rw-r--r-- | starmath/source/parse.cxx | 10 |
2 files changed, 6 insertions, 7 deletions
diff --git a/starmath/qa/cppunit/mock-visitor.hxx b/starmath/qa/cppunit/mock-visitor.hxx index 79e578483c94..aa1639ee7519 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 1c88da91da36..591404af14a1 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); |