summaryrefslogtreecommitdiff
path: root/platform/structuralsearch/source/com/intellij/structuralsearch/Matcher.java
blob: 594686e14d495a834bde1378d51bddd753389e2e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
package com.intellij.structuralsearch;

import com.intellij.openapi.fileTypes.FileType;
import com.intellij.openapi.project.Project;
import com.intellij.psi.PsiElement;
import com.intellij.structuralsearch.impl.matcher.MatcherImpl;
import org.jetbrains.annotations.Nullable;

import java.util.List;

/**
 * This class makes program structure tree matching:
 */
public class Matcher extends MatcherImpl {

  public Matcher(Project project) {
    super(project);
  }

  public Matcher(final Project project, final MatchOptions matchOptions) {
    super(project, matchOptions);
  }

  /**
   * Finds the matches of given pattern starting from given tree element.
   * @throws MalformedPatternException
   * @throws UnsupportedPatternException
   */
  public void findMatches(MatchResultSink sink,MatchOptions options) throws
    MalformedPatternException, UnsupportedPatternException
  {
    super.findMatches(sink,options);
  }

  /**
   * Finds the matches of given pattern starting from given tree element.
   * @param source string for search
   * @param pattern to be searched
   * @return list of matches found
   * @throws MalformedPatternException
   * @throws UnsupportedPatternException
   */
  public List<MatchResult> testFindMatches(String source,
                              String pattern,
                              MatchOptions options,
                              boolean filePattern,
                              FileType sourceFileType,
                              String sourceExtension,
                              boolean physicalSourceFile)
    throws MalformedPatternException, UnsupportedPatternException {
    return super.testFindMatches(source, pattern, options, filePattern, sourceFileType, sourceExtension, physicalSourceFile);
  }

  public List<MatchResult> testFindMatches(String source, String pattern, MatchOptions options, boolean filePattern)
    throws MalformedPatternException, UnsupportedPatternException {
    return super.testFindMatches(source, pattern, options, filePattern);
  }

  /**
   * Finds the matches of given pattern starting from given tree element.
   * @param sink
   * @param options
   * @throws MalformedPatternException
   * @throws UnsupportedPatternException
   */
  public void testFindMatches(MatchResultSink sink,MatchOptions options)
    throws MalformedPatternException, UnsupportedPatternException {

    super.testFindMatches(sink,options);
  }

  /**
   * Tests if given element is matched by given pattern starting from target variable. If matching succeeds
   * then not null match result is returned.
   * @throws MalformedPatternException
   * @throws UnsupportedPatternException
   */
  @Nullable
  public MatchResult isMatchedByDownUp(PsiElement element,MatchOptions options) throws
    MalformedPatternException, UnsupportedPatternException
  {
    return super.isMatchedByDownUp(element, options);
  }
}