示例#1
0
        private ResolveContext CreateContext(string groupPrefix)
        {
            IReadOnlyList <IValueBuilder> values = _regexGroupParser
                                                   .ParseValues(_groups, groupPrefix)
                                                   .ToList();
            var valueContext = new ResolvedMatchContext <IValueBuilder>(values);

            IReadOnlyList <IReferenceConverter> references = _regexGroupParser
                                                             .ParseReferences(_groups.Keys, groupPrefix)
                                                             .Select(t => ResolveNested(t.referenceName, t.matcherIndex, t.groupPrefix))
                                                             .ToList();
            var referenceContext = new ResolvedMatchContext <IReferenceConverter>(references);

            return(new ResolveContext(valueContext, referenceContext));
        }
示例#2
0
        private ResolveContext CreateContext(IReadOnlyDictionary <string, string> groups, string groupPrefix)
        {
            var values       = _regexGroupParser.ParseValues(groups, groupPrefix);
            var valueContext = new ResolvedMatchContext <IValueBuilder>(values);

            var parsedReferences = _regexGroupParser.ParseReferences(groups.Keys, groupPrefix);
            var references       = new List <IReferenceConverter>(parsedReferences.Count);

            foreach (var(referenceName, matcherIndex, nestedGroupPrefix) in parsedReferences)
            {
                references.Add(ResolveNested(groups, referenceName, matcherIndex, nestedGroupPrefix));
            }
            var referenceContext = new ResolvedMatchContext <IReferenceConverter>(references);

            return(new ResolveContext(valueContext, referenceContext));
        }