nl_tokens: Search for nearest comment in <code > str< / code > starting from index <code > from< / code >
pl_tokens: function searchComment ( text , from , startToken , endToken ) { var commentStart = - 1 ; var commentEnd = - 1 ; var hasMatch = function ( str , start ) { return <mask> . substr ( start , str . length ) == str ; } ; // search for comment start while ( from -- ) { if ( hasMatch ( startToken , from ) ) { commentStart = from ; break ; } } if ( commentStart != - 1 ) { // search for comment end from = commentStart ; var contentLen = text . length ; while ( contentLen >= from ++ ) { if ( hasMatch ( endToken , from ) ) { commentEnd = from + endToken . length ; break ; } } } return ( commentStart != - 1 && commentEnd != - 1 ) ? require ( 'range' ) . create ( commentStart , commentEnd - commentStart ) : null ; }