nl_tokens: Called on every comment to parse
pl_tokens: function parseComment ( comment , append ) { // separatet so that this code could be parsed var escapedollar = '----esacepedollar' + '---' + 'jsdoc-at-examples---' ; function unescape ( result ) { return result . replace ( new RegExp ( escapedollar , 'g' ) , '$$' ) ; } // escape $ in comments comment . value = comment . value . replace ( / \$ / g , escapedollar ) ; var expose , examples , current , statement ; var test = { setup : [ ] , tests : [ ] , teardown : [ ] } ; var hastest = false ; // Normalize comment comment = comment . value . replace ( / \$ / g , '$$$' ) . replace ( / \r / g , '' ) ; // Remove empty lines from comment comment = comment . replace ( / \$ / g , '$$$' ) . replace ( RegExp ( spansLine ( '' ) ) , '' ) ; // Build @expose and @examples regex expose = RegExp ( spansLine ( '@expose\\s*(' + identifier ( ) + '*)' ) , 'g' ) ; examples = RegExp ( spansLine ( '@examples' ) + '((?:' + spansLine ( '.*//.*' ) + ')*)' , 'g' ) ; while ( current = expose . exec ( comment ) ) { statement = buildExpose ( unescape ( current [ 1 ] ) ) ; if ( statement ) append ( <mask> ) ; } while ( current = splitLines ( examples . exec ( comment ) ) ) { for ( var i in current ) { if ( parseExampleLine ( current [ i ] [ 0 ] , current [ i ] [ 1 ] , test ) ) { hastest = true ; } } } return hastest ? test : null ; }