Пример #1
0
        public MatchFinder(IEnumerable <ExtendText> texts, RegexBuilder regex)
        {
            StringBuilder stringBuilder = new StringBuilder();

            foreach (var text in texts)
            {
                _textIndices.Add(stringBuilder.Length);
                stringBuilder.Append(text.Text);
                _textPointers.Add(text.StartText);
            }

            _text  = stringBuilder.ToString();
            _regex = regex;
        }
Пример #2
0
        public static async Task <List <IMatch> > Parse(IEnumerable <ExtendText> texts, RegexBuilder regex)
        {
            var lexer = new MatchFinder(texts, regex);

            return(await Task.Run(() => lexer.Parse().ToList()));
        }