summaryrefslogtreecommitdiff
path: root/starmath/source
diff options
context:
space:
mode:
authorTakeshi Abe <tabe@fixedpoint.jp>2017-03-14 19:07:19 +0900
committerTakeshi Abe <tabe@fixedpoint.jp>2017-03-15 06:22:19 +0000
commit516a320ad496604296433f1471e2dd5434f4872d (patch)
tree841cf796ceb04df694790e2ac9fff5b68762a46f /starmath/source
parent821c3bdfb4c4e31867b63d05c72cb721354d060b (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>
Diffstat (limited to 'starmath/source')
-rw-r--r--starmath/source/parse.cxx19
1 files changed, 12 insertions, 7 deletions
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));
}