/**
* Searches for subtrees that adhere to the given XPath expression
* and applies pattern matching on each subtree.
*
* @param pattern the parse tree pattern, refer to https://github.com/antlr/antlr4/blob/master/doc/faq/parse-trees.md
* @param rule the production rule in the parser that the pattern adheres to
* @param xPath the XPath expression that will be used to find subtrees
* @return a list of matches
*/
List<ParseTreeMatch> match(String pattern, int rule, String xPath) {
ParseTreePattern p = ast.getParser().compileParseTreePattern(pattern, rule);
return p.findAll(ast.getTree(), xPath);
}
PatternMatching.java 文件源码
java
阅读 30
收藏 0
点赞 0
评论 0
项目:SwiftAnalyzer
作者:
评论列表
文章目录