nl_tokens: Finds parts of complex CSS value
pl_tokens: function findParts ( str ) { /** @type StringStream */ var stream = require ( 'stringStream' ) . create ( str ) ; var ch ; var result = [ ] ; var sep = / [\s\u00a0,] / ; var add = function ( ) { stream . next ( ) ; result . push ( range ( stream . start , stream . current ( ) ) ) ; stream . start = stream . pos ; } ; // skip whitespace stream . eatSpace ( ) ; stream . start = stream . pos ; while ( ch = stream . next ( ) ) { if ( ch == '"' || ch == "'" ) { stream . next ( ) ; if ( ! stream . skipTo ( ch ) ) break ; add ( ) ; } else if ( ch == '(' ) { // function found, may have nested function stream . backUp ( 1 ) ; if ( ! stream . skipToPair ( '(' , ')' ) ) break ; stream . backUp ( 1 ) ; add ( ) ; } else { if ( sep . test ( ch ) ) { result . push ( range ( stream . start , <mask> . current ( ) . length - 1 ) ) ; stream . eatWhile ( sep ) ; stream . start = stream . pos ; } } } add ( ) ; return _ . chain ( result ) . filter ( function ( item ) { return ! ! item . length ( ) ; } ) . uniq ( false , function ( item ) { return item . toString ( ) ; } ) . value ( ) ; }