Skip to content

Commit f72927b

Browse files
committed
Remove feed()
Closes #43
1 parent ebd2355 commit f72927b

File tree

4 files changed

+3
-8
lines changed

4 files changed

+3
-8
lines changed

moo.js

-5
Original file line numberDiff line numberDiff line change
@@ -424,11 +424,6 @@
424424
}
425425
}
426426

427-
Lexer.prototype.feed = function(data) {
428-
this.buffer += data
429-
return this
430-
}
431-
432427
Lexer.prototype.clone = function() {
433428
return new Lexer(this.states, this.state)
434429
}

test/python.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ var pythonLexer = moo.compile({
5656

5757

5858
var tokenize = function(input, emit) {
59-
var lexer = pythonLexer.clone().feed(input);
59+
var lexer = pythonLexer.reset(input);
6060
var lex = function() { return lexer.next(); }
6161

6262
var tok = lex();

test/test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ describe('stateful lexer', () => {
333333
strend: {match: '`', pop: 1},
334334
const: {match: /(?:[^$`]|\$(?!\{))+/, lineBreaks: true},
335335
},
336-
}).feed('`a${{c: d}}e`')
336+
}).reset('`a${{c: d}}e`')
337337
expect(lexAll(lexer).map(t => t.type).join(' ')).toBe('strstart const interp lbrace ident colon space ident rbrace rbrace const strend')
338338
})
339339

test/tosh.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ let toshLexer = moo.compile([
3131
])
3232

3333
function tokenize(source) {
34-
let lexer = toshLexer.clone().feed(source + '\n')
34+
let lexer = toshLexer.reset(source + '\n')
3535
let tokens = []
3636
for (let tok of lexer) {
3737
if (tok.type !== 'WS') {

0 commit comments

Comments
 (0)