acorn-walkall

xrefs Most used function Number of funcs Status

acorn-walkall provides a custom walker for Marijn Haverbeke’s acorn JavaScript parser that traverses all AST nodes.

Documentation: acorn-walkall on Sourcegraph

Usage

var acorn = require('acorn'),
    walk = require('acorn/util/walk'),
    walkall = require('./walkall');
var ast = acorn.parse('var x = 7;');
walk.simple(ast, walkall.makeVisitors(function(node) {
  console.log('Found node type', node.type);
}), walkall.traversers);

The included bin/walkall script emits the AST node type and source location for each AST node in the specified JavaScript file.

Running tests

Run npm test.

Author