本文整理汇总了C#中IParserContext.Set方法的典型用法代码示例。如果您正苦于以下问题:C# IParserContext.Set方法的具体用法?C# IParserContext.Set怎么用?C# IParserContext.Set使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IParserContext
的用法示例。
在下文中一共展示了IParserContext.Set方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Evaluate
public override ValueExpression Evaluate(IParserContext context)
{
ValueExpression valueRight = Right.Evaluate(context);
if (Left is VariableExpression)
{
if ((context.AssignmentPermissions & AssignmentPermissions.Variable) == AssignmentPermissions.None)
throw new IllegalAssignmentException("Assignment to variable not allowed", this);
VariableExpression varExpr = (VariableExpression)Left;
bool exists = context.Exists(varExpr.VarName);
if (exists && (context.AssignmentPermissions & AssignmentPermissions.ExistingVariable) == AssignmentPermissions.None)
throw new IllegalAssignmentException("Assignment to existing variable not allowed", this);
if (!exists && (context.AssignmentPermissions & AssignmentPermissions.NewVariable) == AssignmentPermissions.None)
throw new IllegalAssignmentException("Assignment to new variable not allowed", this);
context.Set(varExpr.VarName, valueRight.Value, valueRight.Type);
return valueRight;
}
if (Left is FieldExpression)
{
if ((context.AssignmentPermissions & AssignmentPermissions.Property) == AssignmentPermissions.None)
throw new IllegalAssignmentException("Assignment to property not allowed", this);
return ((FieldExpression)Left).Assign(context, valueRight.Value);
}
throw new IllegalAssignmentException(this);
}
示例2: FillContext
protected override void FillContext(IParserContext context)
{
context.Set("projectName", GetProjectName(Selection.SvnUri));
}
示例3: Evaluate
public override ValueExpression Evaluate(IParserContext context)
{
context.Set(Name,this);
return new FunctionValueExpression(TokenPosition,this);
}