Kaydet (Commit) 51de452e authored tarafından Takeshi Abe's avatar Takeshi Abe

starmath: Kill newly unused m_aNodeStack

which now has been replaced naturally with the call stack
of SmParser functions.

Change-Id: I970a350aae6927c6d13ed4917aa29bce3888a3fe
Reviewed-on: https://gerrit.libreoffice.org/36136Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarTakeshi Abe <tabe@fixedpoint.jp>
üst e1b31fbe
......@@ -33,7 +33,6 @@ class SmParser
{
OUString m_aBufferString;
SmToken m_aCurToken;
SmNodeStack m_aNodeStack;
std::vector<std::unique_ptr<SmErrorDesc>> m_aErrDescList;
int m_nCurError;
sal_Int32 m_nBufferIndex,
......@@ -62,7 +61,7 @@ class SmParser
// grammar
SmTableNode *DoTable();
void DoLine();
SmLineNode *DoLine();
SmNode *DoExpression(bool bUseExtraSpaces = true);
SmNode *DoRelation();
SmNode *DoSum();
......@@ -93,8 +92,6 @@ class SmParser
SmExpressionNode *DoError(SmParseError Error);
// end of grammar
void Error(SmParseError Error);
public:
SmParser();
......
......@@ -942,24 +942,19 @@ void SmParser::NextToken()
SmTableNode *SmParser::DoTable()
{
DoLine();
SmNodeArray aLineArray;
aLineArray.push_back(DoLine());
while (m_aCurToken.eType == TNEWLINE)
{
NextToken();
DoLine();
aLineArray.push_back(DoLine());
}
if (m_aCurToken.eType != TEND)
Error(SmParseError::UnexpectedChar);
SmNodeArray LineArray(m_aNodeStack.size());
for (auto rIt = LineArray.rbegin(), rEnd = LineArray.rend(); rIt != rEnd; ++rIt)
{
*rIt = popOrZero(m_aNodeStack);
}
aLineArray.push_back(DoError(SmParseError::UnexpectedChar));
std::unique_ptr<SmTableNode> pSNode(new SmTableNode(m_aCurToken));
pSNode->SetSubNodes(LineArray);
pSNode->SetSubNodes(aLineArray);
return pSNode.release();
}
......@@ -989,7 +984,7 @@ SmNode *SmParser::DoAlign(bool bUseExtraSpaces)
return pNode.release();
}
void SmParser::DoLine()
SmLineNode *SmParser::DoLine()
{
SmNodeArray ExpressionArray;
......@@ -1012,9 +1007,9 @@ void SmParser::DoLine()
ExpressionArray.push_back(new SmExpressionNode(aTok));
}
std::unique_ptr<SmStructureNode> pSNode(new SmLineNode(m_aCurToken));
auto pSNode = o3tl::make_unique<SmLineNode>(m_aCurToken);
pSNode->SetSubNodes(ExpressionArray);
m_aNodeStack.push_front(std::move(pSNode));
return pSNode.release();
}
SmNode *SmParser::DoExpression(bool bUseExtraSpaces)
......@@ -2170,15 +2165,6 @@ SmExpressionNode *SmParser::DoError(SmParseError eError)
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.emplace_front(DoError(eError));
}
// end grammar
......@@ -2208,8 +2194,6 @@ SmTableNode *SmParser::Parse(const OUString &rBuffer)
m_aErrDescList.clear();
m_aNodeStack.clear();
NextToken();
return DoTable();
}
......@@ -2225,8 +2209,6 @@ SmNode *SmParser::ParseExpression(const OUString &rBuffer)
m_aErrDescList.clear();
m_aNodeStack.clear();
NextToken();
return DoExpression();
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment