コード例 #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();
 }
コード例 #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);
        }
コード例 #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);
        }
コード例 #4
0
 public override Value Evaluate(RumorScope scope)
 {
     return(l.Evaluate(scope).AsBoolean() && r.Evaluate(scope).AsBoolean());
 }
コード例 #5
0
 public override Value Evaluate(RumorScope scope)
 {
     return(l.Evaluate(scope).AsNumber() - r.Evaluate(scope).AsNumber());
 }
コード例 #6
0
        public override Value Evaluate(RumorScope scope)
        {
            var result = value.Evaluate(scope).InternalValue;

            return(new StringValue(result.ToString()));
        }
コード例 #7
0
 public override Value Evaluate(RumorScope scope)
 {
     return(new BooleanValue(
                l.Evaluate(scope).AsNumber() < r.Evaluate(scope).AsNumber()
                ));
 }
コード例 #8
0
 public override Value Evaluate(RumorScope scope)
 {
     return(new BooleanValue(l.Evaluate(scope) == r.Evaluate(scope)));
 }
コード例 #9
0
 public override Value Evaluate(RumorScope scope)
 {
     return(!expression.Evaluate(scope).AsBoolean());
 }
コード例 #10
0
 public override Value Evaluate(RumorScope scope)
 {
     return(new StringValue(value.Evaluate(scope).ToString()));
 }
コード例 #11
0
 public override Value Evaluate(RumorScope scope)
 {
     return(l.Evaluate(scope).AsString() + r.Evaluate(scope).AsString());
 }
コード例 #12
0
 public override Value Evaluate(RumorScope _)
 {
     return(Value);
 }
コード例 #13
0
 public abstract Value Evaluate(RumorScope scope);