本文整理汇总了C#中XSpect.Yacq.Symbols.SymbolTable.ResolveMatch方法的典型用法代码示例。如果您正苦于以下问题:C# SymbolTable.ResolveMatch方法的具体用法?C# SymbolTable.ResolveMatch怎么用?C# SymbolTable.ResolveMatch使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XSpect.Yacq.Symbols.SymbolTable
的用法示例。
在下文中一共展示了SymbolTable.ResolveMatch方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ReduceImpl
/// <summary>
/// Reduces this node to a simpler expression with additional symbol tables.
/// </summary>
/// <param name="symbols">The additional symbol table for reducing.</param>
/// <param name="expectedType">The type which is expected as the type of reduced expression.</param>
/// <returns>The reduced expression.</returns>
protected override Expression ReduceImpl(SymbolTable symbols, Type expectedType)
{
if (symbols.ResolveMatch(DispatchTypes.Member, this.Name) != null
|| symbols.Missing != DispatchExpression.DefaultMissing
)
{
return Variable(symbols, this.Name)
.ReduceOnce(symbols, expectedType)
.Let(e => (e as MacroExpression).Null(m => m.Evaluate(symbols)) ?? e);
}
else
{
throw new ParseException("Identifier evaluation failed: " + this, this);
}
}
示例2: ReduceImpl
/// <summary>
/// Reduces this node to a simpler expression with additional symbol tables.
/// </summary>
/// <param name="symbols">The additional symbol table for reducing.</param>
/// <param name="expectedType">The type which is expected as the type of reduced expression.</param>
/// <returns>The reduced expression.</returns>
protected override Expression ReduceImpl(SymbolTable symbols, Type expectedType)
{
Expression value = null;
if (this.Elements.IsEmpty())
{
return Empty();
}
if (!(this[0] is IdentifierExpression)
|| symbols.ResolveMatch(DispatchTypes.Member, this[0].Id()) != null
)
{
value = this[0].TryReduce(symbols);
if (value is MacroExpression)
{
return ((MacroExpression) value).Evaluate(symbols, this.Elements.Skip(1));
}
if (value != null && value.Type(symbols).GetDelegateSignature() != null)
{
return Invoke(value, this.Elements.Skip(1).ReduceAll(symbols));
}
if (value is TypeCandidateExpression)
{
return Dispatch(
symbols,
DispatchTypes.Constructor,
value,
null,
this.Elements.Skip(1)
);
}
}
if (this[0] is IdentifierExpression
&& symbols.ResolveMatch(DispatchTypes.Method, this[0].Id()) != null
|| symbols.Missing != DispatchExpression.DefaultMissing
)
{
return Function(
symbols,
this[0].Id(),
this.Elements.Skip(1)
);
}
if (value != null && this.Length == 1)
{
return value;
}
throw new ParseException("List evaluation failed: " + this, this);
}
示例3: ReduceImpl
// this._left and Candidate.Arguments is already reduced with symbols.
/// <summary>
/// Reduces this node to a simpler expression with additional symbol tables.
/// </summary>
/// <param name="symbols">The additional symbol table for reducing.</param>
/// <param name="expectedType">The type which is expected as the type of reduced expression.</param>
/// <returns>The reduced expression.</returns>
protected override Expression ReduceImpl(SymbolTable symbols, Type expectedType)
{
this._left = this.Left.Reduce(symbols);
return symbols.ResolveMatch(this)
.If(d => d == null, d => symbols.Missing)
(this, symbols, expectedType);
}