Skip to content

Commit f6f9481

Browse files
fix: mentioning deepdive doc
1 parent 9303ee1 commit f6f9481

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

website/catalog/go/match-function-call.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,13 @@
66

77
One of the common questions of ast-grep is to match function calls in Golang.
88

9-
A plain pattern like `fmt.Println($A)` will not work. This is because Golang syntax also allows type conversions, e.g. `int(3.14)`, that look like function calls.
9+
A plain pattern like `fmt.Println($A)` will not work. This is because Golang syntax also allows type conversions, e.g. `int(3.14)`, that look like function calls. Tree-sitter, ast-grep's parser, will prefer parsing `func_call(arg)` as a type conversion instead of a call expression.
1010

1111
To avoid this ambiguity, ast-grep lets us write a [contextual pattern](/guide/rule-config/atomic-rule.html#pattern), which is a pattern inside a larger code snippet.
1212
We can use `context` to write a pattern like this: `func t() { fmt.Println($A) }`. Then, we can use the selector `call_expression` to match only function calls.
1313

14+
Please also read the [deep dive](/advanced/pattern-parse.html) on [ambiguous pattern](/advanced/pattern-parse.html#ambiguous-pattern-code).
15+
1416
### YAML
1517

1618
```yaml

0 commit comments

Comments
 (0)