Refactoring. Delete repetitive code.

--HG--
branch : feature
This commit is contained in:
dismine 2014-06-18 16:07:12 +03:00
parent ec44c57c34
commit 95422546b6

View File

@ -932,58 +932,26 @@ void QmuParserBase::ApplyRemainingOprt(QStack<token_type> &stOpt, QStack<token_t
while (stOpt.size() && stOpt.top().GetCode() != cmBO && stOpt.top().GetCode() != cmIF) while (stOpt.size() && stOpt.top().GetCode() != cmBO && stOpt.top().GetCode() != cmIF)
{ {
token_type tok = stOpt.top(); token_type tok = stOpt.top();
switch (tok.GetCode()) const ECmdCode code = tok.GetCode();
if ((code >= cmLE && code <= cmASSIGN) || code == cmOPRT_INFIX || code == cmOPRT_BIN)
{ {
case cmOPRT_INFIX: if (stOpt.top().GetCode()==cmOPRT_INFIX)
case cmOPRT_BIN: {
case cmLE: ApplyFunc(stOpt, stVal, 1);
case cmGE: }
case cmNEQ: else
case cmEQ: {
case cmLT: ApplyBinOprt(stOpt, stVal);
case cmGT: }
case cmADD: }
case cmSUB: else if (code == cmELSE)
case cmMUL: {
case cmDIV: ApplyIfElse(stOpt, stVal);
case cmPOW: }
case cmLAND: else
case cmLOR: {
case cmASSIGN: Error(ecINTERNAL_ERROR);
if (stOpt.top().GetCode()==cmOPRT_INFIX)
{
ApplyFunc(stOpt, stVal, 1);
}
else
{
ApplyBinOprt(stOpt, stVal);
}
break;
case cmELSE:
ApplyIfElse(stOpt, stVal);
break;
case cmBO:
case cmBC:
case cmIF:
case cmENDIF:
case cmARG_SEP:
case cmVAR:
case cmVAL:
case cmVARPOW2:
case cmVARPOW3:
case cmVARPOW4:
case cmVARMUL:
case cmPOW2:
case cmFUNC:
case cmFUNC_STR:
case cmFUNC_BULK:
case cmSTRING:
case cmOPRT_POSTFIX:
case cmEND:
case cmUNKNOWN:
default:
Error(ecINTERNAL_ERROR);
break;
} }
} }
} }