本文整理汇总了C#中ExpressionVisitor类的典型用法代码示例。如果您正苦于以下问题:C# ExpressionVisitor类的具体用法?C# ExpressionVisitor怎么用?C# ExpressionVisitor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ExpressionVisitor类属于命名空间,在下文中一共展示了ExpressionVisitor类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ClientQueryProvider
/// <summary>
/// Initializes a new instance of the <see cref="Artefacts.Service.ClientQueryProvider`1"/> class.
/// </summary>
/// <param name="repository">Repository.</param>
/// <param name="visitor">Visitor.</param>
public ClientQueryProvider(IRepository repository, ExpressionVisitor visitor = null)
{
if (repository == null)
throw new ArgumentNullException("repository");
Repository = repository;
_clientProxy = new RepositoryClientProxy(new NetTcpBinding(SecurityMode.None), "net.tcp://localhost:3334/ArtefactRepository");
}
示例2: BuildParameters
public static Dictionary<string, FNode> BuildParameters(ExpressionVisitor Evaluator, HScriptParser.Bind_element_setContext context)
{
Dictionary<string, FNode> parameters = new Dictionary<string, FNode>();
if (context == null)
return parameters;
foreach (HScriptParser.Bind_elementContext ctx in context.bind_element())
{
string key = ctx.SCALAR().GetText();
bool is_dynamic =
(ctx.K_STATIC() == null)
? true
: false;
FNode value =
(is_dynamic)
? Evaluator.ToNode(ctx.expression())
: new FNodeValue(null, new Cell(ctx.expression().GetText(), false));
parameters.Add(key, value);
}
return parameters;
}
示例3: ParseTokens
private static Expression ParseTokens(CommonTokenStream input)
{
ExpressionParser.ExpressionContext startContext = new ExpressionParser(input).expression();
ExpressionVisitor visit = new ExpressionVisitor();
Expression expr = visit.Visit(startContext);
return expr;
}
示例4: RenderStagedReadPlan
// Reads //
public static StagedReadName RenderStagedReadPlan(Workspace Home, HScriptParser.Crudam_readContext context)
{
// Get the data source //
DataSet data = VisitorHelper.GetData(Home, context.full_table_name());
string alias =
(context.K_AS() != null)
? context.IDENTIFIER().GetText()
: data.Name;
// Create a local heap to work off of //
MemoryStruct local_heap = new MemoryStruct(true);
// Create a record register //
StreamRegister memory = new StreamRegister(null);
// Create expression visitor //
ExpressionVisitor exp_vis = new ExpressionVisitor(local_heap, Home, alias, data.Columns, memory);
// Where clause //
Predicate where = VisitorHelper.GetWhere(exp_vis, context.where_clause());
// Create a reader //
RecordReader reader = data.OpenReader(where);
// Attach the reader to the register //
memory.BaseStream = reader;
// Create the action visitor //
ActionVisitor act_vis = new ActionVisitor(Home, local_heap, exp_vis);
// Get the declarations //
if (context.crudam_declare_many() != null)
{
VisitorHelper.AllocateMemory(Home, local_heap, exp_vis, context.crudam_declare_many());
}
// Get the initial actionset //
TNode pre_run =
(context.init_action() != null)
? act_vis.ToNode(context.init_action().query_action())
: new TNodeNothing(null);
// Get the main actionset //
TNode run = act_vis.ToNode(context.main_action().query_action());
// Get the final actionset //
TNode post_run =
(context.final_action() != null)
? act_vis.ToNode(context.final_action().query_action())
: new TNodeNothing(null);
return new StagedReadName(reader, pre_run, run, post_run);
}
示例5: Accept
public override Expression Accept(ExpressionVisitor visitor)
{
return visitor.VisitParameter(this);
}
示例6: Accept
/// <summary>
/// Dispatches to the specific visit method for this node type.
/// </summary>
protected internal override Expression Accept(ExpressionVisitor visitor) {
return visitor.VisitMethodCall(this);
}
示例7: Visit
public override void Visit(ExpressionVisitor visitor)
{
visitor.Visit(this);
}
示例8: Accept
/// <summary>
/// Dispatches to the specific visit method for this node type.
/// </summary>
protected internal override Expression Accept(ExpressionVisitor visitor) {
return visitor.VisitNewArray(this);
}
示例9: OnAfterCall
public override void OnAfterCall(Identifier stackReg, ProcedureSignature sigCallee, ExpressionVisitor<Expression> eval)
{
throw new NotImplementedException();
}
示例10: GetPartitions
// Partitions //
public static int GetPartitions(ExpressionVisitor Evaluator, HScriptParser.PartitionsContext context)
{
// Null then assume 1 partition //
if (context == null)
return 1;
// If the expression is null, then max out cores //
if (context.expression() == null)
return Environment.ProcessorCount;
// Otherwise, get the value //
int cnt = (int)Evaluator.ToNode(context.expression()).Evaluate().valueINT;
// Bound it //
cnt = Math.Min(cnt, Environment.ProcessorCount * 2);
cnt = Math.Max(cnt, 1);
return cnt;
}
示例11: AllocateMemory
public static void AllocateMemory(Workspace Home, MemoryStruct Heap, ExpressionVisitor Evaluator, HScriptParser.DeclareMatrixLiteralContext context)
{
string name = context.IDENTIFIER().GetText();
CellAffinity type = GetAffinity(context.type());
MatrixVisitor vis = new MatrixVisitor(Home, Heap, Evaluator);
CellMatrix mat = vis.ToMatrix(context.matrix_expression()).Evaluate();
Heap.Arrays.Reallocate(name, mat);
}
示例12: OnAfterCall
public override void OnAfterCall(Identifier sp, ProcedureSignature sigCallee, ExpressionVisitor<Expression> eval)
{
}
示例13: Accept
/// <summary>
/// Dispatches to the specific visit method for this node type.
/// </summary>
protected internal override Expression Accept(ExpressionVisitor visitor) {
return visitor.VisitInvocation(this);
}
示例14: AppendSet
private static void AppendSet(ExpressionVisitor Evaluator, FNodeSet Fields, HScriptParser.Expression_or_wildcardContext context)
{
if (context is HScriptParser.EOW_expressionContext)
{
AppendSet(Evaluator, Fields, context as HScriptParser.EOW_expressionContext);
return;
}
if (context is HScriptParser.EOW_local_starContext)
{
AppendSet(Evaluator, Fields, context as HScriptParser.EOW_local_starContext);
return;
}
if (context is HScriptParser.EOW_global_starContext)
{
AppendSet(Evaluator, Fields, context as HScriptParser.EOW_global_starContext);
return;
}
if (context is HScriptParser.EOW_table_starContext)
{
AppendSet(Evaluator, Fields, context as HScriptParser.EOW_table_starContext);
return;
}
if (context is HScriptParser.EOW_tables_starContext)
{
AppendSet(Evaluator, Fields, context as HScriptParser.EOW_tables_starContext);
return;
}
}
示例15: GetReturnStatement
public static FNodeSet GetReturnStatement(ExpressionVisitor Evaluator, HScriptParser.Expression_or_wildcard_setContext context)
{
FNodeSet nodes = new FNodeSet();
foreach (HScriptParser.Expression_or_wildcardContext ctx in context.expression_or_wildcard())
AppendSet(Evaluator, nodes, ctx);
return nodes;
}