starmath/inc/parse.hxx    |    1 +
 starmath/source/parse.cxx |   19 ++++++++++++-------
 2 files changed, 13 insertions(+), 7 deletions(-)

New commits:
commit 516a320ad496604296433f1471e2dd5434f4872d
Author: Takeshi Abe <t...@fixedpoint.jp>
Date:   Tue Mar 14 19:07:19 2017 +0900

    starmath: Separate SmParser::DoError() from Error()
    
    for incoming refactoring.
    
    Change-Id: I74355dbd1d7a5822cbf67e828ddc31bd76be79f2
    Reviewed-on: https://gerrit.libreoffice.org/35171
    Tested-by: Jenkins <c...@libreoffice.org>
    Reviewed-by: Takeshi Abe <t...@fixedpoint.jp>

diff --git a/starmath/inc/parse.hxx b/starmath/inc/parse.hxx
index d402213..afb4d9c 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 3edefe7..8a8ca21 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));
 }
 
 
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to