nl_tokens: Parses linear gradient definition
pl_tokens: function parseLinearGradient ( gradient ) { var direction = defaultLinearDirections [ 0 ] ; // extract tokens /** @type StringStream */ var stream = require ( 'stringStream' ) . create ( require ( 'utils' ) . trim ( gradient ) ) ; var colorStops = [ ] , ch ; while ( ch = stream . next ( ) ) { if ( stream . peek ( ) == ',' ) { colorStops . push ( stream . current ( ) ) ; stream . <mask> ( ) ; stream . eatSpace ( ) ; stream . start = stream . pos ; } else if ( ch == '(' ) { // color definition, like 'rgb(0,0,0)' stream . skipTo ( ')' ) ; } } // add last token colorStops . push ( stream . current ( ) ) ; colorStops = _ . compact ( _ . map ( colorStops , normalizeSpace ) ) ; if ( ! colorStops . length ) return null ; // let's see if the first color stop is actually a direction if ( reDeg . test ( colorStops [ 0 ] ) || reKeyword . test ( colorStops [ 0 ] ) ) { direction = colorStops . shift ( ) ; } return { type : 'linear' , direction : direction , colorStops : _ . map ( colorStops , parseColorStop ) } ; }