Moo lexer.reset returns a reference to the Lexer instance (#42587)

This commit is contained in:
chrbala
2020-02-24 16:12:45 -08:00
committed by GitHub
parent 636c3e9cbd
commit 09dec0bcda
2 changed files with 3 additions and 1 deletions

View File

@@ -90,7 +90,7 @@ export interface Lexer {
/**
* Empty the internal buffer of the lexer, and set the line, column, and offset counts back to their initial value.
*/
reset(chunk?: string, state?: LexerState): void;
reset(chunk?: string, state?: LexerState): this;
/**
* Returns current state, which you can later pass it as the second argument
* to reset() to explicitly control the internal state of the lexer.

View File

@@ -77,6 +77,8 @@ lexer.next();
lexer.reset('a different line\n', info);
lexer.next();
Array.from(lexer.reset('lex this'));
// Transform: https://github.com/no-context/moo#transform
moo.compile({
STRING: [