code: function walkWithRules(options, rules, defaultDir, ast, nodeCb, finalCb) {
    var typeToRules;
    try {
      typeToRules = prepareRules(options, rules, defaultDir);
    } catch (e) {
      return finalCb(e);
    }
  
    options._walkQueue = [];
  
    function eachNode(node, queue) {
      //node = wrapNode(node, this);
      var nodeType = node.type;
      var isEndNode = false;
      if (nodeType === 'end') {
        isEndNode = true;
        nodeType = nodeType + '-' + node.node.type;
        node = node.node;
      }
      var ruleType = (nodeType in typeToRules) ? nodeType : '';
      if (ruleType === '' && isEndNode) {
        ruleType = 'end';
      }
      var rules = typeToRules[ruleType];
      for (var i = 0; i < rules.length; i++) {
        var rule = rules[i];
  
        if (typeof rule.match === 'function') {
          if (!rule.match(node)) {
            continue;
          }
        }
        nodeCb(node, rule);
      }
  
      if (!queue) {
        while (options._walkQueue.length > 0) {
          var nextNode = options._walkQueue.splice(0, 1)[0];
          eachNode(nextNode, true);
        }
      }
    }
  
    try {
      walkEnd(ast, eachNode);
      delete options._walkQueue;
    } catch (e) {
      return finalCb(e);
    }
  
    finalCb(null, ast);
  
  }
docs: /*
  Walk a tree of AST nodes and apply rules.
  @param {Object} options Doctor options.
  @param {Array|String} rules One or more rules file names.
  @param {String} defaultDir Default location for rules modules.
  @param {AstNode} ast Root of AST.
  @param {function} nodeCb Function to call for each node.
  @param {function} finalCb Function to call when finished walking.