Skip to content

Commit

Permalink
Remove feed()
Browse files Browse the repository at this point in the history
Closes #43
  • Loading branch information
tjvr committed Apr 5, 2017
1 parent ebd2355 commit f72927b
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 8 deletions.
5 changes: 0 additions & 5 deletions moo.js
Original file line number Diff line number Diff line change
Expand Up @@ -424,11 +424,6 @@
}
}

Lexer.prototype.feed = function(data) {
this.buffer += data
return this
}

Lexer.prototype.clone = function() {
return new Lexer(this.states, this.state)
}
Expand Down
2 changes: 1 addition & 1 deletion test/python.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ var pythonLexer = moo.compile({


var tokenize = function(input, emit) {
var lexer = pythonLexer.clone().feed(input);
var lexer = pythonLexer.reset(input);
var lex = function() { return lexer.next(); }

var tok = lex();
Expand Down
2 changes: 1 addition & 1 deletion test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ describe('stateful lexer', () => {
strend: {match: '`', pop: 1},
const: {match: /(?:[^$`]|\$(?!\{))+/, lineBreaks: true},
},
}).feed('`a${{c: d}}e`')
}).reset('`a${{c: d}}e`')
expect(lexAll(lexer).map(t => t.type).join(' ')).toBe('strstart const interp lbrace ident colon space ident rbrace rbrace const strend')
})

Expand Down
2 changes: 1 addition & 1 deletion test/tosh.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ let toshLexer = moo.compile([
])

function tokenize(source) {
let lexer = toshLexer.clone().feed(source + '\n')
let lexer = toshLexer.reset(source + '\n')
let tokens = []
for (let tok of lexer) {
if (tok.type !== 'WS') {
Expand Down

0 comments on commit f72927b

Please sign in to comment.