예제 #1
0
        public static string ParseSpans(this string text, out ImmutableArray <TextSpan> spans)
        {
            var annotatedText = AnnotatedText.Parse(text);

            spans = annotatedText.Spans;
            return(annotatedText.Text);
        }
예제 #2
0
        public static string ParseSinglePosition(this string text, out int position)
        {
            var annotatedText = AnnotatedText.Parse(text);

            if (annotatedText.Spans.Length != 1 || annotatedText.Spans[0].Length != 0)
            {
                throw new ArgumentException(@"The position must be marked with a single pipe, such as 'SELECT e.Empl|oyeeId'", nameof(text));
            }

            position = annotatedText.Spans.Single().Start;
            return(annotatedText.Text);
        }