Skip to content

Commit 521088e

Browse files
committed
Get rid of unnecessary error branch
1 parent 11b4a59 commit 521088e

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

lib/es6/Lexer.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,9 @@ function makeLexer () {
8080
? DELIMITED_BODIES[delimiter]
8181
: PREFIX_BEFORE_DELIMITER;
8282
const match = pattern.exec(text);
83-
if (!match) {
84-
throw new Error(
85-
errorMessage = msg`Failed to lex starting at ${text}`);
86-
}
83+
// Match must be defined since all possible values of pattern have
84+
// an outer Kleene-* and no postcondition so will fallback to matching
85+
// the empty string.
8786
let nConsumed = match[0].length;
8887
if (text.length > nConsumed) {
8988
const chr = text.charAt(nConsumed);

0 commit comments

Comments
 (0)