diff options
author | Takeshi Abe <tabe@fixedpoint.jp> | 2017-03-14 19:07:19 +0900 |
---|---|---|
committer | Takeshi Abe <tabe@fixedpoint.jp> | 2017-03-15 06:22:19 +0000 |
commit | 516a320ad496604296433f1471e2dd5434f4872d (patch) | |
tree | 841cf796ceb04df694790e2ac9fff5b68762a46f | |
parent | 821c3bdfb4c4e31867b63d05c72cb721354d060b (diff) |
starmath: Separate SmParser::DoError() from Error()
for incoming refactoring.
Change-Id: I74355dbd1d7a5822cbf67e828ddc31bd76be79f2
Reviewed-on: https://gerrit.libreoffice.org/35171
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Takeshi Abe <tabe@fixedpoint.jp>
-rw-r--r-- | starmath/inc/parse.hxx | 1 | ||||
-rw-r--r-- | starmath/source/parse.cxx | 19 |
2 files changed, 13 insertions, 7 deletions
diff --git a/starmath/inc/parse.hxx b/starmath/inc/parse.hxx index d4022137c2e9..afb4d9c5aa8f 100644 --- a/starmath/inc/parse.hxx +++ b/starmath/inc/parse.hxx @@ -90,6 +90,7 @@ class SmParser void DoMatrix(); void DoSpecial(); SmGlyphSpecialNode *DoGlyphSpecial(); + SmExpressionNode *DoError(SmParseError Error); // end of grammar void Error(SmParseError Error); diff --git a/starmath/source/parse.cxx b/starmath/source/parse.cxx index 3edefe77626b..8a8ca218226a 100644 --- a/starmath/source/parse.cxx +++ b/starmath/source/parse.cxx @@ -2255,20 +2255,25 @@ SmGlyphSpecialNode *SmParser::DoGlyphSpecial() return pNode.release(); } -void SmParser::Error(SmParseError eError) +SmExpressionNode *SmParser::DoError(SmParseError eError) { - SmStructureNode *pSNode = new SmExpressionNode(m_aCurToken); + auto pSNode = o3tl::make_unique<SmExpressionNode>(m_aCurToken); SmErrorNode *pErr = new SmErrorNode(m_aCurToken); pSNode->SetSubNodes(pErr, nullptr); + AddError(eError, pSNode.get()); + + NextToken(); + + return pSNode.release(); +} + +void SmParser::Error(SmParseError eError) +{ //! put a structure node on the stack (instead of the error node itself) //! because sometimes such a node is expected in order to attach some //! subnodes - m_aNodeStack.push_front(std::unique_ptr<SmStructureNode>(pSNode)); - - AddError(eError, pSNode); - - NextToken(); + m_aNodeStack.emplace_front(DoError(eError)); } |