summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--starmath/qa/cppunit/mock-visitor.hxx2
-rw-r--r--starmath/source/parse.cxx6
2 files changed, 5 insertions, 3 deletions
diff --git a/starmath/qa/cppunit/mock-visitor.hxx b/starmath/qa/cppunit/mock-visitor.hxx
index 63134cab648c..79e578483c94 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 8ff4ab4a62c0..7ccf4424167d 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);