Exemplo n.º 1
0
        /// <summary>
        /// Does
        /// <code>pattern</code>
        /// matched as rule patternRuleIndex match tree? Pass in a
        /// compiled pattern instead of a string representation of a tree pattern.
        /// </summary>
        public virtual bool Matches(IParseTree tree, ParseTreePattern pattern)
        {
            MultiMap <string, IParseTree> labels = new MultiMap <string, IParseTree>();
            IParseTree mismatchedNode            = MatchImpl(tree, pattern.GetPatternTree(), labels);

            return(mismatchedNode == null);
        }
Exemplo n.º 2
0
        public virtual ParseTreeMatch Match(IParseTree tree, ParseTreePattern pattern)
        {
            MultiMap <string, IParseTree> labels = new MultiMap <string, IParseTree>();

            IParseTree mismatchedNode = MatchImpl(tree, pattern.GetPatternTree(), labels);

            return(new ParseTreeMatch(tree, pattern, labels, mismatchedNode));
        }