diff options
author | Takeshi Abe <tabe@fixedpoint.jp> | 2016-05-12 12:41:09 +0900 |
---|---|---|
committer | Takeshi Abe <tabe@fixedpoint.jp> | 2016-05-13 01:40:50 +0000 |
commit | b43b79648f4fbcd815092268d1b7a5af9e278f52 (patch) | |
tree | 07c3b1d4a77b89363e4ab772bc39ed4b05bcbc45 /starmath | |
parent | db729f3b685fd832a3ec7387b339cf2bbeb4bd4d (diff) |
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@libreoffice.org>
Reviewed-by: Takeshi Abe <tabe@fixedpoint.jp>
Diffstat (limited to 'starmath')
-rw-r--r-- | starmath/qa/cppunit/mock-visitor.hxx | 2 | ||||
-rw-r--r-- | starmath/source/parse.cxx | 6 |
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); |