File tree 4 files changed +3
-8
lines changed
4 files changed +3
-8
lines changed Original file line number Diff line number Diff line change 424
424
}
425
425
}
426
426
427
- Lexer . prototype . feed = function ( data ) {
428
- this . buffer += data
429
- return this
430
- }
431
-
432
427
Lexer . prototype . clone = function ( ) {
433
428
return new Lexer ( this . states , this . state )
434
429
}
Original file line number Diff line number Diff line change @@ -56,7 +56,7 @@ var pythonLexer = moo.compile({
56
56
57
57
58
58
var tokenize = function ( input , emit ) {
59
- var lexer = pythonLexer . clone ( ) . feed ( input ) ;
59
+ var lexer = pythonLexer . reset ( input ) ;
60
60
var lex = function ( ) { return lexer . next ( ) ; }
61
61
62
62
var tok = lex ( ) ;
Original file line number Diff line number Diff line change @@ -333,7 +333,7 @@ describe('stateful lexer', () => {
333
333
strend : { match : '`' , pop : 1 } ,
334
334
const : { match : / (?: [ ^ $ ` ] | \$ (? ! \{ ) ) + / , lineBreaks : true } ,
335
335
} ,
336
- } ) . feed ( '`a${{c: d}}e`' )
336
+ } ) . reset ( '`a${{c: d}}e`' )
337
337
expect ( lexAll ( lexer ) . map ( t => t . type ) . join ( ' ' ) ) . toBe ( 'strstart const interp lbrace ident colon space ident rbrace rbrace const strend' )
338
338
} )
339
339
Original file line number Diff line number Diff line change @@ -31,7 +31,7 @@ let toshLexer = moo.compile([
31
31
] )
32
32
33
33
function tokenize ( source ) {
34
- let lexer = toshLexer . clone ( ) . feed ( source + '\n' )
34
+ let lexer = toshLexer . reset ( source + '\n' )
35
35
let tokens = [ ]
36
36
for ( let tok of lexer ) {
37
37
if ( tok . type !== 'WS' ) {
You can’t perform that action at this time.
0 commit comments