本文整理汇总了C#中Expression.Interpret方法的典型用法代码示例。如果您正苦于以下问题:C# Expression.Interpret方法的具体用法?C# Expression.Interpret怎么用?C# Expression.Interpret使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Expression
的用法示例。
在下文中一共展示了Expression.Interpret方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Handle
public override Value Handle(Expression left, Expression right, IDictionary<String, Value> symbols)
{
var l = left.Interpret(symbols);
var symbol = right as SymbolExpression;
var value = default(StringValue);
//Is it a Method Call?
if (symbol == null)
{
var contExp = right as ContainerExpression;
if (contExp != null)
{
if (contExp.Expressions != null && contExp.Expressions.Length == 1 && contExp.Expressions[0] is SymbolExpression)
{
symbol = contExp.Expressions[0] as SymbolExpression;
var op = contExp.Operator as ArgsOperator;
if (op != null)
{
return op.Handle(symbol, symbols, l);
}
//YAMPMemberFunctionMissingException
}
}
}
if (symbol != null)
{
value = new StringValue(symbol.SymbolName);
}
if (value == null)
throw new YAMPFunctionMissingException("()");
return Perform(l, value);
}
示例2: Handle
public override Value Handle(Expression expression, IDictionary<String, Value> symbols)
{
var a = PlusAssignmentOperator.CreateWithContext(Query);
var origin = expression.Interpret(symbols);
a.Handle(expression, new NumberExpression(ScalarValue.One), symbols);
return origin;
}
示例3: Handle
public override Value Handle(Expression left, Expression right, IDictionary<String, Value> symbols)
{
var l = left.Interpret(symbols);
var r = new StringValue(End) as Value;
var symbol = right as SymbolExpression;
if (symbol == null || !symbol.SymbolName.Equals(End))
{
r = right.Interpret(symbols);
}
return Perform(l, r);
}
示例4: Handle
public override Value Handle(Expression expression, IDictionary<String, Value> symbols)
{
var args = _content.Interpret(symbols);
var left = expression.Interpret(symbols);
if (left is IFunction)
{
return ((IFunction)left).Perform(Context, args);
}
if (expression is SymbolExpression)
{
throw new YAMPFunctionMissingException(((SymbolExpression)expression).SymbolName);
}
throw new YAMPExpressionNoFunctionException();
}
示例5: Handle
public override Value Handle(Expression value, IDictionary<String, Value> symbols)
{
var a = MinusAssignmentOperator.CreateWithContext(Query);
a.Handle(value, new NumberExpression(ScalarValue.One), symbols);
return value.Interpret(symbols);
}
示例6: Handle
/// <summary>
/// Handles the evaluation of two expressions.
/// </summary>
/// <param name="left">The expression on the left.</param>
/// <param name="right">The expression on the right.</param>
/// <param name="symbols">The external symbols to consider.</param>
/// <returns>The result of the operation.</returns>
public virtual Value Handle(Expression left, Expression right, IDictionary<String, Value> symbols)
{
var l = left.Interpret(symbols);
var r = right.Interpret(symbols);
return Perform(l, r);
}
示例7: Handle
/// <summary>
/// Handles the evaluation of one expression.
/// </summary>
/// <param name="expression">The expression on the left.</param>
/// <param name="symbols">The external symbols to consider.</param>
/// <returns>The result of the operation.</returns>
public virtual Value Handle(Expression expression, IDictionary<String, Value> symbols)
{
var value = expression.Interpret(symbols);
return Perform(value);
}
示例8: Handle
public override Value Handle(Expression left, Expression right, IDictionary<String, Value> symbols)
{
var bottom = right.Interpret(symbols);
return Assign(left, bottom, symbols);
}
示例9: SetPerform
void SetPerform(String name, String[] arguments, Expression body)
{
_perform = (context, argument) =>
{
var symbols = new Dictionary<String, Value>();
var av = new ArgumentsValue().Append(argument);
if (av.Length != arguments.Length)
{
throw new YAMPArgumentNumberException(name, av.Length, arguments.Length);
}
for (var i = 0; i < arguments.Length; i++)
{
symbols.Add(arguments[i], av.Values[i].Copy());
}
return body.Interpret(symbols);
};
}