private static TreeNode CreateNodeForSequence(Sequence sequence) { TreeNode node = new TreeNode("Sequence"); foreach (DataItem item in sequence.Enties) { node.Nodes.Add(CreateNode(item)); } return node; }
private Sequence ParseBlockSequence(out bool success) { int errorCount = Errors.Count; Sequence sequence = new Sequence(); while (true) { int seq_start_position1 = position; DataItem dataItem = ParseBlockSequenceEntry(out success); if (success) { sequence.Enties.Add(dataItem); } else { Error("Failed to parse BlockSequenceEntry of BlockSequence."); break; } while (true) { while (true) { int seq_start_position2 = position; ParseIndent(out success); if (!success) { Error("Failed to parse Indent of BlockSequence."); break; } dataItem = ParseBlockSequenceEntry(out success); if (success) { sequence.Enties.Add(dataItem); } else { Error("Failed to parse BlockSequenceEntry of BlockSequence."); position = seq_start_position2; } break; } if (!success) { break; } } success = true; break; } if (success) { ClearError(errorCount); } else { Error("Failed to parse Enties of BlockSequence."); } return sequence; }
private Sequence ParseFlowSequence(out bool success) { int errorCount = Errors.Count; Sequence sequence = new Sequence(); int start_position = position; MatchTerminal('[', out success); if (!success) { Error("Failed to parse '[' of FlowSequence."); position = start_position; return sequence; } ParseSeparationLinesInFlow(out success); success = true; while (true) { int seq_start_position1 = position; DataItem dataItem = ParseFlowSequenceEntry(out success); if (success) { sequence.Enties.Add(dataItem); } else { Error("Failed to parse FlowSequenceEntry of FlowSequence."); break; } while (true) { while (true) { int seq_start_position2 = position; MatchTerminal(',', out success); if (!success) { Error("Failed to parse ',' of FlowSequence."); break; } ParseSeparationLinesInFlow(out success); success = true; dataItem = ParseFlowSequenceEntry(out success); if (success) { sequence.Enties.Add(dataItem); } else { Error("Failed to parse FlowSequenceEntry of FlowSequence."); position = seq_start_position2; } break; } if (!success) { break; } } success = true; break; } if (!success) { Error("Failed to parse Enties of FlowSequence."); position = start_position; return sequence; } MatchTerminal(']', out success); if (!success) { Error("Failed to parse ']' of FlowSequence."); position = start_position; } if (success) { ClearError(errorCount); } return sequence; }