diff --git a/acorn/src/parseutil.js b/acorn/src/parseutil.js index efcad6ce..730642c3 100644 --- a/acorn/src/parseutil.js +++ b/acorn/src/parseutil.js @@ -6,7 +6,7 @@ const pp = Parser.prototype // ## Parser utilities -const literal = /^(?:'((?:\\.|[^'\\])*?)'|"((?:\\.|[^"\\])*?)")/ +const literal = /^(?:'((?:\\.|[^'\\])*?)'|"((?:\\.|[^"\\])*?)")/s pp.strictDirective = function(start) { if (this.options.ecmaVersion < 5) return false for (;;) { diff --git a/test/tests-directive.js b/test/tests-directive.js index 39d9fb18..eb23c247 100644 --- a/test/tests-directive.js +++ b/test/tests-directive.js @@ -2,6 +2,7 @@ if (typeof exports !== "undefined") { var driver = require("./driver.js"); var test = driver.test; + var testFail = driver.testFail; } //------------------------------------------------------------------------ @@ -1384,3 +1385,8 @@ test("(a = () => { \"use strict\"; foo }) => { \"use strict\" }", { } ] }, { ecmaVersion: 6 }) + +testFail( + "function invalid() { \"\\7\\\n\"; \"use strict\"; }", + "Octal literal in strict mode (1:22)", + { ecmaVersion: 6 })