Make tests pass for loose parser

Define Program node extent to be the whole program, make
both parser and the tests conform to this.

Fix a bunch of bugs in the loose parser's handling of corner
cases.

Issue #151
This commit is contained in:
Marijn Haverbeke
2014-11-12 17:04:41 +01:00
parent bc64d3c5f4
commit 249e6961f8
4 changed files with 53 additions and 39 deletions

View File

@@ -55,6 +55,7 @@
parse: (typeof require === "undefined" ? window.acorn : require("../acorn_loose")).parse_dammit,
loose: true,
filter: function (test) {
if (/`/.test(test.code)) return false; // FIXME remove this when the loose parse supports template strings
var opts = test.options || {};
if (opts.loose === false) return false;
return (opts.ecmaVersion || 5) <= 6;