Skip to content

Commit

Permalink
[tokenizer] changed internal name to Tokenizer
Browse files Browse the repository at this point in the history
  • Loading branch information
fb55 committed Mar 31, 2013
1 parent a23d7a6 commit 1db8148
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions lib/Tokenizer.js
@@ -1,4 +1,4 @@
module.exports = Parser;
module.exports = Tokenizer;

var i = 0,

Expand Down Expand Up @@ -71,7 +71,7 @@ function whitespace(c){
return c === " " || c === "\t" || c === "\r" || c === "\n";
}

function Parser(options, cbs){
function Tokenizer(options, cbs){
this._state = TEXT;
this._buffer = "";
this._sectionStart = 0;
Expand All @@ -83,7 +83,7 @@ function Parser(options, cbs){
}

//TODO make events conditional
Parser.prototype.write = function(chunk){
Tokenizer.prototype.write = function(chunk){
this._buffer += chunk;

while(this._index < this._buffer.length && this._running){
Expand Down Expand Up @@ -502,14 +502,14 @@ Parser.prototype.write = function(chunk){
}
};

Parser.prototype.pause = function(){
Tokenizer.prototype.pause = function(){
this._running = false;
};
Parser.prototype.resume = function(){
Tokenizer.prototype.resume = function(){
this._running = true;
};

Parser.prototype.end = function(chunk){
Tokenizer.prototype.end = function(chunk){
if(chunk) this.write(chunk);

//if there is remaining data, emit it in a reasonable way
Expand All @@ -529,16 +529,16 @@ Parser.prototype.end = function(chunk){
this._cbs.onend();
};

Parser.prototype.reset = function(){
Parser.call(this, this._options, this._cbs);
Tokenizer.prototype.reset = function(){
Tokenizer.call(this, this._options, this._cbs);
};

Parser.prototype._emitToken = function(name){
Tokenizer.prototype._emitToken = function(name){
this._cbs["on" + name](this._buffer.substring(this._sectionStart, this._index));
this._sectionStart = -1;
};

Parser.prototype._emitIfToken = function(name){
Tokenizer.prototype._emitIfToken = function(name){
if(this._index > this._sectionStart){
this._cbs["on" + name](this._buffer.substring(this._sectionStart, this._index));
}
Expand Down

0 comments on commit 1db8148

Please sign in to comment.