lib/parser.js
/**
	 * Handles detection of full match in slice of provided buffer starting at
	 * (probably negative) byte index `firstIndex` and ending at `lastIndex`
	 * _inclusively_.
	 *
	 * @param {Context} context reference on context for sharing results of parsing
	 * @param {Buffer} buffer buffer containing (trailing parts of) match
	 * @param {int} atOffset offset of currently processed buffer in context of a larger file or stream
	 * @param {int} firstIndex first byte index of found match, might be negative if match has started as partial match before
	 * @param {int} lastIndex last _inclusive_ byte index of found match
	 * @returns {Promise.<ParserResult>}
	 * @protected
	 */
Handles detection of full match in slice of provided buffer starting at
(probably negative) byte index `firstIndex` and ending at `lastIndex`
_inclusively_.


Handles detection of full match in slice of provided buffer starting at ( probably negative ) byte index ` firstIndex ` and ending at ` lastIndex ` _inclusively_ .
_fullMatch( context, buffer, atOffset, firstIndex, lastIndex ) {
		let parsed = [];
		if ( firstIndex > -1 ) {
			if ( this._matchingBuffers.length > 0 ) {
				parsed.push = this._matchingBuffers;
				this._matchingBuffers = [];
			}
			if ( firstIndex > 0 ) {
				parsed.push( buffer.slice( 0, firstIndex ) );
			}
		}
		this._matchingBuffers.push( buffer.slice( Math.max( 0, firstIndex ), lastIndex + 1 ) );
		return this._handleMatch( context, this._matchingBuffers, atOffset + firstIndex )
			.then( transitionToState => {
				const buffers = this._matchingBuffers;
				for ( let i = 0, length = buffers.length; i < length; i++ ) {
					parsed.push( buffers[i] );
				}
				this._matchingBuffers = [];
				return {
					parsed,
					unparsed: buffer.slice( lastIndex + 1 ),
					parser: transitionToState,
				};
			} );
	}
_fullMatch ( context , buffer , atOffset , firstIndex , lastIndex ) { let parsed = [ ] ; if ( firstIndex > - 1 ) { if ( this . _matchingBuffers . length > 0 ) { parsed . push = this . _matchingBuffers ; this . _matchingBuffers = [ ] ; } if ( firstIndex > 0 ) { parsed . push ( buffer . slice ( 0 , firstIndex ) ) ; } } this . _matchingBuffers . push ( buffer . slice ( Math . max ( 0 , firstIndex ) , lastIndex + 1 ) ) ; return this . _handleMatch ( context , this . _matchingBuffers , atOffset + firstIndex ) . then ( transitionToState => { const buffers = this . _matchingBuffers ; for ( let i = 0 , length = buffers . length ; i < length ; i ++ ) { parsed . push ( buffers [ i ] ) ; } this . _matchingBuffers = [ ] ; return { parsed , unparsed : buffer . slice ( lastIndex + 1 ) , parser : transitionToState , } ; } ) ; }
Handles detection of full match in slice of provided buffer starting at
 (probably negative) byte index `firstIndex` and ending at `lastIndex`
 _inclusively_.
Handles detection of full match in slice of provided buffer starting at ( probably negative ) byte index ` firstIndex ` and ending at ` lastIndex ` _inclusively_ .