Skip to content

Commit ff23512

Browse files
zyyvHerringtonDarkholme
authored andcommitted
chore: update example log
1 parent 8a5480e commit ff23512

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

website/guide/api-usage/js-api.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -169,9 +169,9 @@ arg.text() // returns 'hello'
169169
node.getMultipleMatches('A')
170170
171171
const logs = root.find('logger($$$ARGS)')
172-
// returns [SgNode('hello'), SgNode('world'), SgNode('!')]
173-
node.getMultipleMatches("ARGS")
174-
node.getMatch("A") // returns null
172+
// returns [SgNode('hello'), SgNode(','), SgNode('world'), SgNode(','), SgNode('!')]
173+
logs.getMultipleMatches("ARGS")
174+
logs.getMatch("A") // returns null
175175
```
176176

177177
## Inspection
@@ -303,4 +303,4 @@ import { parse, Lang } from '@ast-grep/napi'
303303
const sg = parse(Lang.Python, 'def test(): pass')
304304

305305
console.log(sg.root().has('function_definition'))
306-
```
306+
```

website/guide/api-usage/py-api.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -179,10 +179,10 @@ arg.text() # returns 'hello'
179179
# returns [] because $A and $$$A are different
180180
node.get_multiple_matches("A")
181181
182-
node = root.find(pattern="logger($$$ARGS)")
183-
# returns [SgNode('hello'), SgNode('world'), SgNode('!')]
184-
node.get_multiple_matches("ARGS")
185-
node.get_match("A") # returns None
182+
logs = root.find(pattern="logger($$$ARGS)")
183+
# returns [SgNode('hello'), SgNode(','), SgNode('world'), SgNode(','), SgNode('!')]
184+
logs.get_multiple_matches("ARGS")
185+
logs.get_match("A") # returns None
186186
```
187187

188188
`SgNode` also supports `__getitem__` to get the match of single meta variable.
@@ -313,4 +313,4 @@ Note, `logger.log($A)` will not generate `logger.log('hello world')` in Python A
313313
Metavariable will not be replaced in the `replace` method. You need to create a string using `get_match(var_name)` by using Python.
314314
:::
315315

316-
See also [ast-grep#1172](https://github.com/ast-grep/ast-grep/issues/1172)
316+
See also [ast-grep#1172](https://github.com/ast-grep/ast-grep/issues/1172)

0 commit comments

Comments
 (0)