hsp/compiler/treebuilder/syntaxTree.js
function(nodeList, parent) {
        // Ensure that {let} nodes are always at the beginning of a containter element
        var node, contentFound = false; // true when a node different from let is found
        for (var i = 0; i < nodeList.length; i++) {
            node = nodeList[i];
            //console.log(i+":"+node.type)
            if (node.type === "comment") {
                continue;
            }
            if (node.type==="text") {
                // tolerate static white space text
                if (node.value.match(/^\s*$/)) {
                    continue;
                }
            }
            if (node.type === "let") {
                if (contentFound) {
                    // error: let must be defined before any piece of content
                    this._logError("Let statements must be defined at the beginning of a block", node);
                } else {
                    parent.needSubScope = true;
                }
            } else {
                contentFound = true;
                if (node.content) {
                    this._processNodeContent(node.content, node);
                }
                if (node.content1) {
                    this._processNodeContent(node.content1, node);
                }
                if (node.content2) {
                    this._processNodeContent(node.content2, node);
                }
            }
        }
    }
function(nodeList, parent) {
        // Ensure that {let} nodes are always at the beginning of a containter element
        var node, contentFound = false; // true when a node different from let is found
        for (var i = 0; i < nodeList.length; i++) {
            node = nodeList[i];
            //console.log(i+":"+node.type)
            if (node.type === "comment") {
                continue;
            }
            if (node.type==="text") {
                // tolerate static white space text
                if (node.value.match(/^\s*$/)) {
                    continue;
                }
            }
            if (node.type === "let") {
                if (contentFound) {
                    // error: let must be defined before any piece of content
                    this._logError("Let statements must be defined at the beginning of a block", node);
                } else {
                    parent.needSubScope = true;
                }
            } else {
                contentFound = true;
                if (node.content) {
                    this._processNodeContent(node.content, node);
                }
                if (node.content1) {
                    this._processNodeContent(node.content1, node);
                }
                if (node.content2) {
                    this._processNodeContent(node.content2, node);
                }
            }
        }
    }
function ( nodeList , parent ) { // Ensure that {let} nodes are always at the beginning of a containter element var node , contentFound = false ; // true when a node different from let is found for ( var i = 0 ; i < nodeList . length ; i ++ ) { node = nodeList [ i ] ; //console.log(i+":"+node.type) if ( node . type === "comment" ) { continue ; } if ( node . type === "text" ) { // tolerate static white space text if ( node . value . match ( / ^\s*$ / ) ) { continue ; } } if ( node . type === "let" ) { if ( contentFound ) { // error: let must be defined before any piece of content this . _logError ( "Let statements must be defined at the beginning of a block" , node ) ; } else { parent . needSubScope = true ; } } else { contentFound = true ; if ( node . content ) { this . _processNodeContent ( node . content , node ) ; } if ( node . content1 ) { this . _processNodeContent ( node . content1 , node ) ; } if ( node . content2 ) { this . _processNodeContent ( node . content2 , node ) ; } } } }
Validates the content of a container node.
@param {Array} nodeList the content of a container node
@param {Node} parent the parent node
Validates the content of a container node .