public override bool Match(M token) { bool matched = true; foreach (Pair <K, NodePattern> entry in annotationPatterns) { NodePattern annoPattern = entry.second; object anno = getter.Apply(token, entry.first); if (!annoPattern.Match(anno)) { matched = false; break; } } return(matched); }
// Does matching, returning match results protected internal virtual bool Match(M token, IDictionary <K, object> matchResults) { bool matched = true; foreach (Pair <K, NodePattern> entry in annotationPatterns) { NodePattern annoPattern = entry.second; object anno = getter.Apply(token, entry.first); object matchResult = annoPattern.MatchWithResult(anno); if (matchResult != null) { matchResults[entry.first] = matchResult; } else { matched = false; break; } } return(matched); }
public NegateNodePattern(NodePattern <T> p) { this.p = p; }
public MultiCoreMapNodePattern(NodePattern nodePattern, IDictionary <Type, CoreMapAttributeAggregator> aggregators) { this.nodePattern = nodePattern; this.aggregators = aggregators; }
public MultiCoreMapNodePattern(NodePattern nodePattern) { this.nodePattern = nodePattern; }
public ComplexNodePattern(IBiFunction <M, K, object> getter, K key, NodePattern pattern) : this(getter, Pair.MakePair(key, pattern)) { }
public virtual void Add(K c, NodePattern pattern) { annotationPatterns.Add(Pair.MakePair(c, pattern)); }
public CoreMapNodePattern(Type key, NodePattern pattern) : this(Pair.MakePair(key, pattern)) { }
public MapNodePattern(K key, NodePattern pattern) : base(CreateGetter(), key, pattern) { }