Skip to content

Commit 43099f8

Browse files
committed
Prevent infinite loop when catching errors.
If an error is caught, the parser's while loop would continue to run without advancing, as the return value of `take` would always be true. By always returning false, parsing will stop when an error is raised, caught or otherwise.
1 parent 0925f97 commit 43099f8

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ function parser() {
210210

211211
function take() {
212212
if(errored || !state.length)
213-
return errored
213+
return false
214214

215215
return (token = tokens[0]) && !stream.paused
216216
}

0 commit comments

Comments
 (0)