summaryrefslogtreecommitdiff
path: root/starmath
diff options
context:
space:
mode:
Diffstat (limited to 'starmath')
-rw-r--r--starmath/qa/cppunit/mock-visitor.hxx3
-rw-r--r--starmath/source/parse.cxx10
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);