glayzzle / glayzzle/php-parser

[feature] implement a visitor & filter helper

Open
#198 2 comments 2 reactions 0 assignees View on GitHub
AST feature good first issue help wanted
Dominant language
JavaScript
Stars
565
Forks
75
PR merge metrics
No merged PRs in 30d

Description

implement a visitor helper in order to handle AST transversal :

```js
const ast = parser.parse('...some code...');

// visiting child nodes :
ast.visit(function(node) {
// do something
});

// filtering a list of nodes
const nodes = ast.filter(function(node) {
return node.kind === 'something';
});
```

> NOTE : this is implemented on each node, can be used on program node as in the example, or on any other node

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.