Iterates in preorder, calling the function with the current node.
            If stopOn is set to True or False, it will stop on true or false.
174673
def preorder(self, funct, stopOn=None):
        
        if funct(self.symbol) == stopOn and stopOn is not None:
            return stopOn

        if stopOn is None:
            for i in self.children:
                i.preorder(funct)
        else:
            for i in self.children:
                if i.preorder(funct) == stopOn:
                    return stopOn
511770
def iterate(node)
      return unless node.is_a?(AST::Node)

      before    = :"on_#{node.type}"
      after     = :"after_#{node.type}"
      skip_node = catch :skip_child_nodes do
        execute_callback(before, node)
      end

      if skip_node != node
        node.children.each do |child|
          iterate(child) if child.is_a?(AST::Node)
        end
      end

      execute_callback(after, node)
    end
434236
def on_begin(node)
      child, other_children = *node.children

      # Not sure if this can happen in an `if` statement
      raise LogicError if other_children

      case @truth.fetch(child, process(child))
      when :true
        :true
      when :false
        :false
      else
        nil
      end
    end
193595
function checkFunction(node) {
            if (!node.generator) {
                return;
            }

            const starToken = getStarToken(node);
            const prevToken = sourceCode.getTokenBefore(starToken);
            const nextToken = sourceCode.getTokenAfter(starToken);

            let kind = "named";

            if (node.parent.type === "MethodDefinition" || (node.parent.type === "Property" && node.parent.method)) {
                kind = "method";
            } else if (!node.id) {
                kind = "anonymous";
            }

            // Only check before when preceded by `function`|`static` keyword
            if (!(kind === "method" && starToken === sourceCode.getFirstToken(node.parent))) {
                checkSpacing(kind, "before", prevToken, starToken);
            }

            checkSpacing(kind, "after", starToken, nextToken);
        }
640359
function walk(node, callback)
{
	var childNode,i;
	
	if (callback(node) === false) return false;
	
	if (node.childNodes != null)
	{
		i = 0;
		childNode = node.childNodes[i];
	}
	
	while (childNode != null)
	{
		if (walk(childNode, callback) === false) return false;
		
		childNode = node.childNodes[++i];
	}
}
830363
def preorder(self):
        

        if not self:
            return

        yield self

        if self.left:
            for x in self.left.preorder():
                yield x

        if self.right:
            for x in self.right.preorder():
                yield x
440409
private void doProcessNext()
	{
		int _position = getPosition();
		Node _current = getSource().item(_position);

		if (getActionPool().containsKey(_current.getNodeName()))
		{
			getActionPool().get(_current.getNodeName()).execute(_current, _position);
		}
		else if (getActionPool().containsKey(NODE_NAME__DEFAULT))
		{
			getActionPool().get(NODE_NAME__DEFAULT).execute(_current, _position);
		}
		// else do nothing...

		// done
		_position++;
		setPosition(_position);
	}
48079
def node_is_on_list(self, node):
        
        next = self.node_next(node)
        if next == node or next is None:
            assert(self.node_prev(node) is next)
            return False

        return True
1358562
@Override
  public Boolean call() throws Exception {

    // Guard to make sure we get called only once.
    if (isCalled) {
      return false;
    } else {
      isCalled = true;
    }

    if (job == null) {
      return false;
    }

    boolean success = false;
    // Schedule the job on the JobTracker and wait for it to complete.
    try {
     success = job.waitForCompletion(true);
    } catch (InterruptedException interuptus) {
      // We're told to stop, so honor that.
      // And restore interupt status.
      Thread.currentThread().interrupt();
      // Indicate that we should NOT run the postProcessor.
      success = false;
    }
    
    if (success && (postProcessor != null)) {
      success = postProcessor.call();
    }

    return success;
  }
611950
def node_updated(self, node):
        
        if self._capture_node and node == self._capture_node["node"] and node.status != "started":
            yield from self.stop_capture()
434325
def iter_prepostorder(self, is_leaf_fn=None):
        
        to_visit = [self]
        if is_leaf_fn is not None:
            _leaf = is_leaf_fn
        else:
            _leaf = self.__class__.is_leaf

        while to_visit:
            node = to_visit.pop(-1)
            try:
                node = node[1]
            except TypeError:
                # PREORDER ACTIONS
                yield (False, node)
                if not _leaf(node):
                    # ADD CHILDREN
                    to_visit.extend(reversed(node.children + [[1, node]]))
            else:
                #POSTORDER ACTIONS
                yield (True, node)
1286969
public void onNodeFinished(final IExecutionNode node) {

        if (node.equals(this.theLastNode)) {
            printPassed("Passed: " + format(this.theLastNode));
        } else {

            // print the last one first
            if (this.theLastNode != null) {
                printStarted("Starting: " + format(this.theLastNode));
            }

            printPassed("Passed: " + format(node));
        }
        this.theLastNode = null;

    }
210332
public void preOrderTraversal(N root, Visitor<N> v) {
        setMarkedAllNodes(false);
        preOrderTraveralRecursive(root, v);
    }
51872
async def stop(self, wait_for_completion=True):
        
        await self.set_position(
            position=CurrentPosition(),
            wait_for_completion=wait_for_completion)
557430
public static void visitPreOrder(
      Node node, Visitor visitor, Predicate<Node> traverseChildrenPred) {
    visitor.visit(node);

    if (traverseChildrenPred.apply(node)) {
      for (Node c = node.getFirstChild(); c != null; c = c.getNext()) {
        visitPreOrder(c, visitor, traverseChildrenPred);
      }
    }
  }
824613
function(stopOnParents) {
		var nodeList = [];
		this.rootNode.visit(function(node){
			if( node.selected ) {
				nodeList.push(node);
				if( stopOnParents === true ){
					return "skip"; // stop processing this branch
				}
			}
		});
		return nodeList;
	}
3232
def before(complete = true, index = 0, &block)
        unless @before_run
          while callback = machine.callbacks[:before][index]
            index += 1
            
            if callback.type == :around
              # Around callback: need to handle recursively.  Execution only gets
              # paused if:
              # * The block fails and the callback doesn't run on failures OR
              # * The block succeeds, but after callbacks are disabled (in which
              #   case a continuation is stored for later execution)
              return if catch(:cancel) do
                callback.call(object, context, self) do
                  before(complete, index, &block)
                  
                  pause if @success && !complete
                  throw :cancel, true unless @success
                end
              end
            else
              # Normal before callback
              callback.call(object, context, self)
            end
          end
          
          @before_run = true
        end
        
        action = {:success => true}.merge(block_given? ? yield : {})
        @result, @success = action[:result], action[:success]
      end