nl_tokens: / * -- module -- name : SetHash description : Hash object set method
pl_tokens: function ( Template , expression ) { this . needs = { } ; var reHashSplit = new RegExp ( '^' + Template . language . tag ( 'setahash' ) + '\\s+([^=]+)\\s*=\\s*(.+)' ) , hashObject = { } , obj , hash , value ; if ( ! reHashSplit . test ( expression ) ) { this . skip = true ; Noodles . Utilities . warning ( Template , 'Setahash tag has bad syntax' ) ; return ; } expression = reHashSplit . exec ( expression ) obj = Noodles . Utilities . parseType ( Template , expression [ 1 ] ) ; if ( obj . type !== "object" ) { this . skip = true ; Noodles . Utilities . warning ( Template , 'Setahash tag has bad syntax, the variable must be an identifier or object' ) ; return ; } this . key = obj ; if ( this . key . order . length > 1 ) { this . needs = Noodles . Utilities . mergeObjectWith ( this . needs , this . key . needs ) ; } else { this . sets = { } ; this . sets [ this . key . order [ 0 ] ] = true ; } this . modifies = { } ; this . modifies [ this . key . order [ 0 ] ] = true ; hash = expression [ 2 ] . split ( ',' ) ; for ( var i = 0 , l = hash . length ; i < l ; i ++ ) { hash [ i ] = hash [ i ] . split ( ':' ) ; value = hash [ i ] [ 0 ] . trim ( ) . toLowerCase ( ) ; hashObject [ value ] = Noodles . Utilities . parseType ( Template , hash [ i ] [ 1 ] . trim ( ) ) this . needs = Noodles . Utilities . mergeObjectWith ( this . needs , hashObject [ value ] . needs ) ; } this . <mask> = hashObject ; }