[Libreoffice-commits] core.git: starmath/source
Takeshi Abe
tabe at fixedpoint.jp
Thu Jun 16 03:11:13 UTC 2016
starmath/source/parse.cxx | 41 ++++++++++++++++++++---------------------
1 file changed, 20 insertions(+), 21 deletions(-)
New commits:
commit fca1c92a2b79480f7842a90698115ae862442df9
Author: Takeshi Abe <tabe at fixedpoint.jp>
Date: Wed Jun 15 20:32:44 2016 +0900
starmath: more assertions hold
Change-Id: I9a7fb2f4d45c5b34c0ea1d186dd90353fedc8a6d
Reviewed-on: https://gerrit.libreoffice.org/26299
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Takeshi Abe <tabe at fixedpoint.jp>
diff --git a/starmath/source/parse.cxx b/starmath/source/parse.cxx
index 26f6f45..647426b 100644
--- a/starmath/source/parse.cxx
+++ b/starmath/source/parse.cxx
@@ -30,6 +30,7 @@
#include "smdll.hxx"
#include "smmod.hxx"
#include "cfgitem.hxx"
+#include <cassert>
#include <stack>
using namespace ::com::sun::star::i18n;
@@ -1573,23 +1574,22 @@ void SmParser::DoEscape()
void SmParser::DoOperator()
{
- if (TokenInGroup(TG::Oper))
- {
- std::unique_ptr<SmStructureNode> pSNode(new SmOperNode(m_aCurToken));
+ assert(TokenInGroup(TG::Oper));
- // put operator on top of stack
- DoOper();
+ std::unique_ptr<SmStructureNode> pSNode(new SmOperNode(m_aCurToken));
- if (TokenInGroup(TG::Limit) || TokenInGroup(TG::Power))
- DoSubSup(m_aCurToken.nGroup);
- SmNode *pOperator = popOrZero(m_aNodeStack);
+ // put operator on top of stack
+ DoOper();
- // get argument
- DoPower();
+ if (TokenInGroup(TG::Limit) || TokenInGroup(TG::Power))
+ DoSubSup(m_aCurToken.nGroup);
+ SmNode *pOperator = popOrZero(m_aNodeStack);
- pSNode->SetSubNodes(pOperator, popOrZero(m_aNodeStack));
- m_aNodeStack.push_front(std::move(pSNode));
- }
+ // get argument
+ DoPower();
+
+ pSNode->SetSubNodes(pOperator, popOrZero(m_aNodeStack));
+ m_aNodeStack.push_front(std::move(pSNode));
}
void SmParser::DoOper()
@@ -1647,7 +1647,7 @@ void SmParser::DoOper()
void SmParser::DoUnOper()
{
- OSL_ENSURE(TokenInGroup(TG::UnOper), "Sm: wrong token");
+ assert(TokenInGroup(TG::UnOper));
SmToken aNodeToken = m_aCurToken;
SmTokenType eType = m_aCurToken.eType;
@@ -1747,7 +1747,7 @@ void SmParser::DoUnOper()
void SmParser::DoAttribut()
{
- OSL_ENSURE(TokenInGroup(TG::Attribute), "Sm: wrong token group");
+ assert(TokenInGroup(TG::Attribute));
std::unique_ptr<SmStructureNode> pSNode(new SmAttributNode(m_aCurToken));
SmNode *pAttr;
@@ -1783,7 +1783,7 @@ void SmParser::DoAttribut()
void SmParser::DoFontAttribut()
{
- OSL_ENSURE(TokenInGroup(TG::FontAttr), "Sm: wrong token group");
+ assert(TokenInGroup(TG::FontAttr));
switch (m_aCurToken.eType)
{
@@ -1815,7 +1815,7 @@ void SmParser::DoFontAttribut()
void SmParser::DoColor()
{
- OSL_ENSURE(m_aCurToken.eType == TCOLOR, "Sm : Ooops...");
+ assert(m_aCurToken.eType == TCOLOR);
// last color rules, get that one
SmToken aToken;
@@ -1835,7 +1835,7 @@ void SmParser::DoColor()
void SmParser::DoFont()
{
- OSL_ENSURE(m_aCurToken.eType == TFONT, "Sm : Ooops...");
+ assert(m_aCurToken.eType == TFONT);
// last font rules, get that one
SmToken aToken;
@@ -1878,7 +1878,7 @@ static bool lcl_IsNumber(const OUString& rText)
void SmParser::DoFontSize()
{
- OSL_ENSURE(m_aCurToken.eType == TSIZE, "Sm : Ooops...");
+ assert(m_aCurToken.eType == TSIZE);
FontSizeType Type;
std::unique_ptr<SmFontNode> pFontNode(new SmFontNode(m_aCurToken));
@@ -1944,8 +1944,7 @@ void SmParser::DoFontSize()
void SmParser::DoBrace()
{
- OSL_ENSURE(m_aCurToken.eType == TLEFT || TokenInGroup(TG::LBrace),
- "Sm: kein Klammer Ausdruck");
+ assert(m_aCurToken.eType == TLEFT || TokenInGroup(TG::LBrace));
std::unique_ptr<SmStructureNode> pSNode(new SmBraceNode(m_aCurToken));
SmNode *pBody = nullptr,
More information about the Libreoffice-commits
mailing list