本文整理汇总了C#中CellProcessor.ParseTree方法的典型用法代码示例。如果您正苦于以下问题:C# CellProcessor.ParseTree方法的具体用法?C# CellProcessor.ParseTree怎么用?C# CellProcessor.ParseTree使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CellProcessor
的用法示例。
在下文中一共展示了CellProcessor.ParseTree方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Evaluate
public object Evaluate(DomainAdapter theFixture, CellProcessor processor) {
cells.ValueAt(0).SetAttribute(CellAttribute.Syntax, CellAttributeValue.SyntaxKeyword);
var cellCount = cells.Branches.Count;
if (cellCount < 2) throw MakeException("missing cells");
var identifier = cells.ValueAt(1).Text;
if (newIdentifier.Equals(identifier)) {
cells.ValueAt(1).SetAttribute(CellAttribute.Syntax, CellAttributeValue.SyntaxKeyword);
return new MethodPhrase(cells.Skip(1)).EvaluateNew(processor);
}
if (typeIdentifier.Equals(identifier)) {
cells.ValueAt(1).SetAttribute(CellAttribute.Syntax, CellAttributeValue.SyntaxKeyword);
if (cellCount < 3) throw MakeException("missing cells");
cells.ValueAt(2).SetAttribute(CellAttribute.Syntax, CellAttributeValue.SyntaxSUT);
return processor.ParseTree(typeof (Type), cells.Branches[2]).Value;
}
if (currentIdentifier.Equals(identifier)) {
cells.ValueAt(1).SetAttribute(CellAttribute.Syntax, CellAttributeValue.SyntaxKeyword);
return theFixture.SystemUnderTest;
}
var fixture = theFixture as FlowInterpreter;
if (fixture == null) throw MakeException("flow fixture required");
return processor.Get<Symbols>().HasValue(identifier)
? processor.Get<Symbols>().GetValue(identifier)
: fixture.ExecuteFlowRowMethod(processor, cells);
}
示例2: MakeNewFixture
static Interpreter MakeNewFixture(CellProcessor processor, Tree<Cell> firstRow) {
var fixture = processor.ParseTree<Cell, Interpreter>(firstRow.Skip(1));
if (firstRow.Branches.Count > 2) {
var adapter = fixture as MutableDomainAdapter;
if (adapter != null) {
var parent = processor.CallStack.DomainAdapter.GetValueAs<DomainAdapter>();
adapter.SetSystemUnderTest(new MethodPhrase(firstRow.Skip(2)).Evaluate(parent, processor));
}
}
return fixture;
}
示例3: ComputeRow
void ComputeRow(CellProcessor processor, Tree<Cell> row) {
var memberName = processor.ParseTree<Cell, MemberName>(headerRow.Branches.Last()).WithNamedParameters();
var parameterList = new List<Tree<Cell>>();
for (var i = 0; i < headerRow.Branches.Count - 1; i++) {
parameterList.Add(new CellTreeLeaf(new GracefulName(headerRow.ValueAt(i).Text).ToString()));
parameterList.Add(row.Branches[i]);
}
var result = processor.Invoke(processor.CallStack.DomainAdapter, memberName,
new EnumeratedTree<Cell>(parameterList));
processor.Check(result, row.Branches.Last());
}
示例4: ComputeRow
void ComputeRow(CellProcessor processor, Tree<Cell> row)
{
var memberName = MemberName.NamedParameterPrefix + processor.ParseTree<Cell, MemberName>(headerRow.Branches.Last());
var parameterList = new List<Tree<Cell>>();
for (var i = 0; i < headerRow.Branches.Count - 1; i++) {
parameterList.Add(new CellTreeLeaf(new GracefulName(headerRow.Branches[i].Value.Text).ToString()));
parameterList.Add(row.Branches[i]);
}
var result = processor.Invoke(new TypedValue(SystemUnderTest), memberName,
new EnumeratedTree<Cell>(parameterList));
new CellOperationImpl(processor).Check(result, row.Branches.Last());
}
示例5: InvokeSpecialAction
public static TypedValue InvokeSpecialAction(this Tree<Cell> row, CellProcessor processor, FlowInterpreter interpreter)
{
var specialActionName = processor.ParseTree<Cell, MemberName>(row.Branches[0]);
try {
var result = processor.Operate<InvokeSpecialOperator>(new TypedValue(interpreter), specialActionName, row);
if (result.IsValid) {
SetSyntaxKeyword(row);
}
return result;
}
catch (System.Exception) {
SetSyntaxKeyword(row);
throw;
}
}
示例6: Evaluate
public void Evaluate(CellProcessor processor, FlowInterpreter interpreter)
{
var specialActionName = processor.ParseTree<Cell, MemberName>(row.Branches[0]);
var result = processor.Operate<InvokeSpecialOperator>(new TypedValue(interpreter), specialActionName, row.Branches[0]);
if (result.IsValid) {
row.ValueAt(0).SetAttribute(CellAttribute.Syntax, CellAttributeValue.SyntaxKeyword);
return;
}
if (!result.IsValid) {
processor.Execute(interpreter,
interpreter.MethodRowSelector.SelectMethodCells(row),
interpreter.MethodRowSelector.SelectParameterCells(row),
row.ValueAt(0));
}
}
示例7: Interpret
public void Interpret(CellProcessor processor, Tree<Cell> table)
{
processor.TestStatus.TableCount--;
var name = processor.ParseTree<Cell, MemberName>(new EnumeratedTree<Cell>(table.Branches[0].Branches.Skip(1).Alternate()));
processor.Get<Procedures>().Save(name.ToString(), table);
}