Beispiel #1
0
 public Value.IValue BinaryOperator(Value.IValue operand1, string op, Value.IValue operand2)
 {
     if (op == "==")
     {
         return(ValueFactory.make(operand1.Get <IType>().Check(operand2.Get <IType>())));
     }
     else if (op == "()")
     {
         var type = operand1.Get <IType>();
         return(new Value.Value(type, operand2));
     }
     throw new NotImplementedException();
 }
Beispiel #2
0
        public Value.IValue BinaryOperator(Value.IValue operand1, string op, Value.IValue operand2)
        {
            if (op == "[]")
            {
                var str   = operand1.Get <string>();
                var index = operand2.Get <int>();
                if (index < 0)
                {
                    index = str.Length + index;
                }
                return(ValueFactory.make(str[index].ToString()));
            }

            throw new InvalidOperationException();
        }
Beispiel #3
0
        public Value.IValue BinaryOperator(Value.IValue operand1, string op, Value.IValue operand2)
        {
            switch (op)
            {
            case "+": {
                var str1 = operand1.Get <string>();
                var str2 = operand2.Get <string>();
                return(ValueFactory.make(str1 + str2));
            }

            case "==": {
                var str1 = operand1.Get <string>();
                var str2 = operand2.Get <string>();
                return(ValueFactory.make(str1.Equals(str2)));
            }
            }
            throw new InvalidOperationException();
        }
Beispiel #4
0
 public Value.IValue UnaryOperator(Value.IValue operand1, string op)
 {
     throw new NotImplementedException();
 }
Beispiel #5
0
 public Value.IValue UnaryOperator(Value.IValue operand1, string op)
 {
     throw new InvalidOperationException();
 }