Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
all Line Terminators matter
  • Loading branch information
rubys committed Aug 2, 2018
commit 02c5827c32da84770a6697af65d66e076b4312a1
3 changes: 2 additions & 1 deletion lib/internal/repl/recoverable.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ function isRecoverableError(e, code) {

case 'Unterminated string constant':
const token = this.input.slice(this.lastTokStart, this.pos);
recoverable = token.endsWith('\\\n');
// see https://www.ecma-international.org/ecma-262/#sec-line-terminators
recoverable = token.match(/\\(\r\n?|\n|\u2028|\u2029)$/);
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

token.match() will return an array or null.
You probably want /\\(?:\r\n?|\n|\u2028|\u2029)$/.test(token).


Reflect.apply(raise, this, [pos, message]);
Expand Down