示例#1
0
 /// <summary>
 /// Find the first match of a given snippet in a tree.
 /// </summary>
 /// <param name="haystack">A <see cref="SyntaxNode"/> representing the code to be searched in.</param>
 /// <param name="needle">A match pattern.</param>
 /// <returns></returns>
 public static IEnumerable <SyntaxNode> Matches(SyntaxNode haystack, Snippet needle)
 {
     return(Matches(haystack, needle.Expression));
 }
示例#2
0
 /// <summary>
 /// Find the first match of a given snippet in a tree.
 /// </summary>
 /// <param name="haystack">A <see cref="SyntaxNode"/> representing the code to be searched in.</param>
 /// <param name="needle">A match pattern.</param>
 /// <returns></returns>
 public static SyntaxNode?Match(SyntaxNode haystack, Snippet needle)
 {
     return(Matches(haystack, needle.Expression).FirstOrDefault());
 }