pegjs-each-nodedeprecated

pegjs plugin helper: Run a function once for each node in a grammar AST.

Usage no npm install needed!

<script type="module">
  import pegjsEachNode from 'https://cdn.skypack.dev/pegjs-each-node';
</script>

README

DEPRECATED. Use peg.compiler.visitor added in PEG.js 0.10.0 instead.

pegjs-each-node Build Status

npm install pegjs-each-node

var eachNode = require('pegjs-each-node')

eachNode(startNode, function(node, parent) {
  // This function will be run once with `startNode` itself, and then once for
  // each of its subnodes.
  console.log(node.type)

  // During the first run (when `node` is `startNode`), `parent` is null. (Or
  // you may pass `parent` as the third argument to `eachNode`). Then `parent`
  // is the node that contains `node`.
})

js-standard-style

License

The X11 (“MIT”) License.