WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
implement a visitor helper in order to handle AST transversal :
constast=parser.parse('...some code...');// visiting child nodes :ast.visit(function(node){// do something});// filtering a list of nodesconstnodes=ast.filter(function(node){returnnode.kind==='something';});
NOTE : this is implemented on each node, can be used on program node as in the example, or on any other node