public static int IndexOf <T>(this ReadOnlyArraySegment <T> arraySegment, T value, int startIndex) where T : IEquatable <T> { var result = arraySegment.Span.Slice(startIndex).IndexOf(value); if (result == -1) { return(result); } return(result + startIndex); }
private static int GetLength(ReadOnlyArraySegment <char> token, List <ReadOnlyArraySegment <char> > descriptionSegments) { var length = token.Count; foreach (var segment in descriptionSegments) { length += segment.Count; } return(length); }
public static void GetEssentialPart(ReadOnlyArraySegment <char> line, out int lineDepth, out ReadOnlyArraySegment <char> essential) { lineDepth = 0; var tokenStart = -1; var tokenEnd = -1; for (var i = 0; i < line.Count; i += 2) { if (line[i] == '|' || line[i] == '`' || line[i] == ' ' || line[i] == '-') { lineDepth++; continue; } tokenStart = i; break; } essential = line[tokenStart..];
public static int IndexOf <T>(this ReadOnlyArraySegment <T> arraySegment, ReadOnlySpan <T> value) where T : IEquatable <T> { return(arraySegment.Span.IndexOf(value)); }
public AstTokenizerBatchItem(int lineDepth, ReadOnlyArraySegment <char> line) { LineDepth = lineDepth; Line = line; }