CSharpUML.UmlParser.ParseBlocks C# (CSharp) Метод

ParseBlocks() приватный Метод

private ParseBlocks ( string lines, int &i, int parentIndent ) : UmlBlock[]
lines string
i int
parentIndent int
Результат UmlBlock[]
        private UmlBlock[] ParseBlocks(string[] lines, ref int i, int parentIndent)
        {
            int baseIndent = nextIndent (lines, i);

            List<UmlBlock> blocks = new List<UmlBlock> ();
            for (; i < lines.Length; ++i) {
                string line = lines [i];
                int indent = line.Indentation ();
                // Console.WriteLine (indent + "  " + line + "  (" + baseIndent + ")");

                if (line.Trim ().Contains ("//")) {
                    //Console.WriteLine ("CurrentComments.add(" + line + ")");
                    Comments.AddParsedComment (line.TrimAll ().Substring (2).TrimAll ());

                } else if (indent < baseIndent) {
                    --i;
                    break;

                } else if (indent == baseIndent) {
                    UmlBlock block;
                    string[] comments = Comments.CurrentComments ();
                    if (i + 1 < lines.Length && nextIndent (lines, i + 1) > indent) {
                        i += 1;
                        block = new UmlBlock (
                            name: line.TrimAll (),
                            content: ParseBlocks (lines, ref i, indent),
                            comments : comments
                        );
                    } else {
                        block = new UmlBlock (
                            name: line.TrimAll (),
                            comments: comments
                        );
                    }
                    blocks.Add (block);

                } else if (line.Trim ().Length > 0) {
                    throw new InvalidOperationException ("This should never happen! " + line);
                }
            }
            return blocks.ToArray ();
        }