public static TryCreateRegion ( |
||
parser | ||
Результат |
/// <summary> /// parses buffer /// </summary> /// <param name="parser"></param> /// <param name="parent">parent region or null</param> /// <returns>a region with its children or null</returns> public static TextRegion ParseBuffer(SnapshotParser parser, TextRegion parent) { for (; !parser.AtEnd(); parser.MoveNext()) { TextRegion r = TextRegion.TryCreateRegion(parser); if (r != null) { parser.MoveNext(); //found the start of the region if (!r.Complete) { //searching for child regions while (TextRegion.ParseBuffer(parser, r) != null) { ; } //found everything r.ExtendStartPoint(); } //adding to children or merging with last child r.Parent = parent; parent.Children.Add(r); return(r); } //found parent's end - terminating parsing if (parent.TryComplete(parser)) { parser.MoveNext(); return(null); } } return(null); }