Example #1
0
        public override string EvalExpression(MoccaExpression codeBase)
        {
            if (codeBase.atom_evaluation != null)
            {
                return(codeBase.atom_evaluation);
            }
            string comparer = "?";

            switch (codeBase.logic_op)
            {
            case "EQUAL":
                comparer = "==";
                break;

            case "NOT_EQUAL":
                comparer = "!=";
                break;

            case "LEFT_BIG":
                comparer = ">";
                break;

            case "LEFT_BIG_EQUAL":
                comparer = ">=";
                break;

            case "RIGHT_BIG":
                comparer = "<";
                break;

            case "RIGHT_BIG_EQUAL":
                comparer = "<=";
                break;

            case "AND":
                comparer = "&&";
                break;

            case "OR":
                comparer = "||";
                break;
            }

            return(codeBase.a.ToString() + " " + comparer + " " + codeBase.b.ToString());
        }
Example #2
0
 public abstract string EvalExpression(MoccaExpression codeBase);