public override Node ExitPlayerNameAttribute(Production node) { var values = GetChildValues(node); if(values.Count != 0) node.AddValue(new PlayerName() { Value = (string)values[0] }); return node; }
public override Node ExitExamples(Production node) { var table = GetChildValues(node).Cast<Table>().Single(); node.AddValue(table); return node; }
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; }
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; }
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; }
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; }
public override Node ExitTags(Production node) { var tags = GetChildValues(node).Cast<string>().ToArray(); node.AddValue(tags); return node; }
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; }
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; }
public override Node ExitBackgroundHeader(Production node) { node.AddValue(GetTitle(node)); return node; }
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; }
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; }
public override Node ExitScenarioOutlineHeader(Production node) { node.AddValue(GetTitle(node)); return node; }
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; }
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; }
public override Node ExitTableColumn(Production node) { var cell = GetChildValues(node).Cast<string>().Single().Trim(); var column = new Cell(cell); node.AddValue(column); return node; }
public override Node ExitTable(Production node) { var rows = GetChildValues(node).Cast<Row>().ToList(); var table = new Table(rows); node.AddValue(table); return node; }
public override Node ExitSummaryLine(Production node) { var text = GetChildValues(node).Cast<string>().SingleOrDefault(); if (!string.IsNullOrEmpty(text)) { var lineValue = new LineValue { Text = text.Trim(), LineNumber = node.StartLine }; node.AddValue(lineValue); } return node; }
public override Node ExitText(Production node) { var text = string.Concat(GetChildValues(node).Cast<string>().ToArray()); node.AddValue(text.Trim()); return node; }
public override Node ExitFeatureHeader(Production node) { // Skip the first value, it's the string for T_FEATURE var values = GetChildValues(node); var summaryLines = values.GetRange(1, values.Count - 1).Cast<LineValue>().ToList(); node.AddValue(summaryLines); return node; }