how to match all function with name in javascript ? #716
-
sg -p 'function $FUNC($$$ARGS)' -l js
Warning: Pattern contains an ERROR node and may cause unexpected results.
Help: ast-grep parsed the pattern but it matched nothing in this run. Try using playground to refine the pattern.
See also: https://ast-grep.github.io/playground.html
sg -V
ast-grep 0.13.0 any syntax error ? by the way , how to ignore with |
Beta Was this translation helpful? Give feedback.
Answered by
HerringtonDarkholme
Nov 15, 2023
Replies: 2 comments
-
You can see in the playground link how the pattern is parsed, as shown in the error message. This is a valid pattern instead |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
HerringtonDarkholme
-
By the way, you can check out ast-grep's command line reference in the documentation site. https://ast-grep.github.io/reference/cli.html#sg-run https://ast-grep.github.io/reference/cli/run.html#no-ignore-file-type You can also view the documentation on the command line by sg -h
sg --help
sg run -h
sg run --help Either one will work. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You can see in the playground link how the pattern is parsed, as shown in the error message.
https://ast-grep.github.io/playground.html#eyJtb2RlIjoiUGF0Y2giLCJsYW5nIjoiamF2YXNjcmlwdCIsInF1ZXJ5IjoiZnVuY3Rpb24gJEZVTkMoJCQkQVJHUykiLCJyZXdyaXRlIjoiIiwiY29uZmlnIjoicnVsZTpcbiAgcGF0dGVybjogaWYgKCRBKSB7ICQkJEIgfVxuICBmb2xsb3dzOlxuICAgIHBhdHRlcm46IGlmICgkQSkgeyAkJCRDIH1cbiAgICBzdG9wQnk6IGVuZFxuZml4OiB8LVxuICBpZiAoJEEpIHsgXG4gICAgJCQkQ1xuICAgICQkJEJcbiAgfVxuLS0tXG5ydWxlOlxuICBwYXR0ZXJuOiBpZiAoJEEpIHsgJCQkQiB9XG4gIHByZWNlZGVzOlxuICAgIHBhdHRlcm46IGlmICgkQSkgeyAkJCRDIH1cbiAgICBzdG9wQnk6IGVuZFxuZml4OiAnJyIsInNvdXJjZSI6IiJ9
This is a valid pattern instead