Parse a MIDI chunk

@param {string} expected Expected type
@param {module:buffercursor} cursor Buffer to parse
@throws {module:midijs/lib/error~MIDIParserError}
Type expectation failed
@return {Buffer} Chunk data
767121
function parseChunk(expected, cursor) {
    var type, length;

    type = cursor.toString('ascii', 4);
    length = cursor.readUInt32BE();

    if (type !== expected) {
        throw new error.MIDIParserError(
            type,
            expected,
            cursor.tell()
        );
    }

    return cursor.slice(length);
}
250640
function parse(data, initExpected) {
		var lines, i, last;
		data = tail + data;
		data = data.replace(/\r*\n+/g, "\n");
		lines = data.split("\n");
		last = lines.length - 1;
		for (i = 0; i < last; i++) {
			messages.push(read(lines[i], initExpected));
		}
		tail = lines[lines.length - 1];
	}
1031520
public TreeComparison<E, A> decorateErrorsWith(Function<? super E, String> expectedToString, Function<? super A, String> actualToString) {
		this.expectedToString = expectedToString;
		this.actualToString = actualToString;
		return this;
	}
512970
function expectedFile(file) {
  const filePath = path.resolve(__dirname, 'expected', file);
  return new File({
    path: filePath,
    cwd: __dirname,
    base: path.resolve(__dirname, 'expected', path.dirname(file)),
    contents: fs.readFileSync(filePath)
  });
}
1340066
function parseString(str) {
    var obj = {};
    var pairs = str.split('&');
    var parts;
    var pair;

    for (var i = 0, len = pairs.length; i < len; ++i) {
        pair = pairs[i];
        parts = pair.split('=');
        obj[decodeURIComponent(parts[0])] = decodeURIComponent(parts[1]);
    }

    return obj;
}
298976
private final void consumeExpected(String expected)
          throws javax.xml.transform.TransformerException
  {

    if (tokenIs(expected))
    {
      nextToken();
    }
    else
    {
      error(XPATHErrorResources.ER_EXPECTED_BUT_FOUND, new Object[]{ expected,
                                                                     m_token });  //"Expected "+expected+", but found: "+m_token);

	  // Patch for Christina's gripe. She wants her errorHandler to return from
	  // this error and continue trying to parse, rather than throwing an exception.
	  // Without the patch, that put us into an endless loop.
		throw new XPathProcessorException(CONTINUE_AFTER_FATAL_ERROR);
	}
  }
248403
function parseTrack(cursor) {
    var chunk, events = [],
        result, runningStatus = null;

    chunk = parseChunk('MTrk', cursor);

    while (!chunk.eof()) {
        result = parseEvent(chunk, runningStatus);
        runningStatus = result.runningStatus;

        events.push(result.event);
    }

    return new Track(events);
}
118
function parse_lpstr(blob, type, pad) {
	var start = blob.l;
	var str = blob.read_shift(0, 'lpstr-cp');
	if(pad) while((blob.l - start) & 3) ++blob.l;
	return str;
}
478591
function _str(chunk, type) {
  var b, s = '';
  while(this._offset < chunk.length) {
    b = chunk[this._offset];
    if(b === CR && chunk[this._offset + 1] === LF) {
      this._offset += 2;
      return type === ERR ? new Error(s) : this.simple ? new String(s) : s;
    }
    s += String.fromCharCode(b);
    ++this._offset;
  }
}
1042359
function Promise(resolver) {
  if (!(this instanceof InstrumentedPromise)) {
    throw new TypeError('Cannot call a class as a function');
  }
  const promise = new OriginalPromise((resolve, reject) =>
    resolver(resolve, arg => {
      OriginalPromise.resolve().then(() => {
        if (promise._hasDownstreams === undefined) {
          dispatchUnhandledRejectionEvent(promise, arg);
        }
      });
      return reject(arg);
    }));
  promise.__proto__ = InstrumentedPromise.prototype;
  return promise;
}
891060
private Character consumeNextCharacter(CharType... expected) {
        try {
            return chars.consume(expected);
        } catch (UnexpectedElementException e) {
            throw new UnexpectedCharacterException(e);
        }
    }
1253770
def expect(parser, kind):
    # type: (Parser, int) -> Token
    """"""
    token = parser.token
    if token.kind == kind:
        advance(parser)
        return token

    raise GraphQLSyntaxError(
        parser.source,
        token.start,
        u"Expected {}, found {}".format(
            get_token_kind_desc(kind), get_token_desc(token)
        ),
    )
931766
void expectString(Node n, JSType type, String msg) {
    if (!type.matchesStringContext()) {
      mismatch(n, msg, type, STRING_TYPE);
    }
  }
558903
def unexpected(parser, at_token=None):
    # type: (Parser, Optional[Any]) -> GraphQLSyntaxError
    """"""
    token = at_token or parser.token
    return GraphQLSyntaxError(
        parser.source, token.start, u"Unexpected {}".format(get_token_desc(token))
    )
389280
def parse_track(self, fp):
        
        events = []
        chunk_size = self.parse_track_header(fp)
        bytes = chunk_size
        while chunk_size > 0:
            (delta_time, chunk_delta) = self.parse_varbyte_as_int(fp)
            chunk_size -= chunk_delta
            (event, chunk_delta) = self.parse_midi_event(fp)
            chunk_size -= chunk_delta
            events.append([delta_time, event])
        if chunk_size < 0:
            print 'yikes.', self.bytes_read, chunk_size
        return events
74237
function fromString (string) {
  assert.equal(typeof string, 'string')

  return from(function (size, next) {
    if (string.length <= 0) return this.push(null)

    const chunk = string.slice(0, size)
    string = string.slice(size)

    next(null, chunk)
  })
}
398045
function parse (str) {
	var params = str.split('_')
	return {
		float: params[0] === 'F',
		signed: params[0] === 'S',
		bitDepth: parseInt(params[1]),
		byteOrder: params[2],
		channels: parseInt(params[3]),
		sampleRate: parseInt(params[4]),
		interleaved: params[5] === 'I'
	}
}