hsp/compiler/treebuilder/syntaxTree.js
function (index, blocks, out) {
        //creates the foreach node
        var node = new Node("foreach"), block = blocks[index];
        node.item = block.item;
        node.key = block.key;
        node.collection = block.colref;

        node.content = [];
        out.push(node);

        //fills node.content with the next blocks, until an endforeach is found, if any
        var nextIndex = this._advance(blocks, index + 1, node.content, this._foreachEndTypes);
        if (nextIndex < 0 || !blocks[nextIndex]) {
            this._logError("Missing end foreach statement", blocks[index]);
        }

        return nextIndex;
    }
function (index, blocks, out) {
        //creates the foreach node
        var node = new Node("foreach"), block = blocks[index];
        node.item = block.item;
        node.key = block.key;
        node.collection = block.colref;

        node.content = [];
        out.push(node);

        //fills node.content with the next blocks, until an endforeach is found, if any
        var nextIndex = this._advance(blocks, index + 1, node.content, this._foreachEndTypes);
        if (nextIndex < 0 || !blocks[nextIndex]) {
            this._logError("Missing end foreach statement", blocks[index]);
        }

        return nextIndex;
    }
function ( index , blocks , out ) { //creates the foreach node var node = new Node ( "foreach" ) , block = blocks [ index ] ; node . item = block . item ; node . key = block . key ; node . collection = block . colref ; node . content = [ ] ; out . push ( node ) ; //fills node.content with the next blocks, until an endforeach is found, if any var nextIndex = this . _advance ( blocks , index + 1 , node . content , this . _foreachEndTypes ) ; if ( nextIndex < 0 || ! blocks [ nextIndex ] ) { this . _logError ( "Missing end foreach statement" , blocks [ index ] ) ; } return nextIndex ; }
Manages a foreach block.
@param {Array} blocks the full list of blocks.
@param {Integer} index the index of the block to manage.
@param {Array} out the output as an array of Node.
@return {Integer} the index of the block where the function stopped or -1 if all blocks have been handled.
Manages a foreach block .