We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 3dc1931 commit 0c370eaCopy full SHA for 0c370ea
types/moo/index.d.ts
@@ -70,7 +70,7 @@ export interface Lexer {
70
/**
71
* Returns a string with a pretty error message.
72
*/
73
- formatError(token: Token, message?: string): string;
+ formatError(token?: Token, message?: string): string;
74
75
* @deprecated since 0.5.0. Now just returns true
76
types/moo/moo-tests.ts
@@ -102,3 +102,15 @@ moo.compile({
102
],
103
// ...
104
});
105
+
106
+// formatError
107
+lexer.reset(`"foo"`);
108
109
+let token = lexer.next();
110
+if (!token) {
111
+ lexer.formatError(token);
112
+ lexer.formatError(token, "No more tokens");
113
+} else {
114
115
+ lexer.formatError(token, "Error message");
116
+}
0 commit comments