Exemplo n.º 1
0
 public Rumor(Dictionary <string, List <Node> > nodes, RumorScope scope = null)
 {
     // Make a copy so our version does not change
     Nodes    = new Dictionary <string, List <Node> >(nodes);
     Stack    = new Stack <StackFrame>();
     State    = new RumorState();
     Scope    = scope ?? new RumorScope();
     Bindings = new RumorBindings();
 }
Exemplo n.º 2
0
        public override Value Evaluate(RumorScope scope)
        {
            var value = scope.Get(name);

            if (value == null)
            {
                throw new UndefinedVariableException(
                          "Variable \"" + name + "\" has not been defined yet!"
                          );
            }

            return(value);
        }
Exemplo n.º 3
0
        public override Value Evaluate(RumorScope scope)
        {
            var value = scope.Get(name);

            if (value == null)
            {
                throw new UndefinedVariableException(
                          "Variable \"" + name + "\" has not been defined yet!"
                          );
            }
            if (!(value is NumberValue))
            {
                throw new VariableTypeException(
                          "Variable is not a number!"
                          );
            }

            return((NumberValue)value);
        }
Exemplo n.º 4
0
 public override Value Evaluate(RumorScope scope)
 {
     return(l.Evaluate(scope).AsBoolean() && r.Evaluate(scope).AsBoolean());
 }
 public override Value Evaluate(RumorScope scope)
 {
     return(l.Evaluate(scope).AsNumber() - r.Evaluate(scope).AsNumber());
 }
        public override Value Evaluate(RumorScope scope)
        {
            var result = value.Evaluate(scope).InternalValue;

            return(new StringValue(result.ToString()));
        }
 public override Value Evaluate(RumorScope scope)
 {
     return(new BooleanValue(
                l.Evaluate(scope).AsNumber() < r.Evaluate(scope).AsNumber()
                ));
 }
Exemplo n.º 8
0
 public override Value Evaluate(RumorScope scope)
 {
     return(new BooleanValue(l.Evaluate(scope) == r.Evaluate(scope)));
 }
Exemplo n.º 9
0
 public override Value Evaluate(RumorScope scope)
 {
     return(!expression.Evaluate(scope).AsBoolean());
 }
 public override Value Evaluate(RumorScope scope)
 {
     return(new StringValue(value.Evaluate(scope).ToString()));
 }
Exemplo n.º 11
0
 public override Value Evaluate(RumorScope scope)
 {
     return(l.Evaluate(scope).AsString() + r.Evaluate(scope).AsString());
 }
Exemplo n.º 12
0
 public override Value Evaluate(RumorScope _)
 {
     return(Value);
 }
Exemplo n.º 13
0
 public abstract Value Evaluate(RumorScope scope);