本文整理匯總了C#中PerCederberg.Grammatica.Runtime.Production.AddValue方法的典型用法代碼示例。如果您正苦於以下問題:C# Production.AddValue方法的具體用法?C# Production.AddValue怎麽用?C# Production.AddValue使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類PerCederberg.Grammatica.Runtime.Production
的用法示例。
在下文中一共展示了Production.AddValue方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: ExitPlayerNameAttribute
public override Node ExitPlayerNameAttribute(Production node)
{
var values = GetChildValues(node);
if(values.Count != 0)
node.AddValue(new PlayerName() { Value = (string)values[0] });
return node;
}
示例2: ExitExamples
public override Node ExitExamples(Production node)
{
var table = GetChildValues(node).Cast<Table>().Single();
node.AddValue(table);
return node;
}
示例3: ExitClassificationAttribute
public override Node ExitClassificationAttribute(Production node)
{
var values = GetChildValues(node);
if (values.Count != 0)
{
Classification value = (Classification)int.Parse((string)values[0]);
node.AddValue(value);
}
return node;
}
示例4: ExitBackground
public override Node ExitBackground(Production node)
{
var values = GetChildValues(node);
// First value is either title from header or first FeatureStep
var title = values[0] as string;
var featureIndex = title == null ? 0 : 1;
// Rest of values are FeatureSteps
var steps = values.GetRange(featureIndex, values.Count - featureIndex).Cast<Step>().ToList();
var background = new Background(steps)
{
Title = title,
LineNumber = node.StartLine
};
node.AddValue(background);
return node;
}
示例5: ExitPlayerNoteNode
public override Node ExitPlayerNoteNode(Production node)
{
var values = GetChildValues(node);
if (values.Count != 0)
{
IrfNote note = new IrfNote();
note.PlayerName = (PlayerName)values[0];
for (int i = 1; i < values.Count; i++)
{
object value = values[i];
if (value is NoteText)
note.NoteText = (NoteText)value;
else if (value is DateTime)
note.DateTime = (DateTime)value;
else if (value is Classification)
note.Classification = (Classification)value;
}
node.AddValue(note);
}
return node;
}
示例6: ExitUserNode
public override Node ExitUserNode(Production node)
{
var values = GetChildValues(node);
if (values.Count != 0)
{
IrfUserData userData = new IrfUserData();
userData.UserName = (string)values[0];
for (int i = 1; i < values.Count; i++)
userData.Add((IrfNote)values[i]);
node.AddValue(userData);
}
return node;
}
示例7: ExitTags
public override Node ExitTags(Production node)
{
var tags = GetChildValues(node).Cast<string>().ToArray();
node.AddValue(tags);
return node;
}
示例8: ExitFeature
public override Node ExitFeature(Production node)
{
var values = GetChildValues(node);
var tags = (IEnumerable<string>) null;
int summaryLinesIndex = 0;
if (values[0] is IEnumerable<string>)
{
tags = values[0] as IEnumerable<string>;
summaryLinesIndex++;
}
var summaryLines = values[summaryLinesIndex] as IList<LineValue>;
var background = values[summaryLinesIndex + 1] as Background;
var featureIndex = summaryLinesIndex + (background == null ? 1 : 2);
// Rest of values are FeatureItems
var items = values.GetRange(featureIndex, values.Count - featureIndex).Cast<FeatureItem>().ToList();
var feature = new Feature(summaryLines, background, items, tags)
{
// TODO: Should this get a value?
Description = ""
};
node.AddValue(feature);
return node;
}
示例9: ExitTimestampAttribute
public override Node ExitTimestampAttribute(Production node)
{
var values = GetChildValues(node);
if (values.Count != 0)
{
long seconds = long.Parse((string)values[0]);
node.AddValue(TimestampHelper.GetDateTime(seconds));
}
return node;
}
示例10: ExitBackgroundHeader
public override Node ExitBackgroundHeader(Production node)
{
node.AddValue(GetTitle(node));
return node;
}
示例11: ExitScenarioOutline
public override Node ExitScenarioOutline(Production node)
{
var values = GetChildValues(node);
// First value is title from header
var title = values[0] as string;
// Last value is example table
var examples = values[values.Count - 1] as Table;
// Rest of values are FeatureSteps
var steps = values.GetRange(1, values.Count - 2).Cast<Step>().ToList();
var scenarioOutline = new ScenarioOutline(steps, examples)
{
Title = title,
LineNumber = node.StartLine
};
node.AddValue(scenarioOutline);
return node;
}
示例12: ExitFeatureItem
public override Node ExitFeatureItem(Production node)
{
// Add tags to already constructed feature item
var values = GetChildValues(node);
var hasTags = values[0] is IEnumerable<string>;
var tags = hasTags ? GetChildValues(node).Cast<object>().Take(1).Cast<IEnumerable<string>>().Single() : null;
var featureItem = hasTags ?
GetChildValues(node).Cast<object>().Skip(1).Cast<FeatureItem>().Single() :
GetChildValues(node).Cast<FeatureItem>().Single();
featureItem.Tags = tags;
node.AddValue(featureItem);
return node;
}
示例13: ExitScenarioOutlineHeader
public override Node ExitScenarioOutlineHeader(Production node)
{
node.AddValue(GetTitle(node));
return node;
}
示例14: ExitStep
public override Node ExitStep(Production node)
{
var values = GetChildValues(node);
if (values.Count > 0)
{
var kindWord = (string) values[0];
CurrentStepKind = LookupStepKind(kindWord);
var stepBody = (string) values[1];
var table = (Table) null;
if (values.Count > 2)
table = (Table)values[3];
var step = new Step(table)
{
KindWord = kindWord,
Kind = CurrentStepKind,
Body = stepBody,
LineNumber = node.StartLine
};
node.AddValue(step);
}
return node;
}
示例15: ExitTableRow
public override Node ExitTableRow(Production node)
{
// Ignore whitespace and grab columms
var columns = GetChildValues(node).Cast<object>().Where(o => o is Cell).Cast<Cell>().ToList();
var row = new Row(columns);
node.AddValue(row);
return node;
}