From 09dec0bcdaa68a62e4975451dbfab5f74177fe14 Mon Sep 17 00:00:00 2001 From: chrbala Date: Mon, 24 Feb 2020 16:12:45 -0800 Subject: [PATCH] Moo lexer.reset returns a reference to the Lexer instance (#42587) --- types/moo/index.d.ts | 2 +- types/moo/moo-tests.ts | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/types/moo/index.d.ts b/types/moo/index.d.ts index 2a952a8f34..1a8e9f18d4 100644 --- a/types/moo/index.d.ts +++ b/types/moo/index.d.ts @@ -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. diff --git a/types/moo/moo-tests.ts b/types/moo/moo-tests.ts index 5cb9fa6f5b..9de53e87ee 100644 --- a/types/moo/moo-tests.ts +++ b/types/moo/moo-tests.ts @@ -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: [