Skip to content

Commit

Permalink
[tokenizer] set _sectionStart to 0 when text was emitted
Browse files Browse the repository at this point in the history
  • Loading branch information
fb55 committed Mar 30, 2013
1 parent 550b42e commit dabe165
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions lib/Tokenizer.js
Expand Up @@ -503,19 +503,17 @@ Parser.prototype._write = function(chunk, encoding, cb){
this._emitIfToken("text");
this._buffer = null;
this._index = 0;
} else if(this._sectionStart === this._index - 1){
//the section just started
this._buffer = null;
this._index = 0;
} else {
if(this._sectionStart === this._index - 1){
//the section just started
this._buffer = null;
this._index = 0;
} else {
//remove everything unnecessary
this._buffer = this._buffer.slice(this._sectionStart);
this._index -= this._sectionStart;
}

this._sectionStart = 0;
//remove everything unnecessary
this._buffer = this._buffer.slice(this._sectionStart);
this._index -= this._sectionStart;
}

this._sectionStart = 0;
}

cb();
Expand Down

0 comments on commit dabe165

Please sign in to comment.