/// <summary> /// Returns a new node for a subsnippet whose whitespace at the beginning and end are cut off. /// </summary> /// <param name="content">The full content of the node to create, which may contain unwanted white spaces</param> SubSnippet ParseTrimmedContent(TMLTerminalNode content) { var startIncl = content.BeginIndex; var endIncl = content.BeginIndex + content.Length - 1; while (Char.IsWhiteSpace(text[startIncl]) && startIncl <= endIncl) { ++startIncl; } if (startIncl > endIncl) { return(new SubSnippet()); //no left content, all white-space } while (Char.IsWhiteSpace(text[endIncl])) { --endIncl; } return(new SubSnippet(text.Substring(startIncl, endIncl + 1 - startIncl).Split(new[] { "\r\n", "\r", "\n" }, StringSplitOptions.None))); }
public TextNode(TMLTerminalNode content) { this.Content = content; }