bool BlockReader.ReadBlock(string text, int startIndex, out int nextIndex, out Morpheme product) { nextIndex = startIndex; product = null; int i = startIndex; if (MarkerBlockReader.CheckMarker(text, leftMarker, i, out i)) { int firstContentIndex = i; int lastContentIndex = i; while (i < text.Length) { if (MarkerBlockReader.CheckMarker(text, rightMarker, i, out i)) { nextIndex = i; product = new Morpheme { id = formatID, word = text.Substring(firstContentIndex, lastContentIndex - firstContentIndex) }; return(true); } lastContentIndex = ++i; } } return(false); }
bool BlockReader.ReadBlock(string text, int startIndex, out int nextIndex, out Morpheme product) { nextIndex = startIndex; product = null; foreach (var marker in markers) { if (MarkerBlockReader.CheckMarker(text, marker, startIndex, out nextIndex)) { return(true); } } return(false); }