hsp/compiler/treebuilder/syntaxTree.js
function (blocks, startIndex, out, optEndFn) {
        var block, type;
        if (blocks) {
            for (var i = startIndex; i < blocks.length; i++) {
                block = blocks[i];
                type = block.type;

                if (optEndFn && optEndFn(type, block.name)) {
                    // we stop here
                    return i;
                }
                //by convention, a block of type xyz is managed by a __xyz function in the class 
                if (this["__" + type]) {
                    i = this["__" + type](i, blocks, out);
                } else {
                    this._logError("Invalid statement: " + type, block);
                }
            }
            return blocks.length;
        }
    }
function (blocks, startIndex, out, optEndFn) {
        var block, type;
        if (blocks) {
            for (var i = startIndex; i < blocks.length; i++) {
                block = blocks[i];
                type = block.type;

                if (optEndFn && optEndFn(type, block.name)) {
                    // we stop here
                    return i;
                }
                //by convention, a block of type xyz is managed by a __xyz function in the class 
                if (this["__" + type]) {
                    i = this["__" + type](i, blocks, out);
                } else {
                    this._logError("Invalid statement: " + type, block);
                }
            }
            return blocks.length;
        }
    }
function ( blocks , startIndex , out , optEndFn ) { var block , type ; if ( blocks ) { for ( var i = startIndex ; i < blocks . length ; i ++ ) { block = blocks [ i ] ; type = block . type ; if ( optEndFn && optEndFn ( type , block . name ) ) { // we stop here return i ; } //by convention, a block of type xyz is managed by a __xyz function in the class  if ( this [ "__" + type ] ) { i = this [ "__" + type ] ( i , blocks , out ) ; } else { this . _logError ( "Invalid statement: " + type , block ) ; } } return blocks . length ; } }
Process a list of blocks and advance the cursor index that scans the collection.
@param {Array} blocks the full list of blocks.
@param {Integer} startIndex the index from which the process has to start.
@param {Array} out the output as an array of Node.
@param {Function} optEndFn an optional end function that takes a node type as argument.
@return {Integer} the index of the block where the function stopped or -1 if all blocks have been handled.
Process a list of blocks and advance the cursor index that scans the collection .