@@ -26,6 +26,8 @@ def dump_syntax_tree(
26
26
`format` is the output format of the syntax tree.
27
27
use `format=cst` to inspect the code's concrete syntax tree structure, useful to debug target code.
28
28
use `format=pattern` to inspect how ast-grep interprets a pattern, useful to debug pattern rule.
29
+
30
+ Internally calls: ast-grep run --pattern <code> --lang <language> --debug-query=<format>
29
31
"""
30
32
return run_ast_grep_dump (code , language , format .value )
31
33
@@ -38,6 +40,8 @@ def test_match_code_rule(
38
40
"""
39
41
Test a code against an ast-grep YAML rule.
40
42
This is useful to test a rule before using it in a project.
43
+
44
+ Internally calls: ast-grep scan --inline-rules <yaml> --json --stdin
41
45
"""
42
46
args = ["ast-grep" , "scan" ,"--inline-rules" , yaml , "--json" , "--stdin" ]
43
47
try :
@@ -66,6 +70,8 @@ def find_code(
66
70
Find code in a project folder that matches the given ast-grep pattern.
67
71
Pattern is good for simple and single-AST node result.
68
72
For more complex usage, please use YAML by `find_code_by_rule`.
73
+
74
+ Internally calls: ast-grep run --pattern <pattern> --json <project_folder>
69
75
"""
70
76
return run_ast_grep_command (pattern , project_folder , language )
71
77
@@ -80,6 +86,8 @@ def find_code_by_rule(
80
86
It is a more advanced search tool than the simple `find_code`.
81
87
82
88
Tip: When using relational rules (inside/has), add `stopBy: end` to ensure complete traversal.
89
+
90
+ Internally calls: ast-grep scan --inline-rules <yaml> --json <project_folder>
83
91
"""
84
92
return run_ast_grep_yaml (yaml , project_folder )
85
93
0 commit comments