Ejemplo n.º 1
0
        public TData ApplyRhs(PatternRule <TData, TOffset> rule, Match <TData, TOffset> match)
        {
            IPatternRuleSpec <TData, TOffset> ruleSpec = _ruleIds[match.PatternPath.First()];
            var newMatch = new Match <TData, TOffset>(match.Matcher, match.Span, match.Input, match.GroupCaptures, match.PatternPath.Skip(1).ToArray(),
                                                      match.VariableBindings, match.NextAnnotation);

            return(ruleSpec.ApplyRhs(rule, newMatch));
        }
Ejemplo n.º 2
0
        protected virtual IEnumerable <TData> ApplyImpl(TData input, TOffset start)
        {
            Match <TData, TOffset> match = _matcher.Match(input, start);

            if (match.Success)
            {
                return(_ruleSpec.ApplyRhs(this, match).ToEnumerable());
            }
            return(Enumerable.Empty <TData>());
        }