private static bool Matched(
            ITreeNode treeNode,
            string pattern,
            StructuralSearchEngine structuralSearchEngine,
            int placeholdersCount,
            out IStructuralMatchResult matchResult,
            out List <string> orderedPlaceholderNames)
        {
            matchResult             = null;
            orderedPlaceholderNames = null;

            IStructuralSearchPattern structuralSearchPattern =
                structuralSearchEngine.GetFactory(CSharpLanguage.Instance).CreatePattern(pattern);

            if (!structuralSearchPattern.GuessPlaceholders() || structuralSearchPattern.Placeholders.Count != placeholdersCount)
            {
                return(false);
            }

            orderedPlaceholderNames = GetPatternOrderedPlaceholderNames(pattern);
            if (orderedPlaceholderNames.Count != placeholdersCount)
            {
                return(false);
            }

            IStructuralMatcher matcher = structuralSearchPattern.CreateMatcher();

            matchResult = matcher.Match(treeNode);

            return(matchResult.Matched);
        }
Example #2
0
 protected RegistrationPatternBase(IStructuralSearchPattern pattern)
 {
     matcher = pattern.CreateMatcher();
 }
        protected RegistrationPatternBase(IStructuralSearchPattern pattern)
        {
            this.pattern = pattern;

            matcher = pattern.CreateMatcher();
        }
 protected RegistrationBasePattern(IStructuralSearchPattern pattern)
 {
     matcher = pattern.CreateMatcher();
 }