juliangruber/barse — pull request #2 by MiniGod (2013-12-30 03:14:31+00:00)
Title: Allow different length of a string for each "iteration"

If you have
```javascript
var parser = parse()
.readUInt8('length')
.string('str', 'length')
parser.on('data', console.log);

parser.write(new Buffer([1, 0x30])); // { length: 1, str: '0'}
parser.write(new Buffer([2, 0x31, 0x32])); // { length: 2, str: '12' }
```
First chunk works fine.
For the second chunk of data, it thinks that the length is still 1, so `str` will be `'1'` (`length` is still read as `2`, but is kinda ignored).
Hence the offset is +1, instead of +2, which creates big problems if another chunk is written, ie: `length` will be read as `0x32`, instead of `0x2` (but hell.., it doesn't matter. it will think the length is `1` anyways..)

This pull request is an attempt to fix that behavior.