Skip to content

Commit

Permalink
fix: typos
Browse files Browse the repository at this point in the history
  • Loading branch information
fvictorio authored and HerringtonDarkholme committed May 14, 2023
1 parent acae21b commit 0c06c91
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions website/guide/pattern-syntax.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Pattern code must be valid code that tree-sitter can parse.
## Meta Variable
It is usually desirable to write a pattern to match dynamic content.

We can use meta varialbes to match sub expression in pattern.
We can use meta variables to match sub expression in pattern.

Meta variables starts with `$` sign, followed its name composed by upper case letters `A-Z`, underscore `_` or digits `1-9`.
`$META_VARIABLE` is a wildcard expression that can match any **single** AST node.
Expand Down Expand Up @@ -135,4 +135,4 @@ Note in the example above, even if two meta variables have the same name `$_FUNC

:::info Why use non-capturing match?
This is a useful trick to micro-optimize pattern matching speed, since we don't need to create a [HashMap](https://doc.rust-lang.org/stable/std/collections/struct.HashMap.html) for bookkeeping.
:::
:::
4 changes: 2 additions & 2 deletions website/guide/rule-config.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ Be sure to add `./` to the beginning of your rules. ast-grep will not recognize
:::

## `fix`
ast-grep can perform automatic rewriting to the codebase. The `fix` field in the rule configuration specifies how to rewrite the code. We can also use meta variables specified in the `rule` in `fix`. ast-grep will replace the meta-varialbes with the content of actual matched AST nodes.
ast-grep can perform automatic rewriting to the codebase. The `fix` field in the rule configuration specifies how to rewrite the code. We can also use meta variables specified in the `rule` in `fix`. ast-grep will replace the meta-variables with the content of actual matched AST nodes.

Example:

Expand Down Expand Up @@ -166,4 +166,4 @@ So `console.log(name)` will match the above rule, but `console.log('Rem')` will
See [playground](/playground.html#eyJtb2RlIjoiQ29uZmlnIiwibGFuZyI6ImphdmFzY3JpcHQiLCJxdWVyeSI6ImNvbnNvbGUubG9nKCRNQVRDSCkiLCJjb25maWciOiIjIENvbmZpZ3VyZSBSdWxlIGluIFlBTUxcbnJ1bGU6XG4gIHBhdHRlcm46IGNvbnNvbGUubG9nKCRHUkVFVClcbmNvbnN0cmFpbnRzOlxuICBHUkVFVDpcbiAgICBraW5kOiBpZGVudGlmaWVyIiwic291cmNlIjoiY29uc29sZS5sb2coJ0hlbGxvIFdvcmxkJylcbmNvbnNvbGUubG9nKGdyZWV0aW5nKVxuIn0=) in action.

After you have written your rule, you can test it with ast-grep's builtin `test` command.
Let's see it in [next section](/guide/test-rule).
Let's see it in [next section](/guide/test-rule).

0 comments on commit 0c06c91

Please sign in to comment.