Exemple #1
0
        private static bool HandleOperators(string opcodeStr, MetaMidRepresentationOperationFactory operationFactory)
        {
            #region Operators

            if (opcodeStr == OpcodeOperatorNames.Add)
            {
                operationFactory.Add();
                return(true);
            }
            if (opcodeStr == OpcodeOperatorNames.Sub)
            {
                operationFactory.Sub();
                return(true);
            }
            if (opcodeStr == OpcodeOperatorNames.Div)
            {
                operationFactory.Div();
                return(true);
            }
            if (opcodeStr == OpcodeOperatorNames.Mul)
            {
                operationFactory.Mul();
                return(true);
            }
            if (opcodeStr == OpcodeOperatorNames.Rem)
            {
                operationFactory.Rem();
                return(true);
            }


            if (opcodeStr == OpcodeOperatorNames.And)
            {
                operationFactory.And();
                return(true);
            }
            if (opcodeStr == OpcodeOperatorNames.Or)
            {
                operationFactory.Or();
                return(true);
            }

            if (opcodeStr == OpcodeOperatorNames.Xor)
            {
                operationFactory.Xor();
                return(true);
            }

            #region Unary operators

            if (opcodeStr == OpcodeOperatorNames.Not)
            {
                operationFactory.Not();
                return(true);
            }

            if (opcodeStr == OpcodeOperatorNames.Neg)
            {
                operationFactory.Neg();
                return(true);
            }

            #endregion

            #region Compare operators

            if (opcodeStr == "cgt")
            {
                operationFactory.Cgt();
                return(true);
            }

            if (opcodeStr == "ceq")
            {
                operationFactory.Ceq();
                return(true);
            }
            if (opcodeStr == "clt")
            {
                operationFactory.Clt();
                return(true);
            }

            #endregion

            #endregion

            return(false);
        }