Skip to content

Commit

Permalink
[[FIX]] Correct interpretation of whitespace
Browse files Browse the repository at this point in the history
  • Loading branch information
jugglinmike authored and rwaldron committed Nov 28, 2017
1 parent 8d4317e commit dd06eea
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/lex.js
Original file line number Diff line number Diff line change
Expand Up @@ -1514,7 +1514,7 @@ Lexer.prototype = {
this.from = this.char;

// Move to the next non-space character.
while (/\s/.test(this.peek())) {
while (reg.whitespace.test(this.peek())) {
this.from += 1;
this.skip();
}
Expand Down
8 changes: 8 additions & 0 deletions src/reg.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,11 @@ exports.fallsThrough = /^\s*falls?\sthrough\s*$/;
// very conservative rule (eg: only one space between the start of the comment and the first character)
// to relax the maxlen option
exports.maxlenException = /^(?:(?:\/\/|\/\*|\*) ?)?[^ ]+$/;

// Node.js releases prior to version 8 include a version of the V8 engine which
// incorrectly interprets the character class escape `\s`. The following
// regular expression may be replaced with `/\s/` when JSHint removes support
// for Node.js versions prior to 8.
// Source:
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp
exports.whitespace = /[ \f\n\r\t\v\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]/;
1 change: 0 additions & 1 deletion tests/test262/expectations.txt
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,6 @@ language/identifiers/vals-rus-alpha-upper-via-escape-hex.js
language/rest-parameters/array-pattern.js
language/rest-parameters/no-alias-arguments.js
language/rest-parameters/object-pattern.js
language/white-space/mongolian-vowel-separator.js
language/arguments-object/10.5-7-b-2-s.js
language/arguments-object/10.5-7-b-3-s.js
language/arguments-object/10.6-10-c-ii-2.js
Expand Down

0 comments on commit dd06eea

Please sign in to comment.