[muParser] Remove ecINTERNAL_ERROR

Internal errors should not be represented as exceptions, but
instead as assertion failures.
This commit is contained in:
ridiculousfish
2017-11-16 12:46:01 -08:00
parent edcf9ebc12
commit 483930946b
7 changed files with 20 additions and 26 deletions

View File

@@ -244,7 +244,7 @@ namespace mu
void SetIdx(int a_iIdx)
{
if (m_iCode!=cmSTRING || a_iIdx<0)
throw ParserError(ecINTERNAL_ERROR);
assert(0 && "muParser internal error");
m_iIdx = a_iIdx;
}
@@ -260,7 +260,7 @@ namespace mu
int GetIdx() const
{
if (m_iIdx<0 || m_iCode!=cmSTRING )
throw ParserError(ecINTERNAL_ERROR);
assert(0 && "muParser internal error");
return m_iIdx;
}
@@ -300,10 +300,10 @@ namespace mu
int GetPri() const
{
if ( !m_pCallback.get())
throw ParserError(ecINTERNAL_ERROR);
assert(0 && "muParser internal error");
if ( m_pCallback->GetCode()!=cmOPRT_BIN && m_pCallback->GetCode()!=cmOPRT_INFIX)
throw ParserError(ecINTERNAL_ERROR);
assert(0 && "muParser internal error");
return m_pCallback->GetPri();
}
@@ -312,7 +312,7 @@ namespace mu
EOprtAssociativity GetAssociativity() const
{
if (m_pCallback.get()==NULL || m_pCallback->GetCode()!=cmOPRT_BIN)
throw ParserError(ecINTERNAL_ERROR);
assert(0 && "muParser internal error");
return m_pCallback->GetAssociativity();
}
@@ -362,7 +362,7 @@ namespace mu
TBase* GetVar() const
{
if (m_iCode!=cmVAR)
throw ParserError(ecINTERNAL_ERROR);
assert(0 && "muParser internal error");
return (TBase*)m_pTok;
}
@@ -377,7 +377,7 @@ namespace mu
assert(m_pCallback.get());
if (!m_pCallback->GetAddr())
throw ParserError(ecINTERNAL_ERROR);
assert(0 && "muParser internal error");
return m_pCallback->GetArgc();
}