Created
April 18, 2022 20:54
-
-
Save lucacicada/ccd0879345250a3f34c20b9db13358ef to your computer and use it in GitHub Desktop.
Deno JSDOM 19.0.0 port
This file has been truncated, but you can view the full file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var e$g,t$f,n$i,r$h="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:global,o$f=e$g={};function i$e(){throw new Error("setTimeout has not been defined")}function u$e(){throw new Error("clearTimeout has not been defined")}function c$d(e){if(t$f===setTimeout)return setTimeout(e,0);if((t$f===i$e||!t$f)&&setTimeout)return t$f=setTimeout,setTimeout(e,0);try{return t$f(e,0)}catch(n){try{return t$f.call(null,e,0)}catch(n){return t$f.call(this||r$h,e,0)}}}!function(){try{t$f="function"==typeof setTimeout?setTimeout:i$e;}catch(e){t$f=i$e;}try{n$i="function"==typeof clearTimeout?clearTimeout:u$e;}catch(e){n$i=u$e;}}();var l$i,s$b=[],f$h=!1,a$f=-1;function h$b(){f$h&&l$i&&(f$h=!1,l$i.length?s$b=l$i.concat(s$b):a$f=-1,s$b.length&&d$9());}function d$9(){if(!f$h){var e=c$d(h$b);f$h=!0;for(var t=s$b.length;t;){for(l$i=s$b,s$b=[];++a$f<t;)l$i&&l$i[a$f].run();a$f=-1,t=s$b.length;}l$i=null,f$h=!1,function(e){if(n$i===clearTimeout)return clearTimeout(e);if((n$i===u$e||!n$i)&&clearTimeout)return n$i=clearTimeout,clearTimeout(e);try{n$i(e);}catch(t){try{return n$i.call(null,e)}catch(t){return n$i.call(this||r$h,e)}}}(e);}}function m$9(e,t){(this||r$h).fun=e,(this||r$h).array=t;}function p$d(){}o$f.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];s$b.push(new m$9(e,t)),1!==s$b.length||f$h||c$d(d$9);},m$9.prototype.run=function(){(this||r$h).fun.apply(null,(this||r$h).array);},o$f.title="browser",o$f.browser=!0,o$f.env={},o$f.argv=[],o$f.version="",o$f.versions={},o$f.on=p$d,o$f.addListener=p$d,o$f.once=p$d,o$f.off=p$d,o$f.removeListener=p$d,o$f.removeAllListeners=p$d,o$f.emit=p$d,o$f.prependListener=p$d,o$f.prependOnceListener=p$d,o$f.listeners=function(e){return []},o$f.binding=function(e){throw new Error("process.binding is not supported")},o$f.cwd=function(){return "/"},o$f.chdir=function(e){throw new Error("process.chdir is not supported")},o$f.umask=function(){return 0};var T$7=e$g;T$7.addListener;T$7.argv;T$7.binding;T$7.browser;T$7.chdir;T$7.cwd;T$7.emit;T$7.env;T$7.listeners;T$7.nextTick;T$7.off;T$7.on;T$7.once;T$7.prependListener;T$7.prependOnceListener;T$7.removeAllListeners;T$7.removeListener;T$7.title;T$7.umask;T$7.version;T$7.versions; | |
var r$g = T$7; | |
function t$e(e) { | |
if ("string" != typeof e) throw new TypeError("Path must be a string. Received " + JSON.stringify(e)); | |
} | |
function n$h(e, r) { | |
for (var t, n = "", i = 0, l = -1, o = 0, a = 0; a <= e.length; ++a) { | |
if (a < e.length) t = e.charCodeAt(a);else { | |
if (47 === t) break; | |
t = 47; | |
} | |
if (47 === t) { | |
if (l === a - 1 || 1 === o) ;else if (l !== a - 1 && 2 === o) { | |
if (n.length < 2 || 2 !== i || 46 !== n.charCodeAt(n.length - 1) || 46 !== n.charCodeAt(n.length - 2)) if (n.length > 2) { | |
var h = n.lastIndexOf("/"); | |
if (h !== n.length - 1) { | |
-1 === h ? (n = "", i = 0) : i = (n = n.slice(0, h)).length - 1 - n.lastIndexOf("/"), l = a, o = 0; | |
continue; | |
} | |
} else if (2 === n.length || 1 === n.length) { | |
n = "", i = 0, l = a, o = 0; | |
continue; | |
} | |
r && (n.length > 0 ? n += "/.." : n = "..", i = 2); | |
} else n.length > 0 ? n += "/" + e.slice(l + 1, a) : n = e.slice(l + 1, a), i = a - l - 1; | |
l = a, o = 0; | |
} else 46 === t && -1 !== o ? ++o : o = -1; | |
} | |
return n; | |
} | |
var i$d = { | |
resolve: function () { | |
for (var e, i = "", l = !1, o = arguments.length - 1; o >= -1 && !l; o--) { | |
var a; | |
o >= 0 ? a = arguments[o] : (void 0 === e && (e = r$g.cwd()), a = e), t$e(a), 0 !== a.length && (i = a + "/" + i, l = 47 === a.charCodeAt(0)); | |
} | |
return i = n$h(i, !l), l ? i.length > 0 ? "/" + i : "/" : i.length > 0 ? i : "."; | |
}, | |
normalize: function (e) { | |
if (t$e(e), 0 === e.length) return "."; | |
var r = 47 === e.charCodeAt(0), | |
i = 47 === e.charCodeAt(e.length - 1); | |
return 0 !== (e = n$h(e, !r)).length || r || (e = "."), e.length > 0 && i && (e += "/"), r ? "/" + e : e; | |
}, | |
isAbsolute: function (e) { | |
return t$e(e), e.length > 0 && 47 === e.charCodeAt(0); | |
}, | |
join: function () { | |
if (0 === arguments.length) return "."; | |
for (var e, r = 0; r < arguments.length; ++r) { | |
var n = arguments[r]; | |
t$e(n), n.length > 0 && (void 0 === e ? e = n : e += "/" + n); | |
} | |
return void 0 === e ? "." : i$d.normalize(e); | |
}, | |
relative: function (e, r) { | |
if (t$e(e), t$e(r), e === r) return ""; | |
if ((e = i$d.resolve(e)) === (r = i$d.resolve(r))) return ""; | |
for (var n = 1; n < e.length && 47 === e.charCodeAt(n); ++n); | |
for (var l = e.length, o = l - n, a = 1; a < r.length && 47 === r.charCodeAt(a); ++a); | |
for (var h = r.length - a, f = o < h ? o : h, c = -1, s = 0; s <= f; ++s) { | |
if (s === f) { | |
if (h > f) { | |
if (47 === r.charCodeAt(a + s)) return r.slice(a + s + 1); | |
if (0 === s) return r.slice(a + s); | |
} else o > f && (47 === e.charCodeAt(n + s) ? c = s : 0 === s && (c = 0)); | |
break; | |
} | |
var g = e.charCodeAt(n + s); | |
if (g !== r.charCodeAt(a + s)) break; | |
47 === g && (c = s); | |
} | |
var u = ""; | |
for (s = n + c + 1; s <= l; ++s) s !== l && 47 !== e.charCodeAt(s) || (0 === u.length ? u += ".." : u += "/.."); | |
return u.length > 0 ? u + r.slice(a + c) : (a += c, 47 === r.charCodeAt(a) && ++a, r.slice(a)); | |
}, | |
_makeLong: function (e) { | |
return e; | |
}, | |
dirname: function (e) { | |
if (t$e(e), 0 === e.length) return "."; | |
for (var r = e.charCodeAt(0), n = 47 === r, i = -1, l = !0, o = e.length - 1; o >= 1; --o) if (47 === (r = e.charCodeAt(o))) { | |
if (!l) { | |
i = o; | |
break; | |
} | |
} else l = !1; | |
return -1 === i ? n ? "/" : "." : n && 1 === i ? "//" : e.slice(0, i); | |
}, | |
basename: function (e, r) { | |
if (void 0 !== r && "string" != typeof r) throw new TypeError('"ext" argument must be a string'); | |
t$e(e); | |
var n, | |
i = 0, | |
l = -1, | |
o = !0; | |
if (void 0 !== r && r.length > 0 && r.length <= e.length) { | |
if (r.length === e.length && r === e) return ""; | |
var a = r.length - 1, | |
h = -1; | |
for (n = e.length - 1; n >= 0; --n) { | |
var f = e.charCodeAt(n); | |
if (47 === f) { | |
if (!o) { | |
i = n + 1; | |
break; | |
} | |
} else -1 === h && (o = !1, h = n + 1), a >= 0 && (f === r.charCodeAt(a) ? -1 == --a && (l = n) : (a = -1, l = h)); | |
} | |
return i === l ? l = h : -1 === l && (l = e.length), e.slice(i, l); | |
} | |
for (n = e.length - 1; n >= 0; --n) if (47 === e.charCodeAt(n)) { | |
if (!o) { | |
i = n + 1; | |
break; | |
} | |
} else -1 === l && (o = !1, l = n + 1); | |
return -1 === l ? "" : e.slice(i, l); | |
}, | |
extname: function (e) { | |
t$e(e); | |
for (var r = -1, n = 0, i = -1, l = !0, o = 0, a = e.length - 1; a >= 0; --a) { | |
var h = e.charCodeAt(a); | |
if (47 !== h) -1 === i && (l = !1, i = a + 1), 46 === h ? -1 === r ? r = a : 1 !== o && (o = 1) : -1 !== r && (o = -1);else if (!l) { | |
n = a + 1; | |
break; | |
} | |
} | |
return -1 === r || -1 === i || 0 === o || 1 === o && r === i - 1 && r === n + 1 ? "" : e.slice(r, i); | |
}, | |
format: function (e) { | |
if (null === e || "object" != typeof e) throw new TypeError('The "pathObject" argument must be of type Object. Received type ' + typeof e); | |
return function (e, r) { | |
var t = r.dir || r.root, | |
n = r.base || (r.name || "") + (r.ext || ""); | |
return t ? t === r.root ? t + n : t + e + n : n; | |
}("/", e); | |
}, | |
parse: function (e) { | |
t$e(e); | |
var r = { | |
root: "", | |
dir: "", | |
base: "", | |
ext: "", | |
name: "" | |
}; | |
if (0 === e.length) return r; | |
var n, | |
i = e.charCodeAt(0), | |
l = 47 === i; | |
l ? (r.root = "/", n = 1) : n = 0; | |
for (var o = -1, a = 0, h = -1, f = !0, c = e.length - 1, s = 0; c >= n; --c) if (47 !== (i = e.charCodeAt(c))) -1 === h && (f = !1, h = c + 1), 46 === i ? -1 === o ? o = c : 1 !== s && (s = 1) : -1 !== o && (s = -1);else if (!f) { | |
a = c + 1; | |
break; | |
} | |
return -1 === o || -1 === h || 0 === s || 1 === s && o === h - 1 && o === a + 1 ? -1 !== h && (r.base = r.name = 0 === a && l ? e.slice(1, h) : e.slice(a, h)) : (0 === a && l ? (r.name = e.slice(1, o), r.base = e.slice(1, h)) : (r.name = e.slice(a, o), r.base = e.slice(a, h)), r.ext = e.slice(o, h)), a > 0 ? r.dir = e.slice(0, a - 1) : l && (r.dir = "/"), r; | |
}, | |
sep: "/", | |
delimiter: ":", | |
win32: null, | |
posix: null | |
}; | |
i$d.posix = i$d; | |
var l$h = i$d; | |
l$h._makeLong; | |
l$h.basename; | |
l$h.delimiter; | |
l$h.dirname; | |
l$h.extname; | |
l$h.format; | |
l$h.isAbsolute; | |
l$h.join; | |
l$h.normalize; | |
l$h.parse; | |
l$h.posix; | |
l$h.relative; | |
l$h.resolve; | |
l$h.sep; | |
l$h.win32; | |
function unimplemented$3(){throw new Error("Node.js fs module is not supported by jspm core"+("undefined"!=typeof Deno?". Deno support here is tracking in https://github.com/jspm/jspm-core/issues/4, +1's are appreciated!":" in the browser"))}var promises={access:unimplemented$3,copyFile:unimplemented$3,open:unimplemented$3,opendir:unimplemented$3,rename:unimplemented$3,truncate:unimplemented$3,rmdir:unimplemented$3,mkdir:unimplemented$3,readdir:unimplemented$3,readlink:unimplemented$3,symlink:unimplemented$3,lstat:unimplemented$3,stat:unimplemented$3,link:unimplemented$3,unlink:unimplemented$3,chmod:unimplemented$3,lchmod:unimplemented$3,lchown:unimplemented$3,chown:unimplemented$3,utimes:unimplemented$3,realpath:unimplemented$3,mkdtemp:unimplemented$3,writeFile:unimplemented$3,appendFile:unimplemented$3,readFile:unimplemented$3};var fs = {appendFile:unimplemented$3,appendFileSync:unimplemented$3,access:unimplemented$3,accessSync:unimplemented$3,chown:unimplemented$3,chownSync:unimplemented$3,chmod:unimplemented$3,chmodSync:unimplemented$3,close:unimplemented$3,closeSync:unimplemented$3,copyFile:unimplemented$3,copyFileSync:unimplemented$3,createReadStream:unimplemented$3,createWriteStream:unimplemented$3,exists:unimplemented$3,existsSync:unimplemented$3,fchown:unimplemented$3,fchownSync:unimplemented$3,fchmod:unimplemented$3,fchmodSync:unimplemented$3,fdatasync:unimplemented$3,fdatasyncSync:unimplemented$3,fstat:unimplemented$3,fstatSync:unimplemented$3,fsync:unimplemented$3,fsyncSync:unimplemented$3,ftruncate:unimplemented$3,ftruncateSync:unimplemented$3,futimes:unimplemented$3,futimesSync:unimplemented$3,lchown:unimplemented$3,lchownSync:unimplemented$3,lchmod:unimplemented$3,lchmodSync:unimplemented$3,link:unimplemented$3,linkSync:unimplemented$3,lstat:unimplemented$3,lstatSync:unimplemented$3,mkdir:unimplemented$3,mkdirSync:unimplemented$3,mkdtemp:unimplemented$3,mkdtempSync:unimplemented$3,open:unimplemented$3,openSync:unimplemented$3,opendir:unimplemented$3,opendirSync:unimplemented$3,readdir:unimplemented$3,readdirSync:unimplemented$3,read:unimplemented$3,readSync:unimplemented$3,readFile:unimplemented$3,readFileSync:unimplemented$3,readlink:unimplemented$3,readlinkSync:unimplemented$3,realpath:unimplemented$3,realpathSync:unimplemented$3,rename:unimplemented$3,renameSync:unimplemented$3,rmdir:unimplemented$3,rmdirSync:unimplemented$3,stat:unimplemented$3,statSync:unimplemented$3,symlink:unimplemented$3,symlinkSync:unimplemented$3,truncate:unimplemented$3,truncateSync:unimplemented$3,unwatchFile:unimplemented$3,unlink:unimplemented$3,unlinkSync:unimplemented$3,utimes:unimplemented$3,utimesSync:unimplemented$3,watch:unimplemented$3,watchFile:unimplemented$3,writeFile:unimplemented$3,writeFileSync:unimplemented$3,write:unimplemented$3,writeSync:unimplemented$3,writev:unimplemented$3,writevSync:unimplemented$3,Dir:unimplemented$3,Dirent:unimplemented$3,Stats:unimplemented$3,ReadStream:unimplemented$3,WriteStream:unimplemented$3,FileReadStream:unimplemented$3,FileWriteStream:unimplemented$3,_toUnixTimestamp:unimplemented$3,F_OK:null,R_OK:null,W_OK:null,X_OK:null,constants:null,promises:promises}; | |
var exports$ac = {}, | |
_dewExec$9X = false; | |
var _global$R = typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : global; | |
function dew$ac() { | |
if (_dewExec$9X) return exports$ac; | |
_dewExec$9X = true; | |
(function (global, factory) { | |
typeof exports$ac === 'object' && true ? factory(exports$ac) : typeof define === 'function' && define.amd ? define(['exports'], factory) : (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.acorn = {})); | |
})(exports$ac, function (exports) { | |
var reservedWords = { | |
3: "abstract boolean byte char class double enum export extends final float goto implements import int interface long native package private protected public short static super synchronized throws transient volatile", | |
5: "class enum extends super const export import", | |
6: "enum", | |
strict: "implements interface let package private protected public static yield", | |
strictBind: "eval arguments" | |
}; // And the keywords | |
var ecma5AndLessKeywords = "break case catch continue debugger default do else finally for function if return switch throw try var while with null true false instanceof typeof void delete new in this"; | |
var keywords$1 = { | |
5: ecma5AndLessKeywords, | |
"5module": ecma5AndLessKeywords + " export import", | |
6: ecma5AndLessKeywords + " const class extends export import super" | |
}; | |
var keywordRelationalOperator = /^in(stanceof)?$/; // ## Character categories | |
// Big ugly regular expressions that match characters in the | |
// whitespace, identifier, and identifier-start categories. These | |
// are only applied when a character is found to actually have a | |
// code point above 128. | |
// Generated by `bin/generate-identifier-regex.js`. | |
var nonASCIIidentifierStartChars = "\xaa\xb5\xba\xc0-\xd6\xd8-\xf6\xf8-\u02c1\u02c6-\u02d1\u02e0-\u02e4\u02ec\u02ee\u0370-\u0374\u0376\u0377\u037a-\u037d\u037f\u0386\u0388-\u038a\u038c\u038e-\u03a1\u03a3-\u03f5\u03f7-\u0481\u048a-\u052f\u0531-\u0556\u0559\u0560-\u0588\u05d0-\u05ea\u05ef-\u05f2\u0620-\u064a\u066e\u066f\u0671-\u06d3\u06d5\u06e5\u06e6\u06ee\u06ef\u06fa-\u06fc\u06ff\u0710\u0712-\u072f\u074d-\u07a5\u07b1\u07ca-\u07ea\u07f4\u07f5\u07fa\u0800-\u0815\u081a\u0824\u0828\u0840-\u0858\u0860-\u086a\u0870-\u0887\u0889-\u088e\u08a0-\u08c9\u0904-\u0939\u093d\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098c\u098f\u0990\u0993-\u09a8\u09aa-\u09b0\u09b2\u09b6-\u09b9\u09bd\u09ce\u09dc\u09dd\u09df-\u09e1\u09f0\u09f1\u09fc\u0a05-\u0a0a\u0a0f\u0a10\u0a13-\u0a28\u0a2a-\u0a30\u0a32\u0a33\u0a35\u0a36\u0a38\u0a39\u0a59-\u0a5c\u0a5e\u0a72-\u0a74\u0a85-\u0a8d\u0a8f-\u0a91\u0a93-\u0aa8\u0aaa-\u0ab0\u0ab2\u0ab3\u0ab5-\u0ab9\u0abd\u0ad0\u0ae0\u0ae1\u0af9\u0b05-\u0b0c\u0b0f\u0b10\u0b13-\u0b28\u0b2a-\u0b30\u0b32\u0b33\u0b35-\u0b39\u0b3d\u0b5c\u0b5d\u0b5f-\u0b61\u0b71\u0b83\u0b85-\u0b8a\u0b8e-\u0b90\u0b92-\u0b95\u0b99\u0b9a\u0b9c\u0b9e\u0b9f\u0ba3\u0ba4\u0ba8-\u0baa\u0bae-\u0bb9\u0bd0\u0c05-\u0c0c\u0c0e-\u0c10\u0c12-\u0c28\u0c2a-\u0c39\u0c3d\u0c58-\u0c5a\u0c5d\u0c60\u0c61\u0c80\u0c85-\u0c8c\u0c8e-\u0c90\u0c92-\u0ca8\u0caa-\u0cb3\u0cb5-\u0cb9\u0cbd\u0cdd\u0cde\u0ce0\u0ce1\u0cf1\u0cf2\u0d04-\u0d0c\u0d0e-\u0d10\u0d12-\u0d3a\u0d3d\u0d4e\u0d54-\u0d56\u0d5f-\u0d61\u0d7a-\u0d7f\u0d85-\u0d96\u0d9a-\u0db1\u0db3-\u0dbb\u0dbd\u0dc0-\u0dc6\u0e01-\u0e30\u0e32\u0e33\u0e40-\u0e46\u0e81\u0e82\u0e84\u0e86-\u0e8a\u0e8c-\u0ea3\u0ea5\u0ea7-\u0eb0\u0eb2\u0eb3\u0ebd\u0ec0-\u0ec4\u0ec6\u0edc-\u0edf\u0f00\u0f40-\u0f47\u0f49-\u0f6c\u0f88-\u0f8c\u1000-\u102a\u103f\u1050-\u1055\u105a-\u105d\u1061\u1065\u1066\u106e-\u1070\u1075-\u1081\u108e\u10a0-\u10c5\u10c7\u10cd\u10d0-\u10fa\u10fc-\u1248\u124a-\u124d\u1250-\u1256\u1258\u125a-\u125d\u1260-\u1288\u128a-\u128d\u1290-\u12b0\u12b2-\u12b5\u12b8-\u12be\u12c0\u12c2-\u12c5\u12c8-\u12d6\u12d8-\u1310\u1312-\u1315\u1318-\u135a\u1380-\u138f\u13a0-\u13f5\u13f8-\u13fd\u1401-\u166c\u166f-\u167f\u1681-\u169a\u16a0-\u16ea\u16ee-\u16f8\u1700-\u1711\u171f-\u1731\u1740-\u1751\u1760-\u176c\u176e-\u1770\u1780-\u17b3\u17d7\u17dc\u1820-\u1878\u1880-\u18a8\u18aa\u18b0-\u18f5\u1900-\u191e\u1950-\u196d\u1970-\u1974\u1980-\u19ab\u19b0-\u19c9\u1a00-\u1a16\u1a20-\u1a54\u1aa7\u1b05-\u1b33\u1b45-\u1b4c\u1b83-\u1ba0\u1bae\u1baf\u1bba-\u1be5\u1c00-\u1c23\u1c4d-\u1c4f\u1c5a-\u1c7d\u1c80-\u1c88\u1c90-\u1cba\u1cbd-\u1cbf\u1ce9-\u1cec\u1cee-\u1cf3\u1cf5\u1cf6\u1cfa\u1d00-\u1dbf\u1e00-\u1f15\u1f18-\u1f1d\u1f20-\u1f45\u1f48-\u1f4d\u1f50-\u1f57\u1f59\u1f5b\u1f5d\u1f5f-\u1f7d\u1f80-\u1fb4\u1fb6-\u1fbc\u1fbe\u1fc2-\u1fc4\u1fc6-\u1fcc\u1fd0-\u1fd3\u1fd6-\u1fdb\u1fe0-\u1fec\u1ff2-\u1ff4\u1ff6-\u1ffc\u2071\u207f\u2090-\u209c\u2102\u2107\u210a-\u2113\u2115\u2118-\u211d\u2124\u2126\u2128\u212a-\u2139\u213c-\u213f\u2145-\u2149\u214e\u2160-\u2188\u2c00-\u2ce4\u2ceb-\u2cee\u2cf2\u2cf3\u2d00-\u2d25\u2d27\u2d2d\u2d30-\u2d67\u2d6f\u2d80-\u2d96\u2da0-\u2da6\u2da8-\u2dae\u2db0-\u2db6\u2db8-\u2dbe\u2dc0-\u2dc6\u2dc8-\u2dce\u2dd0-\u2dd6\u2dd8-\u2dde\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303c\u3041-\u3096\u309b-\u309f\u30a1-\u30fa\u30fc-\u30ff\u3105-\u312f\u3131-\u318e\u31a0-\u31bf\u31f0-\u31ff\u3400-\u4dbf\u4e00-\ua48c\ua4d0-\ua4fd\ua500-\ua60c\ua610-\ua61f\ua62a\ua62b\ua640-\ua66e\ua67f-\ua69d\ua6a0-\ua6ef\ua717-\ua71f\ua722-\ua788\ua78b-\ua7ca\ua7d0\ua7d1\ua7d3\ua7d5-\ua7d9\ua7f2-\ua801\ua803-\ua805\ua807-\ua80a\ua80c-\ua822\ua840-\ua873\ua882-\ua8b3\ua8f2-\ua8f7\ua8fb\ua8fd\ua8fe\ua90a-\ua925\ua930-\ua946\ua960-\ua97c\ua984-\ua9b2\ua9cf\ua9e0-\ua9e4\ua9e6-\ua9ef\ua9fa-\ua9fe\uaa00-\uaa28\uaa40-\uaa42\uaa44-\uaa4b\uaa60-\uaa76\uaa7a\uaa7e-\uaaaf\uaab1\uaab5\uaab6\uaab9-\uaabd\uaac0\uaac2\uaadb-\uaadd\uaae0-\uaaea\uaaf2-\uaaf4\uab01-\uab06\uab09-\uab0e\uab11-\uab16\uab20-\uab26\uab28-\uab2e\uab30-\uab5a\uab5c-\uab69\uab70-\uabe2\uac00-\ud7a3\ud7b0-\ud7c6\ud7cb-\ud7fb\uf900-\ufa6d\ufa70-\ufad9\ufb00-\ufb06\ufb13-\ufb17\ufb1d\ufb1f-\ufb28\ufb2a-\ufb36\ufb38-\ufb3c\ufb3e\ufb40\ufb41\ufb43\ufb44\ufb46-\ufbb1\ufbd3-\ufd3d\ufd50-\ufd8f\ufd92-\ufdc7\ufdf0-\ufdfb\ufe70-\ufe74\ufe76-\ufefc\uff21-\uff3a\uff41-\uff5a\uff66-\uffbe\uffc2-\uffc7\uffca-\uffcf\uffd2-\uffd7\uffda-\uffdc"; | |
var nonASCIIidentifierChars = "\u200c\u200d\xb7\u0300-\u036f\u0387\u0483-\u0487\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u0669\u0670\u06d6-\u06dc\u06df-\u06e4\u06e7\u06e8\u06ea-\u06ed\u06f0-\u06f9\u0711\u0730-\u074a\u07a6-\u07b0\u07c0-\u07c9\u07eb-\u07f3\u07fd\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0859-\u085b\u0898-\u089f\u08ca-\u08e1\u08e3-\u0903\u093a-\u093c\u093e-\u094f\u0951-\u0957\u0962\u0963\u0966-\u096f\u0981-\u0983\u09bc\u09be-\u09c4\u09c7\u09c8\u09cb-\u09cd\u09d7\u09e2\u09e3\u09e6-\u09ef\u09fe\u0a01-\u0a03\u0a3c\u0a3e-\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a66-\u0a71\u0a75\u0a81-\u0a83\u0abc\u0abe-\u0ac5\u0ac7-\u0ac9\u0acb-\u0acd\u0ae2\u0ae3\u0ae6-\u0aef\u0afa-\u0aff\u0b01-\u0b03\u0b3c\u0b3e-\u0b44\u0b47\u0b48\u0b4b-\u0b4d\u0b55-\u0b57\u0b62\u0b63\u0b66-\u0b6f\u0b82\u0bbe-\u0bc2\u0bc6-\u0bc8\u0bca-\u0bcd\u0bd7\u0be6-\u0bef\u0c00-\u0c04\u0c3c\u0c3e-\u0c44\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0c66-\u0c6f\u0c81-\u0c83\u0cbc\u0cbe-\u0cc4\u0cc6-\u0cc8\u0cca-\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0ce6-\u0cef\u0d00-\u0d03\u0d3b\u0d3c\u0d3e-\u0d44\u0d46-\u0d48\u0d4a-\u0d4d\u0d57\u0d62\u0d63\u0d66-\u0d6f\u0d81-\u0d83\u0dca\u0dcf-\u0dd4\u0dd6\u0dd8-\u0ddf\u0de6-\u0def\u0df2\u0df3\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0e50-\u0e59\u0eb1\u0eb4-\u0ebc\u0ec8-\u0ecd\u0ed0-\u0ed9\u0f18\u0f19\u0f20-\u0f29\u0f35\u0f37\u0f39\u0f3e\u0f3f\u0f71-\u0f84\u0f86\u0f87\u0f8d-\u0f97\u0f99-\u0fbc\u0fc6\u102b-\u103e\u1040-\u1049\u1056-\u1059\u105e-\u1060\u1062-\u1064\u1067-\u106d\u1071-\u1074\u1082-\u108d\u108f-\u109d\u135d-\u135f\u1369-\u1371\u1712-\u1715\u1732-\u1734\u1752\u1753\u1772\u1773\u17b4-\u17d3\u17dd\u17e0-\u17e9\u180b-\u180d\u180f-\u1819\u18a9\u1920-\u192b\u1930-\u193b\u1946-\u194f\u19d0-\u19da\u1a17-\u1a1b\u1a55-\u1a5e\u1a60-\u1a7c\u1a7f-\u1a89\u1a90-\u1a99\u1ab0-\u1abd\u1abf-\u1ace\u1b00-\u1b04\u1b34-\u1b44\u1b50-\u1b59\u1b6b-\u1b73\u1b80-\u1b82\u1ba1-\u1bad\u1bb0-\u1bb9\u1be6-\u1bf3\u1c24-\u1c37\u1c40-\u1c49\u1c50-\u1c59\u1cd0-\u1cd2\u1cd4-\u1ce8\u1ced\u1cf4\u1cf7-\u1cf9\u1dc0-\u1dff\u203f\u2040\u2054\u20d0-\u20dc\u20e1\u20e5-\u20f0\u2cef-\u2cf1\u2d7f\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua620-\ua629\ua66f\ua674-\ua67d\ua69e\ua69f\ua6f0\ua6f1\ua802\ua806\ua80b\ua823-\ua827\ua82c\ua880\ua881\ua8b4-\ua8c5\ua8d0-\ua8d9\ua8e0-\ua8f1\ua8ff-\ua909\ua926-\ua92d\ua947-\ua953\ua980-\ua983\ua9b3-\ua9c0\ua9d0-\ua9d9\ua9e5\ua9f0-\ua9f9\uaa29-\uaa36\uaa43\uaa4c\uaa4d\uaa50-\uaa59\uaa7b-\uaa7d\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uaaeb-\uaaef\uaaf5\uaaf6\uabe3-\uabea\uabec\uabed\uabf0-\uabf9\ufb1e\ufe00-\ufe0f\ufe20-\ufe2f\ufe33\ufe34\ufe4d-\ufe4f\uff10-\uff19\uff3f"; | |
var nonASCIIidentifierStart = new RegExp("[" + nonASCIIidentifierStartChars + "]"); | |
var nonASCIIidentifier = new RegExp("[" + nonASCIIidentifierStartChars + nonASCIIidentifierChars + "]"); | |
nonASCIIidentifierStartChars = nonASCIIidentifierChars = null; // These are a run-length and offset encoded representation of the | |
// >0xffff code points that are a valid part of identifiers. The | |
// offset starts at 0x10000, and each pair of numbers represents an | |
// offset to the next range, and then a size of the range. They were | |
// generated by bin/generate-identifier-regex.js | |
// eslint-disable-next-line comma-spacing | |
var astralIdentifierStartCodes = [0, 11, 2, 25, 2, 18, 2, 1, 2, 14, 3, 13, 35, 122, 70, 52, 268, 28, 4, 48, 48, 31, 14, 29, 6, 37, 11, 29, 3, 35, 5, 7, 2, 4, 43, 157, 19, 35, 5, 35, 5, 39, 9, 51, 13, 10, 2, 14, 2, 6, 2, 1, 2, 10, 2, 14, 2, 6, 2, 1, 68, 310, 10, 21, 11, 7, 25, 5, 2, 41, 2, 8, 70, 5, 3, 0, 2, 43, 2, 1, 4, 0, 3, 22, 11, 22, 10, 30, 66, 18, 2, 1, 11, 21, 11, 25, 71, 55, 7, 1, 65, 0, 16, 3, 2, 2, 2, 28, 43, 28, 4, 28, 36, 7, 2, 27, 28, 53, 11, 21, 11, 18, 14, 17, 111, 72, 56, 50, 14, 50, 14, 35, 349, 41, 7, 1, 79, 28, 11, 0, 9, 21, 43, 17, 47, 20, 28, 22, 13, 52, 58, 1, 3, 0, 14, 44, 33, 24, 27, 35, 30, 0, 3, 0, 9, 34, 4, 0, 13, 47, 15, 3, 22, 0, 2, 0, 36, 17, 2, 24, 85, 6, 2, 0, 2, 3, 2, 14, 2, 9, 8, 46, 39, 7, 3, 1, 3, 21, 2, 6, 2, 1, 2, 4, 4, 0, 19, 0, 13, 4, 159, 52, 19, 3, 21, 2, 31, 47, 21, 1, 2, 0, 185, 46, 42, 3, 37, 47, 21, 0, 60, 42, 14, 0, 72, 26, 38, 6, 186, 43, 117, 63, 32, 7, 3, 0, 3, 7, 2, 1, 2, 23, 16, 0, 2, 0, 95, 7, 3, 38, 17, 0, 2, 0, 29, 0, 11, 39, 8, 0, 22, 0, 12, 45, 20, 0, 19, 72, 264, 8, 2, 36, 18, 0, 50, 29, 113, 6, 2, 1, 2, 37, 22, 0, 26, 5, 2, 1, 2, 31, 15, 0, 328, 18, 190, 0, 80, 921, 103, 110, 18, 195, 2637, 96, 16, 1070, 4050, 582, 8634, 568, 8, 30, 18, 78, 18, 29, 19, 47, 17, 3, 32, 20, 6, 18, 689, 63, 129, 74, 6, 0, 67, 12, 65, 1, 2, 0, 29, 6135, 9, 1237, 43, 8, 8936, 3, 2, 6, 2, 1, 2, 290, 46, 2, 18, 3, 9, 395, 2309, 106, 6, 12, 4, 8, 8, 9, 5991, 84, 2, 70, 2, 1, 3, 0, 3, 1, 3, 3, 2, 11, 2, 0, 2, 6, 2, 64, 2, 3, 3, 7, 2, 6, 2, 27, 2, 3, 2, 4, 2, 0, 4, 6, 2, 339, 3, 24, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 7, 1845, 30, 482, 44, 11, 6, 17, 0, 322, 29, 19, 43, 1269, 6, 2, 3, 2, 1, 2, 14, 2, 196, 60, 67, 8, 0, 1205, 3, 2, 26, 2, 1, 2, 0, 3, 0, 2, 9, 2, 3, 2, 0, 2, 0, 7, 0, 5, 0, 2, 0, 2, 0, 2, 2, 2, 1, 2, 0, 3, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 1, 2, 0, 3, 3, 2, 6, 2, 3, 2, 3, 2, 0, 2, 9, 2, 16, 6, 2, 2, 4, 2, 16, 4421, 42719, 33, 4152, 8, 221, 3, 5761, 15, 7472, 3104, 541, 1507, 4938]; // eslint-disable-next-line comma-spacing | |
var astralIdentifierCodes = [509, 0, 227, 0, 150, 4, 294, 9, 1368, 2, 2, 1, 6, 3, 41, 2, 5, 0, 166, 1, 574, 3, 9, 9, 370, 1, 154, 10, 50, 3, 123, 2, 54, 14, 32, 10, 3, 1, 11, 3, 46, 10, 8, 0, 46, 9, 7, 2, 37, 13, 2, 9, 6, 1, 45, 0, 13, 2, 49, 13, 9, 3, 2, 11, 83, 11, 7, 0, 161, 11, 6, 9, 7, 3, 56, 1, 2, 6, 3, 1, 3, 2, 10, 0, 11, 1, 3, 6, 4, 4, 193, 17, 10, 9, 5, 0, 82, 19, 13, 9, 214, 6, 3, 8, 28, 1, 83, 16, 16, 9, 82, 12, 9, 9, 84, 14, 5, 9, 243, 14, 166, 9, 71, 5, 2, 1, 3, 3, 2, 0, 2, 1, 13, 9, 120, 6, 3, 6, 4, 0, 29, 9, 41, 6, 2, 3, 9, 0, 10, 10, 47, 15, 406, 7, 2, 7, 17, 9, 57, 21, 2, 13, 123, 5, 4, 0, 2, 1, 2, 6, 2, 0, 9, 9, 49, 4, 2, 1, 2, 4, 9, 9, 330, 3, 19306, 9, 87, 9, 39, 4, 60, 6, 26, 9, 1014, 0, 2, 54, 8, 3, 82, 0, 12, 1, 19628, 1, 4706, 45, 3, 22, 543, 4, 4, 5, 9, 7, 3, 6, 31, 3, 149, 2, 1418, 49, 513, 54, 5, 49, 9, 0, 15, 0, 23, 4, 2, 14, 1361, 6, 2, 16, 3, 6, 2, 1, 2, 4, 262, 6, 10, 9, 357, 0, 62, 13, 1495, 6, 110, 6, 6, 9, 4759, 9, 787719, 239]; // This has a complexity linear to the value of the code. The | |
// assumption is that looking up astral identifier characters is | |
// rare. | |
function isInAstralSet(code, set) { | |
var pos = 0x10000; | |
for (var i = 0; i < set.length; i += 2) { | |
pos += set[i]; | |
if (pos > code) { | |
return false; | |
} | |
pos += set[i + 1]; | |
if (pos >= code) { | |
return true; | |
} | |
} | |
} // Test whether a given character code starts an identifier. | |
function isIdentifierStart(code, astral) { | |
if (code < 65) { | |
return code === 36; | |
} | |
if (code < 91) { | |
return true; | |
} | |
if (code < 97) { | |
return code === 95; | |
} | |
if (code < 123) { | |
return true; | |
} | |
if (code <= 0xffff) { | |
return code >= 0xaa && nonASCIIidentifierStart.test(String.fromCharCode(code)); | |
} | |
if (astral === false) { | |
return false; | |
} | |
return isInAstralSet(code, astralIdentifierStartCodes); | |
} // Test whether a given character is part of an identifier. | |
function isIdentifierChar(code, astral) { | |
if (code < 48) { | |
return code === 36; | |
} | |
if (code < 58) { | |
return true; | |
} | |
if (code < 65) { | |
return false; | |
} | |
if (code < 91) { | |
return true; | |
} | |
if (code < 97) { | |
return code === 95; | |
} | |
if (code < 123) { | |
return true; | |
} | |
if (code <= 0xffff) { | |
return code >= 0xaa && nonASCIIidentifier.test(String.fromCharCode(code)); | |
} | |
if (astral === false) { | |
return false; | |
} | |
return isInAstralSet(code, astralIdentifierStartCodes) || isInAstralSet(code, astralIdentifierCodes); | |
} // ## Token types | |
// The assignment of fine-grained, information-carrying type objects | |
// allows the tokenizer to store the information it has about a | |
// token in a way that is very cheap for the parser to look up. | |
// All token type variables start with an underscore, to make them | |
// easy to recognize. | |
// The `beforeExpr` property is used to disambiguate between regular | |
// expressions and divisions. It is set on all token types that can | |
// be followed by an expression (thus, a slash after them would be a | |
// regular expression). | |
// | |
// The `startsExpr` property is used to check if the token ends a | |
// `yield` expression. It is set on all token types that either can | |
// directly start an expression (like a quotation mark) or can | |
// continue an expression (like the body of a string). | |
// | |
// `isLoop` marks a keyword as starting a loop, which is important | |
// to know when parsing a label, in order to allow or disallow | |
// continue jumps to that label. | |
var TokenType = function TokenType(label, conf) { | |
if (conf === void 0) conf = {}; | |
(this || _global$R).label = label; | |
(this || _global$R).keyword = conf.keyword; | |
(this || _global$R).beforeExpr = !!conf.beforeExpr; | |
(this || _global$R).startsExpr = !!conf.startsExpr; | |
(this || _global$R).isLoop = !!conf.isLoop; | |
(this || _global$R).isAssign = !!conf.isAssign; | |
(this || _global$R).prefix = !!conf.prefix; | |
(this || _global$R).postfix = !!conf.postfix; | |
(this || _global$R).binop = conf.binop || null; | |
(this || _global$R).updateContext = null; | |
}; | |
function binop(name, prec) { | |
return new TokenType(name, { | |
beforeExpr: true, | |
binop: prec | |
}); | |
} | |
var beforeExpr = { | |
beforeExpr: true | |
}, | |
startsExpr = { | |
startsExpr: true | |
}; // Map keyword names to token types. | |
var keywords = {}; // Succinct definitions of keyword token types | |
function kw(name, options) { | |
if (options === void 0) options = {}; | |
options.keyword = name; | |
return keywords[name] = new TokenType(name, options); | |
} | |
var types$1 = { | |
num: new TokenType("num", startsExpr), | |
regexp: new TokenType("regexp", startsExpr), | |
string: new TokenType("string", startsExpr), | |
name: new TokenType("name", startsExpr), | |
privateId: new TokenType("privateId", startsExpr), | |
eof: new TokenType("eof"), | |
// Punctuation token types. | |
bracketL: new TokenType("[", { | |
beforeExpr: true, | |
startsExpr: true | |
}), | |
bracketR: new TokenType("]"), | |
braceL: new TokenType("{", { | |
beforeExpr: true, | |
startsExpr: true | |
}), | |
braceR: new TokenType("}"), | |
parenL: new TokenType("(", { | |
beforeExpr: true, | |
startsExpr: true | |
}), | |
parenR: new TokenType(")"), | |
comma: new TokenType(",", beforeExpr), | |
semi: new TokenType(";", beforeExpr), | |
colon: new TokenType(":", beforeExpr), | |
dot: new TokenType("."), | |
question: new TokenType("?", beforeExpr), | |
questionDot: new TokenType("?."), | |
arrow: new TokenType("=>", beforeExpr), | |
template: new TokenType("template"), | |
invalidTemplate: new TokenType("invalidTemplate"), | |
ellipsis: new TokenType("...", beforeExpr), | |
backQuote: new TokenType("`", startsExpr), | |
dollarBraceL: new TokenType("${", { | |
beforeExpr: true, | |
startsExpr: true | |
}), | |
// Operators. These carry several kinds of properties to help the | |
// parser use them properly (the presence of these properties is | |
// what categorizes them as operators). | |
// | |
// `binop`, when present, specifies that this operator is a binary | |
// operator, and will refer to its precedence. | |
// | |
// `prefix` and `postfix` mark the operator as a prefix or postfix | |
// unary operator. | |
// | |
// `isAssign` marks all of `=`, `+=`, `-=` etcetera, which act as | |
// binary operators with a very low precedence, that should result | |
// in AssignmentExpression nodes. | |
eq: new TokenType("=", { | |
beforeExpr: true, | |
isAssign: true | |
}), | |
assign: new TokenType("_=", { | |
beforeExpr: true, | |
isAssign: true | |
}), | |
incDec: new TokenType("++/--", { | |
prefix: true, | |
postfix: true, | |
startsExpr: true | |
}), | |
prefix: new TokenType("!/~", { | |
beforeExpr: true, | |
prefix: true, | |
startsExpr: true | |
}), | |
logicalOR: binop("||", 1), | |
logicalAND: binop("&&", 2), | |
bitwiseOR: binop("|", 3), | |
bitwiseXOR: binop("^", 4), | |
bitwiseAND: binop("&", 5), | |
equality: binop("==/!=/===/!==", 6), | |
relational: binop("</>/<=/>=", 7), | |
bitShift: binop("<</>>/>>>", 8), | |
plusMin: new TokenType("+/-", { | |
beforeExpr: true, | |
binop: 9, | |
prefix: true, | |
startsExpr: true | |
}), | |
modulo: binop("%", 10), | |
star: binop("*", 10), | |
slash: binop("/", 10), | |
starstar: new TokenType("**", { | |
beforeExpr: true | |
}), | |
coalesce: binop("??", 1), | |
// Keyword token types. | |
_break: kw("break"), | |
_case: kw("case", beforeExpr), | |
_catch: kw("catch"), | |
_continue: kw("continue"), | |
_debugger: kw("debugger"), | |
_default: kw("default", beforeExpr), | |
_do: kw("do", { | |
isLoop: true, | |
beforeExpr: true | |
}), | |
_else: kw("else", beforeExpr), | |
_finally: kw("finally"), | |
_for: kw("for", { | |
isLoop: true | |
}), | |
_function: kw("function", startsExpr), | |
_if: kw("if"), | |
_return: kw("return", beforeExpr), | |
_switch: kw("switch"), | |
_throw: kw("throw", beforeExpr), | |
_try: kw("try"), | |
_var: kw("var"), | |
_const: kw("const"), | |
_while: kw("while", { | |
isLoop: true | |
}), | |
_with: kw("with"), | |
_new: kw("new", { | |
beforeExpr: true, | |
startsExpr: true | |
}), | |
_this: kw("this", startsExpr), | |
_super: kw("super", startsExpr), | |
_class: kw("class", startsExpr), | |
_extends: kw("extends", beforeExpr), | |
_export: kw("export"), | |
_import: kw("import", startsExpr), | |
_null: kw("null", startsExpr), | |
_true: kw("true", startsExpr), | |
_false: kw("false", startsExpr), | |
_in: kw("in", { | |
beforeExpr: true, | |
binop: 7 | |
}), | |
_instanceof: kw("instanceof", { | |
beforeExpr: true, | |
binop: 7 | |
}), | |
_typeof: kw("typeof", { | |
beforeExpr: true, | |
prefix: true, | |
startsExpr: true | |
}), | |
_void: kw("void", { | |
beforeExpr: true, | |
prefix: true, | |
startsExpr: true | |
}), | |
_delete: kw("delete", { | |
beforeExpr: true, | |
prefix: true, | |
startsExpr: true | |
}) | |
}; // Matches a whole line break (where CRLF is considered a single | |
// line break). Used to count lines. | |
var lineBreak = /\r\n?|\n|\u2028|\u2029/; | |
var lineBreakG = new RegExp(lineBreak.source, "g"); | |
function isNewLine(code) { | |
return code === 10 || code === 13 || code === 0x2028 || code === 0x2029; | |
} | |
function nextLineBreak(code, from, end) { | |
if (end === void 0) end = code.length; | |
for (var i = from; i < end; i++) { | |
var next = code.charCodeAt(i); | |
if (isNewLine(next)) { | |
return i < end - 1 && next === 13 && code.charCodeAt(i + 1) === 10 ? i + 2 : i + 1; | |
} | |
} | |
return -1; | |
} | |
var nonASCIIwhitespace = /[\u1680\u2000-\u200a\u202f\u205f\u3000\ufeff]/; | |
var skipWhiteSpace = /(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g; | |
var ref = Object.prototype; | |
var hasOwnProperty = ref.hasOwnProperty; | |
var toString = ref.toString; | |
var hasOwn = Object.hasOwn || function (obj, propName) { | |
return hasOwnProperty.call(obj, propName); | |
}; | |
var isArray = Array.isArray || function (obj) { | |
return toString.call(obj) === "[object Array]"; | |
}; | |
function wordsRegexp(words) { | |
return new RegExp("^(?:" + words.replace(/ /g, "|") + ")$"); | |
} | |
var loneSurrogate = /(?:[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/; // These are used when `options.locations` is on, for the | |
// `startLoc` and `endLoc` properties. | |
var Position = function Position(line, col) { | |
(this || _global$R).line = line; | |
(this || _global$R).column = col; | |
}; | |
Position.prototype.offset = function offset(n) { | |
return new Position((this || _global$R).line, (this || _global$R).column + n); | |
}; | |
var SourceLocation = function SourceLocation(p, start, end) { | |
(this || _global$R).start = start; | |
(this || _global$R).end = end; | |
if (p.sourceFile !== null) { | |
(this || _global$R).source = p.sourceFile; | |
} | |
}; // The `getLineInfo` function is mostly useful when the | |
// `locations` option is off (for performance reasons) and you | |
// want to find the line/column position for a given character | |
// offset. `input` should be the code string that the offset refers | |
// into. | |
function getLineInfo(input, offset) { | |
for (var line = 1, cur = 0;;) { | |
var nextBreak = nextLineBreak(input, cur, offset); | |
if (nextBreak < 0) { | |
return new Position(line, offset - cur); | |
} | |
++line; | |
cur = nextBreak; | |
} | |
} // A second argument must be given to configure the parser process. | |
// These options are recognized (only `ecmaVersion` is required): | |
var defaultOptions = { | |
// `ecmaVersion` indicates the ECMAScript version to parse. Must be | |
// either 3, 5, 6 (or 2015), 7 (2016), 8 (2017), 9 (2018), 10 | |
// (2019), 11 (2020), 12 (2021), 13 (2022), or `"latest"` (the | |
// latest version the library supports). This influences support | |
// for strict mode, the set of reserved words, and support for | |
// new syntax features. | |
ecmaVersion: null, | |
// `sourceType` indicates the mode the code should be parsed in. | |
// Can be either `"script"` or `"module"`. This influences global | |
// strict mode and parsing of `import` and `export` declarations. | |
sourceType: "script", | |
// `onInsertedSemicolon` can be a callback that will be called | |
// when a semicolon is automatically inserted. It will be passed | |
// the position of the comma as an offset, and if `locations` is | |
// enabled, it is given the location as a `{line, column}` object | |
// as second argument. | |
onInsertedSemicolon: null, | |
// `onTrailingComma` is similar to `onInsertedSemicolon`, but for | |
// trailing commas. | |
onTrailingComma: null, | |
// By default, reserved words are only enforced if ecmaVersion >= 5. | |
// Set `allowReserved` to a boolean value to explicitly turn this on | |
// an off. When this option has the value "never", reserved words | |
// and keywords can also not be used as property names. | |
allowReserved: null, | |
// When enabled, a return at the top level is not considered an | |
// error. | |
allowReturnOutsideFunction: false, | |
// When enabled, import/export statements are not constrained to | |
// appearing at the top of the program, and an import.meta expression | |
// in a script isn't considered an error. | |
allowImportExportEverywhere: false, | |
// By default, await identifiers are allowed to appear at the top-level scope only if ecmaVersion >= 2022. | |
// When enabled, await identifiers are allowed to appear at the top-level scope, | |
// but they are still not allowed in non-async functions. | |
allowAwaitOutsideFunction: null, | |
// When enabled, super identifiers are not constrained to | |
// appearing in methods and do not raise an error when they appear elsewhere. | |
allowSuperOutsideMethod: null, | |
// When enabled, hashbang directive in the beginning of file | |
// is allowed and treated as a line comment. | |
allowHashBang: false, | |
// When `locations` is on, `loc` properties holding objects with | |
// `start` and `end` properties in `{line, column}` form (with | |
// line being 1-based and column 0-based) will be attached to the | |
// nodes. | |
locations: false, | |
// A function can be passed as `onToken` option, which will | |
// cause Acorn to call that function with object in the same | |
// format as tokens returned from `tokenizer().getToken()`. Note | |
// that you are not allowed to call the parser from the | |
// callback—that will corrupt its internal state. | |
onToken: null, | |
// A function can be passed as `onComment` option, which will | |
// cause Acorn to call that function with `(block, text, start, | |
// end)` parameters whenever a comment is skipped. `block` is a | |
// boolean indicating whether this is a block (`/* */`) comment, | |
// `text` is the content of the comment, and `start` and `end` are | |
// character offsets that denote the start and end of the comment. | |
// When the `locations` option is on, two more parameters are | |
// passed, the full `{line, column}` locations of the start and | |
// end of the comments. Note that you are not allowed to call the | |
// parser from the callback—that will corrupt its internal state. | |
onComment: null, | |
// Nodes have their start and end characters offsets recorded in | |
// `start` and `end` properties (directly on the node, rather than | |
// the `loc` object, which holds line/column data. To also add a | |
// [semi-standardized][range] `range` property holding a `[start, | |
// end]` array with the same numbers, set the `ranges` option to | |
// `true`. | |
// | |
// [range]: https://bugzilla.mozilla.org/show_bug.cgi?id=745678 | |
ranges: false, | |
// It is possible to parse multiple files into a single AST by | |
// passing the tree produced by parsing the first file as | |
// `program` option in subsequent parses. This will add the | |
// toplevel forms of the parsed file to the `Program` (top) node | |
// of an existing parse tree. | |
program: null, | |
// When `locations` is on, you can pass this to record the source | |
// file in every node's `loc` object. | |
sourceFile: null, | |
// This value, if given, is stored in every node, whether | |
// `locations` is on or off. | |
directSourceFile: null, | |
// When enabled, parenthesized expressions are represented by | |
// (non-standard) ParenthesizedExpression nodes | |
preserveParens: false | |
}; // Interpret and default an options object | |
var warnedAboutEcmaVersion = false; | |
function getOptions(opts) { | |
var options = {}; | |
for (var opt in defaultOptions) { | |
options[opt] = opts && hasOwn(opts, opt) ? opts[opt] : defaultOptions[opt]; | |
} | |
if (options.ecmaVersion === "latest") { | |
options.ecmaVersion = 1e8; | |
} else if (options.ecmaVersion == null) { | |
if (!warnedAboutEcmaVersion && typeof console === "object" && console.warn) { | |
warnedAboutEcmaVersion = true; | |
console.warn("Since Acorn 8.0.0, options.ecmaVersion is required.\nDefaulting to 2020, but this will stop working in the future."); | |
} | |
options.ecmaVersion = 11; | |
} else if (options.ecmaVersion >= 2015) { | |
options.ecmaVersion -= 2009; | |
} | |
if (options.allowReserved == null) { | |
options.allowReserved = options.ecmaVersion < 5; | |
} | |
if (isArray(options.onToken)) { | |
var tokens = options.onToken; | |
options.onToken = function (token) { | |
return tokens.push(token); | |
}; | |
} | |
if (isArray(options.onComment)) { | |
options.onComment = pushComment(options, options.onComment); | |
} | |
return options; | |
} | |
function pushComment(options, array) { | |
return function (block, text, start, end, startLoc, endLoc) { | |
var comment = { | |
type: block ? "Block" : "Line", | |
value: text, | |
start: start, | |
end: end | |
}; | |
if (options.locations) { | |
comment.loc = new SourceLocation(this || _global$R, startLoc, endLoc); | |
} | |
if (options.ranges) { | |
comment.range = [start, end]; | |
} | |
array.push(comment); | |
}; | |
} // Each scope gets a bitset that may contain these flags | |
var SCOPE_TOP = 1, | |
SCOPE_FUNCTION = 2, | |
SCOPE_ASYNC = 4, | |
SCOPE_GENERATOR = 8, | |
SCOPE_ARROW = 16, | |
SCOPE_SIMPLE_CATCH = 32, | |
SCOPE_SUPER = 64, | |
SCOPE_DIRECT_SUPER = 128, | |
SCOPE_CLASS_STATIC_BLOCK = 256, | |
SCOPE_VAR = SCOPE_TOP | SCOPE_FUNCTION | SCOPE_CLASS_STATIC_BLOCK; | |
function functionFlags(async, generator) { | |
return SCOPE_FUNCTION | (async ? SCOPE_ASYNC : 0) | (generator ? SCOPE_GENERATOR : 0); | |
} // Used in checkLVal* and declareName to determine the type of a binding | |
var BIND_NONE = 0, | |
// Not a binding | |
BIND_VAR = 1, | |
// Var-style binding | |
BIND_LEXICAL = 2, | |
// Let- or const-style binding | |
BIND_FUNCTION = 3, | |
// Function declaration | |
BIND_SIMPLE_CATCH = 4, | |
// Simple (identifier pattern) catch binding | |
BIND_OUTSIDE = 5; // Special case for function names as bound inside the function | |
var Parser = function Parser(options, input, startPos) { | |
(this || _global$R).options = options = getOptions(options); | |
(this || _global$R).sourceFile = options.sourceFile; | |
(this || _global$R).keywords = wordsRegexp(keywords$1[options.ecmaVersion >= 6 ? 6 : options.sourceType === "module" ? "5module" : 5]); | |
var reserved = ""; | |
if (options.allowReserved !== true) { | |
reserved = reservedWords[options.ecmaVersion >= 6 ? 6 : options.ecmaVersion === 5 ? 5 : 3]; | |
if (options.sourceType === "module") { | |
reserved += " await"; | |
} | |
} | |
(this || _global$R).reservedWords = wordsRegexp(reserved); | |
var reservedStrict = (reserved ? reserved + " " : "") + reservedWords.strict; | |
(this || _global$R).reservedWordsStrict = wordsRegexp(reservedStrict); | |
(this || _global$R).reservedWordsStrictBind = wordsRegexp(reservedStrict + " " + reservedWords.strictBind); | |
(this || _global$R).input = String(input); // Used to signal to callers of `readWord1` whether the word | |
// contained any escape sequences. This is needed because words with | |
// escape sequences must not be interpreted as keywords. | |
(this || _global$R).containsEsc = false; // Set up token state | |
// The current position of the tokenizer in the input. | |
if (startPos) { | |
(this || _global$R).pos = startPos; | |
(this || _global$R).lineStart = (this || _global$R).input.lastIndexOf("\n", startPos - 1) + 1; | |
(this || _global$R).curLine = (this || _global$R).input.slice(0, (this || _global$R).lineStart).split(lineBreak).length; | |
} else { | |
(this || _global$R).pos = (this || _global$R).lineStart = 0; | |
(this || _global$R).curLine = 1; | |
} // Properties of the current token: | |
// Its type | |
(this || _global$R).type = types$1.eof; // For tokens that include more information than their type, the value | |
(this || _global$R).value = null; // Its start and end offset | |
(this || _global$R).start = (this || _global$R).end = (this || _global$R).pos; // And, if locations are used, the {line, column} object | |
// corresponding to those offsets | |
(this || _global$R).startLoc = (this || _global$R).endLoc = this.curPosition(); // Position information for the previous token | |
(this || _global$R).lastTokEndLoc = (this || _global$R).lastTokStartLoc = null; | |
(this || _global$R).lastTokStart = (this || _global$R).lastTokEnd = (this || _global$R).pos; // The context stack is used to superficially track syntactic | |
// context to predict whether a regular expression is allowed in a | |
// given position. | |
(this || _global$R).context = this.initialContext(); | |
(this || _global$R).exprAllowed = true; // Figure out if it's a module code. | |
(this || _global$R).inModule = options.sourceType === "module"; | |
(this || _global$R).strict = (this || _global$R).inModule || this.strictDirective((this || _global$R).pos); // Used to signify the start of a potential arrow function | |
(this || _global$R).potentialArrowAt = -1; | |
(this || _global$R).potentialArrowInForAwait = false; // Positions to delayed-check that yield/await does not exist in default parameters. | |
(this || _global$R).yieldPos = (this || _global$R).awaitPos = (this || _global$R).awaitIdentPos = 0; // Labels in scope. | |
(this || _global$R).labels = []; // Thus-far undefined exports. | |
(this || _global$R).undefinedExports = Object.create(null); // If enabled, skip leading hashbang line. | |
if ((this || _global$R).pos === 0 && options.allowHashBang && (this || _global$R).input.slice(0, 2) === "#!") { | |
this.skipLineComment(2); | |
} // Scope tracking for duplicate variable names (see scope.js) | |
(this || _global$R).scopeStack = []; | |
this.enterScope(SCOPE_TOP); // For RegExp validation | |
(this || _global$R).regexpState = null; // The stack of private names. | |
// Each element has two properties: 'declared' and 'used'. | |
// When it exited from the outermost class definition, all used private names must be declared. | |
(this || _global$R).privateNameStack = []; | |
}; | |
var prototypeAccessors = { | |
inFunction: { | |
configurable: true | |
}, | |
inGenerator: { | |
configurable: true | |
}, | |
inAsync: { | |
configurable: true | |
}, | |
canAwait: { | |
configurable: true | |
}, | |
allowSuper: { | |
configurable: true | |
}, | |
allowDirectSuper: { | |
configurable: true | |
}, | |
treatFunctionsAsVar: { | |
configurable: true | |
}, | |
allowNewDotTarget: { | |
configurable: true | |
}, | |
inClassStaticBlock: { | |
configurable: true | |
} | |
}; | |
Parser.prototype.parse = function parse() { | |
var node = (this || _global$R).options.program || this.startNode(); | |
this.nextToken(); | |
return this.parseTopLevel(node); | |
}; | |
prototypeAccessors.inFunction.get = function () { | |
return (this.currentVarScope().flags & SCOPE_FUNCTION) > 0; | |
}; | |
prototypeAccessors.inGenerator.get = function () { | |
return (this.currentVarScope().flags & SCOPE_GENERATOR) > 0 && !this.currentVarScope().inClassFieldInit; | |
}; | |
prototypeAccessors.inAsync.get = function () { | |
return (this.currentVarScope().flags & SCOPE_ASYNC) > 0 && !this.currentVarScope().inClassFieldInit; | |
}; | |
prototypeAccessors.canAwait.get = function () { | |
for (var i = (this || _global$R).scopeStack.length - 1; i >= 0; i--) { | |
var scope = (this || _global$R).scopeStack[i]; | |
if (scope.inClassFieldInit || scope.flags & SCOPE_CLASS_STATIC_BLOCK) { | |
return false; | |
} | |
if (scope.flags & SCOPE_FUNCTION) { | |
return (scope.flags & SCOPE_ASYNC) > 0; | |
} | |
} | |
return (this || _global$R).inModule && (this || _global$R).options.ecmaVersion >= 13 || (this || _global$R).options.allowAwaitOutsideFunction; | |
}; | |
prototypeAccessors.allowSuper.get = function () { | |
var ref = this.currentThisScope(); | |
var flags = ref.flags; | |
var inClassFieldInit = ref.inClassFieldInit; | |
return (flags & SCOPE_SUPER) > 0 || inClassFieldInit || (this || _global$R).options.allowSuperOutsideMethod; | |
}; | |
prototypeAccessors.allowDirectSuper.get = function () { | |
return (this.currentThisScope().flags & SCOPE_DIRECT_SUPER) > 0; | |
}; | |
prototypeAccessors.treatFunctionsAsVar.get = function () { | |
return this.treatFunctionsAsVarInScope(this.currentScope()); | |
}; | |
prototypeAccessors.allowNewDotTarget.get = function () { | |
var ref = this.currentThisScope(); | |
var flags = ref.flags; | |
var inClassFieldInit = ref.inClassFieldInit; | |
return (flags & (SCOPE_FUNCTION | SCOPE_CLASS_STATIC_BLOCK)) > 0 || inClassFieldInit; | |
}; | |
prototypeAccessors.inClassStaticBlock.get = function () { | |
return (this.currentVarScope().flags & SCOPE_CLASS_STATIC_BLOCK) > 0; | |
}; | |
Parser.extend = function extend() { | |
var plugins = [], | |
len = arguments.length; | |
while (len--) plugins[len] = arguments[len]; | |
var cls = this || _global$R; | |
for (var i = 0; i < plugins.length; i++) { | |
cls = plugins[i](cls); | |
} | |
return cls; | |
}; | |
Parser.parse = function parse(input, options) { | |
return new (this || _global$R)(options, input).parse(); | |
}; | |
Parser.parseExpressionAt = function parseExpressionAt(input, pos, options) { | |
var parser = new (this || _global$R)(options, input, pos); | |
parser.nextToken(); | |
return parser.parseExpression(); | |
}; | |
Parser.tokenizer = function tokenizer(input, options) { | |
return new (this || _global$R)(options, input); | |
}; | |
Object.defineProperties(Parser.prototype, prototypeAccessors); | |
var pp$9 = Parser.prototype; // ## Parser utilities | |
var literal = /^(?:'((?:\\.|[^'\\])*?)'|"((?:\\.|[^"\\])*?)")/; | |
pp$9.strictDirective = function (start) { | |
for (;;) { | |
// Try to find string literal. | |
skipWhiteSpace.lastIndex = start; | |
start += skipWhiteSpace.exec((this || _global$R).input)[0].length; | |
var match = literal.exec((this || _global$R).input.slice(start)); | |
if (!match) { | |
return false; | |
} | |
if ((match[1] || match[2]) === "use strict") { | |
skipWhiteSpace.lastIndex = start + match[0].length; | |
var spaceAfter = skipWhiteSpace.exec((this || _global$R).input), | |
end = spaceAfter.index + spaceAfter[0].length; | |
var next = (this || _global$R).input.charAt(end); | |
return next === ";" || next === "}" || lineBreak.test(spaceAfter[0]) && !(/[(`.[+\-/*%<>=,?^&]/.test(next) || next === "!" && (this || _global$R).input.charAt(end + 1) === "="); | |
} | |
start += match[0].length; // Skip semicolon, if any. | |
skipWhiteSpace.lastIndex = start; | |
start += skipWhiteSpace.exec((this || _global$R).input)[0].length; | |
if ((this || _global$R).input[start] === ";") { | |
start++; | |
} | |
} | |
}; // Predicate that tests whether the next token is of the given | |
// type, and if yes, consumes it as a side effect. | |
pp$9.eat = function (type) { | |
if ((this || _global$R).type === type) { | |
this.next(); | |
return true; | |
} else { | |
return false; | |
} | |
}; // Tests whether parsed token is a contextual keyword. | |
pp$9.isContextual = function (name) { | |
return (this || _global$R).type === types$1.name && (this || _global$R).value === name && !(this || _global$R).containsEsc; | |
}; // Consumes contextual keyword if possible. | |
pp$9.eatContextual = function (name) { | |
if (!this.isContextual(name)) { | |
return false; | |
} | |
this.next(); | |
return true; | |
}; // Asserts that following token is given contextual keyword. | |
pp$9.expectContextual = function (name) { | |
if (!this.eatContextual(name)) { | |
this.unexpected(); | |
} | |
}; // Test whether a semicolon can be inserted at the current position. | |
pp$9.canInsertSemicolon = function () { | |
return (this || _global$R).type === types$1.eof || (this || _global$R).type === types$1.braceR || lineBreak.test((this || _global$R).input.slice((this || _global$R).lastTokEnd, (this || _global$R).start)); | |
}; | |
pp$9.insertSemicolon = function () { | |
if (this.canInsertSemicolon()) { | |
if ((this || _global$R).options.onInsertedSemicolon) { | |
(this || _global$R).options.onInsertedSemicolon((this || _global$R).lastTokEnd, (this || _global$R).lastTokEndLoc); | |
} | |
return true; | |
} | |
}; // Consume a semicolon, or, failing that, see if we are allowed to | |
// pretend that there is a semicolon at this position. | |
pp$9.semicolon = function () { | |
if (!this.eat(types$1.semi) && !this.insertSemicolon()) { | |
this.unexpected(); | |
} | |
}; | |
pp$9.afterTrailingComma = function (tokType, notNext) { | |
if ((this || _global$R).type === tokType) { | |
if ((this || _global$R).options.onTrailingComma) { | |
(this || _global$R).options.onTrailingComma((this || _global$R).lastTokStart, (this || _global$R).lastTokStartLoc); | |
} | |
if (!notNext) { | |
this.next(); | |
} | |
return true; | |
} | |
}; // Expect a token of a given type. If found, consume it, otherwise, | |
// raise an unexpected token error. | |
pp$9.expect = function (type) { | |
this.eat(type) || this.unexpected(); | |
}; // Raise an unexpected token error. | |
pp$9.unexpected = function (pos) { | |
this.raise(pos != null ? pos : (this || _global$R).start, "Unexpected token"); | |
}; | |
function DestructuringErrors() { | |
(this || _global$R).shorthandAssign = (this || _global$R).trailingComma = (this || _global$R).parenthesizedAssign = (this || _global$R).parenthesizedBind = (this || _global$R).doubleProto = -1; | |
} | |
pp$9.checkPatternErrors = function (refDestructuringErrors, isAssign) { | |
if (!refDestructuringErrors) { | |
return; | |
} | |
if (refDestructuringErrors.trailingComma > -1) { | |
this.raiseRecoverable(refDestructuringErrors.trailingComma, "Comma is not permitted after the rest element"); | |
} | |
var parens = isAssign ? refDestructuringErrors.parenthesizedAssign : refDestructuringErrors.parenthesizedBind; | |
if (parens > -1) { | |
this.raiseRecoverable(parens, "Parenthesized pattern"); | |
} | |
}; | |
pp$9.checkExpressionErrors = function (refDestructuringErrors, andThrow) { | |
if (!refDestructuringErrors) { | |
return false; | |
} | |
var shorthandAssign = refDestructuringErrors.shorthandAssign; | |
var doubleProto = refDestructuringErrors.doubleProto; | |
if (!andThrow) { | |
return shorthandAssign >= 0 || doubleProto >= 0; | |
} | |
if (shorthandAssign >= 0) { | |
this.raise(shorthandAssign, "Shorthand property assignments are valid only in destructuring patterns"); | |
} | |
if (doubleProto >= 0) { | |
this.raiseRecoverable(doubleProto, "Redefinition of __proto__ property"); | |
} | |
}; | |
pp$9.checkYieldAwaitInDefaultParams = function () { | |
if ((this || _global$R).yieldPos && (!(this || _global$R).awaitPos || (this || _global$R).yieldPos < (this || _global$R).awaitPos)) { | |
this.raise((this || _global$R).yieldPos, "Yield expression cannot be a default value"); | |
} | |
if ((this || _global$R).awaitPos) { | |
this.raise((this || _global$R).awaitPos, "Await expression cannot be a default value"); | |
} | |
}; | |
pp$9.isSimpleAssignTarget = function (expr) { | |
if (expr.type === "ParenthesizedExpression") { | |
return this.isSimpleAssignTarget(expr.expression); | |
} | |
return expr.type === "Identifier" || expr.type === "MemberExpression"; | |
}; | |
var pp$8 = Parser.prototype; // ### Statement parsing | |
// Parse a program. Initializes the parser, reads any number of | |
// statements, and wraps them in a Program node. Optionally takes a | |
// `program` argument. If present, the statements will be appended | |
// to its body instead of creating a new node. | |
pp$8.parseTopLevel = function (node) { | |
var exports = Object.create(null); | |
if (!node.body) { | |
node.body = []; | |
} | |
while ((this || _global$R).type !== types$1.eof) { | |
var stmt = this.parseStatement(null, true, exports); | |
node.body.push(stmt); | |
} | |
if ((this || _global$R).inModule) { | |
for (var i = 0, list = Object.keys((this || _global$R).undefinedExports); i < list.length; i += 1) { | |
var name = list[i]; | |
this.raiseRecoverable((this || _global$R).undefinedExports[name].start, "Export '" + name + "' is not defined"); | |
} | |
} | |
this.adaptDirectivePrologue(node.body); | |
this.next(); | |
node.sourceType = (this || _global$R).options.sourceType; | |
return this.finishNode(node, "Program"); | |
}; | |
var loopLabel = { | |
kind: "loop" | |
}, | |
switchLabel = { | |
kind: "switch" | |
}; | |
pp$8.isLet = function (context) { | |
if ((this || _global$R).options.ecmaVersion < 6 || !this.isContextual("let")) { | |
return false; | |
} | |
skipWhiteSpace.lastIndex = (this || _global$R).pos; | |
var skip = skipWhiteSpace.exec((this || _global$R).input); | |
var next = (this || _global$R).pos + skip[0].length, | |
nextCh = (this || _global$R).input.charCodeAt(next); // For ambiguous cases, determine if a LexicalDeclaration (or only a | |
// Statement) is allowed here. If context is not empty then only a Statement | |
// is allowed. However, `let [` is an explicit negative lookahead for | |
// ExpressionStatement, so special-case it first. | |
if (nextCh === 91 || nextCh === 92 || nextCh > 0xd7ff && nextCh < 0xdc00) { | |
return true; | |
} // '[', '/', astral | |
if (context) { | |
return false; | |
} | |
if (nextCh === 123) { | |
return true; | |
} // '{' | |
if (isIdentifierStart(nextCh, true)) { | |
var pos = next + 1; | |
while (isIdentifierChar(nextCh = (this || _global$R).input.charCodeAt(pos), true)) { | |
++pos; | |
} | |
if (nextCh === 92 || nextCh > 0xd7ff && nextCh < 0xdc00) { | |
return true; | |
} | |
var ident = (this || _global$R).input.slice(next, pos); | |
if (!keywordRelationalOperator.test(ident)) { | |
return true; | |
} | |
} | |
return false; | |
}; // check 'async [no LineTerminator here] function' | |
// - 'async /*foo*/ function' is OK. | |
// - 'async /*\n*/ function' is invalid. | |
pp$8.isAsyncFunction = function () { | |
if ((this || _global$R).options.ecmaVersion < 8 || !this.isContextual("async")) { | |
return false; | |
} | |
skipWhiteSpace.lastIndex = (this || _global$R).pos; | |
var skip = skipWhiteSpace.exec((this || _global$R).input); | |
var next = (this || _global$R).pos + skip[0].length, | |
after; | |
return !lineBreak.test((this || _global$R).input.slice((this || _global$R).pos, next)) && (this || _global$R).input.slice(next, next + 8) === "function" && (next + 8 === (this || _global$R).input.length || !(isIdentifierChar(after = (this || _global$R).input.charCodeAt(next + 8)) || after > 0xd7ff && after < 0xdc00)); | |
}; // Parse a single statement. | |
// | |
// If expecting a statement and finding a slash operator, parse a | |
// regular expression literal. This is to handle cases like | |
// `if (foo) /blah/.exec(foo)`, where looking at the previous token | |
// does not help. | |
pp$8.parseStatement = function (context, topLevel, exports) { | |
var starttype = (this || _global$R).type, | |
node = this.startNode(), | |
kind; | |
if (this.isLet(context)) { | |
starttype = types$1._var; | |
kind = "let"; | |
} // Most types of statements are recognized by the keyword they | |
// start with. Many are trivial to parse, some require a bit of | |
// complexity. | |
switch (starttype) { | |
case types$1._break: | |
case types$1._continue: | |
return this.parseBreakContinueStatement(node, starttype.keyword); | |
case types$1._debugger: | |
return this.parseDebuggerStatement(node); | |
case types$1._do: | |
return this.parseDoStatement(node); | |
case types$1._for: | |
return this.parseForStatement(node); | |
case types$1._function: | |
// Function as sole body of either an if statement or a labeled statement | |
// works, but not when it is part of a labeled statement that is the sole | |
// body of an if statement. | |
if (context && ((this || _global$R).strict || context !== "if" && context !== "label") && (this || _global$R).options.ecmaVersion >= 6) { | |
this.unexpected(); | |
} | |
return this.parseFunctionStatement(node, false, !context); | |
case types$1._class: | |
if (context) { | |
this.unexpected(); | |
} | |
return this.parseClass(node, true); | |
case types$1._if: | |
return this.parseIfStatement(node); | |
case types$1._return: | |
return this.parseReturnStatement(node); | |
case types$1._switch: | |
return this.parseSwitchStatement(node); | |
case types$1._throw: | |
return this.parseThrowStatement(node); | |
case types$1._try: | |
return this.parseTryStatement(node); | |
case types$1._const: | |
case types$1._var: | |
kind = kind || (this || _global$R).value; | |
if (context && kind !== "var") { | |
this.unexpected(); | |
} | |
return this.parseVarStatement(node, kind); | |
case types$1._while: | |
return this.parseWhileStatement(node); | |
case types$1._with: | |
return this.parseWithStatement(node); | |
case types$1.braceL: | |
return this.parseBlock(true, node); | |
case types$1.semi: | |
return this.parseEmptyStatement(node); | |
case types$1._export: | |
case types$1._import: | |
if ((this || _global$R).options.ecmaVersion > 10 && starttype === types$1._import) { | |
skipWhiteSpace.lastIndex = (this || _global$R).pos; | |
var skip = skipWhiteSpace.exec((this || _global$R).input); | |
var next = (this || _global$R).pos + skip[0].length, | |
nextCh = (this || _global$R).input.charCodeAt(next); | |
if (nextCh === 40 || nextCh === 46) // '(' or '.' | |
{ | |
return this.parseExpressionStatement(node, this.parseExpression()); | |
} | |
} | |
if (!(this || _global$R).options.allowImportExportEverywhere) { | |
if (!topLevel) { | |
this.raise((this || _global$R).start, "'import' and 'export' may only appear at the top level"); | |
} | |
if (!(this || _global$R).inModule) { | |
this.raise((this || _global$R).start, "'import' and 'export' may appear only with 'sourceType: module'"); | |
} | |
} | |
return starttype === types$1._import ? this.parseImport(node) : this.parseExport(node, exports); | |
// If the statement does not start with a statement keyword or a | |
// brace, it's an ExpressionStatement or LabeledStatement. We | |
// simply start parsing an expression, and afterwards, if the | |
// next token is a colon and the expression was a simple | |
// Identifier node, we switch to interpreting it as a label. | |
default: | |
if (this.isAsyncFunction()) { | |
if (context) { | |
this.unexpected(); | |
} | |
this.next(); | |
return this.parseFunctionStatement(node, true, !context); | |
} | |
var maybeName = (this || _global$R).value, | |
expr = this.parseExpression(); | |
if (starttype === types$1.name && expr.type === "Identifier" && this.eat(types$1.colon)) { | |
return this.parseLabeledStatement(node, maybeName, expr, context); | |
} else { | |
return this.parseExpressionStatement(node, expr); | |
} | |
} | |
}; | |
pp$8.parseBreakContinueStatement = function (node, keyword) { | |
var isBreak = keyword === "break"; | |
this.next(); | |
if (this.eat(types$1.semi) || this.insertSemicolon()) { | |
node.label = null; | |
} else if ((this || _global$R).type !== types$1.name) { | |
this.unexpected(); | |
} else { | |
node.label = this.parseIdent(); | |
this.semicolon(); | |
} // Verify that there is an actual destination to break or | |
// continue to. | |
var i = 0; | |
for (; i < (this || _global$R).labels.length; ++i) { | |
var lab = (this || _global$R).labels[i]; | |
if (node.label == null || lab.name === node.label.name) { | |
if (lab.kind != null && (isBreak || lab.kind === "loop")) { | |
break; | |
} | |
if (node.label && isBreak) { | |
break; | |
} | |
} | |
} | |
if (i === (this || _global$R).labels.length) { | |
this.raise(node.start, "Unsyntactic " + keyword); | |
} | |
return this.finishNode(node, isBreak ? "BreakStatement" : "ContinueStatement"); | |
}; | |
pp$8.parseDebuggerStatement = function (node) { | |
this.next(); | |
this.semicolon(); | |
return this.finishNode(node, "DebuggerStatement"); | |
}; | |
pp$8.parseDoStatement = function (node) { | |
this.next(); | |
(this || _global$R).labels.push(loopLabel); | |
node.body = this.parseStatement("do"); | |
(this || _global$R).labels.pop(); | |
this.expect(types$1._while); | |
node.test = this.parseParenExpression(); | |
if ((this || _global$R).options.ecmaVersion >= 6) { | |
this.eat(types$1.semi); | |
} else { | |
this.semicolon(); | |
} | |
return this.finishNode(node, "DoWhileStatement"); | |
}; // Disambiguating between a `for` and a `for`/`in` or `for`/`of` | |
// loop is non-trivial. Basically, we have to parse the init `var` | |
// statement or expression, disallowing the `in` operator (see | |
// the second parameter to `parseExpression`), and then check | |
// whether the next token is `in` or `of`. When there is no init | |
// part (semicolon immediately after the opening parenthesis), it | |
// is a regular `for` loop. | |
pp$8.parseForStatement = function (node) { | |
this.next(); | |
var awaitAt = (this || _global$R).options.ecmaVersion >= 9 && (this || _global$R).canAwait && this.eatContextual("await") ? (this || _global$R).lastTokStart : -1; | |
(this || _global$R).labels.push(loopLabel); | |
this.enterScope(0); | |
this.expect(types$1.parenL); | |
if ((this || _global$R).type === types$1.semi) { | |
if (awaitAt > -1) { | |
this.unexpected(awaitAt); | |
} | |
return this.parseFor(node, null); | |
} | |
var isLet = this.isLet(); | |
if ((this || _global$R).type === types$1._var || (this || _global$R).type === types$1._const || isLet) { | |
var init$1 = this.startNode(), | |
kind = isLet ? "let" : (this || _global$R).value; | |
this.next(); | |
this.parseVar(init$1, true, kind); | |
this.finishNode(init$1, "VariableDeclaration"); | |
if (((this || _global$R).type === types$1._in || (this || _global$R).options.ecmaVersion >= 6 && this.isContextual("of")) && init$1.declarations.length === 1) { | |
if ((this || _global$R).options.ecmaVersion >= 9) { | |
if ((this || _global$R).type === types$1._in) { | |
if (awaitAt > -1) { | |
this.unexpected(awaitAt); | |
} | |
} else { | |
node.await = awaitAt > -1; | |
} | |
} | |
return this.parseForIn(node, init$1); | |
} | |
if (awaitAt > -1) { | |
this.unexpected(awaitAt); | |
} | |
return this.parseFor(node, init$1); | |
} | |
var startsWithLet = this.isContextual("let"), | |
isForOf = false; | |
var refDestructuringErrors = new DestructuringErrors(); | |
var init = this.parseExpression(awaitAt > -1 ? "await" : true, refDestructuringErrors); | |
if ((this || _global$R).type === types$1._in || (isForOf = (this || _global$R).options.ecmaVersion >= 6 && this.isContextual("of"))) { | |
if ((this || _global$R).options.ecmaVersion >= 9) { | |
if ((this || _global$R).type === types$1._in) { | |
if (awaitAt > -1) { | |
this.unexpected(awaitAt); | |
} | |
} else { | |
node.await = awaitAt > -1; | |
} | |
} | |
if (startsWithLet && isForOf) { | |
this.raise(init.start, "The left-hand side of a for-of loop may not start with 'let'."); | |
} | |
this.toAssignable(init, false, refDestructuringErrors); | |
this.checkLValPattern(init); | |
return this.parseForIn(node, init); | |
} else { | |
this.checkExpressionErrors(refDestructuringErrors, true); | |
} | |
if (awaitAt > -1) { | |
this.unexpected(awaitAt); | |
} | |
return this.parseFor(node, init); | |
}; | |
pp$8.parseFunctionStatement = function (node, isAsync, declarationPosition) { | |
this.next(); | |
return this.parseFunction(node, FUNC_STATEMENT | (declarationPosition ? 0 : FUNC_HANGING_STATEMENT), false, isAsync); | |
}; | |
pp$8.parseIfStatement = function (node) { | |
this.next(); | |
node.test = this.parseParenExpression(); // allow function declarations in branches, but only in non-strict mode | |
node.consequent = this.parseStatement("if"); | |
node.alternate = this.eat(types$1._else) ? this.parseStatement("if") : null; | |
return this.finishNode(node, "IfStatement"); | |
}; | |
pp$8.parseReturnStatement = function (node) { | |
if (!(this || _global$R).inFunction && !(this || _global$R).options.allowReturnOutsideFunction) { | |
this.raise((this || _global$R).start, "'return' outside of function"); | |
} | |
this.next(); // In `return` (and `break`/`continue`), the keywords with | |
// optional arguments, we eagerly look for a semicolon or the | |
// possibility to insert one. | |
if (this.eat(types$1.semi) || this.insertSemicolon()) { | |
node.argument = null; | |
} else { | |
node.argument = this.parseExpression(); | |
this.semicolon(); | |
} | |
return this.finishNode(node, "ReturnStatement"); | |
}; | |
pp$8.parseSwitchStatement = function (node) { | |
this.next(); | |
node.discriminant = this.parseParenExpression(); | |
node.cases = []; | |
this.expect(types$1.braceL); | |
(this || _global$R).labels.push(switchLabel); | |
this.enterScope(0); // Statements under must be grouped (by label) in SwitchCase | |
// nodes. `cur` is used to keep the node that we are currently | |
// adding statements to. | |
var cur; | |
for (var sawDefault = false; (this || _global$R).type !== types$1.braceR;) { | |
if ((this || _global$R).type === types$1._case || (this || _global$R).type === types$1._default) { | |
var isCase = (this || _global$R).type === types$1._case; | |
if (cur) { | |
this.finishNode(cur, "SwitchCase"); | |
} | |
node.cases.push(cur = this.startNode()); | |
cur.consequent = []; | |
this.next(); | |
if (isCase) { | |
cur.test = this.parseExpression(); | |
} else { | |
if (sawDefault) { | |
this.raiseRecoverable((this || _global$R).lastTokStart, "Multiple default clauses"); | |
} | |
sawDefault = true; | |
cur.test = null; | |
} | |
this.expect(types$1.colon); | |
} else { | |
if (!cur) { | |
this.unexpected(); | |
} | |
cur.consequent.push(this.parseStatement(null)); | |
} | |
} | |
this.exitScope(); | |
if (cur) { | |
this.finishNode(cur, "SwitchCase"); | |
} | |
this.next(); // Closing brace | |
(this || _global$R).labels.pop(); | |
return this.finishNode(node, "SwitchStatement"); | |
}; | |
pp$8.parseThrowStatement = function (node) { | |
this.next(); | |
if (lineBreak.test((this || _global$R).input.slice((this || _global$R).lastTokEnd, (this || _global$R).start))) { | |
this.raise((this || _global$R).lastTokEnd, "Illegal newline after throw"); | |
} | |
node.argument = this.parseExpression(); | |
this.semicolon(); | |
return this.finishNode(node, "ThrowStatement"); | |
}; // Reused empty array added for node fields that are always empty. | |
var empty$1 = []; | |
pp$8.parseTryStatement = function (node) { | |
this.next(); | |
node.block = this.parseBlock(); | |
node.handler = null; | |
if ((this || _global$R).type === types$1._catch) { | |
var clause = this.startNode(); | |
this.next(); | |
if (this.eat(types$1.parenL)) { | |
clause.param = this.parseBindingAtom(); | |
var simple = clause.param.type === "Identifier"; | |
this.enterScope(simple ? SCOPE_SIMPLE_CATCH : 0); | |
this.checkLValPattern(clause.param, simple ? BIND_SIMPLE_CATCH : BIND_LEXICAL); | |
this.expect(types$1.parenR); | |
} else { | |
if ((this || _global$R).options.ecmaVersion < 10) { | |
this.unexpected(); | |
} | |
clause.param = null; | |
this.enterScope(0); | |
} | |
clause.body = this.parseBlock(false); | |
this.exitScope(); | |
node.handler = this.finishNode(clause, "CatchClause"); | |
} | |
node.finalizer = this.eat(types$1._finally) ? this.parseBlock() : null; | |
if (!node.handler && !node.finalizer) { | |
this.raise(node.start, "Missing catch or finally clause"); | |
} | |
return this.finishNode(node, "TryStatement"); | |
}; | |
pp$8.parseVarStatement = function (node, kind) { | |
this.next(); | |
this.parseVar(node, false, kind); | |
this.semicolon(); | |
return this.finishNode(node, "VariableDeclaration"); | |
}; | |
pp$8.parseWhileStatement = function (node) { | |
this.next(); | |
node.test = this.parseParenExpression(); | |
(this || _global$R).labels.push(loopLabel); | |
node.body = this.parseStatement("while"); | |
(this || _global$R).labels.pop(); | |
return this.finishNode(node, "WhileStatement"); | |
}; | |
pp$8.parseWithStatement = function (node) { | |
if ((this || _global$R).strict) { | |
this.raise((this || _global$R).start, "'with' in strict mode"); | |
} | |
this.next(); | |
node.object = this.parseParenExpression(); | |
node.body = this.parseStatement("with"); | |
return this.finishNode(node, "WithStatement"); | |
}; | |
pp$8.parseEmptyStatement = function (node) { | |
this.next(); | |
return this.finishNode(node, "EmptyStatement"); | |
}; | |
pp$8.parseLabeledStatement = function (node, maybeName, expr, context) { | |
for (var i$1 = 0, list = (this || _global$R).labels; i$1 < list.length; i$1 += 1) { | |
var label = list[i$1]; | |
if (label.name === maybeName) { | |
this.raise(expr.start, "Label '" + maybeName + "' is already declared"); | |
} | |
} | |
var kind = (this || _global$R).type.isLoop ? "loop" : (this || _global$R).type === types$1._switch ? "switch" : null; | |
for (var i = (this || _global$R).labels.length - 1; i >= 0; i--) { | |
var label$1 = (this || _global$R).labels[i]; | |
if (label$1.statementStart === node.start) { | |
// Update information about previous labels on this node | |
label$1.statementStart = (this || _global$R).start; | |
label$1.kind = kind; | |
} else { | |
break; | |
} | |
} | |
(this || _global$R).labels.push({ | |
name: maybeName, | |
kind: kind, | |
statementStart: (this || _global$R).start | |
}); | |
node.body = this.parseStatement(context ? context.indexOf("label") === -1 ? context + "label" : context : "label"); | |
(this || _global$R).labels.pop(); | |
node.label = expr; | |
return this.finishNode(node, "LabeledStatement"); | |
}; | |
pp$8.parseExpressionStatement = function (node, expr) { | |
node.expression = expr; | |
this.semicolon(); | |
return this.finishNode(node, "ExpressionStatement"); | |
}; // Parse a semicolon-enclosed block of statements, handling `"use | |
// strict"` declarations when `allowStrict` is true (used for | |
// function bodies). | |
pp$8.parseBlock = function (createNewLexicalScope, node, exitStrict) { | |
if (createNewLexicalScope === void 0) createNewLexicalScope = true; | |
if (node === void 0) node = this.startNode(); | |
node.body = []; | |
this.expect(types$1.braceL); | |
if (createNewLexicalScope) { | |
this.enterScope(0); | |
} | |
while ((this || _global$R).type !== types$1.braceR) { | |
var stmt = this.parseStatement(null); | |
node.body.push(stmt); | |
} | |
if (exitStrict) { | |
(this || _global$R).strict = false; | |
} | |
this.next(); | |
if (createNewLexicalScope) { | |
this.exitScope(); | |
} | |
return this.finishNode(node, "BlockStatement"); | |
}; // Parse a regular `for` loop. The disambiguation code in | |
// `parseStatement` will already have parsed the init statement or | |
// expression. | |
pp$8.parseFor = function (node, init) { | |
node.init = init; | |
this.expect(types$1.semi); | |
node.test = (this || _global$R).type === types$1.semi ? null : this.parseExpression(); | |
this.expect(types$1.semi); | |
node.update = (this || _global$R).type === types$1.parenR ? null : this.parseExpression(); | |
this.expect(types$1.parenR); | |
node.body = this.parseStatement("for"); | |
this.exitScope(); | |
(this || _global$R).labels.pop(); | |
return this.finishNode(node, "ForStatement"); | |
}; // Parse a `for`/`in` and `for`/`of` loop, which are almost | |
// same from parser's perspective. | |
pp$8.parseForIn = function (node, init) { | |
var isForIn = (this || _global$R).type === types$1._in; | |
this.next(); | |
if (init.type === "VariableDeclaration" && init.declarations[0].init != null && (!isForIn || (this || _global$R).options.ecmaVersion < 8 || (this || _global$R).strict || init.kind !== "var" || init.declarations[0].id.type !== "Identifier")) { | |
this.raise(init.start, (isForIn ? "for-in" : "for-of") + " loop variable declaration may not have an initializer"); | |
} | |
node.left = init; | |
node.right = isForIn ? this.parseExpression() : this.parseMaybeAssign(); | |
this.expect(types$1.parenR); | |
node.body = this.parseStatement("for"); | |
this.exitScope(); | |
(this || _global$R).labels.pop(); | |
return this.finishNode(node, isForIn ? "ForInStatement" : "ForOfStatement"); | |
}; // Parse a list of variable declarations. | |
pp$8.parseVar = function (node, isFor, kind) { | |
node.declarations = []; | |
node.kind = kind; | |
for (;;) { | |
var decl = this.startNode(); | |
this.parseVarId(decl, kind); | |
if (this.eat(types$1.eq)) { | |
decl.init = this.parseMaybeAssign(isFor); | |
} else if (kind === "const" && !((this || _global$R).type === types$1._in || (this || _global$R).options.ecmaVersion >= 6 && this.isContextual("of"))) { | |
this.unexpected(); | |
} else if (decl.id.type !== "Identifier" && !(isFor && ((this || _global$R).type === types$1._in || this.isContextual("of")))) { | |
this.raise((this || _global$R).lastTokEnd, "Complex binding patterns require an initialization value"); | |
} else { | |
decl.init = null; | |
} | |
node.declarations.push(this.finishNode(decl, "VariableDeclarator")); | |
if (!this.eat(types$1.comma)) { | |
break; | |
} | |
} | |
return node; | |
}; | |
pp$8.parseVarId = function (decl, kind) { | |
decl.id = this.parseBindingAtom(); | |
this.checkLValPattern(decl.id, kind === "var" ? BIND_VAR : BIND_LEXICAL, false); | |
}; | |
var FUNC_STATEMENT = 1, | |
FUNC_HANGING_STATEMENT = 2, | |
FUNC_NULLABLE_ID = 4; // Parse a function declaration or literal (depending on the | |
// `statement & FUNC_STATEMENT`). | |
// Remove `allowExpressionBody` for 7.0.0, as it is only called with false | |
pp$8.parseFunction = function (node, statement, allowExpressionBody, isAsync, forInit) { | |
this.initFunction(node); | |
if ((this || _global$R).options.ecmaVersion >= 9 || (this || _global$R).options.ecmaVersion >= 6 && !isAsync) { | |
if ((this || _global$R).type === types$1.star && statement & FUNC_HANGING_STATEMENT) { | |
this.unexpected(); | |
} | |
node.generator = this.eat(types$1.star); | |
} | |
if ((this || _global$R).options.ecmaVersion >= 8) { | |
node.async = !!isAsync; | |
} | |
if (statement & FUNC_STATEMENT) { | |
node.id = statement & FUNC_NULLABLE_ID && (this || _global$R).type !== types$1.name ? null : this.parseIdent(); | |
if (node.id && !(statement & FUNC_HANGING_STATEMENT)) // If it is a regular function declaration in sloppy mode, then it is | |
// subject to Annex B semantics (BIND_FUNCTION). Otherwise, the binding | |
// mode depends on properties of the current scope (see | |
// treatFunctionsAsVar). | |
{ | |
this.checkLValSimple(node.id, (this || _global$R).strict || node.generator || node.async ? (this || _global$R).treatFunctionsAsVar ? BIND_VAR : BIND_LEXICAL : BIND_FUNCTION); | |
} | |
} | |
var oldYieldPos = (this || _global$R).yieldPos, | |
oldAwaitPos = (this || _global$R).awaitPos, | |
oldAwaitIdentPos = (this || _global$R).awaitIdentPos; | |
(this || _global$R).yieldPos = 0; | |
(this || _global$R).awaitPos = 0; | |
(this || _global$R).awaitIdentPos = 0; | |
this.enterScope(functionFlags(node.async, node.generator)); | |
if (!(statement & FUNC_STATEMENT)) { | |
node.id = (this || _global$R).type === types$1.name ? this.parseIdent() : null; | |
} | |
this.parseFunctionParams(node); | |
this.parseFunctionBody(node, allowExpressionBody, false, forInit); | |
(this || _global$R).yieldPos = oldYieldPos; | |
(this || _global$R).awaitPos = oldAwaitPos; | |
(this || _global$R).awaitIdentPos = oldAwaitIdentPos; | |
return this.finishNode(node, statement & FUNC_STATEMENT ? "FunctionDeclaration" : "FunctionExpression"); | |
}; | |
pp$8.parseFunctionParams = function (node) { | |
this.expect(types$1.parenL); | |
node.params = this.parseBindingList(types$1.parenR, false, (this || _global$R).options.ecmaVersion >= 8); | |
this.checkYieldAwaitInDefaultParams(); | |
}; // Parse a class declaration or literal (depending on the | |
// `isStatement` parameter). | |
pp$8.parseClass = function (node, isStatement) { | |
this.next(); // ecma-262 14.6 Class Definitions | |
// A class definition is always strict mode code. | |
var oldStrict = (this || _global$R).strict; | |
(this || _global$R).strict = true; | |
this.parseClassId(node, isStatement); | |
this.parseClassSuper(node); | |
var privateNameMap = this.enterClassBody(); | |
var classBody = this.startNode(); | |
var hadConstructor = false; | |
classBody.body = []; | |
this.expect(types$1.braceL); | |
while ((this || _global$R).type !== types$1.braceR) { | |
var element = this.parseClassElement(node.superClass !== null); | |
if (element) { | |
classBody.body.push(element); | |
if (element.type === "MethodDefinition" && element.kind === "constructor") { | |
if (hadConstructor) { | |
this.raise(element.start, "Duplicate constructor in the same class"); | |
} | |
hadConstructor = true; | |
} else if (element.key && element.key.type === "PrivateIdentifier" && isPrivateNameConflicted(privateNameMap, element)) { | |
this.raiseRecoverable(element.key.start, "Identifier '#" + element.key.name + "' has already been declared"); | |
} | |
} | |
} | |
(this || _global$R).strict = oldStrict; | |
this.next(); | |
node.body = this.finishNode(classBody, "ClassBody"); | |
this.exitClassBody(); | |
return this.finishNode(node, isStatement ? "ClassDeclaration" : "ClassExpression"); | |
}; | |
pp$8.parseClassElement = function (constructorAllowsSuper) { | |
if (this.eat(types$1.semi)) { | |
return null; | |
} | |
var ecmaVersion = (this || _global$R).options.ecmaVersion; | |
var node = this.startNode(); | |
var keyName = ""; | |
var isGenerator = false; | |
var isAsync = false; | |
var kind = "method"; | |
var isStatic = false; | |
if (this.eatContextual("static")) { | |
// Parse static init block | |
if (ecmaVersion >= 13 && this.eat(types$1.braceL)) { | |
this.parseClassStaticBlock(node); | |
return node; | |
} | |
if (this.isClassElementNameStart() || (this || _global$R).type === types$1.star) { | |
isStatic = true; | |
} else { | |
keyName = "static"; | |
} | |
} | |
node.static = isStatic; | |
if (!keyName && ecmaVersion >= 8 && this.eatContextual("async")) { | |
if ((this.isClassElementNameStart() || (this || _global$R).type === types$1.star) && !this.canInsertSemicolon()) { | |
isAsync = true; | |
} else { | |
keyName = "async"; | |
} | |
} | |
if (!keyName && (ecmaVersion >= 9 || !isAsync) && this.eat(types$1.star)) { | |
isGenerator = true; | |
} | |
if (!keyName && !isAsync && !isGenerator) { | |
var lastValue = (this || _global$R).value; | |
if (this.eatContextual("get") || this.eatContextual("set")) { | |
if (this.isClassElementNameStart()) { | |
kind = lastValue; | |
} else { | |
keyName = lastValue; | |
} | |
} | |
} // Parse element name | |
if (keyName) { | |
// 'async', 'get', 'set', or 'static' were not a keyword contextually. | |
// The last token is any of those. Make it the element name. | |
node.computed = false; | |
node.key = this.startNodeAt((this || _global$R).lastTokStart, (this || _global$R).lastTokStartLoc); | |
node.key.name = keyName; | |
this.finishNode(node.key, "Identifier"); | |
} else { | |
this.parseClassElementName(node); | |
} // Parse element value | |
if (ecmaVersion < 13 || (this || _global$R).type === types$1.parenL || kind !== "method" || isGenerator || isAsync) { | |
var isConstructor = !node.static && checkKeyName(node, "constructor"); | |
var allowsDirectSuper = isConstructor && constructorAllowsSuper; // Couldn't move this check into the 'parseClassMethod' method for backward compatibility. | |
if (isConstructor && kind !== "method") { | |
this.raise(node.key.start, "Constructor can't have get/set modifier"); | |
} | |
node.kind = isConstructor ? "constructor" : kind; | |
this.parseClassMethod(node, isGenerator, isAsync, allowsDirectSuper); | |
} else { | |
this.parseClassField(node); | |
} | |
return node; | |
}; | |
pp$8.isClassElementNameStart = function () { | |
return (this || _global$R).type === types$1.name || (this || _global$R).type === types$1.privateId || (this || _global$R).type === types$1.num || (this || _global$R).type === types$1.string || (this || _global$R).type === types$1.bracketL || (this || _global$R).type.keyword; | |
}; | |
pp$8.parseClassElementName = function (element) { | |
if ((this || _global$R).type === types$1.privateId) { | |
if ((this || _global$R).value === "constructor") { | |
this.raise((this || _global$R).start, "Classes can't have an element named '#constructor'"); | |
} | |
element.computed = false; | |
element.key = this.parsePrivateIdent(); | |
} else { | |
this.parsePropertyName(element); | |
} | |
}; | |
pp$8.parseClassMethod = function (method, isGenerator, isAsync, allowsDirectSuper) { | |
// Check key and flags | |
var key = method.key; | |
if (method.kind === "constructor") { | |
if (isGenerator) { | |
this.raise(key.start, "Constructor can't be a generator"); | |
} | |
if (isAsync) { | |
this.raise(key.start, "Constructor can't be an async method"); | |
} | |
} else if (method.static && checkKeyName(method, "prototype")) { | |
this.raise(key.start, "Classes may not have a static property named prototype"); | |
} // Parse value | |
var value = method.value = this.parseMethod(isGenerator, isAsync, allowsDirectSuper); // Check value | |
if (method.kind === "get" && value.params.length !== 0) { | |
this.raiseRecoverable(value.start, "getter should have no params"); | |
} | |
if (method.kind === "set" && value.params.length !== 1) { | |
this.raiseRecoverable(value.start, "setter should have exactly one param"); | |
} | |
if (method.kind === "set" && value.params[0].type === "RestElement") { | |
this.raiseRecoverable(value.params[0].start, "Setter cannot use rest params"); | |
} | |
return this.finishNode(method, "MethodDefinition"); | |
}; | |
pp$8.parseClassField = function (field) { | |
if (checkKeyName(field, "constructor")) { | |
this.raise(field.key.start, "Classes can't have a field named 'constructor'"); | |
} else if (field.static && checkKeyName(field, "prototype")) { | |
this.raise(field.key.start, "Classes can't have a static field named 'prototype'"); | |
} | |
if (this.eat(types$1.eq)) { | |
// To raise SyntaxError if 'arguments' exists in the initializer. | |
var scope = this.currentThisScope(); | |
var inClassFieldInit = scope.inClassFieldInit; | |
scope.inClassFieldInit = true; | |
field.value = this.parseMaybeAssign(); | |
scope.inClassFieldInit = inClassFieldInit; | |
} else { | |
field.value = null; | |
} | |
this.semicolon(); | |
return this.finishNode(field, "PropertyDefinition"); | |
}; | |
pp$8.parseClassStaticBlock = function (node) { | |
node.body = []; | |
var oldLabels = (this || _global$R).labels; | |
(this || _global$R).labels = []; | |
this.enterScope(SCOPE_CLASS_STATIC_BLOCK | SCOPE_SUPER); | |
while ((this || _global$R).type !== types$1.braceR) { | |
var stmt = this.parseStatement(null); | |
node.body.push(stmt); | |
} | |
this.next(); | |
this.exitScope(); | |
(this || _global$R).labels = oldLabels; | |
return this.finishNode(node, "StaticBlock"); | |
}; | |
pp$8.parseClassId = function (node, isStatement) { | |
if ((this || _global$R).type === types$1.name) { | |
node.id = this.parseIdent(); | |
if (isStatement) { | |
this.checkLValSimple(node.id, BIND_LEXICAL, false); | |
} | |
} else { | |
if (isStatement === true) { | |
this.unexpected(); | |
} | |
node.id = null; | |
} | |
}; | |
pp$8.parseClassSuper = function (node) { | |
node.superClass = this.eat(types$1._extends) ? this.parseExprSubscripts(false) : null; | |
}; | |
pp$8.enterClassBody = function () { | |
var element = { | |
declared: Object.create(null), | |
used: [] | |
}; | |
(this || _global$R).privateNameStack.push(element); | |
return element.declared; | |
}; | |
pp$8.exitClassBody = function () { | |
var ref = (this || _global$R).privateNameStack.pop(); | |
var declared = ref.declared; | |
var used = ref.used; | |
var len = (this || _global$R).privateNameStack.length; | |
var parent = len === 0 ? null : (this || _global$R).privateNameStack[len - 1]; | |
for (var i = 0; i < used.length; ++i) { | |
var id = used[i]; | |
if (!hasOwn(declared, id.name)) { | |
if (parent) { | |
parent.used.push(id); | |
} else { | |
this.raiseRecoverable(id.start, "Private field '#" + id.name + "' must be declared in an enclosing class"); | |
} | |
} | |
} | |
}; | |
function isPrivateNameConflicted(privateNameMap, element) { | |
var name = element.key.name; | |
var curr = privateNameMap[name]; | |
var next = "true"; | |
if (element.type === "MethodDefinition" && (element.kind === "get" || element.kind === "set")) { | |
next = (element.static ? "s" : "i") + element.kind; | |
} // `class { get #a(){}; static set #a(_){} }` is also conflict. | |
if (curr === "iget" && next === "iset" || curr === "iset" && next === "iget" || curr === "sget" && next === "sset" || curr === "sset" && next === "sget") { | |
privateNameMap[name] = "true"; | |
return false; | |
} else if (!curr) { | |
privateNameMap[name] = next; | |
return false; | |
} else { | |
return true; | |
} | |
} | |
function checkKeyName(node, name) { | |
var computed = node.computed; | |
var key = node.key; | |
return !computed && (key.type === "Identifier" && key.name === name || key.type === "Literal" && key.value === name); | |
} // Parses module export declaration. | |
pp$8.parseExport = function (node, exports) { | |
this.next(); // export * from '...' | |
if (this.eat(types$1.star)) { | |
if ((this || _global$R).options.ecmaVersion >= 11) { | |
if (this.eatContextual("as")) { | |
node.exported = this.parseModuleExportName(); | |
this.checkExport(exports, node.exported.name, (this || _global$R).lastTokStart); | |
} else { | |
node.exported = null; | |
} | |
} | |
this.expectContextual("from"); | |
if ((this || _global$R).type !== types$1.string) { | |
this.unexpected(); | |
} | |
node.source = this.parseExprAtom(); | |
this.semicolon(); | |
return this.finishNode(node, "ExportAllDeclaration"); | |
} | |
if (this.eat(types$1._default)) { | |
// export default ... | |
this.checkExport(exports, "default", (this || _global$R).lastTokStart); | |
var isAsync; | |
if ((this || _global$R).type === types$1._function || (isAsync = this.isAsyncFunction())) { | |
var fNode = this.startNode(); | |
this.next(); | |
if (isAsync) { | |
this.next(); | |
} | |
node.declaration = this.parseFunction(fNode, FUNC_STATEMENT | FUNC_NULLABLE_ID, false, isAsync); | |
} else if ((this || _global$R).type === types$1._class) { | |
var cNode = this.startNode(); | |
node.declaration = this.parseClass(cNode, "nullableID"); | |
} else { | |
node.declaration = this.parseMaybeAssign(); | |
this.semicolon(); | |
} | |
return this.finishNode(node, "ExportDefaultDeclaration"); | |
} // export var|const|let|function|class ... | |
if (this.shouldParseExportStatement()) { | |
node.declaration = this.parseStatement(null); | |
if (node.declaration.type === "VariableDeclaration") { | |
this.checkVariableExport(exports, node.declaration.declarations); | |
} else { | |
this.checkExport(exports, node.declaration.id.name, node.declaration.id.start); | |
} | |
node.specifiers = []; | |
node.source = null; | |
} else { | |
// export { x, y as z } [from '...'] | |
node.declaration = null; | |
node.specifiers = this.parseExportSpecifiers(exports); | |
if (this.eatContextual("from")) { | |
if ((this || _global$R).type !== types$1.string) { | |
this.unexpected(); | |
} | |
node.source = this.parseExprAtom(); | |
} else { | |
for (var i = 0, list = node.specifiers; i < list.length; i += 1) { | |
// check for keywords used as local names | |
var spec = list[i]; | |
this.checkUnreserved(spec.local); // check if export is defined | |
this.checkLocalExport(spec.local); | |
if (spec.local.type === "Literal") { | |
this.raise(spec.local.start, "A string literal cannot be used as an exported binding without `from`."); | |
} | |
} | |
node.source = null; | |
} | |
this.semicolon(); | |
} | |
return this.finishNode(node, "ExportNamedDeclaration"); | |
}; | |
pp$8.checkExport = function (exports, name, pos) { | |
if (!exports) { | |
return; | |
} | |
if (hasOwn(exports, name)) { | |
this.raiseRecoverable(pos, "Duplicate export '" + name + "'"); | |
} | |
exports[name] = true; | |
}; | |
pp$8.checkPatternExport = function (exports, pat) { | |
var type = pat.type; | |
if (type === "Identifier") { | |
this.checkExport(exports, pat.name, pat.start); | |
} else if (type === "ObjectPattern") { | |
for (var i = 0, list = pat.properties; i < list.length; i += 1) { | |
var prop = list[i]; | |
this.checkPatternExport(exports, prop); | |
} | |
} else if (type === "ArrayPattern") { | |
for (var i$1 = 0, list$1 = pat.elements; i$1 < list$1.length; i$1 += 1) { | |
var elt = list$1[i$1]; | |
if (elt) { | |
this.checkPatternExport(exports, elt); | |
} | |
} | |
} else if (type === "Property") { | |
this.checkPatternExport(exports, pat.value); | |
} else if (type === "AssignmentPattern") { | |
this.checkPatternExport(exports, pat.left); | |
} else if (type === "RestElement") { | |
this.checkPatternExport(exports, pat.argument); | |
} else if (type === "ParenthesizedExpression") { | |
this.checkPatternExport(exports, pat.expression); | |
} | |
}; | |
pp$8.checkVariableExport = function (exports, decls) { | |
if (!exports) { | |
return; | |
} | |
for (var i = 0, list = decls; i < list.length; i += 1) { | |
var decl = list[i]; | |
this.checkPatternExport(exports, decl.id); | |
} | |
}; | |
pp$8.shouldParseExportStatement = function () { | |
return (this || _global$R).type.keyword === "var" || (this || _global$R).type.keyword === "const" || (this || _global$R).type.keyword === "class" || (this || _global$R).type.keyword === "function" || this.isLet() || this.isAsyncFunction(); | |
}; // Parses a comma-separated list of module exports. | |
pp$8.parseExportSpecifiers = function (exports) { | |
var nodes = [], | |
first = true; // export { x, y as z } [from '...'] | |
this.expect(types$1.braceL); | |
while (!this.eat(types$1.braceR)) { | |
if (!first) { | |
this.expect(types$1.comma); | |
if (this.afterTrailingComma(types$1.braceR)) { | |
break; | |
} | |
} else { | |
first = false; | |
} | |
var node = this.startNode(); | |
node.local = this.parseModuleExportName(); | |
node.exported = this.eatContextual("as") ? this.parseModuleExportName() : node.local; | |
this.checkExport(exports, node.exported[node.exported.type === "Identifier" ? "name" : "value"], node.exported.start); | |
nodes.push(this.finishNode(node, "ExportSpecifier")); | |
} | |
return nodes; | |
}; // Parses import declaration. | |
pp$8.parseImport = function (node) { | |
this.next(); // import '...' | |
if ((this || _global$R).type === types$1.string) { | |
node.specifiers = empty$1; | |
node.source = this.parseExprAtom(); | |
} else { | |
node.specifiers = this.parseImportSpecifiers(); | |
this.expectContextual("from"); | |
node.source = (this || _global$R).type === types$1.string ? this.parseExprAtom() : this.unexpected(); | |
} | |
this.semicolon(); | |
return this.finishNode(node, "ImportDeclaration"); | |
}; // Parses a comma-separated list of module imports. | |
pp$8.parseImportSpecifiers = function () { | |
var nodes = [], | |
first = true; | |
if ((this || _global$R).type === types$1.name) { | |
// import defaultObj, { x, y as z } from '...' | |
var node = this.startNode(); | |
node.local = this.parseIdent(); | |
this.checkLValSimple(node.local, BIND_LEXICAL); | |
nodes.push(this.finishNode(node, "ImportDefaultSpecifier")); | |
if (!this.eat(types$1.comma)) { | |
return nodes; | |
} | |
} | |
if ((this || _global$R).type === types$1.star) { | |
var node$1 = this.startNode(); | |
this.next(); | |
this.expectContextual("as"); | |
node$1.local = this.parseIdent(); | |
this.checkLValSimple(node$1.local, BIND_LEXICAL); | |
nodes.push(this.finishNode(node$1, "ImportNamespaceSpecifier")); | |
return nodes; | |
} | |
this.expect(types$1.braceL); | |
while (!this.eat(types$1.braceR)) { | |
if (!first) { | |
this.expect(types$1.comma); | |
if (this.afterTrailingComma(types$1.braceR)) { | |
break; | |
} | |
} else { | |
first = false; | |
} | |
var node$2 = this.startNode(); | |
node$2.imported = this.parseModuleExportName(); | |
if (this.eatContextual("as")) { | |
node$2.local = this.parseIdent(); | |
} else { | |
this.checkUnreserved(node$2.imported); | |
node$2.local = node$2.imported; | |
} | |
this.checkLValSimple(node$2.local, BIND_LEXICAL); | |
nodes.push(this.finishNode(node$2, "ImportSpecifier")); | |
} | |
return nodes; | |
}; | |
pp$8.parseModuleExportName = function () { | |
if ((this || _global$R).options.ecmaVersion >= 13 && (this || _global$R).type === types$1.string) { | |
var stringLiteral = this.parseLiteral((this || _global$R).value); | |
if (loneSurrogate.test(stringLiteral.value)) { | |
this.raise(stringLiteral.start, "An export name cannot include a lone surrogate."); | |
} | |
return stringLiteral; | |
} | |
return this.parseIdent(true); | |
}; // Set `ExpressionStatement#directive` property for directive prologues. | |
pp$8.adaptDirectivePrologue = function (statements) { | |
for (var i = 0; i < statements.length && this.isDirectiveCandidate(statements[i]); ++i) { | |
statements[i].directive = statements[i].expression.raw.slice(1, -1); | |
} | |
}; | |
pp$8.isDirectiveCandidate = function (statement) { | |
return statement.type === "ExpressionStatement" && statement.expression.type === "Literal" && typeof statement.expression.value === "string" && ( // Reject parenthesized strings. | |
(this || _global$R).input[statement.start] === "\"" || (this || _global$R).input[statement.start] === "'"); | |
}; | |
var pp$7 = Parser.prototype; // Convert existing expression atom to assignable pattern | |
// if possible. | |
pp$7.toAssignable = function (node, isBinding, refDestructuringErrors) { | |
if ((this || _global$R).options.ecmaVersion >= 6 && node) { | |
switch (node.type) { | |
case "Identifier": | |
if ((this || _global$R).inAsync && node.name === "await") { | |
this.raise(node.start, "Cannot use 'await' as identifier inside an async function"); | |
} | |
break; | |
case "ObjectPattern": | |
case "ArrayPattern": | |
case "AssignmentPattern": | |
case "RestElement": | |
break; | |
case "ObjectExpression": | |
node.type = "ObjectPattern"; | |
if (refDestructuringErrors) { | |
this.checkPatternErrors(refDestructuringErrors, true); | |
} | |
for (var i = 0, list = node.properties; i < list.length; i += 1) { | |
var prop = list[i]; | |
this.toAssignable(prop, isBinding); // Early error: | |
// AssignmentRestProperty[Yield, Await] : | |
// `...` DestructuringAssignmentTarget[Yield, Await] | |
// | |
// It is a Syntax Error if |DestructuringAssignmentTarget| is an |ArrayLiteral| or an |ObjectLiteral|. | |
if (prop.type === "RestElement" && (prop.argument.type === "ArrayPattern" || prop.argument.type === "ObjectPattern")) { | |
this.raise(prop.argument.start, "Unexpected token"); | |
} | |
} | |
break; | |
case "Property": | |
// AssignmentProperty has type === "Property" | |
if (node.kind !== "init") { | |
this.raise(node.key.start, "Object pattern can't contain getter or setter"); | |
} | |
this.toAssignable(node.value, isBinding); | |
break; | |
case "ArrayExpression": | |
node.type = "ArrayPattern"; | |
if (refDestructuringErrors) { | |
this.checkPatternErrors(refDestructuringErrors, true); | |
} | |
this.toAssignableList(node.elements, isBinding); | |
break; | |
case "SpreadElement": | |
node.type = "RestElement"; | |
this.toAssignable(node.argument, isBinding); | |
if (node.argument.type === "AssignmentPattern") { | |
this.raise(node.argument.start, "Rest elements cannot have a default value"); | |
} | |
break; | |
case "AssignmentExpression": | |
if (node.operator !== "=") { | |
this.raise(node.left.end, "Only '=' operator can be used for specifying default value."); | |
} | |
node.type = "AssignmentPattern"; | |
delete node.operator; | |
this.toAssignable(node.left, isBinding); | |
break; | |
case "ParenthesizedExpression": | |
this.toAssignable(node.expression, isBinding, refDestructuringErrors); | |
break; | |
case "ChainExpression": | |
this.raiseRecoverable(node.start, "Optional chaining cannot appear in left-hand side"); | |
break; | |
case "MemberExpression": | |
if (!isBinding) { | |
break; | |
} | |
default: | |
this.raise(node.start, "Assigning to rvalue"); | |
} | |
} else if (refDestructuringErrors) { | |
this.checkPatternErrors(refDestructuringErrors, true); | |
} | |
return node; | |
}; // Convert list of expression atoms to binding list. | |
pp$7.toAssignableList = function (exprList, isBinding) { | |
var end = exprList.length; | |
for (var i = 0; i < end; i++) { | |
var elt = exprList[i]; | |
if (elt) { | |
this.toAssignable(elt, isBinding); | |
} | |
} | |
if (end) { | |
var last = exprList[end - 1]; | |
if ((this || _global$R).options.ecmaVersion === 6 && isBinding && last && last.type === "RestElement" && last.argument.type !== "Identifier") { | |
this.unexpected(last.argument.start); | |
} | |
} | |
return exprList; | |
}; // Parses spread element. | |
pp$7.parseSpread = function (refDestructuringErrors) { | |
var node = this.startNode(); | |
this.next(); | |
node.argument = this.parseMaybeAssign(false, refDestructuringErrors); | |
return this.finishNode(node, "SpreadElement"); | |
}; | |
pp$7.parseRestBinding = function () { | |
var node = this.startNode(); | |
this.next(); // RestElement inside of a function parameter must be an identifier | |
if ((this || _global$R).options.ecmaVersion === 6 && (this || _global$R).type !== types$1.name) { | |
this.unexpected(); | |
} | |
node.argument = this.parseBindingAtom(); | |
return this.finishNode(node, "RestElement"); | |
}; // Parses lvalue (assignable) atom. | |
pp$7.parseBindingAtom = function () { | |
if ((this || _global$R).options.ecmaVersion >= 6) { | |
switch ((this || _global$R).type) { | |
case types$1.bracketL: | |
var node = this.startNode(); | |
this.next(); | |
node.elements = this.parseBindingList(types$1.bracketR, true, true); | |
return this.finishNode(node, "ArrayPattern"); | |
case types$1.braceL: | |
return this.parseObj(true); | |
} | |
} | |
return this.parseIdent(); | |
}; | |
pp$7.parseBindingList = function (close, allowEmpty, allowTrailingComma) { | |
var elts = [], | |
first = true; | |
while (!this.eat(close)) { | |
if (first) { | |
first = false; | |
} else { | |
this.expect(types$1.comma); | |
} | |
if (allowEmpty && (this || _global$R).type === types$1.comma) { | |
elts.push(null); | |
} else if (allowTrailingComma && this.afterTrailingComma(close)) { | |
break; | |
} else if ((this || _global$R).type === types$1.ellipsis) { | |
var rest = this.parseRestBinding(); | |
this.parseBindingListItem(rest); | |
elts.push(rest); | |
if ((this || _global$R).type === types$1.comma) { | |
this.raise((this || _global$R).start, "Comma is not permitted after the rest element"); | |
} | |
this.expect(close); | |
break; | |
} else { | |
var elem = this.parseMaybeDefault((this || _global$R).start, (this || _global$R).startLoc); | |
this.parseBindingListItem(elem); | |
elts.push(elem); | |
} | |
} | |
return elts; | |
}; | |
pp$7.parseBindingListItem = function (param) { | |
return param; | |
}; // Parses assignment pattern around given atom if possible. | |
pp$7.parseMaybeDefault = function (startPos, startLoc, left) { | |
left = left || this.parseBindingAtom(); | |
if ((this || _global$R).options.ecmaVersion < 6 || !this.eat(types$1.eq)) { | |
return left; | |
} | |
var node = this.startNodeAt(startPos, startLoc); | |
node.left = left; | |
node.right = this.parseMaybeAssign(); | |
return this.finishNode(node, "AssignmentPattern"); | |
}; // The following three functions all verify that a node is an lvalue — | |
// something that can be bound, or assigned to. In order to do so, they perform | |
// a variety of checks: | |
// | |
// - Check that none of the bound/assigned-to identifiers are reserved words. | |
// - Record name declarations for bindings in the appropriate scope. | |
// - Check duplicate argument names, if checkClashes is set. | |
// | |
// If a complex binding pattern is encountered (e.g., object and array | |
// destructuring), the entire pattern is recursively checked. | |
// | |
// There are three versions of checkLVal*() appropriate for different | |
// circumstances: | |
// | |
// - checkLValSimple() shall be used if the syntactic construct supports | |
// nothing other than identifiers and member expressions. Parenthesized | |
// expressions are also correctly handled. This is generally appropriate for | |
// constructs for which the spec says | |
// | |
// > It is a Syntax Error if AssignmentTargetType of [the production] is not | |
// > simple. | |
// | |
// It is also appropriate for checking if an identifier is valid and not | |
// defined elsewhere, like import declarations or function/class identifiers. | |
// | |
// Examples where this is used include: | |
// a += …; | |
// import a from '…'; | |
// where a is the node to be checked. | |
// | |
// - checkLValPattern() shall be used if the syntactic construct supports | |
// anything checkLValSimple() supports, as well as object and array | |
// destructuring patterns. This is generally appropriate for constructs for | |
// which the spec says | |
// | |
// > It is a Syntax Error if [the production] is neither an ObjectLiteral nor | |
// > an ArrayLiteral and AssignmentTargetType of [the production] is not | |
// > simple. | |
// | |
// Examples where this is used include: | |
// (a = …); | |
// const a = …; | |
// try { … } catch (a) { … } | |
// where a is the node to be checked. | |
// | |
// - checkLValInnerPattern() shall be used if the syntactic construct supports | |
// anything checkLValPattern() supports, as well as default assignment | |
// patterns, rest elements, and other constructs that may appear within an | |
// object or array destructuring pattern. | |
// | |
// As a special case, function parameters also use checkLValInnerPattern(), | |
// as they also support defaults and rest constructs. | |
// | |
// These functions deliberately support both assignment and binding constructs, | |
// as the logic for both is exceedingly similar. If the node is the target of | |
// an assignment, then bindingType should be set to BIND_NONE. Otherwise, it | |
// should be set to the appropriate BIND_* constant, like BIND_VAR or | |
// BIND_LEXICAL. | |
// | |
// If the function is called with a non-BIND_NONE bindingType, then | |
// additionally a checkClashes object may be specified to allow checking for | |
// duplicate argument names. checkClashes is ignored if the provided construct | |
// is an assignment (i.e., bindingType is BIND_NONE). | |
pp$7.checkLValSimple = function (expr, bindingType, checkClashes) { | |
if (bindingType === void 0) bindingType = BIND_NONE; | |
var isBind = bindingType !== BIND_NONE; | |
switch (expr.type) { | |
case "Identifier": | |
if ((this || _global$R).strict && (this || _global$R).reservedWordsStrictBind.test(expr.name)) { | |
this.raiseRecoverable(expr.start, (isBind ? "Binding " : "Assigning to ") + expr.name + " in strict mode"); | |
} | |
if (isBind) { | |
if (bindingType === BIND_LEXICAL && expr.name === "let") { | |
this.raiseRecoverable(expr.start, "let is disallowed as a lexically bound name"); | |
} | |
if (checkClashes) { | |
if (hasOwn(checkClashes, expr.name)) { | |
this.raiseRecoverable(expr.start, "Argument name clash"); | |
} | |
checkClashes[expr.name] = true; | |
} | |
if (bindingType !== BIND_OUTSIDE) { | |
this.declareName(expr.name, bindingType, expr.start); | |
} | |
} | |
break; | |
case "ChainExpression": | |
this.raiseRecoverable(expr.start, "Optional chaining cannot appear in left-hand side"); | |
break; | |
case "MemberExpression": | |
if (isBind) { | |
this.raiseRecoverable(expr.start, "Binding member expression"); | |
} | |
break; | |
case "ParenthesizedExpression": | |
if (isBind) { | |
this.raiseRecoverable(expr.start, "Binding parenthesized expression"); | |
} | |
return this.checkLValSimple(expr.expression, bindingType, checkClashes); | |
default: | |
this.raise(expr.start, (isBind ? "Binding" : "Assigning to") + " rvalue"); | |
} | |
}; | |
pp$7.checkLValPattern = function (expr, bindingType, checkClashes) { | |
if (bindingType === void 0) bindingType = BIND_NONE; | |
switch (expr.type) { | |
case "ObjectPattern": | |
for (var i = 0, list = expr.properties; i < list.length; i += 1) { | |
var prop = list[i]; | |
this.checkLValInnerPattern(prop, bindingType, checkClashes); | |
} | |
break; | |
case "ArrayPattern": | |
for (var i$1 = 0, list$1 = expr.elements; i$1 < list$1.length; i$1 += 1) { | |
var elem = list$1[i$1]; | |
if (elem) { | |
this.checkLValInnerPattern(elem, bindingType, checkClashes); | |
} | |
} | |
break; | |
default: | |
this.checkLValSimple(expr, bindingType, checkClashes); | |
} | |
}; | |
pp$7.checkLValInnerPattern = function (expr, bindingType, checkClashes) { | |
if (bindingType === void 0) bindingType = BIND_NONE; | |
switch (expr.type) { | |
case "Property": | |
// AssignmentProperty has type === "Property" | |
this.checkLValInnerPattern(expr.value, bindingType, checkClashes); | |
break; | |
case "AssignmentPattern": | |
this.checkLValPattern(expr.left, bindingType, checkClashes); | |
break; | |
case "RestElement": | |
this.checkLValPattern(expr.argument, bindingType, checkClashes); | |
break; | |
default: | |
this.checkLValPattern(expr, bindingType, checkClashes); | |
} | |
}; // The algorithm used to determine whether a regexp can appear at a | |
var TokContext = function TokContext(token, isExpr, preserveSpace, override, generator) { | |
(this || _global$R).token = token; | |
(this || _global$R).isExpr = !!isExpr; | |
(this || _global$R).preserveSpace = !!preserveSpace; | |
(this || _global$R).override = override; | |
(this || _global$R).generator = !!generator; | |
}; | |
var types = { | |
b_stat: new TokContext("{", false), | |
b_expr: new TokContext("{", true), | |
b_tmpl: new TokContext("${", false), | |
p_stat: new TokContext("(", false), | |
p_expr: new TokContext("(", true), | |
q_tmpl: new TokContext("`", true, true, function (p) { | |
return p.tryReadTemplateToken(); | |
}), | |
f_stat: new TokContext("function", false), | |
f_expr: new TokContext("function", true), | |
f_expr_gen: new TokContext("function", true, false, null, true), | |
f_gen: new TokContext("function", false, false, null, true) | |
}; | |
var pp$6 = Parser.prototype; | |
pp$6.initialContext = function () { | |
return [types.b_stat]; | |
}; | |
pp$6.curContext = function () { | |
return (this || _global$R).context[(this || _global$R).context.length - 1]; | |
}; | |
pp$6.braceIsBlock = function (prevType) { | |
var parent = this.curContext(); | |
if (parent === types.f_expr || parent === types.f_stat) { | |
return true; | |
} | |
if (prevType === types$1.colon && (parent === types.b_stat || parent === types.b_expr)) { | |
return !parent.isExpr; | |
} // The check for `tt.name && exprAllowed` detects whether we are | |
// after a `yield` or `of` construct. See the `updateContext` for | |
// `tt.name`. | |
if (prevType === types$1._return || prevType === types$1.name && (this || _global$R).exprAllowed) { | |
return lineBreak.test((this || _global$R).input.slice((this || _global$R).lastTokEnd, (this || _global$R).start)); | |
} | |
if (prevType === types$1._else || prevType === types$1.semi || prevType === types$1.eof || prevType === types$1.parenR || prevType === types$1.arrow) { | |
return true; | |
} | |
if (prevType === types$1.braceL) { | |
return parent === types.b_stat; | |
} | |
if (prevType === types$1._var || prevType === types$1._const || prevType === types$1.name) { | |
return false; | |
} | |
return !(this || _global$R).exprAllowed; | |
}; | |
pp$6.inGeneratorContext = function () { | |
for (var i = (this || _global$R).context.length - 1; i >= 1; i--) { | |
var context = (this || _global$R).context[i]; | |
if (context.token === "function") { | |
return context.generator; | |
} | |
} | |
return false; | |
}; | |
pp$6.updateContext = function (prevType) { | |
var update, | |
type = (this || _global$R).type; | |
if (type.keyword && prevType === types$1.dot) { | |
(this || _global$R).exprAllowed = false; | |
} else if (update = type.updateContext) { | |
update.call(this || _global$R, prevType); | |
} else { | |
(this || _global$R).exprAllowed = type.beforeExpr; | |
} | |
}; // Used to handle egde case when token context could not be inferred correctly in tokenize phase | |
pp$6.overrideContext = function (tokenCtx) { | |
if (this.curContext() !== tokenCtx) { | |
(this || _global$R).context[(this || _global$R).context.length - 1] = tokenCtx; | |
} | |
}; // Token-specific context update code | |
types$1.parenR.updateContext = types$1.braceR.updateContext = function () { | |
if ((this || _global$R).context.length === 1) { | |
(this || _global$R).exprAllowed = true; | |
return; | |
} | |
var out = (this || _global$R).context.pop(); | |
if (out === types.b_stat && this.curContext().token === "function") { | |
out = (this || _global$R).context.pop(); | |
} | |
(this || _global$R).exprAllowed = !out.isExpr; | |
}; | |
types$1.braceL.updateContext = function (prevType) { | |
(this || _global$R).context.push(this.braceIsBlock(prevType) ? types.b_stat : types.b_expr); | |
(this || _global$R).exprAllowed = true; | |
}; | |
types$1.dollarBraceL.updateContext = function () { | |
(this || _global$R).context.push(types.b_tmpl); | |
(this || _global$R).exprAllowed = true; | |
}; | |
types$1.parenL.updateContext = function (prevType) { | |
var statementParens = prevType === types$1._if || prevType === types$1._for || prevType === types$1._with || prevType === types$1._while; | |
(this || _global$R).context.push(statementParens ? types.p_stat : types.p_expr); | |
(this || _global$R).exprAllowed = true; | |
}; | |
types$1.incDec.updateContext = function () {// tokExprAllowed stays unchanged | |
}; | |
types$1._function.updateContext = types$1._class.updateContext = function (prevType) { | |
if (prevType.beforeExpr && prevType !== types$1._else && !(prevType === types$1.semi && this.curContext() !== types.p_stat) && !(prevType === types$1._return && lineBreak.test((this || _global$R).input.slice((this || _global$R).lastTokEnd, (this || _global$R).start))) && !((prevType === types$1.colon || prevType === types$1.braceL) && this.curContext() === types.b_stat)) { | |
(this || _global$R).context.push(types.f_expr); | |
} else { | |
(this || _global$R).context.push(types.f_stat); | |
} | |
(this || _global$R).exprAllowed = false; | |
}; | |
types$1.backQuote.updateContext = function () { | |
if (this.curContext() === types.q_tmpl) { | |
(this || _global$R).context.pop(); | |
} else { | |
(this || _global$R).context.push(types.q_tmpl); | |
} | |
(this || _global$R).exprAllowed = false; | |
}; | |
types$1.star.updateContext = function (prevType) { | |
if (prevType === types$1._function) { | |
var index = (this || _global$R).context.length - 1; | |
if ((this || _global$R).context[index] === types.f_expr) { | |
(this || _global$R).context[index] = types.f_expr_gen; | |
} else { | |
(this || _global$R).context[index] = types.f_gen; | |
} | |
} | |
(this || _global$R).exprAllowed = true; | |
}; | |
types$1.name.updateContext = function (prevType) { | |
var allowed = false; | |
if ((this || _global$R).options.ecmaVersion >= 6 && prevType !== types$1.dot) { | |
if ((this || _global$R).value === "of" && !(this || _global$R).exprAllowed || (this || _global$R).value === "yield" && this.inGeneratorContext()) { | |
allowed = true; | |
} | |
} | |
(this || _global$R).exprAllowed = allowed; | |
}; // A recursive descent parser operates by defining functions for all | |
var pp$5 = Parser.prototype; // Check if property name clashes with already added. | |
// Object/class getters and setters are not allowed to clash — | |
// either with each other or with an init property — and in | |
// strict mode, init properties are also not allowed to be repeated. | |
pp$5.checkPropClash = function (prop, propHash, refDestructuringErrors) { | |
if ((this || _global$R).options.ecmaVersion >= 9 && prop.type === "SpreadElement") { | |
return; | |
} | |
if ((this || _global$R).options.ecmaVersion >= 6 && (prop.computed || prop.method || prop.shorthand)) { | |
return; | |
} | |
var key = prop.key; | |
var name; | |
switch (key.type) { | |
case "Identifier": | |
name = key.name; | |
break; | |
case "Literal": | |
name = String(key.value); | |
break; | |
default: | |
return; | |
} | |
var kind = prop.kind; | |
if ((this || _global$R).options.ecmaVersion >= 6) { | |
if (name === "__proto__" && kind === "init") { | |
if (propHash.proto) { | |
if (refDestructuringErrors) { | |
if (refDestructuringErrors.doubleProto < 0) { | |
refDestructuringErrors.doubleProto = key.start; | |
} | |
} else { | |
this.raiseRecoverable(key.start, "Redefinition of __proto__ property"); | |
} | |
} | |
propHash.proto = true; | |
} | |
return; | |
} | |
name = "$" + name; | |
var other = propHash[name]; | |
if (other) { | |
var redefinition; | |
if (kind === "init") { | |
redefinition = (this || _global$R).strict && other.init || other.get || other.set; | |
} else { | |
redefinition = other.init || other[kind]; | |
} | |
if (redefinition) { | |
this.raiseRecoverable(key.start, "Redefinition of property"); | |
} | |
} else { | |
other = propHash[name] = { | |
init: false, | |
get: false, | |
set: false | |
}; | |
} | |
other[kind] = true; | |
}; // ### Expression parsing | |
// These nest, from the most general expression type at the top to | |
// 'atomic', nondivisible expression types at the bottom. Most of | |
// the functions will simply let the function(s) below them parse, | |
// and, *if* the syntactic construct they handle is present, wrap | |
// the AST node that the inner parser gave them in another node. | |
// Parse a full expression. The optional arguments are used to | |
// forbid the `in` operator (in for loops initalization expressions) | |
// and provide reference for storing '=' operator inside shorthand | |
// property assignment in contexts where both object expression | |
// and object pattern might appear (so it's possible to raise | |
// delayed syntax error at correct position). | |
pp$5.parseExpression = function (forInit, refDestructuringErrors) { | |
var startPos = (this || _global$R).start, | |
startLoc = (this || _global$R).startLoc; | |
var expr = this.parseMaybeAssign(forInit, refDestructuringErrors); | |
if ((this || _global$R).type === types$1.comma) { | |
var node = this.startNodeAt(startPos, startLoc); | |
node.expressions = [expr]; | |
while (this.eat(types$1.comma)) { | |
node.expressions.push(this.parseMaybeAssign(forInit, refDestructuringErrors)); | |
} | |
return this.finishNode(node, "SequenceExpression"); | |
} | |
return expr; | |
}; // Parse an assignment expression. This includes applications of | |
// operators like `+=`. | |
pp$5.parseMaybeAssign = function (forInit, refDestructuringErrors, afterLeftParse) { | |
if (this.isContextual("yield")) { | |
if ((this || _global$R).inGenerator) { | |
return this.parseYield(forInit); | |
} // The tokenizer will assume an expression is allowed after | |
// `yield`, but this isn't that kind of yield | |
else { | |
(this || _global$R).exprAllowed = false; | |
} | |
} | |
var ownDestructuringErrors = false, | |
oldParenAssign = -1, | |
oldTrailingComma = -1, | |
oldDoubleProto = -1; | |
if (refDestructuringErrors) { | |
oldParenAssign = refDestructuringErrors.parenthesizedAssign; | |
oldTrailingComma = refDestructuringErrors.trailingComma; | |
oldDoubleProto = refDestructuringErrors.doubleProto; | |
refDestructuringErrors.parenthesizedAssign = refDestructuringErrors.trailingComma = -1; | |
} else { | |
refDestructuringErrors = new DestructuringErrors(); | |
ownDestructuringErrors = true; | |
} | |
var startPos = (this || _global$R).start, | |
startLoc = (this || _global$R).startLoc; | |
if ((this || _global$R).type === types$1.parenL || (this || _global$R).type === types$1.name) { | |
(this || _global$R).potentialArrowAt = (this || _global$R).start; | |
(this || _global$R).potentialArrowInForAwait = forInit === "await"; | |
} | |
var left = this.parseMaybeConditional(forInit, refDestructuringErrors); | |
if (afterLeftParse) { | |
left = afterLeftParse.call(this || _global$R, left, startPos, startLoc); | |
} | |
if ((this || _global$R).type.isAssign) { | |
var node = this.startNodeAt(startPos, startLoc); | |
node.operator = (this || _global$R).value; | |
if ((this || _global$R).type === types$1.eq) { | |
left = this.toAssignable(left, false, refDestructuringErrors); | |
} | |
if (!ownDestructuringErrors) { | |
refDestructuringErrors.parenthesizedAssign = refDestructuringErrors.trailingComma = refDestructuringErrors.doubleProto = -1; | |
} | |
if (refDestructuringErrors.shorthandAssign >= left.start) { | |
refDestructuringErrors.shorthandAssign = -1; | |
} // reset because shorthand default was used correctly | |
if ((this || _global$R).type === types$1.eq) { | |
this.checkLValPattern(left); | |
} else { | |
this.checkLValSimple(left); | |
} | |
node.left = left; | |
this.next(); | |
node.right = this.parseMaybeAssign(forInit); | |
if (oldDoubleProto > -1) { | |
refDestructuringErrors.doubleProto = oldDoubleProto; | |
} | |
return this.finishNode(node, "AssignmentExpression"); | |
} else { | |
if (ownDestructuringErrors) { | |
this.checkExpressionErrors(refDestructuringErrors, true); | |
} | |
} | |
if (oldParenAssign > -1) { | |
refDestructuringErrors.parenthesizedAssign = oldParenAssign; | |
} | |
if (oldTrailingComma > -1) { | |
refDestructuringErrors.trailingComma = oldTrailingComma; | |
} | |
return left; | |
}; // Parse a ternary conditional (`?:`) operator. | |
pp$5.parseMaybeConditional = function (forInit, refDestructuringErrors) { | |
var startPos = (this || _global$R).start, | |
startLoc = (this || _global$R).startLoc; | |
var expr = this.parseExprOps(forInit, refDestructuringErrors); | |
if (this.checkExpressionErrors(refDestructuringErrors)) { | |
return expr; | |
} | |
if (this.eat(types$1.question)) { | |
var node = this.startNodeAt(startPos, startLoc); | |
node.test = expr; | |
node.consequent = this.parseMaybeAssign(); | |
this.expect(types$1.colon); | |
node.alternate = this.parseMaybeAssign(forInit); | |
return this.finishNode(node, "ConditionalExpression"); | |
} | |
return expr; | |
}; // Start the precedence parser. | |
pp$5.parseExprOps = function (forInit, refDestructuringErrors) { | |
var startPos = (this || _global$R).start, | |
startLoc = (this || _global$R).startLoc; | |
var expr = this.parseMaybeUnary(refDestructuringErrors, false, false, forInit); | |
if (this.checkExpressionErrors(refDestructuringErrors)) { | |
return expr; | |
} | |
return expr.start === startPos && expr.type === "ArrowFunctionExpression" ? expr : this.parseExprOp(expr, startPos, startLoc, -1, forInit); | |
}; // Parse binary operators with the operator precedence parsing | |
// algorithm. `left` is the left-hand side of the operator. | |
// `minPrec` provides context that allows the function to stop and | |
// defer further parser to one of its callers when it encounters an | |
// operator that has a lower precedence than the set it is parsing. | |
pp$5.parseExprOp = function (left, leftStartPos, leftStartLoc, minPrec, forInit) { | |
var prec = (this || _global$R).type.binop; | |
if (prec != null && (!forInit || (this || _global$R).type !== types$1._in)) { | |
if (prec > minPrec) { | |
var logical = (this || _global$R).type === types$1.logicalOR || (this || _global$R).type === types$1.logicalAND; | |
var coalesce = (this || _global$R).type === types$1.coalesce; | |
if (coalesce) { | |
// Handle the precedence of `tt.coalesce` as equal to the range of logical expressions. | |
// In other words, `node.right` shouldn't contain logical expressions in order to check the mixed error. | |
prec = types$1.logicalAND.binop; | |
} | |
var op = (this || _global$R).value; | |
this.next(); | |
var startPos = (this || _global$R).start, | |
startLoc = (this || _global$R).startLoc; | |
var right = this.parseExprOp(this.parseMaybeUnary(null, false, false, forInit), startPos, startLoc, prec, forInit); | |
var node = this.buildBinary(leftStartPos, leftStartLoc, left, right, op, logical || coalesce); | |
if (logical && (this || _global$R).type === types$1.coalesce || coalesce && ((this || _global$R).type === types$1.logicalOR || (this || _global$R).type === types$1.logicalAND)) { | |
this.raiseRecoverable((this || _global$R).start, "Logical expressions and coalesce expressions cannot be mixed. Wrap either by parentheses"); | |
} | |
return this.parseExprOp(node, leftStartPos, leftStartLoc, minPrec, forInit); | |
} | |
} | |
return left; | |
}; | |
pp$5.buildBinary = function (startPos, startLoc, left, right, op, logical) { | |
if (right.type === "PrivateIdentifier") { | |
this.raise(right.start, "Private identifier can only be left side of binary expression"); | |
} | |
var node = this.startNodeAt(startPos, startLoc); | |
node.left = left; | |
node.operator = op; | |
node.right = right; | |
return this.finishNode(node, logical ? "LogicalExpression" : "BinaryExpression"); | |
}; // Parse unary operators, both prefix and postfix. | |
pp$5.parseMaybeUnary = function (refDestructuringErrors, sawUnary, incDec, forInit) { | |
var startPos = (this || _global$R).start, | |
startLoc = (this || _global$R).startLoc, | |
expr; | |
if (this.isContextual("await") && (this || _global$R).canAwait) { | |
expr = this.parseAwait(forInit); | |
sawUnary = true; | |
} else if ((this || _global$R).type.prefix) { | |
var node = this.startNode(), | |
update = (this || _global$R).type === types$1.incDec; | |
node.operator = (this || _global$R).value; | |
node.prefix = true; | |
this.next(); | |
node.argument = this.parseMaybeUnary(null, true, update, forInit); | |
this.checkExpressionErrors(refDestructuringErrors, true); | |
if (update) { | |
this.checkLValSimple(node.argument); | |
} else if ((this || _global$R).strict && node.operator === "delete" && node.argument.type === "Identifier") { | |
this.raiseRecoverable(node.start, "Deleting local variable in strict mode"); | |
} else if (node.operator === "delete" && isPrivateFieldAccess(node.argument)) { | |
this.raiseRecoverable(node.start, "Private fields can not be deleted"); | |
} else { | |
sawUnary = true; | |
} | |
expr = this.finishNode(node, update ? "UpdateExpression" : "UnaryExpression"); | |
} else if (!sawUnary && (this || _global$R).type === types$1.privateId) { | |
if (forInit || (this || _global$R).privateNameStack.length === 0) { | |
this.unexpected(); | |
} | |
expr = this.parsePrivateIdent(); // only could be private fields in 'in', such as #x in obj | |
if ((this || _global$R).type !== types$1._in) { | |
this.unexpected(); | |
} | |
} else { | |
expr = this.parseExprSubscripts(refDestructuringErrors, forInit); | |
if (this.checkExpressionErrors(refDestructuringErrors)) { | |
return expr; | |
} | |
while ((this || _global$R).type.postfix && !this.canInsertSemicolon()) { | |
var node$1 = this.startNodeAt(startPos, startLoc); | |
node$1.operator = (this || _global$R).value; | |
node$1.prefix = false; | |
node$1.argument = expr; | |
this.checkLValSimple(expr); | |
this.next(); | |
expr = this.finishNode(node$1, "UpdateExpression"); | |
} | |
} | |
if (!incDec && this.eat(types$1.starstar)) { | |
if (sawUnary) { | |
this.unexpected((this || _global$R).lastTokStart); | |
} else { | |
return this.buildBinary(startPos, startLoc, expr, this.parseMaybeUnary(null, false, false, forInit), "**", false); | |
} | |
} else { | |
return expr; | |
} | |
}; | |
function isPrivateFieldAccess(node) { | |
return node.type === "MemberExpression" && node.property.type === "PrivateIdentifier" || node.type === "ChainExpression" && isPrivateFieldAccess(node.expression); | |
} // Parse call, dot, and `[]`-subscript expressions. | |
pp$5.parseExprSubscripts = function (refDestructuringErrors, forInit) { | |
var startPos = (this || _global$R).start, | |
startLoc = (this || _global$R).startLoc; | |
var expr = this.parseExprAtom(refDestructuringErrors, forInit); | |
if (expr.type === "ArrowFunctionExpression" && (this || _global$R).input.slice((this || _global$R).lastTokStart, (this || _global$R).lastTokEnd) !== ")") { | |
return expr; | |
} | |
var result = this.parseSubscripts(expr, startPos, startLoc, false, forInit); | |
if (refDestructuringErrors && result.type === "MemberExpression") { | |
if (refDestructuringErrors.parenthesizedAssign >= result.start) { | |
refDestructuringErrors.parenthesizedAssign = -1; | |
} | |
if (refDestructuringErrors.parenthesizedBind >= result.start) { | |
refDestructuringErrors.parenthesizedBind = -1; | |
} | |
if (refDestructuringErrors.trailingComma >= result.start) { | |
refDestructuringErrors.trailingComma = -1; | |
} | |
} | |
return result; | |
}; | |
pp$5.parseSubscripts = function (base, startPos, startLoc, noCalls, forInit) { | |
var maybeAsyncArrow = (this || _global$R).options.ecmaVersion >= 8 && base.type === "Identifier" && base.name === "async" && (this || _global$R).lastTokEnd === base.end && !this.canInsertSemicolon() && base.end - base.start === 5 && (this || _global$R).potentialArrowAt === base.start; | |
var optionalChained = false; | |
while (true) { | |
var element = this.parseSubscript(base, startPos, startLoc, noCalls, maybeAsyncArrow, optionalChained, forInit); | |
if (element.optional) { | |
optionalChained = true; | |
} | |
if (element === base || element.type === "ArrowFunctionExpression") { | |
if (optionalChained) { | |
var chainNode = this.startNodeAt(startPos, startLoc); | |
chainNode.expression = element; | |
element = this.finishNode(chainNode, "ChainExpression"); | |
} | |
return element; | |
} | |
base = element; | |
} | |
}; | |
pp$5.parseSubscript = function (base, startPos, startLoc, noCalls, maybeAsyncArrow, optionalChained, forInit) { | |
var optionalSupported = (this || _global$R).options.ecmaVersion >= 11; | |
var optional = optionalSupported && this.eat(types$1.questionDot); | |
if (noCalls && optional) { | |
this.raise((this || _global$R).lastTokStart, "Optional chaining cannot appear in the callee of new expressions"); | |
} | |
var computed = this.eat(types$1.bracketL); | |
if (computed || optional && (this || _global$R).type !== types$1.parenL && (this || _global$R).type !== types$1.backQuote || this.eat(types$1.dot)) { | |
var node = this.startNodeAt(startPos, startLoc); | |
node.object = base; | |
if (computed) { | |
node.property = this.parseExpression(); | |
this.expect(types$1.bracketR); | |
} else if ((this || _global$R).type === types$1.privateId && base.type !== "Super") { | |
node.property = this.parsePrivateIdent(); | |
} else { | |
node.property = this.parseIdent((this || _global$R).options.allowReserved !== "never"); | |
} | |
node.computed = !!computed; | |
if (optionalSupported) { | |
node.optional = optional; | |
} | |
base = this.finishNode(node, "MemberExpression"); | |
} else if (!noCalls && this.eat(types$1.parenL)) { | |
var refDestructuringErrors = new DestructuringErrors(), | |
oldYieldPos = (this || _global$R).yieldPos, | |
oldAwaitPos = (this || _global$R).awaitPos, | |
oldAwaitIdentPos = (this || _global$R).awaitIdentPos; | |
(this || _global$R).yieldPos = 0; | |
(this || _global$R).awaitPos = 0; | |
(this || _global$R).awaitIdentPos = 0; | |
var exprList = this.parseExprList(types$1.parenR, (this || _global$R).options.ecmaVersion >= 8, false, refDestructuringErrors); | |
if (maybeAsyncArrow && !optional && !this.canInsertSemicolon() && this.eat(types$1.arrow)) { | |
this.checkPatternErrors(refDestructuringErrors, false); | |
this.checkYieldAwaitInDefaultParams(); | |
if ((this || _global$R).awaitIdentPos > 0) { | |
this.raise((this || _global$R).awaitIdentPos, "Cannot use 'await' as identifier inside an async function"); | |
} | |
(this || _global$R).yieldPos = oldYieldPos; | |
(this || _global$R).awaitPos = oldAwaitPos; | |
(this || _global$R).awaitIdentPos = oldAwaitIdentPos; | |
return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), exprList, true, forInit); | |
} | |
this.checkExpressionErrors(refDestructuringErrors, true); | |
(this || _global$R).yieldPos = oldYieldPos || (this || _global$R).yieldPos; | |
(this || _global$R).awaitPos = oldAwaitPos || (this || _global$R).awaitPos; | |
(this || _global$R).awaitIdentPos = oldAwaitIdentPos || (this || _global$R).awaitIdentPos; | |
var node$1 = this.startNodeAt(startPos, startLoc); | |
node$1.callee = base; | |
node$1.arguments = exprList; | |
if (optionalSupported) { | |
node$1.optional = optional; | |
} | |
base = this.finishNode(node$1, "CallExpression"); | |
} else if ((this || _global$R).type === types$1.backQuote) { | |
if (optional || optionalChained) { | |
this.raise((this || _global$R).start, "Optional chaining cannot appear in the tag of tagged template expressions"); | |
} | |
var node$2 = this.startNodeAt(startPos, startLoc); | |
node$2.tag = base; | |
node$2.quasi = this.parseTemplate({ | |
isTagged: true | |
}); | |
base = this.finishNode(node$2, "TaggedTemplateExpression"); | |
} | |
return base; | |
}; // Parse an atomic expression — either a single token that is an | |
// expression, an expression started by a keyword like `function` or | |
// `new`, or an expression wrapped in punctuation like `()`, `[]`, | |
// or `{}`. | |
pp$5.parseExprAtom = function (refDestructuringErrors, forInit) { | |
// If a division operator appears in an expression position, the | |
// tokenizer got confused, and we force it to read a regexp instead. | |
if ((this || _global$R).type === types$1.slash) { | |
this.readRegexp(); | |
} | |
var node, | |
canBeArrow = (this || _global$R).potentialArrowAt === (this || _global$R).start; | |
switch ((this || _global$R).type) { | |
case types$1._super: | |
if (!(this || _global$R).allowSuper) { | |
this.raise((this || _global$R).start, "'super' keyword outside a method"); | |
} | |
node = this.startNode(); | |
this.next(); | |
if ((this || _global$R).type === types$1.parenL && !(this || _global$R).allowDirectSuper) { | |
this.raise(node.start, "super() call outside constructor of a subclass"); | |
} // The `super` keyword can appear at below: | |
// SuperProperty: | |
// super [ Expression ] | |
// super . IdentifierName | |
// SuperCall: | |
// super ( Arguments ) | |
if ((this || _global$R).type !== types$1.dot && (this || _global$R).type !== types$1.bracketL && (this || _global$R).type !== types$1.parenL) { | |
this.unexpected(); | |
} | |
return this.finishNode(node, "Super"); | |
case types$1._this: | |
node = this.startNode(); | |
this.next(); | |
return this.finishNode(node, "ThisExpression"); | |
case types$1.name: | |
var startPos = (this || _global$R).start, | |
startLoc = (this || _global$R).startLoc, | |
containsEsc = (this || _global$R).containsEsc; | |
var id = this.parseIdent(false); | |
if ((this || _global$R).options.ecmaVersion >= 8 && !containsEsc && id.name === "async" && !this.canInsertSemicolon() && this.eat(types$1._function)) { | |
this.overrideContext(types.f_expr); | |
return this.parseFunction(this.startNodeAt(startPos, startLoc), 0, false, true, forInit); | |
} | |
if (canBeArrow && !this.canInsertSemicolon()) { | |
if (this.eat(types$1.arrow)) { | |
return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), [id], false, forInit); | |
} | |
if ((this || _global$R).options.ecmaVersion >= 8 && id.name === "async" && (this || _global$R).type === types$1.name && !containsEsc && (!(this || _global$R).potentialArrowInForAwait || (this || _global$R).value !== "of" || (this || _global$R).containsEsc)) { | |
id = this.parseIdent(false); | |
if (this.canInsertSemicolon() || !this.eat(types$1.arrow)) { | |
this.unexpected(); | |
} | |
return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), [id], true, forInit); | |
} | |
} | |
return id; | |
case types$1.regexp: | |
var value = (this || _global$R).value; | |
node = this.parseLiteral(value.value); | |
node.regex = { | |
pattern: value.pattern, | |
flags: value.flags | |
}; | |
return node; | |
case types$1.num: | |
case types$1.string: | |
return this.parseLiteral((this || _global$R).value); | |
case types$1._null: | |
case types$1._true: | |
case types$1._false: | |
node = this.startNode(); | |
node.value = (this || _global$R).type === types$1._null ? null : (this || _global$R).type === types$1._true; | |
node.raw = (this || _global$R).type.keyword; | |
this.next(); | |
return this.finishNode(node, "Literal"); | |
case types$1.parenL: | |
var start = (this || _global$R).start, | |
expr = this.parseParenAndDistinguishExpression(canBeArrow, forInit); | |
if (refDestructuringErrors) { | |
if (refDestructuringErrors.parenthesizedAssign < 0 && !this.isSimpleAssignTarget(expr)) { | |
refDestructuringErrors.parenthesizedAssign = start; | |
} | |
if (refDestructuringErrors.parenthesizedBind < 0) { | |
refDestructuringErrors.parenthesizedBind = start; | |
} | |
} | |
return expr; | |
case types$1.bracketL: | |
node = this.startNode(); | |
this.next(); | |
node.elements = this.parseExprList(types$1.bracketR, true, true, refDestructuringErrors); | |
return this.finishNode(node, "ArrayExpression"); | |
case types$1.braceL: | |
this.overrideContext(types.b_expr); | |
return this.parseObj(false, refDestructuringErrors); | |
case types$1._function: | |
node = this.startNode(); | |
this.next(); | |
return this.parseFunction(node, 0); | |
case types$1._class: | |
return this.parseClass(this.startNode(), false); | |
case types$1._new: | |
return this.parseNew(); | |
case types$1.backQuote: | |
return this.parseTemplate(); | |
case types$1._import: | |
if ((this || _global$R).options.ecmaVersion >= 11) { | |
return this.parseExprImport(); | |
} else { | |
return this.unexpected(); | |
} | |
default: | |
this.unexpected(); | |
} | |
}; | |
pp$5.parseExprImport = function () { | |
var node = this.startNode(); // Consume `import` as an identifier for `import.meta`. | |
// Because `this.parseIdent(true)` doesn't check escape sequences, it needs the check of `this.containsEsc`. | |
if ((this || _global$R).containsEsc) { | |
this.raiseRecoverable((this || _global$R).start, "Escape sequence in keyword import"); | |
} | |
var meta = this.parseIdent(true); | |
switch ((this || _global$R).type) { | |
case types$1.parenL: | |
return this.parseDynamicImport(node); | |
case types$1.dot: | |
node.meta = meta; | |
return this.parseImportMeta(node); | |
default: | |
this.unexpected(); | |
} | |
}; | |
pp$5.parseDynamicImport = function (node) { | |
this.next(); // skip `(` | |
// Parse node.source. | |
node.source = this.parseMaybeAssign(); // Verify ending. | |
if (!this.eat(types$1.parenR)) { | |
var errorPos = (this || _global$R).start; | |
if (this.eat(types$1.comma) && this.eat(types$1.parenR)) { | |
this.raiseRecoverable(errorPos, "Trailing comma is not allowed in import()"); | |
} else { | |
this.unexpected(errorPos); | |
} | |
} | |
return this.finishNode(node, "ImportExpression"); | |
}; | |
pp$5.parseImportMeta = function (node) { | |
this.next(); // skip `.` | |
var containsEsc = (this || _global$R).containsEsc; | |
node.property = this.parseIdent(true); | |
if (node.property.name !== "meta") { | |
this.raiseRecoverable(node.property.start, "The only valid meta property for import is 'import.meta'"); | |
} | |
if (containsEsc) { | |
this.raiseRecoverable(node.start, "'import.meta' must not contain escaped characters"); | |
} | |
if ((this || _global$R).options.sourceType !== "module" && !(this || _global$R).options.allowImportExportEverywhere) { | |
this.raiseRecoverable(node.start, "Cannot use 'import.meta' outside a module"); | |
} | |
return this.finishNode(node, "MetaProperty"); | |
}; | |
pp$5.parseLiteral = function (value) { | |
var node = this.startNode(); | |
node.value = value; | |
node.raw = (this || _global$R).input.slice((this || _global$R).start, (this || _global$R).end); | |
if (node.raw.charCodeAt(node.raw.length - 1) === 110) { | |
node.bigint = node.raw.slice(0, -1).replace(/_/g, ""); | |
} | |
this.next(); | |
return this.finishNode(node, "Literal"); | |
}; | |
pp$5.parseParenExpression = function () { | |
this.expect(types$1.parenL); | |
var val = this.parseExpression(); | |
this.expect(types$1.parenR); | |
return val; | |
}; | |
pp$5.parseParenAndDistinguishExpression = function (canBeArrow, forInit) { | |
var startPos = (this || _global$R).start, | |
startLoc = (this || _global$R).startLoc, | |
val, | |
allowTrailingComma = (this || _global$R).options.ecmaVersion >= 8; | |
if ((this || _global$R).options.ecmaVersion >= 6) { | |
this.next(); | |
var innerStartPos = (this || _global$R).start, | |
innerStartLoc = (this || _global$R).startLoc; | |
var exprList = [], | |
first = true, | |
lastIsComma = false; | |
var refDestructuringErrors = new DestructuringErrors(), | |
oldYieldPos = (this || _global$R).yieldPos, | |
oldAwaitPos = (this || _global$R).awaitPos, | |
spreadStart; | |
(this || _global$R).yieldPos = 0; | |
(this || _global$R).awaitPos = 0; // Do not save awaitIdentPos to allow checking awaits nested in parameters | |
while ((this || _global$R).type !== types$1.parenR) { | |
first ? first = false : this.expect(types$1.comma); | |
if (allowTrailingComma && this.afterTrailingComma(types$1.parenR, true)) { | |
lastIsComma = true; | |
break; | |
} else if ((this || _global$R).type === types$1.ellipsis) { | |
spreadStart = (this || _global$R).start; | |
exprList.push(this.parseParenItem(this.parseRestBinding())); | |
if ((this || _global$R).type === types$1.comma) { | |
this.raise((this || _global$R).start, "Comma is not permitted after the rest element"); | |
} | |
break; | |
} else { | |
exprList.push(this.parseMaybeAssign(false, refDestructuringErrors, (this || _global$R).parseParenItem)); | |
} | |
} | |
var innerEndPos = (this || _global$R).lastTokEnd, | |
innerEndLoc = (this || _global$R).lastTokEndLoc; | |
this.expect(types$1.parenR); | |
if (canBeArrow && !this.canInsertSemicolon() && this.eat(types$1.arrow)) { | |
this.checkPatternErrors(refDestructuringErrors, false); | |
this.checkYieldAwaitInDefaultParams(); | |
(this || _global$R).yieldPos = oldYieldPos; | |
(this || _global$R).awaitPos = oldAwaitPos; | |
return this.parseParenArrowList(startPos, startLoc, exprList, forInit); | |
} | |
if (!exprList.length || lastIsComma) { | |
this.unexpected((this || _global$R).lastTokStart); | |
} | |
if (spreadStart) { | |
this.unexpected(spreadStart); | |
} | |
this.checkExpressionErrors(refDestructuringErrors, true); | |
(this || _global$R).yieldPos = oldYieldPos || (this || _global$R).yieldPos; | |
(this || _global$R).awaitPos = oldAwaitPos || (this || _global$R).awaitPos; | |
if (exprList.length > 1) { | |
val = this.startNodeAt(innerStartPos, innerStartLoc); | |
val.expressions = exprList; | |
this.finishNodeAt(val, "SequenceExpression", innerEndPos, innerEndLoc); | |
} else { | |
val = exprList[0]; | |
} | |
} else { | |
val = this.parseParenExpression(); | |
} | |
if ((this || _global$R).options.preserveParens) { | |
var par = this.startNodeAt(startPos, startLoc); | |
par.expression = val; | |
return this.finishNode(par, "ParenthesizedExpression"); | |
} else { | |
return val; | |
} | |
}; | |
pp$5.parseParenItem = function (item) { | |
return item; | |
}; | |
pp$5.parseParenArrowList = function (startPos, startLoc, exprList, forInit) { | |
return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), exprList, false, forInit); | |
}; // New's precedence is slightly tricky. It must allow its argument to | |
// be a `[]` or dot subscript expression, but not a call — at least, | |
// not without wrapping it in parentheses. Thus, it uses the noCalls | |
// argument to parseSubscripts to prevent it from consuming the | |
// argument list. | |
var empty = []; | |
pp$5.parseNew = function () { | |
if ((this || _global$R).containsEsc) { | |
this.raiseRecoverable((this || _global$R).start, "Escape sequence in keyword new"); | |
} | |
var node = this.startNode(); | |
var meta = this.parseIdent(true); | |
if ((this || _global$R).options.ecmaVersion >= 6 && this.eat(types$1.dot)) { | |
node.meta = meta; | |
var containsEsc = (this || _global$R).containsEsc; | |
node.property = this.parseIdent(true); | |
if (node.property.name !== "target") { | |
this.raiseRecoverable(node.property.start, "The only valid meta property for new is 'new.target'"); | |
} | |
if (containsEsc) { | |
this.raiseRecoverable(node.start, "'new.target' must not contain escaped characters"); | |
} | |
if (!(this || _global$R).allowNewDotTarget) { | |
this.raiseRecoverable(node.start, "'new.target' can only be used in functions and class static block"); | |
} | |
return this.finishNode(node, "MetaProperty"); | |
} | |
var startPos = (this || _global$R).start, | |
startLoc = (this || _global$R).startLoc, | |
isImport = (this || _global$R).type === types$1._import; | |
node.callee = this.parseSubscripts(this.parseExprAtom(), startPos, startLoc, true, false); | |
if (isImport && node.callee.type === "ImportExpression") { | |
this.raise(startPos, "Cannot use new with import()"); | |
} | |
if (this.eat(types$1.parenL)) { | |
node.arguments = this.parseExprList(types$1.parenR, (this || _global$R).options.ecmaVersion >= 8, false); | |
} else { | |
node.arguments = empty; | |
} | |
return this.finishNode(node, "NewExpression"); | |
}; // Parse template expression. | |
pp$5.parseTemplateElement = function (ref) { | |
var isTagged = ref.isTagged; | |
var elem = this.startNode(); | |
if ((this || _global$R).type === types$1.invalidTemplate) { | |
if (!isTagged) { | |
this.raiseRecoverable((this || _global$R).start, "Bad escape sequence in untagged template literal"); | |
} | |
elem.value = { | |
raw: (this || _global$R).value, | |
cooked: null | |
}; | |
} else { | |
elem.value = { | |
raw: (this || _global$R).input.slice((this || _global$R).start, (this || _global$R).end).replace(/\r\n?/g, "\n"), | |
cooked: (this || _global$R).value | |
}; | |
} | |
this.next(); | |
elem.tail = (this || _global$R).type === types$1.backQuote; | |
return this.finishNode(elem, "TemplateElement"); | |
}; | |
pp$5.parseTemplate = function (ref) { | |
if (ref === void 0) ref = {}; | |
var isTagged = ref.isTagged; | |
if (isTagged === void 0) isTagged = false; | |
var node = this.startNode(); | |
this.next(); | |
node.expressions = []; | |
var curElt = this.parseTemplateElement({ | |
isTagged: isTagged | |
}); | |
node.quasis = [curElt]; | |
while (!curElt.tail) { | |
if ((this || _global$R).type === types$1.eof) { | |
this.raise((this || _global$R).pos, "Unterminated template literal"); | |
} | |
this.expect(types$1.dollarBraceL); | |
node.expressions.push(this.parseExpression()); | |
this.expect(types$1.braceR); | |
node.quasis.push(curElt = this.parseTemplateElement({ | |
isTagged: isTagged | |
})); | |
} | |
this.next(); | |
return this.finishNode(node, "TemplateLiteral"); | |
}; | |
pp$5.isAsyncProp = function (prop) { | |
return !prop.computed && prop.key.type === "Identifier" && prop.key.name === "async" && ((this || _global$R).type === types$1.name || (this || _global$R).type === types$1.num || (this || _global$R).type === types$1.string || (this || _global$R).type === types$1.bracketL || (this || _global$R).type.keyword || (this || _global$R).options.ecmaVersion >= 9 && (this || _global$R).type === types$1.star) && !lineBreak.test((this || _global$R).input.slice((this || _global$R).lastTokEnd, (this || _global$R).start)); | |
}; // Parse an object literal or binding pattern. | |
pp$5.parseObj = function (isPattern, refDestructuringErrors) { | |
var node = this.startNode(), | |
first = true, | |
propHash = {}; | |
node.properties = []; | |
this.next(); | |
while (!this.eat(types$1.braceR)) { | |
if (!first) { | |
this.expect(types$1.comma); | |
if ((this || _global$R).options.ecmaVersion >= 5 && this.afterTrailingComma(types$1.braceR)) { | |
break; | |
} | |
} else { | |
first = false; | |
} | |
var prop = this.parseProperty(isPattern, refDestructuringErrors); | |
if (!isPattern) { | |
this.checkPropClash(prop, propHash, refDestructuringErrors); | |
} | |
node.properties.push(prop); | |
} | |
return this.finishNode(node, isPattern ? "ObjectPattern" : "ObjectExpression"); | |
}; | |
pp$5.parseProperty = function (isPattern, refDestructuringErrors) { | |
var prop = this.startNode(), | |
isGenerator, | |
isAsync, | |
startPos, | |
startLoc; | |
if ((this || _global$R).options.ecmaVersion >= 9 && this.eat(types$1.ellipsis)) { | |
if (isPattern) { | |
prop.argument = this.parseIdent(false); | |
if ((this || _global$R).type === types$1.comma) { | |
this.raise((this || _global$R).start, "Comma is not permitted after the rest element"); | |
} | |
return this.finishNode(prop, "RestElement"); | |
} // To disallow parenthesized identifier via `this.toAssignable()`. | |
if ((this || _global$R).type === types$1.parenL && refDestructuringErrors) { | |
if (refDestructuringErrors.parenthesizedAssign < 0) { | |
refDestructuringErrors.parenthesizedAssign = (this || _global$R).start; | |
} | |
if (refDestructuringErrors.parenthesizedBind < 0) { | |
refDestructuringErrors.parenthesizedBind = (this || _global$R).start; | |
} | |
} // Parse argument. | |
prop.argument = this.parseMaybeAssign(false, refDestructuringErrors); // To disallow trailing comma via `this.toAssignable()`. | |
if ((this || _global$R).type === types$1.comma && refDestructuringErrors && refDestructuringErrors.trailingComma < 0) { | |
refDestructuringErrors.trailingComma = (this || _global$R).start; | |
} // Finish | |
return this.finishNode(prop, "SpreadElement"); | |
} | |
if ((this || _global$R).options.ecmaVersion >= 6) { | |
prop.method = false; | |
prop.shorthand = false; | |
if (isPattern || refDestructuringErrors) { | |
startPos = (this || _global$R).start; | |
startLoc = (this || _global$R).startLoc; | |
} | |
if (!isPattern) { | |
isGenerator = this.eat(types$1.star); | |
} | |
} | |
var containsEsc = (this || _global$R).containsEsc; | |
this.parsePropertyName(prop); | |
if (!isPattern && !containsEsc && (this || _global$R).options.ecmaVersion >= 8 && !isGenerator && this.isAsyncProp(prop)) { | |
isAsync = true; | |
isGenerator = (this || _global$R).options.ecmaVersion >= 9 && this.eat(types$1.star); | |
this.parsePropertyName(prop, refDestructuringErrors); | |
} else { | |
isAsync = false; | |
} | |
this.parsePropertyValue(prop, isPattern, isGenerator, isAsync, startPos, startLoc, refDestructuringErrors, containsEsc); | |
return this.finishNode(prop, "Property"); | |
}; | |
pp$5.parsePropertyValue = function (prop, isPattern, isGenerator, isAsync, startPos, startLoc, refDestructuringErrors, containsEsc) { | |
if ((isGenerator || isAsync) && (this || _global$R).type === types$1.colon) { | |
this.unexpected(); | |
} | |
if (this.eat(types$1.colon)) { | |
prop.value = isPattern ? this.parseMaybeDefault((this || _global$R).start, (this || _global$R).startLoc) : this.parseMaybeAssign(false, refDestructuringErrors); | |
prop.kind = "init"; | |
} else if ((this || _global$R).options.ecmaVersion >= 6 && (this || _global$R).type === types$1.parenL) { | |
if (isPattern) { | |
this.unexpected(); | |
} | |
prop.kind = "init"; | |
prop.method = true; | |
prop.value = this.parseMethod(isGenerator, isAsync); | |
} else if (!isPattern && !containsEsc && (this || _global$R).options.ecmaVersion >= 5 && !prop.computed && prop.key.type === "Identifier" && (prop.key.name === "get" || prop.key.name === "set") && (this || _global$R).type !== types$1.comma && (this || _global$R).type !== types$1.braceR && (this || _global$R).type !== types$1.eq) { | |
if (isGenerator || isAsync) { | |
this.unexpected(); | |
} | |
prop.kind = prop.key.name; | |
this.parsePropertyName(prop); | |
prop.value = this.parseMethod(false); | |
var paramCount = prop.kind === "get" ? 0 : 1; | |
if (prop.value.params.length !== paramCount) { | |
var start = prop.value.start; | |
if (prop.kind === "get") { | |
this.raiseRecoverable(start, "getter should have no params"); | |
} else { | |
this.raiseRecoverable(start, "setter should have exactly one param"); | |
} | |
} else { | |
if (prop.kind === "set" && prop.value.params[0].type === "RestElement") { | |
this.raiseRecoverable(prop.value.params[0].start, "Setter cannot use rest params"); | |
} | |
} | |
} else if ((this || _global$R).options.ecmaVersion >= 6 && !prop.computed && prop.key.type === "Identifier") { | |
if (isGenerator || isAsync) { | |
this.unexpected(); | |
} | |
this.checkUnreserved(prop.key); | |
if (prop.key.name === "await" && !(this || _global$R).awaitIdentPos) { | |
(this || _global$R).awaitIdentPos = startPos; | |
} | |
prop.kind = "init"; | |
if (isPattern) { | |
prop.value = this.parseMaybeDefault(startPos, startLoc, this.copyNode(prop.key)); | |
} else if ((this || _global$R).type === types$1.eq && refDestructuringErrors) { | |
if (refDestructuringErrors.shorthandAssign < 0) { | |
refDestructuringErrors.shorthandAssign = (this || _global$R).start; | |
} | |
prop.value = this.parseMaybeDefault(startPos, startLoc, this.copyNode(prop.key)); | |
} else { | |
prop.value = this.copyNode(prop.key); | |
} | |
prop.shorthand = true; | |
} else { | |
this.unexpected(); | |
} | |
}; | |
pp$5.parsePropertyName = function (prop) { | |
if ((this || _global$R).options.ecmaVersion >= 6) { | |
if (this.eat(types$1.bracketL)) { | |
prop.computed = true; | |
prop.key = this.parseMaybeAssign(); | |
this.expect(types$1.bracketR); | |
return prop.key; | |
} else { | |
prop.computed = false; | |
} | |
} | |
return prop.key = (this || _global$R).type === types$1.num || (this || _global$R).type === types$1.string ? this.parseExprAtom() : this.parseIdent((this || _global$R).options.allowReserved !== "never"); | |
}; // Initialize empty function node. | |
pp$5.initFunction = function (node) { | |
node.id = null; | |
if ((this || _global$R).options.ecmaVersion >= 6) { | |
node.generator = node.expression = false; | |
} | |
if ((this || _global$R).options.ecmaVersion >= 8) { | |
node.async = false; | |
} | |
}; // Parse object or class method. | |
pp$5.parseMethod = function (isGenerator, isAsync, allowDirectSuper) { | |
var node = this.startNode(), | |
oldYieldPos = (this || _global$R).yieldPos, | |
oldAwaitPos = (this || _global$R).awaitPos, | |
oldAwaitIdentPos = (this || _global$R).awaitIdentPos; | |
this.initFunction(node); | |
if ((this || _global$R).options.ecmaVersion >= 6) { | |
node.generator = isGenerator; | |
} | |
if ((this || _global$R).options.ecmaVersion >= 8) { | |
node.async = !!isAsync; | |
} | |
(this || _global$R).yieldPos = 0; | |
(this || _global$R).awaitPos = 0; | |
(this || _global$R).awaitIdentPos = 0; | |
this.enterScope(functionFlags(isAsync, node.generator) | SCOPE_SUPER | (allowDirectSuper ? SCOPE_DIRECT_SUPER : 0)); | |
this.expect(types$1.parenL); | |
node.params = this.parseBindingList(types$1.parenR, false, (this || _global$R).options.ecmaVersion >= 8); | |
this.checkYieldAwaitInDefaultParams(); | |
this.parseFunctionBody(node, false, true, false); | |
(this || _global$R).yieldPos = oldYieldPos; | |
(this || _global$R).awaitPos = oldAwaitPos; | |
(this || _global$R).awaitIdentPos = oldAwaitIdentPos; | |
return this.finishNode(node, "FunctionExpression"); | |
}; // Parse arrow function expression with given parameters. | |
pp$5.parseArrowExpression = function (node, params, isAsync, forInit) { | |
var oldYieldPos = (this || _global$R).yieldPos, | |
oldAwaitPos = (this || _global$R).awaitPos, | |
oldAwaitIdentPos = (this || _global$R).awaitIdentPos; | |
this.enterScope(functionFlags(isAsync, false) | SCOPE_ARROW); | |
this.initFunction(node); | |
if ((this || _global$R).options.ecmaVersion >= 8) { | |
node.async = !!isAsync; | |
} | |
(this || _global$R).yieldPos = 0; | |
(this || _global$R).awaitPos = 0; | |
(this || _global$R).awaitIdentPos = 0; | |
node.params = this.toAssignableList(params, true); | |
this.parseFunctionBody(node, true, false, forInit); | |
(this || _global$R).yieldPos = oldYieldPos; | |
(this || _global$R).awaitPos = oldAwaitPos; | |
(this || _global$R).awaitIdentPos = oldAwaitIdentPos; | |
return this.finishNode(node, "ArrowFunctionExpression"); | |
}; // Parse function body and check parameters. | |
pp$5.parseFunctionBody = function (node, isArrowFunction, isMethod, forInit) { | |
var isExpression = isArrowFunction && (this || _global$R).type !== types$1.braceL; | |
var oldStrict = (this || _global$R).strict, | |
useStrict = false; | |
if (isExpression) { | |
node.body = this.parseMaybeAssign(forInit); | |
node.expression = true; | |
this.checkParams(node, false); | |
} else { | |
var nonSimple = (this || _global$R).options.ecmaVersion >= 7 && !this.isSimpleParamList(node.params); | |
if (!oldStrict || nonSimple) { | |
useStrict = this.strictDirective((this || _global$R).end); // If this is a strict mode function, verify that argument names | |
// are not repeated, and it does not try to bind the words `eval` | |
// or `arguments`. | |
if (useStrict && nonSimple) { | |
this.raiseRecoverable(node.start, "Illegal 'use strict' directive in function with non-simple parameter list"); | |
} | |
} // Start a new scope with regard to labels and the `inFunction` | |
// flag (restore them to their old value afterwards). | |
var oldLabels = (this || _global$R).labels; | |
(this || _global$R).labels = []; | |
if (useStrict) { | |
(this || _global$R).strict = true; | |
} // Add the params to varDeclaredNames to ensure that an error is thrown | |
// if a let/const declaration in the function clashes with one of the params. | |
this.checkParams(node, !oldStrict && !useStrict && !isArrowFunction && !isMethod && this.isSimpleParamList(node.params)); // Ensure the function name isn't a forbidden identifier in strict mode, e.g. 'eval' | |
if ((this || _global$R).strict && node.id) { | |
this.checkLValSimple(node.id, BIND_OUTSIDE); | |
} | |
node.body = this.parseBlock(false, undefined, useStrict && !oldStrict); | |
node.expression = false; | |
this.adaptDirectivePrologue(node.body.body); | |
(this || _global$R).labels = oldLabels; | |
} | |
this.exitScope(); | |
}; | |
pp$5.isSimpleParamList = function (params) { | |
for (var i = 0, list = params; i < list.length; i += 1) { | |
var param = list[i]; | |
if (param.type !== "Identifier") { | |
return false; | |
} | |
} | |
return true; | |
}; // Checks function params for various disallowed patterns such as using "eval" | |
// or "arguments" and duplicate parameters. | |
pp$5.checkParams = function (node, allowDuplicates) { | |
var nameHash = Object.create(null); | |
for (var i = 0, list = node.params; i < list.length; i += 1) { | |
var param = list[i]; | |
this.checkLValInnerPattern(param, BIND_VAR, allowDuplicates ? null : nameHash); | |
} | |
}; // Parses a comma-separated list of expressions, and returns them as | |
// an array. `close` is the token type that ends the list, and | |
// `allowEmpty` can be turned on to allow subsequent commas with | |
// nothing in between them to be parsed as `null` (which is needed | |
// for array literals). | |
pp$5.parseExprList = function (close, allowTrailingComma, allowEmpty, refDestructuringErrors) { | |
var elts = [], | |
first = true; | |
while (!this.eat(close)) { | |
if (!first) { | |
this.expect(types$1.comma); | |
if (allowTrailingComma && this.afterTrailingComma(close)) { | |
break; | |
} | |
} else { | |
first = false; | |
} | |
var elt = void 0; | |
if (allowEmpty && (this || _global$R).type === types$1.comma) { | |
elt = null; | |
} else if ((this || _global$R).type === types$1.ellipsis) { | |
elt = this.parseSpread(refDestructuringErrors); | |
if (refDestructuringErrors && (this || _global$R).type === types$1.comma && refDestructuringErrors.trailingComma < 0) { | |
refDestructuringErrors.trailingComma = (this || _global$R).start; | |
} | |
} else { | |
elt = this.parseMaybeAssign(false, refDestructuringErrors); | |
} | |
elts.push(elt); | |
} | |
return elts; | |
}; | |
pp$5.checkUnreserved = function (ref) { | |
var start = ref.start; | |
var end = ref.end; | |
var name = ref.name; | |
if ((this || _global$R).inGenerator && name === "yield") { | |
this.raiseRecoverable(start, "Cannot use 'yield' as identifier inside a generator"); | |
} | |
if ((this || _global$R).inAsync && name === "await") { | |
this.raiseRecoverable(start, "Cannot use 'await' as identifier inside an async function"); | |
} | |
if (this.currentThisScope().inClassFieldInit && name === "arguments") { | |
this.raiseRecoverable(start, "Cannot use 'arguments' in class field initializer"); | |
} | |
if ((this || _global$R).inClassStaticBlock && (name === "arguments" || name === "await")) { | |
this.raise(start, "Cannot use " + name + " in class static initialization block"); | |
} | |
if ((this || _global$R).keywords.test(name)) { | |
this.raise(start, "Unexpected keyword '" + name + "'"); | |
} | |
if ((this || _global$R).options.ecmaVersion < 6 && (this || _global$R).input.slice(start, end).indexOf("\\") !== -1) { | |
return; | |
} | |
var re = (this || _global$R).strict ? (this || _global$R).reservedWordsStrict : (this || _global$R).reservedWords; | |
if (re.test(name)) { | |
if (!(this || _global$R).inAsync && name === "await") { | |
this.raiseRecoverable(start, "Cannot use keyword 'await' outside an async function"); | |
} | |
this.raiseRecoverable(start, "The keyword '" + name + "' is reserved"); | |
} | |
}; // Parse the next token as an identifier. If `liberal` is true (used | |
// when parsing properties), it will also convert keywords into | |
// identifiers. | |
pp$5.parseIdent = function (liberal, isBinding) { | |
var node = this.startNode(); | |
if ((this || _global$R).type === types$1.name) { | |
node.name = (this || _global$R).value; | |
} else if ((this || _global$R).type.keyword) { | |
node.name = (this || _global$R).type.keyword; // To fix https://github.com/acornjs/acorn/issues/575 | |
// `class` and `function` keywords push new context into this.context. | |
// But there is no chance to pop the context if the keyword is consumed as an identifier such as a property name. | |
// If the previous token is a dot, this does not apply because the context-managing code already ignored the keyword | |
if ((node.name === "class" || node.name === "function") && ((this || _global$R).lastTokEnd !== (this || _global$R).lastTokStart + 1 || (this || _global$R).input.charCodeAt((this || _global$R).lastTokStart) !== 46)) { | |
(this || _global$R).context.pop(); | |
} | |
} else { | |
this.unexpected(); | |
} | |
this.next(!!liberal); | |
this.finishNode(node, "Identifier"); | |
if (!liberal) { | |
this.checkUnreserved(node); | |
if (node.name === "await" && !(this || _global$R).awaitIdentPos) { | |
(this || _global$R).awaitIdentPos = node.start; | |
} | |
} | |
return node; | |
}; | |
pp$5.parsePrivateIdent = function () { | |
var node = this.startNode(); | |
if ((this || _global$R).type === types$1.privateId) { | |
node.name = (this || _global$R).value; | |
} else { | |
this.unexpected(); | |
} | |
this.next(); | |
this.finishNode(node, "PrivateIdentifier"); // For validating existence | |
if ((this || _global$R).privateNameStack.length === 0) { | |
this.raise(node.start, "Private field '#" + node.name + "' must be declared in an enclosing class"); | |
} else { | |
(this || _global$R).privateNameStack[(this || _global$R).privateNameStack.length - 1].used.push(node); | |
} | |
return node; | |
}; // Parses yield expression inside generator. | |
pp$5.parseYield = function (forInit) { | |
if (!(this || _global$R).yieldPos) { | |
(this || _global$R).yieldPos = (this || _global$R).start; | |
} | |
var node = this.startNode(); | |
this.next(); | |
if ((this || _global$R).type === types$1.semi || this.canInsertSemicolon() || (this || _global$R).type !== types$1.star && !(this || _global$R).type.startsExpr) { | |
node.delegate = false; | |
node.argument = null; | |
} else { | |
node.delegate = this.eat(types$1.star); | |
node.argument = this.parseMaybeAssign(forInit); | |
} | |
return this.finishNode(node, "YieldExpression"); | |
}; | |
pp$5.parseAwait = function (forInit) { | |
if (!(this || _global$R).awaitPos) { | |
(this || _global$R).awaitPos = (this || _global$R).start; | |
} | |
var node = this.startNode(); | |
this.next(); | |
node.argument = this.parseMaybeUnary(null, true, false, forInit); | |
return this.finishNode(node, "AwaitExpression"); | |
}; | |
var pp$4 = Parser.prototype; // This function is used to raise exceptions on parse errors. It | |
// takes an offset integer (into the current `input`) to indicate | |
// the location of the error, attaches the position to the end | |
// of the error message, and then raises a `SyntaxError` with that | |
// message. | |
pp$4.raise = function (pos, message) { | |
var loc = getLineInfo((this || _global$R).input, pos); | |
message += " (" + loc.line + ":" + loc.column + ")"; | |
var err = new SyntaxError(message); | |
err.pos = pos; | |
err.loc = loc; | |
err.raisedAt = (this || _global$R).pos; | |
throw err; | |
}; | |
pp$4.raiseRecoverable = pp$4.raise; | |
pp$4.curPosition = function () { | |
if ((this || _global$R).options.locations) { | |
return new Position((this || _global$R).curLine, (this || _global$R).pos - (this || _global$R).lineStart); | |
} | |
}; | |
var pp$3 = Parser.prototype; | |
var Scope = function Scope(flags) { | |
(this || _global$R).flags = flags; // A list of var-declared names in the current lexical scope | |
(this || _global$R).var = []; // A list of lexically-declared names in the current lexical scope | |
(this || _global$R).lexical = []; // A list of lexically-declared FunctionDeclaration names in the current lexical scope | |
(this || _global$R).functions = []; // A switch to disallow the identifier reference 'arguments' | |
(this || _global$R).inClassFieldInit = false; | |
}; // The functions in this module keep track of declared variables in the current scope in order to detect duplicate variable names. | |
pp$3.enterScope = function (flags) { | |
(this || _global$R).scopeStack.push(new Scope(flags)); | |
}; | |
pp$3.exitScope = function () { | |
(this || _global$R).scopeStack.pop(); | |
}; // The spec says: | |
// > At the top level of a function, or script, function declarations are | |
// > treated like var declarations rather than like lexical declarations. | |
pp$3.treatFunctionsAsVarInScope = function (scope) { | |
return scope.flags & SCOPE_FUNCTION || !(this || _global$R).inModule && scope.flags & SCOPE_TOP; | |
}; | |
pp$3.declareName = function (name, bindingType, pos) { | |
var redeclared = false; | |
if (bindingType === BIND_LEXICAL) { | |
var scope = this.currentScope(); | |
redeclared = scope.lexical.indexOf(name) > -1 || scope.functions.indexOf(name) > -1 || scope.var.indexOf(name) > -1; | |
scope.lexical.push(name); | |
if ((this || _global$R).inModule && scope.flags & SCOPE_TOP) { | |
delete (this || _global$R).undefinedExports[name]; | |
} | |
} else if (bindingType === BIND_SIMPLE_CATCH) { | |
var scope$1 = this.currentScope(); | |
scope$1.lexical.push(name); | |
} else if (bindingType === BIND_FUNCTION) { | |
var scope$2 = this.currentScope(); | |
if ((this || _global$R).treatFunctionsAsVar) { | |
redeclared = scope$2.lexical.indexOf(name) > -1; | |
} else { | |
redeclared = scope$2.lexical.indexOf(name) > -1 || scope$2.var.indexOf(name) > -1; | |
} | |
scope$2.functions.push(name); | |
} else { | |
for (var i = (this || _global$R).scopeStack.length - 1; i >= 0; --i) { | |
var scope$3 = (this || _global$R).scopeStack[i]; | |
if (scope$3.lexical.indexOf(name) > -1 && !(scope$3.flags & SCOPE_SIMPLE_CATCH && scope$3.lexical[0] === name) || !this.treatFunctionsAsVarInScope(scope$3) && scope$3.functions.indexOf(name) > -1) { | |
redeclared = true; | |
break; | |
} | |
scope$3.var.push(name); | |
if ((this || _global$R).inModule && scope$3.flags & SCOPE_TOP) { | |
delete (this || _global$R).undefinedExports[name]; | |
} | |
if (scope$3.flags & SCOPE_VAR) { | |
break; | |
} | |
} | |
} | |
if (redeclared) { | |
this.raiseRecoverable(pos, "Identifier '" + name + "' has already been declared"); | |
} | |
}; | |
pp$3.checkLocalExport = function (id) { | |
// scope.functions must be empty as Module code is always strict. | |
if ((this || _global$R).scopeStack[0].lexical.indexOf(id.name) === -1 && (this || _global$R).scopeStack[0].var.indexOf(id.name) === -1) { | |
(this || _global$R).undefinedExports[id.name] = id; | |
} | |
}; | |
pp$3.currentScope = function () { | |
return (this || _global$R).scopeStack[(this || _global$R).scopeStack.length - 1]; | |
}; | |
pp$3.currentVarScope = function () { | |
for (var i = (this || _global$R).scopeStack.length - 1;; i--) { | |
var scope = (this || _global$R).scopeStack[i]; | |
if (scope.flags & SCOPE_VAR) { | |
return scope; | |
} | |
} | |
}; // Could be useful for `this`, `new.target`, `super()`, `super.property`, and `super[property]`. | |
pp$3.currentThisScope = function () { | |
for (var i = (this || _global$R).scopeStack.length - 1;; i--) { | |
var scope = (this || _global$R).scopeStack[i]; | |
if (scope.flags & SCOPE_VAR && !(scope.flags & SCOPE_ARROW)) { | |
return scope; | |
} | |
} | |
}; | |
var Node = function Node(parser, pos, loc) { | |
(this || _global$R).type = ""; | |
(this || _global$R).start = pos; | |
(this || _global$R).end = 0; | |
if (parser.options.locations) { | |
(this || _global$R).loc = new SourceLocation(parser, loc); | |
} | |
if (parser.options.directSourceFile) { | |
(this || _global$R).sourceFile = parser.options.directSourceFile; | |
} | |
if (parser.options.ranges) { | |
(this || _global$R).range = [pos, 0]; | |
} | |
}; // Start an AST node, attaching a start offset. | |
var pp$2 = Parser.prototype; | |
pp$2.startNode = function () { | |
return new Node(this || _global$R, (this || _global$R).start, (this || _global$R).startLoc); | |
}; | |
pp$2.startNodeAt = function (pos, loc) { | |
return new Node(this || _global$R, pos, loc); | |
}; // Finish an AST node, adding `type` and `end` properties. | |
function finishNodeAt(node, type, pos, loc) { | |
node.type = type; | |
node.end = pos; | |
if ((this || _global$R).options.locations) { | |
node.loc.end = loc; | |
} | |
if ((this || _global$R).options.ranges) { | |
node.range[1] = pos; | |
} | |
return node; | |
} | |
pp$2.finishNode = function (node, type) { | |
return finishNodeAt.call(this || _global$R, node, type, (this || _global$R).lastTokEnd, (this || _global$R).lastTokEndLoc); | |
}; // Finish node at given position | |
pp$2.finishNodeAt = function (node, type, pos, loc) { | |
return finishNodeAt.call(this || _global$R, node, type, pos, loc); | |
}; | |
pp$2.copyNode = function (node) { | |
var newNode = new Node(this || _global$R, node.start, (this || _global$R).startLoc); | |
for (var prop in node) { | |
newNode[prop] = node[prop]; | |
} | |
return newNode; | |
}; // This file contains Unicode properties extracted from the ECMAScript | |
// specification. The lists are extracted like so: | |
// $$('#table-binary-unicode-properties > figure > table > tbody > tr > td:nth-child(1) code').map(el => el.innerText) | |
// #table-binary-unicode-properties | |
var ecma9BinaryProperties = "ASCII ASCII_Hex_Digit AHex Alphabetic Alpha Any Assigned Bidi_Control Bidi_C Bidi_Mirrored Bidi_M Case_Ignorable CI Cased Changes_When_Casefolded CWCF Changes_When_Casemapped CWCM Changes_When_Lowercased CWL Changes_When_NFKC_Casefolded CWKCF Changes_When_Titlecased CWT Changes_When_Uppercased CWU Dash Default_Ignorable_Code_Point DI Deprecated Dep Diacritic Dia Emoji Emoji_Component Emoji_Modifier Emoji_Modifier_Base Emoji_Presentation Extender Ext Grapheme_Base Gr_Base Grapheme_Extend Gr_Ext Hex_Digit Hex IDS_Binary_Operator IDSB IDS_Trinary_Operator IDST ID_Continue IDC ID_Start IDS Ideographic Ideo Join_Control Join_C Logical_Order_Exception LOE Lowercase Lower Math Noncharacter_Code_Point NChar Pattern_Syntax Pat_Syn Pattern_White_Space Pat_WS Quotation_Mark QMark Radical Regional_Indicator RI Sentence_Terminal STerm Soft_Dotted SD Terminal_Punctuation Term Unified_Ideograph UIdeo Uppercase Upper Variation_Selector VS White_Space space XID_Continue XIDC XID_Start XIDS"; | |
var ecma10BinaryProperties = ecma9BinaryProperties + " Extended_Pictographic"; | |
var ecma11BinaryProperties = ecma10BinaryProperties; | |
var ecma12BinaryProperties = ecma11BinaryProperties + " EBase EComp EMod EPres ExtPict"; | |
var ecma13BinaryProperties = ecma12BinaryProperties; | |
var unicodeBinaryProperties = { | |
9: ecma9BinaryProperties, | |
10: ecma10BinaryProperties, | |
11: ecma11BinaryProperties, | |
12: ecma12BinaryProperties, | |
13: ecma13BinaryProperties | |
}; // #table-unicode-general-category-values | |
var unicodeGeneralCategoryValues = "Cased_Letter LC Close_Punctuation Pe Connector_Punctuation Pc Control Cc cntrl Currency_Symbol Sc Dash_Punctuation Pd Decimal_Number Nd digit Enclosing_Mark Me Final_Punctuation Pf Format Cf Initial_Punctuation Pi Letter L Letter_Number Nl Line_Separator Zl Lowercase_Letter Ll Mark M Combining_Mark Math_Symbol Sm Modifier_Letter Lm Modifier_Symbol Sk Nonspacing_Mark Mn Number N Open_Punctuation Ps Other C Other_Letter Lo Other_Number No Other_Punctuation Po Other_Symbol So Paragraph_Separator Zp Private_Use Co Punctuation P punct Separator Z Space_Separator Zs Spacing_Mark Mc Surrogate Cs Symbol S Titlecase_Letter Lt Unassigned Cn Uppercase_Letter Lu"; // #table-unicode-script-values | |
var ecma9ScriptValues = "Adlam Adlm Ahom Anatolian_Hieroglyphs Hluw Arabic Arab Armenian Armn Avestan Avst Balinese Bali Bamum Bamu Bassa_Vah Bass Batak Batk Bengali Beng Bhaiksuki Bhks Bopomofo Bopo Brahmi Brah Braille Brai Buginese Bugi Buhid Buhd Canadian_Aboriginal Cans Carian Cari Caucasian_Albanian Aghb Chakma Cakm Cham Cham Cherokee Cher Common Zyyy Coptic Copt Qaac Cuneiform Xsux Cypriot Cprt Cyrillic Cyrl Deseret Dsrt Devanagari Deva Duployan Dupl Egyptian_Hieroglyphs Egyp Elbasan Elba Ethiopic Ethi Georgian Geor Glagolitic Glag Gothic Goth Grantha Gran Greek Grek Gujarati Gujr Gurmukhi Guru Han Hani Hangul Hang Hanunoo Hano Hatran Hatr Hebrew Hebr Hiragana Hira Imperial_Aramaic Armi Inherited Zinh Qaai Inscriptional_Pahlavi Phli Inscriptional_Parthian Prti Javanese Java Kaithi Kthi Kannada Knda Katakana Kana Kayah_Li Kali Kharoshthi Khar Khmer Khmr Khojki Khoj Khudawadi Sind Lao Laoo Latin Latn Lepcha Lepc Limbu Limb Linear_A Lina Linear_B Linb Lisu Lisu Lycian Lyci Lydian Lydi Mahajani Mahj Malayalam Mlym Mandaic Mand Manichaean Mani Marchen Marc Masaram_Gondi Gonm Meetei_Mayek Mtei Mende_Kikakui Mend Meroitic_Cursive Merc Meroitic_Hieroglyphs Mero Miao Plrd Modi Mongolian Mong Mro Mroo Multani Mult Myanmar Mymr Nabataean Nbat New_Tai_Lue Talu Newa Newa Nko Nkoo Nushu Nshu Ogham Ogam Ol_Chiki Olck Old_Hungarian Hung Old_Italic Ital Old_North_Arabian Narb Old_Permic Perm Old_Persian Xpeo Old_South_Arabian Sarb Old_Turkic Orkh Oriya Orya Osage Osge Osmanya Osma Pahawh_Hmong Hmng Palmyrene Palm Pau_Cin_Hau Pauc Phags_Pa Phag Phoenician Phnx Psalter_Pahlavi Phlp Rejang Rjng Runic Runr Samaritan Samr Saurashtra Saur Sharada Shrd Shavian Shaw Siddham Sidd SignWriting Sgnw Sinhala Sinh Sora_Sompeng Sora Soyombo Soyo Sundanese Sund Syloti_Nagri Sylo Syriac Syrc Tagalog Tglg Tagbanwa Tagb Tai_Le Tale Tai_Tham Lana Tai_Viet Tavt Takri Takr Tamil Taml Tangut Tang Telugu Telu Thaana Thaa Thai Thai Tibetan Tibt Tifinagh Tfng Tirhuta Tirh Ugaritic Ugar Vai Vaii Warang_Citi Wara Yi Yiii Zanabazar_Square Zanb"; | |
var ecma10ScriptValues = ecma9ScriptValues + " Dogra Dogr Gunjala_Gondi Gong Hanifi_Rohingya Rohg Makasar Maka Medefaidrin Medf Old_Sogdian Sogo Sogdian Sogd"; | |
var ecma11ScriptValues = ecma10ScriptValues + " Elymaic Elym Nandinagari Nand Nyiakeng_Puachue_Hmong Hmnp Wancho Wcho"; | |
var ecma12ScriptValues = ecma11ScriptValues + " Chorasmian Chrs Diak Dives_Akuru Khitan_Small_Script Kits Yezi Yezidi"; | |
var ecma13ScriptValues = ecma12ScriptValues + " Cypro_Minoan Cpmn Old_Uyghur Ougr Tangsa Tnsa Toto Vithkuqi Vith"; | |
var unicodeScriptValues = { | |
9: ecma9ScriptValues, | |
10: ecma10ScriptValues, | |
11: ecma11ScriptValues, | |
12: ecma12ScriptValues, | |
13: ecma13ScriptValues | |
}; | |
var data = {}; | |
function buildUnicodeData(ecmaVersion) { | |
var d = data[ecmaVersion] = { | |
binary: wordsRegexp(unicodeBinaryProperties[ecmaVersion] + " " + unicodeGeneralCategoryValues), | |
nonBinary: { | |
General_Category: wordsRegexp(unicodeGeneralCategoryValues), | |
Script: wordsRegexp(unicodeScriptValues[ecmaVersion]) | |
} | |
}; | |
d.nonBinary.Script_Extensions = d.nonBinary.Script; | |
d.nonBinary.gc = d.nonBinary.General_Category; | |
d.nonBinary.sc = d.nonBinary.Script; | |
d.nonBinary.scx = d.nonBinary.Script_Extensions; | |
} | |
for (var i = 0, list = [9, 10, 11, 12, 13]; i < list.length; i += 1) { | |
var ecmaVersion = list[i]; | |
buildUnicodeData(ecmaVersion); | |
} | |
var pp$1 = Parser.prototype; | |
var RegExpValidationState = function RegExpValidationState(parser) { | |
(this || _global$R).parser = parser; | |
(this || _global$R).validFlags = "gim" + (parser.options.ecmaVersion >= 6 ? "uy" : "") + (parser.options.ecmaVersion >= 9 ? "s" : "") + (parser.options.ecmaVersion >= 13 ? "d" : ""); | |
(this || _global$R).unicodeProperties = data[parser.options.ecmaVersion >= 13 ? 13 : parser.options.ecmaVersion]; | |
(this || _global$R).source = ""; | |
(this || _global$R).flags = ""; | |
(this || _global$R).start = 0; | |
(this || _global$R).switchU = false; | |
(this || _global$R).switchN = false; | |
(this || _global$R).pos = 0; | |
(this || _global$R).lastIntValue = 0; | |
(this || _global$R).lastStringValue = ""; | |
(this || _global$R).lastAssertionIsQuantifiable = false; | |
(this || _global$R).numCapturingParens = 0; | |
(this || _global$R).maxBackReference = 0; | |
(this || _global$R).groupNames = []; | |
(this || _global$R).backReferenceNames = []; | |
}; | |
RegExpValidationState.prototype.reset = function reset(start, pattern, flags) { | |
var unicode = flags.indexOf("u") !== -1; | |
(this || _global$R).start = start | 0; | |
(this || _global$R).source = pattern + ""; | |
(this || _global$R).flags = flags; | |
(this || _global$R).switchU = unicode && (this || _global$R).parser.options.ecmaVersion >= 6; | |
(this || _global$R).switchN = unicode && (this || _global$R).parser.options.ecmaVersion >= 9; | |
}; | |
RegExpValidationState.prototype.raise = function raise(message) { | |
(this || _global$R).parser.raiseRecoverable((this || _global$R).start, "Invalid regular expression: /" + (this || _global$R).source + "/: " + message); | |
}; // If u flag is given, this returns the code point at the index (it combines a surrogate pair). | |
// Otherwise, this returns the code unit of the index (can be a part of a surrogate pair). | |
RegExpValidationState.prototype.at = function at(i, forceU) { | |
if (forceU === void 0) forceU = false; | |
var s = (this || _global$R).source; | |
var l = s.length; | |
if (i >= l) { | |
return -1; | |
} | |
var c = s.charCodeAt(i); | |
if (!(forceU || (this || _global$R).switchU) || c <= 0xD7FF || c >= 0xE000 || i + 1 >= l) { | |
return c; | |
} | |
var next = s.charCodeAt(i + 1); | |
return next >= 0xDC00 && next <= 0xDFFF ? (c << 10) + next - 0x35FDC00 : c; | |
}; | |
RegExpValidationState.prototype.nextIndex = function nextIndex(i, forceU) { | |
if (forceU === void 0) forceU = false; | |
var s = (this || _global$R).source; | |
var l = s.length; | |
if (i >= l) { | |
return l; | |
} | |
var c = s.charCodeAt(i), | |
next; | |
if (!(forceU || (this || _global$R).switchU) || c <= 0xD7FF || c >= 0xE000 || i + 1 >= l || (next = s.charCodeAt(i + 1)) < 0xDC00 || next > 0xDFFF) { | |
return i + 1; | |
} | |
return i + 2; | |
}; | |
RegExpValidationState.prototype.current = function current(forceU) { | |
if (forceU === void 0) forceU = false; | |
return this.at((this || _global$R).pos, forceU); | |
}; | |
RegExpValidationState.prototype.lookahead = function lookahead(forceU) { | |
if (forceU === void 0) forceU = false; | |
return this.at(this.nextIndex((this || _global$R).pos, forceU), forceU); | |
}; | |
RegExpValidationState.prototype.advance = function advance(forceU) { | |
if (forceU === void 0) forceU = false; | |
(this || _global$R).pos = this.nextIndex((this || _global$R).pos, forceU); | |
}; | |
RegExpValidationState.prototype.eat = function eat(ch, forceU) { | |
if (forceU === void 0) forceU = false; | |
if (this.current(forceU) === ch) { | |
this.advance(forceU); | |
return true; | |
} | |
return false; | |
}; | |
function codePointToString$1(ch) { | |
if (ch <= 0xFFFF) { | |
return String.fromCharCode(ch); | |
} | |
ch -= 0x10000; | |
return String.fromCharCode((ch >> 10) + 0xD800, (ch & 0x03FF) + 0xDC00); | |
} | |
/** | |
* Validate the flags part of a given RegExpLiteral. | |
* | |
* @param {RegExpValidationState} state The state to validate RegExp. | |
* @returns {void} | |
*/ | |
pp$1.validateRegExpFlags = function (state) { | |
var validFlags = state.validFlags; | |
var flags = state.flags; | |
for (var i = 0; i < flags.length; i++) { | |
var flag = flags.charAt(i); | |
if (validFlags.indexOf(flag) === -1) { | |
this.raise(state.start, "Invalid regular expression flag"); | |
} | |
if (flags.indexOf(flag, i + 1) > -1) { | |
this.raise(state.start, "Duplicate regular expression flag"); | |
} | |
} | |
}; | |
/** | |
* Validate the pattern part of a given RegExpLiteral. | |
* | |
* @param {RegExpValidationState} state The state to validate RegExp. | |
* @returns {void} | |
*/ | |
pp$1.validateRegExpPattern = function (state) { | |
this.regexp_pattern(state); // The goal symbol for the parse is |Pattern[~U, ~N]|. If the result of | |
// parsing contains a |GroupName|, reparse with the goal symbol | |
// |Pattern[~U, +N]| and use this result instead. Throw a *SyntaxError* | |
// exception if _P_ did not conform to the grammar, if any elements of _P_ | |
// were not matched by the parse, or if any Early Error conditions exist. | |
if (!state.switchN && (this || _global$R).options.ecmaVersion >= 9 && state.groupNames.length > 0) { | |
state.switchN = true; | |
this.regexp_pattern(state); | |
} | |
}; // https://www.ecma-international.org/ecma-262/8.0/#prod-Pattern | |
pp$1.regexp_pattern = function (state) { | |
state.pos = 0; | |
state.lastIntValue = 0; | |
state.lastStringValue = ""; | |
state.lastAssertionIsQuantifiable = false; | |
state.numCapturingParens = 0; | |
state.maxBackReference = 0; | |
state.groupNames.length = 0; | |
state.backReferenceNames.length = 0; | |
this.regexp_disjunction(state); | |
if (state.pos !== state.source.length) { | |
// Make the same messages as V8. | |
if (state.eat(0x29 | |
/* ) */ | |
)) { | |
state.raise("Unmatched ')'"); | |
} | |
if (state.eat(0x5D | |
/* ] */ | |
) || state.eat(0x7D | |
/* } */ | |
)) { | |
state.raise("Lone quantifier brackets"); | |
} | |
} | |
if (state.maxBackReference > state.numCapturingParens) { | |
state.raise("Invalid escape"); | |
} | |
for (var i = 0, list = state.backReferenceNames; i < list.length; i += 1) { | |
var name = list[i]; | |
if (state.groupNames.indexOf(name) === -1) { | |
state.raise("Invalid named capture referenced"); | |
} | |
} | |
}; // https://www.ecma-international.org/ecma-262/8.0/#prod-Disjunction | |
pp$1.regexp_disjunction = function (state) { | |
this.regexp_alternative(state); | |
while (state.eat(0x7C | |
/* | */ | |
)) { | |
this.regexp_alternative(state); | |
} // Make the same message as V8. | |
if (this.regexp_eatQuantifier(state, true)) { | |
state.raise("Nothing to repeat"); | |
} | |
if (state.eat(0x7B | |
/* { */ | |
)) { | |
state.raise("Lone quantifier brackets"); | |
} | |
}; // https://www.ecma-international.org/ecma-262/8.0/#prod-Alternative | |
pp$1.regexp_alternative = function (state) { | |
while (state.pos < state.source.length && this.regexp_eatTerm(state)) {} | |
}; // https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-Term | |
pp$1.regexp_eatTerm = function (state) { | |
if (this.regexp_eatAssertion(state)) { | |
// Handle `QuantifiableAssertion Quantifier` alternative. | |
// `state.lastAssertionIsQuantifiable` is true if the last eaten Assertion | |
// is a QuantifiableAssertion. | |
if (state.lastAssertionIsQuantifiable && this.regexp_eatQuantifier(state)) { | |
// Make the same message as V8. | |
if (state.switchU) { | |
state.raise("Invalid quantifier"); | |
} | |
} | |
return true; | |
} | |
if (state.switchU ? this.regexp_eatAtom(state) : this.regexp_eatExtendedAtom(state)) { | |
this.regexp_eatQuantifier(state); | |
return true; | |
} | |
return false; | |
}; // https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-Assertion | |
pp$1.regexp_eatAssertion = function (state) { | |
var start = state.pos; | |
state.lastAssertionIsQuantifiable = false; // ^, $ | |
if (state.eat(0x5E | |
/* ^ */ | |
) || state.eat(0x24 | |
/* $ */ | |
)) { | |
return true; | |
} // \b \B | |
if (state.eat(0x5C | |
/* \ */ | |
)) { | |
if (state.eat(0x42 | |
/* B */ | |
) || state.eat(0x62 | |
/* b */ | |
)) { | |
return true; | |
} | |
state.pos = start; | |
} // Lookahead / Lookbehind | |
if (state.eat(0x28 | |
/* ( */ | |
) && state.eat(0x3F | |
/* ? */ | |
)) { | |
var lookbehind = false; | |
if ((this || _global$R).options.ecmaVersion >= 9) { | |
lookbehind = state.eat(0x3C | |
/* < */ | |
); | |
} | |
if (state.eat(0x3D | |
/* = */ | |
) || state.eat(0x21 | |
/* ! */ | |
)) { | |
this.regexp_disjunction(state); | |
if (!state.eat(0x29 | |
/* ) */ | |
)) { | |
state.raise("Unterminated group"); | |
} | |
state.lastAssertionIsQuantifiable = !lookbehind; | |
return true; | |
} | |
} | |
state.pos = start; | |
return false; | |
}; // https://www.ecma-international.org/ecma-262/8.0/#prod-Quantifier | |
pp$1.regexp_eatQuantifier = function (state, noError) { | |
if (noError === void 0) noError = false; | |
if (this.regexp_eatQuantifierPrefix(state, noError)) { | |
state.eat(0x3F | |
/* ? */ | |
); | |
return true; | |
} | |
return false; | |
}; // https://www.ecma-international.org/ecma-262/8.0/#prod-QuantifierPrefix | |
pp$1.regexp_eatQuantifierPrefix = function (state, noError) { | |
return state.eat(0x2A | |
/* * */ | |
) || state.eat(0x2B | |
/* + */ | |
) || state.eat(0x3F | |
/* ? */ | |
) || this.regexp_eatBracedQuantifier(state, noError); | |
}; | |
pp$1.regexp_eatBracedQuantifier = function (state, noError) { | |
var start = state.pos; | |
if (state.eat(0x7B | |
/* { */ | |
)) { | |
var min = 0, | |
max = -1; | |
if (this.regexp_eatDecimalDigits(state)) { | |
min = state.lastIntValue; | |
if (state.eat(0x2C | |
/* , */ | |
) && this.regexp_eatDecimalDigits(state)) { | |
max = state.lastIntValue; | |
} | |
if (state.eat(0x7D | |
/* } */ | |
)) { | |
// SyntaxError in https://www.ecma-international.org/ecma-262/8.0/#sec-term | |
if (max !== -1 && max < min && !noError) { | |
state.raise("numbers out of order in {} quantifier"); | |
} | |
return true; | |
} | |
} | |
if (state.switchU && !noError) { | |
state.raise("Incomplete quantifier"); | |
} | |
state.pos = start; | |
} | |
return false; | |
}; // https://www.ecma-international.org/ecma-262/8.0/#prod-Atom | |
pp$1.regexp_eatAtom = function (state) { | |
return this.regexp_eatPatternCharacters(state) || state.eat(0x2E | |
/* . */ | |
) || this.regexp_eatReverseSolidusAtomEscape(state) || this.regexp_eatCharacterClass(state) || this.regexp_eatUncapturingGroup(state) || this.regexp_eatCapturingGroup(state); | |
}; | |
pp$1.regexp_eatReverseSolidusAtomEscape = function (state) { | |
var start = state.pos; | |
if (state.eat(0x5C | |
/* \ */ | |
)) { | |
if (this.regexp_eatAtomEscape(state)) { | |
return true; | |
} | |
state.pos = start; | |
} | |
return false; | |
}; | |
pp$1.regexp_eatUncapturingGroup = function (state) { | |
var start = state.pos; | |
if (state.eat(0x28 | |
/* ( */ | |
)) { | |
if (state.eat(0x3F | |
/* ? */ | |
) && state.eat(0x3A | |
/* : */ | |
)) { | |
this.regexp_disjunction(state); | |
if (state.eat(0x29 | |
/* ) */ | |
)) { | |
return true; | |
} | |
state.raise("Unterminated group"); | |
} | |
state.pos = start; | |
} | |
return false; | |
}; | |
pp$1.regexp_eatCapturingGroup = function (state) { | |
if (state.eat(0x28 | |
/* ( */ | |
)) { | |
if ((this || _global$R).options.ecmaVersion >= 9) { | |
this.regexp_groupSpecifier(state); | |
} else if (state.current() === 0x3F | |
/* ? */ | |
) { | |
state.raise("Invalid group"); | |
} | |
this.regexp_disjunction(state); | |
if (state.eat(0x29 | |
/* ) */ | |
)) { | |
state.numCapturingParens += 1; | |
return true; | |
} | |
state.raise("Unterminated group"); | |
} | |
return false; | |
}; // https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-ExtendedAtom | |
pp$1.regexp_eatExtendedAtom = function (state) { | |
return state.eat(0x2E | |
/* . */ | |
) || this.regexp_eatReverseSolidusAtomEscape(state) || this.regexp_eatCharacterClass(state) || this.regexp_eatUncapturingGroup(state) || this.regexp_eatCapturingGroup(state) || this.regexp_eatInvalidBracedQuantifier(state) || this.regexp_eatExtendedPatternCharacter(state); | |
}; // https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-InvalidBracedQuantifier | |
pp$1.regexp_eatInvalidBracedQuantifier = function (state) { | |
if (this.regexp_eatBracedQuantifier(state, true)) { | |
state.raise("Nothing to repeat"); | |
} | |
return false; | |
}; // https://www.ecma-international.org/ecma-262/8.0/#prod-SyntaxCharacter | |
pp$1.regexp_eatSyntaxCharacter = function (state) { | |
var ch = state.current(); | |
if (isSyntaxCharacter(ch)) { | |
state.lastIntValue = ch; | |
state.advance(); | |
return true; | |
} | |
return false; | |
}; | |
function isSyntaxCharacter(ch) { | |
return ch === 0x24 | |
/* $ */ | |
|| ch >= 0x28 | |
/* ( */ | |
&& ch <= 0x2B | |
/* + */ | |
|| ch === 0x2E | |
/* . */ | |
|| ch === 0x3F | |
/* ? */ | |
|| ch >= 0x5B | |
/* [ */ | |
&& ch <= 0x5E | |
/* ^ */ | |
|| ch >= 0x7B | |
/* { */ | |
&& ch <= 0x7D | |
/* } */ | |
; | |
} // https://www.ecma-international.org/ecma-262/8.0/#prod-PatternCharacter | |
// But eat eager. | |
pp$1.regexp_eatPatternCharacters = function (state) { | |
var start = state.pos; | |
var ch = 0; | |
while ((ch = state.current()) !== -1 && !isSyntaxCharacter(ch)) { | |
state.advance(); | |
} | |
return state.pos !== start; | |
}; // https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-ExtendedPatternCharacter | |
pp$1.regexp_eatExtendedPatternCharacter = function (state) { | |
var ch = state.current(); | |
if (ch !== -1 && ch !== 0x24 | |
/* $ */ | |
&& !(ch >= 0x28 | |
/* ( */ | |
&& ch <= 0x2B | |
/* + */ | |
) && ch !== 0x2E | |
/* . */ | |
&& ch !== 0x3F | |
/* ? */ | |
&& ch !== 0x5B | |
/* [ */ | |
&& ch !== 0x5E | |
/* ^ */ | |
&& ch !== 0x7C | |
/* | */ | |
) { | |
state.advance(); | |
return true; | |
} | |
return false; | |
}; // GroupSpecifier :: | |
// [empty] | |
// `?` GroupName | |
pp$1.regexp_groupSpecifier = function (state) { | |
if (state.eat(0x3F | |
/* ? */ | |
)) { | |
if (this.regexp_eatGroupName(state)) { | |
if (state.groupNames.indexOf(state.lastStringValue) !== -1) { | |
state.raise("Duplicate capture group name"); | |
} | |
state.groupNames.push(state.lastStringValue); | |
return; | |
} | |
state.raise("Invalid group"); | |
} | |
}; // GroupName :: | |
// `<` RegExpIdentifierName `>` | |
// Note: this updates `state.lastStringValue` property with the eaten name. | |
pp$1.regexp_eatGroupName = function (state) { | |
state.lastStringValue = ""; | |
if (state.eat(0x3C | |
/* < */ | |
)) { | |
if (this.regexp_eatRegExpIdentifierName(state) && state.eat(0x3E | |
/* > */ | |
)) { | |
return true; | |
} | |
state.raise("Invalid capture group name"); | |
} | |
return false; | |
}; // RegExpIdentifierName :: | |
// RegExpIdentifierStart | |
// RegExpIdentifierName RegExpIdentifierPart | |
// Note: this updates `state.lastStringValue` property with the eaten name. | |
pp$1.regexp_eatRegExpIdentifierName = function (state) { | |
state.lastStringValue = ""; | |
if (this.regexp_eatRegExpIdentifierStart(state)) { | |
state.lastStringValue += codePointToString$1(state.lastIntValue); | |
while (this.regexp_eatRegExpIdentifierPart(state)) { | |
state.lastStringValue += codePointToString$1(state.lastIntValue); | |
} | |
return true; | |
} | |
return false; | |
}; // RegExpIdentifierStart :: | |
// UnicodeIDStart | |
// `$` | |
// `_` | |
// `\` RegExpUnicodeEscapeSequence[+U] | |
pp$1.regexp_eatRegExpIdentifierStart = function (state) { | |
var start = state.pos; | |
var forceU = (this || _global$R).options.ecmaVersion >= 11; | |
var ch = state.current(forceU); | |
state.advance(forceU); | |
if (ch === 0x5C | |
/* \ */ | |
&& this.regexp_eatRegExpUnicodeEscapeSequence(state, forceU)) { | |
ch = state.lastIntValue; | |
} | |
if (isRegExpIdentifierStart(ch)) { | |
state.lastIntValue = ch; | |
return true; | |
} | |
state.pos = start; | |
return false; | |
}; | |
function isRegExpIdentifierStart(ch) { | |
return isIdentifierStart(ch, true) || ch === 0x24 | |
/* $ */ | |
|| ch === 0x5F; | |
/* _ */ | |
} // RegExpIdentifierPart :: | |
// UnicodeIDContinue | |
// `$` | |
// `_` | |
// `\` RegExpUnicodeEscapeSequence[+U] | |
// <ZWNJ> | |
// <ZWJ> | |
pp$1.regexp_eatRegExpIdentifierPart = function (state) { | |
var start = state.pos; | |
var forceU = (this || _global$R).options.ecmaVersion >= 11; | |
var ch = state.current(forceU); | |
state.advance(forceU); | |
if (ch === 0x5C | |
/* \ */ | |
&& this.regexp_eatRegExpUnicodeEscapeSequence(state, forceU)) { | |
ch = state.lastIntValue; | |
} | |
if (isRegExpIdentifierPart(ch)) { | |
state.lastIntValue = ch; | |
return true; | |
} | |
state.pos = start; | |
return false; | |
}; | |
function isRegExpIdentifierPart(ch) { | |
return isIdentifierChar(ch, true) || ch === 0x24 | |
/* $ */ | |
|| ch === 0x5F | |
/* _ */ | |
|| ch === 0x200C | |
/* <ZWNJ> */ | |
|| ch === 0x200D; | |
/* <ZWJ> */ | |
} // https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-AtomEscape | |
pp$1.regexp_eatAtomEscape = function (state) { | |
if (this.regexp_eatBackReference(state) || this.regexp_eatCharacterClassEscape(state) || this.regexp_eatCharacterEscape(state) || state.switchN && this.regexp_eatKGroupName(state)) { | |
return true; | |
} | |
if (state.switchU) { | |
// Make the same message as V8. | |
if (state.current() === 0x63 | |
/* c */ | |
) { | |
state.raise("Invalid unicode escape"); | |
} | |
state.raise("Invalid escape"); | |
} | |
return false; | |
}; | |
pp$1.regexp_eatBackReference = function (state) { | |
var start = state.pos; | |
if (this.regexp_eatDecimalEscape(state)) { | |
var n = state.lastIntValue; | |
if (state.switchU) { | |
// For SyntaxError in https://www.ecma-international.org/ecma-262/8.0/#sec-atomescape | |
if (n > state.maxBackReference) { | |
state.maxBackReference = n; | |
} | |
return true; | |
} | |
if (n <= state.numCapturingParens) { | |
return true; | |
} | |
state.pos = start; | |
} | |
return false; | |
}; | |
pp$1.regexp_eatKGroupName = function (state) { | |
if (state.eat(0x6B | |
/* k */ | |
)) { | |
if (this.regexp_eatGroupName(state)) { | |
state.backReferenceNames.push(state.lastStringValue); | |
return true; | |
} | |
state.raise("Invalid named reference"); | |
} | |
return false; | |
}; // https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-CharacterEscape | |
pp$1.regexp_eatCharacterEscape = function (state) { | |
return this.regexp_eatControlEscape(state) || this.regexp_eatCControlLetter(state) || this.regexp_eatZero(state) || this.regexp_eatHexEscapeSequence(state) || this.regexp_eatRegExpUnicodeEscapeSequence(state, false) || !state.switchU && this.regexp_eatLegacyOctalEscapeSequence(state) || this.regexp_eatIdentityEscape(state); | |
}; | |
pp$1.regexp_eatCControlLetter = function (state) { | |
var start = state.pos; | |
if (state.eat(0x63 | |
/* c */ | |
)) { | |
if (this.regexp_eatControlLetter(state)) { | |
return true; | |
} | |
state.pos = start; | |
} | |
return false; | |
}; | |
pp$1.regexp_eatZero = function (state) { | |
if (state.current() === 0x30 | |
/* 0 */ | |
&& !isDecimalDigit(state.lookahead())) { | |
state.lastIntValue = 0; | |
state.advance(); | |
return true; | |
} | |
return false; | |
}; // https://www.ecma-international.org/ecma-262/8.0/#prod-ControlEscape | |
pp$1.regexp_eatControlEscape = function (state) { | |
var ch = state.current(); | |
if (ch === 0x74 | |
/* t */ | |
) { | |
state.lastIntValue = 0x09; | |
/* \t */ | |
state.advance(); | |
return true; | |
} | |
if (ch === 0x6E | |
/* n */ | |
) { | |
state.lastIntValue = 0x0A; | |
/* \n */ | |
state.advance(); | |
return true; | |
} | |
if (ch === 0x76 | |
/* v */ | |
) { | |
state.lastIntValue = 0x0B; | |
/* \v */ | |
state.advance(); | |
return true; | |
} | |
if (ch === 0x66 | |
/* f */ | |
) { | |
state.lastIntValue = 0x0C; | |
/* \f */ | |
state.advance(); | |
return true; | |
} | |
if (ch === 0x72 | |
/* r */ | |
) { | |
state.lastIntValue = 0x0D; | |
/* \r */ | |
state.advance(); | |
return true; | |
} | |
return false; | |
}; // https://www.ecma-international.org/ecma-262/8.0/#prod-ControlLetter | |
pp$1.regexp_eatControlLetter = function (state) { | |
var ch = state.current(); | |
if (isControlLetter(ch)) { | |
state.lastIntValue = ch % 0x20; | |
state.advance(); | |
return true; | |
} | |
return false; | |
}; | |
function isControlLetter(ch) { | |
return ch >= 0x41 | |
/* A */ | |
&& ch <= 0x5A | |
/* Z */ | |
|| ch >= 0x61 | |
/* a */ | |
&& ch <= 0x7A | |
/* z */ | |
; | |
} // https://www.ecma-international.org/ecma-262/8.0/#prod-RegExpUnicodeEscapeSequence | |
pp$1.regexp_eatRegExpUnicodeEscapeSequence = function (state, forceU) { | |
if (forceU === void 0) forceU = false; | |
var start = state.pos; | |
var switchU = forceU || state.switchU; | |
if (state.eat(0x75 | |
/* u */ | |
)) { | |
if (this.regexp_eatFixedHexDigits(state, 4)) { | |
var lead = state.lastIntValue; | |
if (switchU && lead >= 0xD800 && lead <= 0xDBFF) { | |
var leadSurrogateEnd = state.pos; | |
if (state.eat(0x5C | |
/* \ */ | |
) && state.eat(0x75 | |
/* u */ | |
) && this.regexp_eatFixedHexDigits(state, 4)) { | |
var trail = state.lastIntValue; | |
if (trail >= 0xDC00 && trail <= 0xDFFF) { | |
state.lastIntValue = (lead - 0xD800) * 0x400 + (trail - 0xDC00) + 0x10000; | |
return true; | |
} | |
} | |
state.pos = leadSurrogateEnd; | |
state.lastIntValue = lead; | |
} | |
return true; | |
} | |
if (switchU && state.eat(0x7B | |
/* { */ | |
) && this.regexp_eatHexDigits(state) && state.eat(0x7D | |
/* } */ | |
) && isValidUnicode(state.lastIntValue)) { | |
return true; | |
} | |
if (switchU) { | |
state.raise("Invalid unicode escape"); | |
} | |
state.pos = start; | |
} | |
return false; | |
}; | |
function isValidUnicode(ch) { | |
return ch >= 0 && ch <= 0x10FFFF; | |
} // https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-IdentityEscape | |
pp$1.regexp_eatIdentityEscape = function (state) { | |
if (state.switchU) { | |
if (this.regexp_eatSyntaxCharacter(state)) { | |
return true; | |
} | |
if (state.eat(0x2F | |
/* / */ | |
)) { | |
state.lastIntValue = 0x2F; | |
/* / */ | |
return true; | |
} | |
return false; | |
} | |
var ch = state.current(); | |
if (ch !== 0x63 | |
/* c */ | |
&& (!state.switchN || ch !== 0x6B | |
/* k */ | |
)) { | |
state.lastIntValue = ch; | |
state.advance(); | |
return true; | |
} | |
return false; | |
}; // https://www.ecma-international.org/ecma-262/8.0/#prod-DecimalEscape | |
pp$1.regexp_eatDecimalEscape = function (state) { | |
state.lastIntValue = 0; | |
var ch = state.current(); | |
if (ch >= 0x31 | |
/* 1 */ | |
&& ch <= 0x39 | |
/* 9 */ | |
) { | |
do { | |
state.lastIntValue = 10 * state.lastIntValue + (ch - 0x30 | |
/* 0 */ | |
); | |
state.advance(); | |
} while ((ch = state.current()) >= 0x30 | |
/* 0 */ | |
&& ch <= 0x39 | |
/* 9 */ | |
); | |
return true; | |
} | |
return false; | |
}; // https://www.ecma-international.org/ecma-262/8.0/#prod-CharacterClassEscape | |
pp$1.regexp_eatCharacterClassEscape = function (state) { | |
var ch = state.current(); | |
if (isCharacterClassEscape(ch)) { | |
state.lastIntValue = -1; | |
state.advance(); | |
return true; | |
} | |
if (state.switchU && (this || _global$R).options.ecmaVersion >= 9 && (ch === 0x50 | |
/* P */ | |
|| ch === 0x70 | |
/* p */ | |
)) { | |
state.lastIntValue = -1; | |
state.advance(); | |
if (state.eat(0x7B | |
/* { */ | |
) && this.regexp_eatUnicodePropertyValueExpression(state) && state.eat(0x7D | |
/* } */ | |
)) { | |
return true; | |
} | |
state.raise("Invalid property name"); | |
} | |
return false; | |
}; | |
function isCharacterClassEscape(ch) { | |
return ch === 0x64 | |
/* d */ | |
|| ch === 0x44 | |
/* D */ | |
|| ch === 0x73 | |
/* s */ | |
|| ch === 0x53 | |
/* S */ | |
|| ch === 0x77 | |
/* w */ | |
|| ch === 0x57 | |
/* W */ | |
; | |
} // UnicodePropertyValueExpression :: | |
// UnicodePropertyName `=` UnicodePropertyValue | |
// LoneUnicodePropertyNameOrValue | |
pp$1.regexp_eatUnicodePropertyValueExpression = function (state) { | |
var start = state.pos; // UnicodePropertyName `=` UnicodePropertyValue | |
if (this.regexp_eatUnicodePropertyName(state) && state.eat(0x3D | |
/* = */ | |
)) { | |
var name = state.lastStringValue; | |
if (this.regexp_eatUnicodePropertyValue(state)) { | |
var value = state.lastStringValue; | |
this.regexp_validateUnicodePropertyNameAndValue(state, name, value); | |
return true; | |
} | |
} | |
state.pos = start; // LoneUnicodePropertyNameOrValue | |
if (this.regexp_eatLoneUnicodePropertyNameOrValue(state)) { | |
var nameOrValue = state.lastStringValue; | |
this.regexp_validateUnicodePropertyNameOrValue(state, nameOrValue); | |
return true; | |
} | |
return false; | |
}; | |
pp$1.regexp_validateUnicodePropertyNameAndValue = function (state, name, value) { | |
if (!hasOwn(state.unicodeProperties.nonBinary, name)) { | |
state.raise("Invalid property name"); | |
} | |
if (!state.unicodeProperties.nonBinary[name].test(value)) { | |
state.raise("Invalid property value"); | |
} | |
}; | |
pp$1.regexp_validateUnicodePropertyNameOrValue = function (state, nameOrValue) { | |
if (!state.unicodeProperties.binary.test(nameOrValue)) { | |
state.raise("Invalid property name"); | |
} | |
}; // UnicodePropertyName :: | |
// UnicodePropertyNameCharacters | |
pp$1.regexp_eatUnicodePropertyName = function (state) { | |
var ch = 0; | |
state.lastStringValue = ""; | |
while (isUnicodePropertyNameCharacter(ch = state.current())) { | |
state.lastStringValue += codePointToString$1(ch); | |
state.advance(); | |
} | |
return state.lastStringValue !== ""; | |
}; | |
function isUnicodePropertyNameCharacter(ch) { | |
return isControlLetter(ch) || ch === 0x5F; | |
/* _ */ | |
} // UnicodePropertyValue :: | |
// UnicodePropertyValueCharacters | |
pp$1.regexp_eatUnicodePropertyValue = function (state) { | |
var ch = 0; | |
state.lastStringValue = ""; | |
while (isUnicodePropertyValueCharacter(ch = state.current())) { | |
state.lastStringValue += codePointToString$1(ch); | |
state.advance(); | |
} | |
return state.lastStringValue !== ""; | |
}; | |
function isUnicodePropertyValueCharacter(ch) { | |
return isUnicodePropertyNameCharacter(ch) || isDecimalDigit(ch); | |
} // LoneUnicodePropertyNameOrValue :: | |
// UnicodePropertyValueCharacters | |
pp$1.regexp_eatLoneUnicodePropertyNameOrValue = function (state) { | |
return this.regexp_eatUnicodePropertyValue(state); | |
}; // https://www.ecma-international.org/ecma-262/8.0/#prod-CharacterClass | |
pp$1.regexp_eatCharacterClass = function (state) { | |
if (state.eat(0x5B | |
/* [ */ | |
)) { | |
state.eat(0x5E | |
/* ^ */ | |
); | |
this.regexp_classRanges(state); | |
if (state.eat(0x5D | |
/* ] */ | |
)) { | |
return true; | |
} // Unreachable since it threw "unterminated regular expression" error before. | |
state.raise("Unterminated character class"); | |
} | |
return false; | |
}; // https://www.ecma-international.org/ecma-262/8.0/#prod-ClassRanges | |
// https://www.ecma-international.org/ecma-262/8.0/#prod-NonemptyClassRanges | |
// https://www.ecma-international.org/ecma-262/8.0/#prod-NonemptyClassRangesNoDash | |
pp$1.regexp_classRanges = function (state) { | |
while (this.regexp_eatClassAtom(state)) { | |
var left = state.lastIntValue; | |
if (state.eat(0x2D | |
/* - */ | |
) && this.regexp_eatClassAtom(state)) { | |
var right = state.lastIntValue; | |
if (state.switchU && (left === -1 || right === -1)) { | |
state.raise("Invalid character class"); | |
} | |
if (left !== -1 && right !== -1 && left > right) { | |
state.raise("Range out of order in character class"); | |
} | |
} | |
} | |
}; // https://www.ecma-international.org/ecma-262/8.0/#prod-ClassAtom | |
// https://www.ecma-international.org/ecma-262/8.0/#prod-ClassAtomNoDash | |
pp$1.regexp_eatClassAtom = function (state) { | |
var start = state.pos; | |
if (state.eat(0x5C | |
/* \ */ | |
)) { | |
if (this.regexp_eatClassEscape(state)) { | |
return true; | |
} | |
if (state.switchU) { | |
// Make the same message as V8. | |
var ch$1 = state.current(); | |
if (ch$1 === 0x63 | |
/* c */ | |
|| isOctalDigit(ch$1)) { | |
state.raise("Invalid class escape"); | |
} | |
state.raise("Invalid escape"); | |
} | |
state.pos = start; | |
} | |
var ch = state.current(); | |
if (ch !== 0x5D | |
/* ] */ | |
) { | |
state.lastIntValue = ch; | |
state.advance(); | |
return true; | |
} | |
return false; | |
}; // https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-ClassEscape | |
pp$1.regexp_eatClassEscape = function (state) { | |
var start = state.pos; | |
if (state.eat(0x62 | |
/* b */ | |
)) { | |
state.lastIntValue = 0x08; | |
/* <BS> */ | |
return true; | |
} | |
if (state.switchU && state.eat(0x2D | |
/* - */ | |
)) { | |
state.lastIntValue = 0x2D; | |
/* - */ | |
return true; | |
} | |
if (!state.switchU && state.eat(0x63 | |
/* c */ | |
)) { | |
if (this.regexp_eatClassControlLetter(state)) { | |
return true; | |
} | |
state.pos = start; | |
} | |
return this.regexp_eatCharacterClassEscape(state) || this.regexp_eatCharacterEscape(state); | |
}; // https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-ClassControlLetter | |
pp$1.regexp_eatClassControlLetter = function (state) { | |
var ch = state.current(); | |
if (isDecimalDigit(ch) || ch === 0x5F | |
/* _ */ | |
) { | |
state.lastIntValue = ch % 0x20; | |
state.advance(); | |
return true; | |
} | |
return false; | |
}; // https://www.ecma-international.org/ecma-262/8.0/#prod-HexEscapeSequence | |
pp$1.regexp_eatHexEscapeSequence = function (state) { | |
var start = state.pos; | |
if (state.eat(0x78 | |
/* x */ | |
)) { | |
if (this.regexp_eatFixedHexDigits(state, 2)) { | |
return true; | |
} | |
if (state.switchU) { | |
state.raise("Invalid escape"); | |
} | |
state.pos = start; | |
} | |
return false; | |
}; // https://www.ecma-international.org/ecma-262/8.0/#prod-DecimalDigits | |
pp$1.regexp_eatDecimalDigits = function (state) { | |
var start = state.pos; | |
var ch = 0; | |
state.lastIntValue = 0; | |
while (isDecimalDigit(ch = state.current())) { | |
state.lastIntValue = 10 * state.lastIntValue + (ch - 0x30 | |
/* 0 */ | |
); | |
state.advance(); | |
} | |
return state.pos !== start; | |
}; | |
function isDecimalDigit(ch) { | |
return ch >= 0x30 | |
/* 0 */ | |
&& ch <= 0x39; | |
/* 9 */ | |
} // https://www.ecma-international.org/ecma-262/8.0/#prod-HexDigits | |
pp$1.regexp_eatHexDigits = function (state) { | |
var start = state.pos; | |
var ch = 0; | |
state.lastIntValue = 0; | |
while (isHexDigit(ch = state.current())) { | |
state.lastIntValue = 16 * state.lastIntValue + hexToInt(ch); | |
state.advance(); | |
} | |
return state.pos !== start; | |
}; | |
function isHexDigit(ch) { | |
return ch >= 0x30 | |
/* 0 */ | |
&& ch <= 0x39 | |
/* 9 */ | |
|| ch >= 0x41 | |
/* A */ | |
&& ch <= 0x46 | |
/* F */ | |
|| ch >= 0x61 | |
/* a */ | |
&& ch <= 0x66 | |
/* f */ | |
; | |
} | |
function hexToInt(ch) { | |
if (ch >= 0x41 | |
/* A */ | |
&& ch <= 0x46 | |
/* F */ | |
) { | |
return 10 + (ch - 0x41 | |
/* A */ | |
); | |
} | |
if (ch >= 0x61 | |
/* a */ | |
&& ch <= 0x66 | |
/* f */ | |
) { | |
return 10 + (ch - 0x61 | |
/* a */ | |
); | |
} | |
return ch - 0x30; | |
/* 0 */ | |
} // https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-LegacyOctalEscapeSequence | |
// Allows only 0-377(octal) i.e. 0-255(decimal). | |
pp$1.regexp_eatLegacyOctalEscapeSequence = function (state) { | |
if (this.regexp_eatOctalDigit(state)) { | |
var n1 = state.lastIntValue; | |
if (this.regexp_eatOctalDigit(state)) { | |
var n2 = state.lastIntValue; | |
if (n1 <= 3 && this.regexp_eatOctalDigit(state)) { | |
state.lastIntValue = n1 * 64 + n2 * 8 + state.lastIntValue; | |
} else { | |
state.lastIntValue = n1 * 8 + n2; | |
} | |
} else { | |
state.lastIntValue = n1; | |
} | |
return true; | |
} | |
return false; | |
}; // https://www.ecma-international.org/ecma-262/8.0/#prod-OctalDigit | |
pp$1.regexp_eatOctalDigit = function (state) { | |
var ch = state.current(); | |
if (isOctalDigit(ch)) { | |
state.lastIntValue = ch - 0x30; | |
/* 0 */ | |
state.advance(); | |
return true; | |
} | |
state.lastIntValue = 0; | |
return false; | |
}; | |
function isOctalDigit(ch) { | |
return ch >= 0x30 | |
/* 0 */ | |
&& ch <= 0x37; | |
/* 7 */ | |
} // https://www.ecma-international.org/ecma-262/8.0/#prod-Hex4Digits | |
// https://www.ecma-international.org/ecma-262/8.0/#prod-HexDigit | |
// And HexDigit HexDigit in https://www.ecma-international.org/ecma-262/8.0/#prod-HexEscapeSequence | |
pp$1.regexp_eatFixedHexDigits = function (state, length) { | |
var start = state.pos; | |
state.lastIntValue = 0; | |
for (var i = 0; i < length; ++i) { | |
var ch = state.current(); | |
if (!isHexDigit(ch)) { | |
state.pos = start; | |
return false; | |
} | |
state.lastIntValue = 16 * state.lastIntValue + hexToInt(ch); | |
state.advance(); | |
} | |
return true; | |
}; // Object type used to represent tokens. Note that normally, tokens | |
// simply exist as properties on the parser object. This is only | |
// used for the onToken callback and the external tokenizer. | |
var Token = function Token(p) { | |
(this || _global$R).type = p.type; | |
(this || _global$R).value = p.value; | |
(this || _global$R).start = p.start; | |
(this || _global$R).end = p.end; | |
if (p.options.locations) { | |
(this || _global$R).loc = new SourceLocation(p, p.startLoc, p.endLoc); | |
} | |
if (p.options.ranges) { | |
(this || _global$R).range = [p.start, p.end]; | |
} | |
}; // ## Tokenizer | |
var pp = Parser.prototype; // Move to the next token | |
pp.next = function (ignoreEscapeSequenceInKeyword) { | |
if (!ignoreEscapeSequenceInKeyword && (this || _global$R).type.keyword && (this || _global$R).containsEsc) { | |
this.raiseRecoverable((this || _global$R).start, "Escape sequence in keyword " + (this || _global$R).type.keyword); | |
} | |
if ((this || _global$R).options.onToken) { | |
(this || _global$R).options.onToken(new Token(this || _global$R)); | |
} | |
(this || _global$R).lastTokEnd = (this || _global$R).end; | |
(this || _global$R).lastTokStart = (this || _global$R).start; | |
(this || _global$R).lastTokEndLoc = (this || _global$R).endLoc; | |
(this || _global$R).lastTokStartLoc = (this || _global$R).startLoc; | |
this.nextToken(); | |
}; | |
pp.getToken = function () { | |
this.next(); | |
return new Token(this || _global$R); | |
}; // If we're in an ES6 environment, make parsers iterable | |
if (typeof Symbol !== "undefined") { | |
pp[Symbol.iterator] = function () { | |
var this$1$1 = this || _global$R; | |
return { | |
next: function () { | |
var token = this$1$1.getToken(); | |
return { | |
done: token.type === types$1.eof, | |
value: token | |
}; | |
} | |
}; | |
}; | |
} // Toggle strict mode. Re-reads the next number or string to please | |
// pedantic tests (`"use strict"; 010;` should fail). | |
// Read a single token, updating the parser object's token-related | |
// properties. | |
pp.nextToken = function () { | |
var curContext = this.curContext(); | |
if (!curContext || !curContext.preserveSpace) { | |
this.skipSpace(); | |
} | |
(this || _global$R).start = (this || _global$R).pos; | |
if ((this || _global$R).options.locations) { | |
(this || _global$R).startLoc = this.curPosition(); | |
} | |
if ((this || _global$R).pos >= (this || _global$R).input.length) { | |
return this.finishToken(types$1.eof); | |
} | |
if (curContext.override) { | |
return curContext.override(this || _global$R); | |
} else { | |
this.readToken(this.fullCharCodeAtPos()); | |
} | |
}; | |
pp.readToken = function (code) { | |
// Identifier or keyword. '\uXXXX' sequences are allowed in | |
// identifiers, so '\' also dispatches to that. | |
if (isIdentifierStart(code, (this || _global$R).options.ecmaVersion >= 6) || code === 92 | |
/* '\' */ | |
) { | |
return this.readWord(); | |
} | |
return this.getTokenFromCode(code); | |
}; | |
pp.fullCharCodeAtPos = function () { | |
var code = (this || _global$R).input.charCodeAt((this || _global$R).pos); | |
if (code <= 0xd7ff || code >= 0xdc00) { | |
return code; | |
} | |
var next = (this || _global$R).input.charCodeAt((this || _global$R).pos + 1); | |
return next <= 0xdbff || next >= 0xe000 ? code : (code << 10) + next - 0x35fdc00; | |
}; | |
pp.skipBlockComment = function () { | |
var startLoc = (this || _global$R).options.onComment && this.curPosition(); | |
var start = (this || _global$R).pos, | |
end = (this || _global$R).input.indexOf("*/", (this || _global$R).pos += 2); | |
if (end === -1) { | |
this.raise((this || _global$R).pos - 2, "Unterminated comment"); | |
} | |
(this || _global$R).pos = end + 2; | |
if ((this || _global$R).options.locations) { | |
for (var nextBreak = void 0, pos = start; (nextBreak = nextLineBreak((this || _global$R).input, pos, (this || _global$R).pos)) > -1;) { | |
++(this || _global$R).curLine; | |
pos = (this || _global$R).lineStart = nextBreak; | |
} | |
} | |
if ((this || _global$R).options.onComment) { | |
(this || _global$R).options.onComment(true, (this || _global$R).input.slice(start + 2, end), start, (this || _global$R).pos, startLoc, this.curPosition()); | |
} | |
}; | |
pp.skipLineComment = function (startSkip) { | |
var start = (this || _global$R).pos; | |
var startLoc = (this || _global$R).options.onComment && this.curPosition(); | |
var ch = (this || _global$R).input.charCodeAt((this || _global$R).pos += startSkip); | |
while ((this || _global$R).pos < (this || _global$R).input.length && !isNewLine(ch)) { | |
ch = (this || _global$R).input.charCodeAt(++(this || _global$R).pos); | |
} | |
if ((this || _global$R).options.onComment) { | |
(this || _global$R).options.onComment(false, (this || _global$R).input.slice(start + startSkip, (this || _global$R).pos), start, (this || _global$R).pos, startLoc, this.curPosition()); | |
} | |
}; // Called at the start of the parse and after every token. Skips | |
// whitespace and comments, and. | |
pp.skipSpace = function () { | |
loop: while ((this || _global$R).pos < (this || _global$R).input.length) { | |
var ch = (this || _global$R).input.charCodeAt((this || _global$R).pos); | |
switch (ch) { | |
case 32: | |
case 160: | |
// ' ' | |
++(this || _global$R).pos; | |
break; | |
case 13: | |
if ((this || _global$R).input.charCodeAt((this || _global$R).pos + 1) === 10) { | |
++(this || _global$R).pos; | |
} | |
case 10: | |
case 8232: | |
case 8233: | |
++(this || _global$R).pos; | |
if ((this || _global$R).options.locations) { | |
++(this || _global$R).curLine; | |
(this || _global$R).lineStart = (this || _global$R).pos; | |
} | |
break; | |
case 47: | |
// '/' | |
switch ((this || _global$R).input.charCodeAt((this || _global$R).pos + 1)) { | |
case 42: | |
// '*' | |
this.skipBlockComment(); | |
break; | |
case 47: | |
this.skipLineComment(2); | |
break; | |
default: | |
break loop; | |
} | |
break; | |
default: | |
if (ch > 8 && ch < 14 || ch >= 5760 && nonASCIIwhitespace.test(String.fromCharCode(ch))) { | |
++(this || _global$R).pos; | |
} else { | |
break loop; | |
} | |
} | |
} | |
}; // Called at the end of every token. Sets `end`, `val`, and | |
// maintains `context` and `exprAllowed`, and skips the space after | |
// the token, so that the next one's `start` will point at the | |
// right position. | |
pp.finishToken = function (type, val) { | |
(this || _global$R).end = (this || _global$R).pos; | |
if ((this || _global$R).options.locations) { | |
(this || _global$R).endLoc = this.curPosition(); | |
} | |
var prevType = (this || _global$R).type; | |
(this || _global$R).type = type; | |
(this || _global$R).value = val; | |
this.updateContext(prevType); | |
}; // ### Token reading | |
// This is the function that is called to fetch the next token. It | |
// is somewhat obscure, because it works in character codes rather | |
// than characters, and because operator parsing has been inlined | |
// into it. | |
// | |
// All in the name of speed. | |
// | |
pp.readToken_dot = function () { | |
var next = (this || _global$R).input.charCodeAt((this || _global$R).pos + 1); | |
if (next >= 48 && next <= 57) { | |
return this.readNumber(true); | |
} | |
var next2 = (this || _global$R).input.charCodeAt((this || _global$R).pos + 2); | |
if ((this || _global$R).options.ecmaVersion >= 6 && next === 46 && next2 === 46) { | |
// 46 = dot '.' | |
(this || _global$R).pos += 3; | |
return this.finishToken(types$1.ellipsis); | |
} else { | |
++(this || _global$R).pos; | |
return this.finishToken(types$1.dot); | |
} | |
}; | |
pp.readToken_slash = function () { | |
// '/' | |
var next = (this || _global$R).input.charCodeAt((this || _global$R).pos + 1); | |
if ((this || _global$R).exprAllowed) { | |
++(this || _global$R).pos; | |
return this.readRegexp(); | |
} | |
if (next === 61) { | |
return this.finishOp(types$1.assign, 2); | |
} | |
return this.finishOp(types$1.slash, 1); | |
}; | |
pp.readToken_mult_modulo_exp = function (code) { | |
// '%*' | |
var next = (this || _global$R).input.charCodeAt((this || _global$R).pos + 1); | |
var size = 1; | |
var tokentype = code === 42 ? types$1.star : types$1.modulo; // exponentiation operator ** and **= | |
if ((this || _global$R).options.ecmaVersion >= 7 && code === 42 && next === 42) { | |
++size; | |
tokentype = types$1.starstar; | |
next = (this || _global$R).input.charCodeAt((this || _global$R).pos + 2); | |
} | |
if (next === 61) { | |
return this.finishOp(types$1.assign, size + 1); | |
} | |
return this.finishOp(tokentype, size); | |
}; | |
pp.readToken_pipe_amp = function (code) { | |
// '|&' | |
var next = (this || _global$R).input.charCodeAt((this || _global$R).pos + 1); | |
if (next === code) { | |
if ((this || _global$R).options.ecmaVersion >= 12) { | |
var next2 = (this || _global$R).input.charCodeAt((this || _global$R).pos + 2); | |
if (next2 === 61) { | |
return this.finishOp(types$1.assign, 3); | |
} | |
} | |
return this.finishOp(code === 124 ? types$1.logicalOR : types$1.logicalAND, 2); | |
} | |
if (next === 61) { | |
return this.finishOp(types$1.assign, 2); | |
} | |
return this.finishOp(code === 124 ? types$1.bitwiseOR : types$1.bitwiseAND, 1); | |
}; | |
pp.readToken_caret = function () { | |
// '^' | |
var next = (this || _global$R).input.charCodeAt((this || _global$R).pos + 1); | |
if (next === 61) { | |
return this.finishOp(types$1.assign, 2); | |
} | |
return this.finishOp(types$1.bitwiseXOR, 1); | |
}; | |
pp.readToken_plus_min = function (code) { | |
// '+-' | |
var next = (this || _global$R).input.charCodeAt((this || _global$R).pos + 1); | |
if (next === code) { | |
if (next === 45 && !(this || _global$R).inModule && (this || _global$R).input.charCodeAt((this || _global$R).pos + 2) === 62 && ((this || _global$R).lastTokEnd === 0 || lineBreak.test((this || _global$R).input.slice((this || _global$R).lastTokEnd, (this || _global$R).pos)))) { | |
// A `-->` line comment | |
this.skipLineComment(3); | |
this.skipSpace(); | |
return this.nextToken(); | |
} | |
return this.finishOp(types$1.incDec, 2); | |
} | |
if (next === 61) { | |
return this.finishOp(types$1.assign, 2); | |
} | |
return this.finishOp(types$1.plusMin, 1); | |
}; | |
pp.readToken_lt_gt = function (code) { | |
// '<>' | |
var next = (this || _global$R).input.charCodeAt((this || _global$R).pos + 1); | |
var size = 1; | |
if (next === code) { | |
size = code === 62 && (this || _global$R).input.charCodeAt((this || _global$R).pos + 2) === 62 ? 3 : 2; | |
if ((this || _global$R).input.charCodeAt((this || _global$R).pos + size) === 61) { | |
return this.finishOp(types$1.assign, size + 1); | |
} | |
return this.finishOp(types$1.bitShift, size); | |
} | |
if (next === 33 && code === 60 && !(this || _global$R).inModule && (this || _global$R).input.charCodeAt((this || _global$R).pos + 2) === 45 && (this || _global$R).input.charCodeAt((this || _global$R).pos + 3) === 45) { | |
// `<!--`, an XML-style comment that should be interpreted as a line comment | |
this.skipLineComment(4); | |
this.skipSpace(); | |
return this.nextToken(); | |
} | |
if (next === 61) { | |
size = 2; | |
} | |
return this.finishOp(types$1.relational, size); | |
}; | |
pp.readToken_eq_excl = function (code) { | |
// '=!' | |
var next = (this || _global$R).input.charCodeAt((this || _global$R).pos + 1); | |
if (next === 61) { | |
return this.finishOp(types$1.equality, (this || _global$R).input.charCodeAt((this || _global$R).pos + 2) === 61 ? 3 : 2); | |
} | |
if (code === 61 && next === 62 && (this || _global$R).options.ecmaVersion >= 6) { | |
// '=>' | |
(this || _global$R).pos += 2; | |
return this.finishToken(types$1.arrow); | |
} | |
return this.finishOp(code === 61 ? types$1.eq : types$1.prefix, 1); | |
}; | |
pp.readToken_question = function () { | |
// '?' | |
var ecmaVersion = (this || _global$R).options.ecmaVersion; | |
if (ecmaVersion >= 11) { | |
var next = (this || _global$R).input.charCodeAt((this || _global$R).pos + 1); | |
if (next === 46) { | |
var next2 = (this || _global$R).input.charCodeAt((this || _global$R).pos + 2); | |
if (next2 < 48 || next2 > 57) { | |
return this.finishOp(types$1.questionDot, 2); | |
} | |
} | |
if (next === 63) { | |
if (ecmaVersion >= 12) { | |
var next2$1 = (this || _global$R).input.charCodeAt((this || _global$R).pos + 2); | |
if (next2$1 === 61) { | |
return this.finishOp(types$1.assign, 3); | |
} | |
} | |
return this.finishOp(types$1.coalesce, 2); | |
} | |
} | |
return this.finishOp(types$1.question, 1); | |
}; | |
pp.readToken_numberSign = function () { | |
// '#' | |
var ecmaVersion = (this || _global$R).options.ecmaVersion; | |
var code = 35; // '#' | |
if (ecmaVersion >= 13) { | |
++(this || _global$R).pos; | |
code = this.fullCharCodeAtPos(); | |
if (isIdentifierStart(code, true) || code === 92 | |
/* '\' */ | |
) { | |
return this.finishToken(types$1.privateId, this.readWord1()); | |
} | |
} | |
this.raise((this || _global$R).pos, "Unexpected character '" + codePointToString(code) + "'"); | |
}; | |
pp.getTokenFromCode = function (code) { | |
switch (code) { | |
// The interpretation of a dot depends on whether it is followed | |
// by a digit or another two dots. | |
case 46: | |
// '.' | |
return this.readToken_dot(); | |
// Punctuation tokens. | |
case 40: | |
++(this || _global$R).pos; | |
return this.finishToken(types$1.parenL); | |
case 41: | |
++(this || _global$R).pos; | |
return this.finishToken(types$1.parenR); | |
case 59: | |
++(this || _global$R).pos; | |
return this.finishToken(types$1.semi); | |
case 44: | |
++(this || _global$R).pos; | |
return this.finishToken(types$1.comma); | |
case 91: | |
++(this || _global$R).pos; | |
return this.finishToken(types$1.bracketL); | |
case 93: | |
++(this || _global$R).pos; | |
return this.finishToken(types$1.bracketR); | |
case 123: | |
++(this || _global$R).pos; | |
return this.finishToken(types$1.braceL); | |
case 125: | |
++(this || _global$R).pos; | |
return this.finishToken(types$1.braceR); | |
case 58: | |
++(this || _global$R).pos; | |
return this.finishToken(types$1.colon); | |
case 96: | |
// '`' | |
if ((this || _global$R).options.ecmaVersion < 6) { | |
break; | |
} | |
++(this || _global$R).pos; | |
return this.finishToken(types$1.backQuote); | |
case 48: | |
// '0' | |
var next = (this || _global$R).input.charCodeAt((this || _global$R).pos + 1); | |
if (next === 120 || next === 88) { | |
return this.readRadixNumber(16); | |
} // '0x', '0X' - hex number | |
if ((this || _global$R).options.ecmaVersion >= 6) { | |
if (next === 111 || next === 79) { | |
return this.readRadixNumber(8); | |
} // '0o', '0O' - octal number | |
if (next === 98 || next === 66) { | |
return this.readRadixNumber(2); | |
} // '0b', '0B' - binary number | |
} | |
// Anything else beginning with a digit is an integer, octal | |
// number, or float. | |
case 49: | |
case 50: | |
case 51: | |
case 52: | |
case 53: | |
case 54: | |
case 55: | |
case 56: | |
case 57: | |
// 1-9 | |
return this.readNumber(false); | |
// Quotes produce strings. | |
case 34: | |
case 39: | |
// '"', "'" | |
return this.readString(code); | |
// Operators are parsed inline in tiny state machines. '=' (61) is | |
// often referred to. `finishOp` simply skips the amount of | |
// characters it is given as second argument, and returns a token | |
// of the type given by its first argument. | |
case 47: | |
// '/' | |
return this.readToken_slash(); | |
case 37: | |
case 42: | |
// '%*' | |
return this.readToken_mult_modulo_exp(code); | |
case 124: | |
case 38: | |
// '|&' | |
return this.readToken_pipe_amp(code); | |
case 94: | |
// '^' | |
return this.readToken_caret(); | |
case 43: | |
case 45: | |
// '+-' | |
return this.readToken_plus_min(code); | |
case 60: | |
case 62: | |
// '<>' | |
return this.readToken_lt_gt(code); | |
case 61: | |
case 33: | |
// '=!' | |
return this.readToken_eq_excl(code); | |
case 63: | |
// '?' | |
return this.readToken_question(); | |
case 126: | |
// '~' | |
return this.finishOp(types$1.prefix, 1); | |
case 35: | |
// '#' | |
return this.readToken_numberSign(); | |
} | |
this.raise((this || _global$R).pos, "Unexpected character '" + codePointToString(code) + "'"); | |
}; | |
pp.finishOp = function (type, size) { | |
var str = (this || _global$R).input.slice((this || _global$R).pos, (this || _global$R).pos + size); | |
(this || _global$R).pos += size; | |
return this.finishToken(type, str); | |
}; | |
pp.readRegexp = function () { | |
var escaped, | |
inClass, | |
start = (this || _global$R).pos; | |
for (;;) { | |
if ((this || _global$R).pos >= (this || _global$R).input.length) { | |
this.raise(start, "Unterminated regular expression"); | |
} | |
var ch = (this || _global$R).input.charAt((this || _global$R).pos); | |
if (lineBreak.test(ch)) { | |
this.raise(start, "Unterminated regular expression"); | |
} | |
if (!escaped) { | |
if (ch === "[") { | |
inClass = true; | |
} else if (ch === "]" && inClass) { | |
inClass = false; | |
} else if (ch === "/" && !inClass) { | |
break; | |
} | |
escaped = ch === "\\"; | |
} else { | |
escaped = false; | |
} | |
++(this || _global$R).pos; | |
} | |
var pattern = (this || _global$R).input.slice(start, (this || _global$R).pos); | |
++(this || _global$R).pos; | |
var flagsStart = (this || _global$R).pos; | |
var flags = this.readWord1(); | |
if ((this || _global$R).containsEsc) { | |
this.unexpected(flagsStart); | |
} // Validate pattern | |
var state = (this || _global$R).regexpState || ((this || _global$R).regexpState = new RegExpValidationState(this || _global$R)); | |
state.reset(start, pattern, flags); | |
this.validateRegExpFlags(state); | |
this.validateRegExpPattern(state); // Create Literal#value property value. | |
var value = null; | |
try { | |
value = new RegExp(pattern, flags); | |
} catch (e) {// ESTree requires null if it failed to instantiate RegExp object. | |
// https://github.com/estree/estree/blob/a27003adf4fd7bfad44de9cef372a2eacd527b1c/es5.md#regexpliteral | |
} | |
return this.finishToken(types$1.regexp, { | |
pattern: pattern, | |
flags: flags, | |
value: value | |
}); | |
}; // Read an integer in the given radix. Return null if zero digits | |
// were read, the integer value otherwise. When `len` is given, this | |
// will return `null` unless the integer has exactly `len` digits. | |
pp.readInt = function (radix, len, maybeLegacyOctalNumericLiteral) { | |
// `len` is used for character escape sequences. In that case, disallow separators. | |
var allowSeparators = (this || _global$R).options.ecmaVersion >= 12 && len === undefined; // `maybeLegacyOctalNumericLiteral` is true if it doesn't have prefix (0x,0o,0b) | |
// and isn't fraction part nor exponent part. In that case, if the first digit | |
// is zero then disallow separators. | |
var isLegacyOctalNumericLiteral = maybeLegacyOctalNumericLiteral && (this || _global$R).input.charCodeAt((this || _global$R).pos) === 48; | |
var start = (this || _global$R).pos, | |
total = 0, | |
lastCode = 0; | |
for (var i = 0, e = len == null ? Infinity : len; i < e; ++i, ++(this || _global$R).pos) { | |
var code = (this || _global$R).input.charCodeAt((this || _global$R).pos), | |
val = void 0; | |
if (allowSeparators && code === 95) { | |
if (isLegacyOctalNumericLiteral) { | |
this.raiseRecoverable((this || _global$R).pos, "Numeric separator is not allowed in legacy octal numeric literals"); | |
} | |
if (lastCode === 95) { | |
this.raiseRecoverable((this || _global$R).pos, "Numeric separator must be exactly one underscore"); | |
} | |
if (i === 0) { | |
this.raiseRecoverable((this || _global$R).pos, "Numeric separator is not allowed at the first of digits"); | |
} | |
lastCode = code; | |
continue; | |
} | |
if (code >= 97) { | |
val = code - 97 + 10; | |
} // a | |
else if (code >= 65) { | |
val = code - 65 + 10; | |
} // A | |
else if (code >= 48 && code <= 57) { | |
val = code - 48; | |
} // 0-9 | |
else { | |
val = Infinity; | |
} | |
if (val >= radix) { | |
break; | |
} | |
lastCode = code; | |
total = total * radix + val; | |
} | |
if (allowSeparators && lastCode === 95) { | |
this.raiseRecoverable((this || _global$R).pos - 1, "Numeric separator is not allowed at the last of digits"); | |
} | |
if ((this || _global$R).pos === start || len != null && (this || _global$R).pos - start !== len) { | |
return null; | |
} | |
return total; | |
}; | |
function stringToNumber(str, isLegacyOctalNumericLiteral) { | |
if (isLegacyOctalNumericLiteral) { | |
return parseInt(str, 8); | |
} // `parseFloat(value)` stops parsing at the first numeric separator then returns a wrong value. | |
return parseFloat(str.replace(/_/g, "")); | |
} | |
function stringToBigInt(str) { | |
if (typeof BigInt !== "function") { | |
return null; | |
} // `BigInt(value)` throws syntax error if the string contains numeric separators. | |
return BigInt(str.replace(/_/g, "")); | |
} | |
pp.readRadixNumber = function (radix) { | |
var start = (this || _global$R).pos; | |
(this || _global$R).pos += 2; // 0x | |
var val = this.readInt(radix); | |
if (val == null) { | |
this.raise((this || _global$R).start + 2, "Expected number in radix " + radix); | |
} | |
if ((this || _global$R).options.ecmaVersion >= 11 && (this || _global$R).input.charCodeAt((this || _global$R).pos) === 110) { | |
val = stringToBigInt((this || _global$R).input.slice(start, (this || _global$R).pos)); | |
++(this || _global$R).pos; | |
} else if (isIdentifierStart(this.fullCharCodeAtPos())) { | |
this.raise((this || _global$R).pos, "Identifier directly after number"); | |
} | |
return this.finishToken(types$1.num, val); | |
}; // Read an integer, octal integer, or floating-point number. | |
pp.readNumber = function (startsWithDot) { | |
var start = (this || _global$R).pos; | |
if (!startsWithDot && this.readInt(10, undefined, true) === null) { | |
this.raise(start, "Invalid number"); | |
} | |
var octal = (this || _global$R).pos - start >= 2 && (this || _global$R).input.charCodeAt(start) === 48; | |
if (octal && (this || _global$R).strict) { | |
this.raise(start, "Invalid number"); | |
} | |
var next = (this || _global$R).input.charCodeAt((this || _global$R).pos); | |
if (!octal && !startsWithDot && (this || _global$R).options.ecmaVersion >= 11 && next === 110) { | |
var val$1 = stringToBigInt((this || _global$R).input.slice(start, (this || _global$R).pos)); | |
++(this || _global$R).pos; | |
if (isIdentifierStart(this.fullCharCodeAtPos())) { | |
this.raise((this || _global$R).pos, "Identifier directly after number"); | |
} | |
return this.finishToken(types$1.num, val$1); | |
} | |
if (octal && /[89]/.test((this || _global$R).input.slice(start, (this || _global$R).pos))) { | |
octal = false; | |
} | |
if (next === 46 && !octal) { | |
// '.' | |
++(this || _global$R).pos; | |
this.readInt(10); | |
next = (this || _global$R).input.charCodeAt((this || _global$R).pos); | |
} | |
if ((next === 69 || next === 101) && !octal) { | |
// 'eE' | |
next = (this || _global$R).input.charCodeAt(++(this || _global$R).pos); | |
if (next === 43 || next === 45) { | |
++(this || _global$R).pos; | |
} // '+-' | |
if (this.readInt(10) === null) { | |
this.raise(start, "Invalid number"); | |
} | |
} | |
if (isIdentifierStart(this.fullCharCodeAtPos())) { | |
this.raise((this || _global$R).pos, "Identifier directly after number"); | |
} | |
var val = stringToNumber((this || _global$R).input.slice(start, (this || _global$R).pos), octal); | |
return this.finishToken(types$1.num, val); | |
}; // Read a string value, interpreting backslash-escapes. | |
pp.readCodePoint = function () { | |
var ch = (this || _global$R).input.charCodeAt((this || _global$R).pos), | |
code; | |
if (ch === 123) { | |
// '{' | |
if ((this || _global$R).options.ecmaVersion < 6) { | |
this.unexpected(); | |
} | |
var codePos = ++(this || _global$R).pos; | |
code = this.readHexChar((this || _global$R).input.indexOf("}", (this || _global$R).pos) - (this || _global$R).pos); | |
++(this || _global$R).pos; | |
if (code > 0x10FFFF) { | |
this.invalidStringToken(codePos, "Code point out of bounds"); | |
} | |
} else { | |
code = this.readHexChar(4); | |
} | |
return code; | |
}; | |
function codePointToString(code) { | |
// UTF-16 Decoding | |
if (code <= 0xFFFF) { | |
return String.fromCharCode(code); | |
} | |
code -= 0x10000; | |
return String.fromCharCode((code >> 10) + 0xD800, (code & 1023) + 0xDC00); | |
} | |
pp.readString = function (quote) { | |
var out = "", | |
chunkStart = ++(this || _global$R).pos; | |
for (;;) { | |
if ((this || _global$R).pos >= (this || _global$R).input.length) { | |
this.raise((this || _global$R).start, "Unterminated string constant"); | |
} | |
var ch = (this || _global$R).input.charCodeAt((this || _global$R).pos); | |
if (ch === quote) { | |
break; | |
} | |
if (ch === 92) { | |
// '\' | |
out += (this || _global$R).input.slice(chunkStart, (this || _global$R).pos); | |
out += this.readEscapedChar(false); | |
chunkStart = (this || _global$R).pos; | |
} else if (ch === 0x2028 || ch === 0x2029) { | |
if ((this || _global$R).options.ecmaVersion < 10) { | |
this.raise((this || _global$R).start, "Unterminated string constant"); | |
} | |
++(this || _global$R).pos; | |
if ((this || _global$R).options.locations) { | |
(this || _global$R).curLine++; | |
(this || _global$R).lineStart = (this || _global$R).pos; | |
} | |
} else { | |
if (isNewLine(ch)) { | |
this.raise((this || _global$R).start, "Unterminated string constant"); | |
} | |
++(this || _global$R).pos; | |
} | |
} | |
out += (this || _global$R).input.slice(chunkStart, (this || _global$R).pos++); | |
return this.finishToken(types$1.string, out); | |
}; // Reads template string tokens. | |
var INVALID_TEMPLATE_ESCAPE_ERROR = {}; | |
pp.tryReadTemplateToken = function () { | |
(this || _global$R).inTemplateElement = true; | |
try { | |
this.readTmplToken(); | |
} catch (err) { | |
if (err === INVALID_TEMPLATE_ESCAPE_ERROR) { | |
this.readInvalidTemplateToken(); | |
} else { | |
throw err; | |
} | |
} | |
(this || _global$R).inTemplateElement = false; | |
}; | |
pp.invalidStringToken = function (position, message) { | |
if ((this || _global$R).inTemplateElement && (this || _global$R).options.ecmaVersion >= 9) { | |
throw INVALID_TEMPLATE_ESCAPE_ERROR; | |
} else { | |
this.raise(position, message); | |
} | |
}; | |
pp.readTmplToken = function () { | |
var out = "", | |
chunkStart = (this || _global$R).pos; | |
for (;;) { | |
if ((this || _global$R).pos >= (this || _global$R).input.length) { | |
this.raise((this || _global$R).start, "Unterminated template"); | |
} | |
var ch = (this || _global$R).input.charCodeAt((this || _global$R).pos); | |
if (ch === 96 || ch === 36 && (this || _global$R).input.charCodeAt((this || _global$R).pos + 1) === 123) { | |
// '`', '${' | |
if ((this || _global$R).pos === (this || _global$R).start && ((this || _global$R).type === types$1.template || (this || _global$R).type === types$1.invalidTemplate)) { | |
if (ch === 36) { | |
(this || _global$R).pos += 2; | |
return this.finishToken(types$1.dollarBraceL); | |
} else { | |
++(this || _global$R).pos; | |
return this.finishToken(types$1.backQuote); | |
} | |
} | |
out += (this || _global$R).input.slice(chunkStart, (this || _global$R).pos); | |
return this.finishToken(types$1.template, out); | |
} | |
if (ch === 92) { | |
// '\' | |
out += (this || _global$R).input.slice(chunkStart, (this || _global$R).pos); | |
out += this.readEscapedChar(true); | |
chunkStart = (this || _global$R).pos; | |
} else if (isNewLine(ch)) { | |
out += (this || _global$R).input.slice(chunkStart, (this || _global$R).pos); | |
++(this || _global$R).pos; | |
switch (ch) { | |
case 13: | |
if ((this || _global$R).input.charCodeAt((this || _global$R).pos) === 10) { | |
++(this || _global$R).pos; | |
} | |
case 10: | |
out += "\n"; | |
break; | |
default: | |
out += String.fromCharCode(ch); | |
break; | |
} | |
if ((this || _global$R).options.locations) { | |
++(this || _global$R).curLine; | |
(this || _global$R).lineStart = (this || _global$R).pos; | |
} | |
chunkStart = (this || _global$R).pos; | |
} else { | |
++(this || _global$R).pos; | |
} | |
} | |
}; // Reads a template token to search for the end, without validating any escape sequences | |
pp.readInvalidTemplateToken = function () { | |
for (; (this || _global$R).pos < (this || _global$R).input.length; (this || _global$R).pos++) { | |
switch ((this || _global$R).input[(this || _global$R).pos]) { | |
case "\\": | |
++(this || _global$R).pos; | |
break; | |
case "$": | |
if ((this || _global$R).input[(this || _global$R).pos + 1] !== "{") { | |
break; | |
} | |
// falls through | |
case "`": | |
return this.finishToken(types$1.invalidTemplate, (this || _global$R).input.slice((this || _global$R).start, (this || _global$R).pos)); | |
// no default | |
} | |
} | |
this.raise((this || _global$R).start, "Unterminated template"); | |
}; // Used to read escaped characters | |
pp.readEscapedChar = function (inTemplate) { | |
var ch = (this || _global$R).input.charCodeAt(++(this || _global$R).pos); | |
++(this || _global$R).pos; | |
switch (ch) { | |
case 110: | |
return "\n"; | |
// 'n' -> '\n' | |
case 114: | |
return "\r"; | |
// 'r' -> '\r' | |
case 120: | |
return String.fromCharCode(this.readHexChar(2)); | |
// 'x' | |
case 117: | |
return codePointToString(this.readCodePoint()); | |
// 'u' | |
case 116: | |
return "\t"; | |
// 't' -> '\t' | |
case 98: | |
return "\b"; | |
// 'b' -> '\b' | |
case 118: | |
return "\u000b"; | |
// 'v' -> '\u000b' | |
case 102: | |
return "\f"; | |
// 'f' -> '\f' | |
case 13: | |
if ((this || _global$R).input.charCodeAt((this || _global$R).pos) === 10) { | |
++(this || _global$R).pos; | |
} | |
// '\r\n' | |
case 10: | |
// ' \n' | |
if ((this || _global$R).options.locations) { | |
(this || _global$R).lineStart = (this || _global$R).pos; | |
++(this || _global$R).curLine; | |
} | |
return ""; | |
case 56: | |
case 57: | |
if ((this || _global$R).strict) { | |
this.invalidStringToken((this || _global$R).pos - 1, "Invalid escape sequence"); | |
} | |
if (inTemplate) { | |
var codePos = (this || _global$R).pos - 1; | |
this.invalidStringToken(codePos, "Invalid escape sequence in template string"); | |
return null; | |
} | |
default: | |
if (ch >= 48 && ch <= 55) { | |
var octalStr = (this || _global$R).input.substr((this || _global$R).pos - 1, 3).match(/^[0-7]+/)[0]; | |
var octal = parseInt(octalStr, 8); | |
if (octal > 255) { | |
octalStr = octalStr.slice(0, -1); | |
octal = parseInt(octalStr, 8); | |
} | |
(this || _global$R).pos += octalStr.length - 1; | |
ch = (this || _global$R).input.charCodeAt((this || _global$R).pos); | |
if ((octalStr !== "0" || ch === 56 || ch === 57) && ((this || _global$R).strict || inTemplate)) { | |
this.invalidStringToken((this || _global$R).pos - 1 - octalStr.length, inTemplate ? "Octal literal in template string" : "Octal literal in strict mode"); | |
} | |
return String.fromCharCode(octal); | |
} | |
if (isNewLine(ch)) { | |
// Unicode new line characters after \ get removed from output in both | |
// template literals and strings | |
return ""; | |
} | |
return String.fromCharCode(ch); | |
} | |
}; // Used to read character escape sequences ('\x', '\u', '\U'). | |
pp.readHexChar = function (len) { | |
var codePos = (this || _global$R).pos; | |
var n = this.readInt(16, len); | |
if (n === null) { | |
this.invalidStringToken(codePos, "Bad character escape sequence"); | |
} | |
return n; | |
}; // Read an identifier, and return it as a string. Sets `this.containsEsc` | |
// to whether the word contained a '\u' escape. | |
// | |
// Incrementally adds only escaped chars, adding other chunks as-is | |
// as a micro-optimization. | |
pp.readWord1 = function () { | |
(this || _global$R).containsEsc = false; | |
var word = "", | |
first = true, | |
chunkStart = (this || _global$R).pos; | |
var astral = (this || _global$R).options.ecmaVersion >= 6; | |
while ((this || _global$R).pos < (this || _global$R).input.length) { | |
var ch = this.fullCharCodeAtPos(); | |
if (isIdentifierChar(ch, astral)) { | |
(this || _global$R).pos += ch <= 0xffff ? 1 : 2; | |
} else if (ch === 92) { | |
// "\" | |
(this || _global$R).containsEsc = true; | |
word += (this || _global$R).input.slice(chunkStart, (this || _global$R).pos); | |
var escStart = (this || _global$R).pos; | |
if ((this || _global$R).input.charCodeAt(++(this || _global$R).pos) !== 117) // "u" | |
{ | |
this.invalidStringToken((this || _global$R).pos, "Expecting Unicode escape sequence \\uXXXX"); | |
} | |
++(this || _global$R).pos; | |
var esc = this.readCodePoint(); | |
if (!(first ? isIdentifierStart : isIdentifierChar)(esc, astral)) { | |
this.invalidStringToken(escStart, "Invalid Unicode escape"); | |
} | |
word += codePointToString(esc); | |
chunkStart = (this || _global$R).pos; | |
} else { | |
break; | |
} | |
first = false; | |
} | |
return word + (this || _global$R).input.slice(chunkStart, (this || _global$R).pos); | |
}; // Read an identifier or keyword token. Will check for reserved | |
// words when necessary. | |
pp.readWord = function () { | |
var word = this.readWord1(); | |
var type = types$1.name; | |
if ((this || _global$R).keywords.test(word)) { | |
type = keywords[word]; | |
} | |
return this.finishToken(type, word); | |
}; // Acorn is a tiny, fast JavaScript parser written in JavaScript. | |
var version = "8.7.0"; | |
Parser.acorn = { | |
Parser: Parser, | |
version: version, | |
defaultOptions: defaultOptions, | |
Position: Position, | |
SourceLocation: SourceLocation, | |
getLineInfo: getLineInfo, | |
Node: Node, | |
TokenType: TokenType, | |
tokTypes: types$1, | |
keywordTypes: keywords, | |
TokContext: TokContext, | |
tokContexts: types, | |
isIdentifierChar: isIdentifierChar, | |
isIdentifierStart: isIdentifierStart, | |
Token: Token, | |
isNewLine: isNewLine, | |
lineBreak: lineBreak, | |
lineBreakG: lineBreakG, | |
nonASCIIwhitespace: nonASCIIwhitespace | |
}; // The main exported interface (under `self.acorn` when in the | |
// browser) is a `parse` function that takes a code string and | |
// returns an abstract syntax tree as specified by [Mozilla parser | |
// API][api]. | |
// | |
// [api]: https://developer.mozilla.org/en-US/docs/SpiderMonkey/Parser_API | |
function parse(input, options) { | |
return Parser.parse(input, options); | |
} // This function tries to parse a single expression at a given | |
// offset in a string. Useful for parsing mixed-language formats | |
// that embed JavaScript expressions. | |
function parseExpressionAt(input, pos, options) { | |
return Parser.parseExpressionAt(input, pos, options); | |
} // Acorn is organized as a tokenizer and a recursive-descent parser. | |
// The `tokenizer` export provides an interface to the tokenizer. | |
function tokenizer(input, options) { | |
return Parser.tokenizer(input, options); | |
} | |
exports.Node = Node; | |
exports.Parser = Parser; | |
exports.Position = Position; | |
exports.SourceLocation = SourceLocation; | |
exports.TokContext = TokContext; | |
exports.Token = Token; | |
exports.TokenType = TokenType; | |
exports.defaultOptions = defaultOptions; | |
exports.getLineInfo = getLineInfo; | |
exports.isIdentifierChar = isIdentifierChar; | |
exports.isIdentifierStart = isIdentifierStart; | |
exports.isNewLine = isNewLine; | |
exports.keywordTypes = keywords; | |
exports.lineBreak = lineBreak; | |
exports.lineBreakG = lineBreakG; | |
exports.nonASCIIwhitespace = nonASCIIwhitespace; | |
exports.parse = parse; | |
exports.parseExpressionAt = parseExpressionAt; | |
exports.tokContexts = types; | |
exports.tokTypes = types$1; | |
exports.tokenizer = tokenizer; | |
exports.version = version; | |
Object.defineProperty(exports, '__esModule', { | |
value: true | |
}); | |
}); | |
return exports$ac; | |
} | |
var exports$ab = {}, | |
_dewExec$9W = false; | |
var _global$Q = typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : global; | |
function dew$ab() { | |
if (_dewExec$9W) return exports$ab; | |
_dewExec$9W = true; | |
(function (global, factory) { | |
typeof exports$ab === 'object' && true ? factory(exports$ab) : typeof define === 'function' && define.amd ? define(['exports'], factory) : (global = global || self, factory(global.acorn = {})); | |
})(exports$ab, function (exports) { | |
var reservedWords = { | |
3: "abstract boolean byte char class double enum export extends final float goto implements import int interface long native package private protected public short static super synchronized throws transient volatile", | |
5: "class enum extends super const export import", | |
6: "enum", | |
strict: "implements interface let package private protected public static yield", | |
strictBind: "eval arguments" | |
}; // And the keywords | |
var ecma5AndLessKeywords = "break case catch continue debugger default do else finally for function if return switch throw try var while with null true false instanceof typeof void delete new in this"; | |
var keywords = { | |
5: ecma5AndLessKeywords, | |
"5module": ecma5AndLessKeywords + " export import", | |
6: ecma5AndLessKeywords + " const class extends export import super" | |
}; | |
var keywordRelationalOperator = /^in(stanceof)?$/; // ## Character categories | |
// Big ugly regular expressions that match characters in the | |
// whitespace, identifier, and identifier-start categories. These | |
// are only applied when a character is found to actually have a | |
// code point above 128. | |
// Generated by `bin/generate-identifier-regex.js`. | |
var nonASCIIidentifierStartChars = "\xaa\xb5\xba\xc0-\xd6\xd8-\xf6\xf8-\u02c1\u02c6-\u02d1\u02e0-\u02e4\u02ec\u02ee\u0370-\u0374\u0376\u0377\u037a-\u037d\u037f\u0386\u0388-\u038a\u038c\u038e-\u03a1\u03a3-\u03f5\u03f7-\u0481\u048a-\u052f\u0531-\u0556\u0559\u0560-\u0588\u05d0-\u05ea\u05ef-\u05f2\u0620-\u064a\u066e\u066f\u0671-\u06d3\u06d5\u06e5\u06e6\u06ee\u06ef\u06fa-\u06fc\u06ff\u0710\u0712-\u072f\u074d-\u07a5\u07b1\u07ca-\u07ea\u07f4\u07f5\u07fa\u0800-\u0815\u081a\u0824\u0828\u0840-\u0858\u0860-\u086a\u08a0-\u08b4\u08b6-\u08c7\u0904-\u0939\u093d\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098c\u098f\u0990\u0993-\u09a8\u09aa-\u09b0\u09b2\u09b6-\u09b9\u09bd\u09ce\u09dc\u09dd\u09df-\u09e1\u09f0\u09f1\u09fc\u0a05-\u0a0a\u0a0f\u0a10\u0a13-\u0a28\u0a2a-\u0a30\u0a32\u0a33\u0a35\u0a36\u0a38\u0a39\u0a59-\u0a5c\u0a5e\u0a72-\u0a74\u0a85-\u0a8d\u0a8f-\u0a91\u0a93-\u0aa8\u0aaa-\u0ab0\u0ab2\u0ab3\u0ab5-\u0ab9\u0abd\u0ad0\u0ae0\u0ae1\u0af9\u0b05-\u0b0c\u0b0f\u0b10\u0b13-\u0b28\u0b2a-\u0b30\u0b32\u0b33\u0b35-\u0b39\u0b3d\u0b5c\u0b5d\u0b5f-\u0b61\u0b71\u0b83\u0b85-\u0b8a\u0b8e-\u0b90\u0b92-\u0b95\u0b99\u0b9a\u0b9c\u0b9e\u0b9f\u0ba3\u0ba4\u0ba8-\u0baa\u0bae-\u0bb9\u0bd0\u0c05-\u0c0c\u0c0e-\u0c10\u0c12-\u0c28\u0c2a-\u0c39\u0c3d\u0c58-\u0c5a\u0c60\u0c61\u0c80\u0c85-\u0c8c\u0c8e-\u0c90\u0c92-\u0ca8\u0caa-\u0cb3\u0cb5-\u0cb9\u0cbd\u0cde\u0ce0\u0ce1\u0cf1\u0cf2\u0d04-\u0d0c\u0d0e-\u0d10\u0d12-\u0d3a\u0d3d\u0d4e\u0d54-\u0d56\u0d5f-\u0d61\u0d7a-\u0d7f\u0d85-\u0d96\u0d9a-\u0db1\u0db3-\u0dbb\u0dbd\u0dc0-\u0dc6\u0e01-\u0e30\u0e32\u0e33\u0e40-\u0e46\u0e81\u0e82\u0e84\u0e86-\u0e8a\u0e8c-\u0ea3\u0ea5\u0ea7-\u0eb0\u0eb2\u0eb3\u0ebd\u0ec0-\u0ec4\u0ec6\u0edc-\u0edf\u0f00\u0f40-\u0f47\u0f49-\u0f6c\u0f88-\u0f8c\u1000-\u102a\u103f\u1050-\u1055\u105a-\u105d\u1061\u1065\u1066\u106e-\u1070\u1075-\u1081\u108e\u10a0-\u10c5\u10c7\u10cd\u10d0-\u10fa\u10fc-\u1248\u124a-\u124d\u1250-\u1256\u1258\u125a-\u125d\u1260-\u1288\u128a-\u128d\u1290-\u12b0\u12b2-\u12b5\u12b8-\u12be\u12c0\u12c2-\u12c5\u12c8-\u12d6\u12d8-\u1310\u1312-\u1315\u1318-\u135a\u1380-\u138f\u13a0-\u13f5\u13f8-\u13fd\u1401-\u166c\u166f-\u167f\u1681-\u169a\u16a0-\u16ea\u16ee-\u16f8\u1700-\u170c\u170e-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176c\u176e-\u1770\u1780-\u17b3\u17d7\u17dc\u1820-\u1878\u1880-\u18a8\u18aa\u18b0-\u18f5\u1900-\u191e\u1950-\u196d\u1970-\u1974\u1980-\u19ab\u19b0-\u19c9\u1a00-\u1a16\u1a20-\u1a54\u1aa7\u1b05-\u1b33\u1b45-\u1b4b\u1b83-\u1ba0\u1bae\u1baf\u1bba-\u1be5\u1c00-\u1c23\u1c4d-\u1c4f\u1c5a-\u1c7d\u1c80-\u1c88\u1c90-\u1cba\u1cbd-\u1cbf\u1ce9-\u1cec\u1cee-\u1cf3\u1cf5\u1cf6\u1cfa\u1d00-\u1dbf\u1e00-\u1f15\u1f18-\u1f1d\u1f20-\u1f45\u1f48-\u1f4d\u1f50-\u1f57\u1f59\u1f5b\u1f5d\u1f5f-\u1f7d\u1f80-\u1fb4\u1fb6-\u1fbc\u1fbe\u1fc2-\u1fc4\u1fc6-\u1fcc\u1fd0-\u1fd3\u1fd6-\u1fdb\u1fe0-\u1fec\u1ff2-\u1ff4\u1ff6-\u1ffc\u2071\u207f\u2090-\u209c\u2102\u2107\u210a-\u2113\u2115\u2118-\u211d\u2124\u2126\u2128\u212a-\u2139\u213c-\u213f\u2145-\u2149\u214e\u2160-\u2188\u2c00-\u2c2e\u2c30-\u2c5e\u2c60-\u2ce4\u2ceb-\u2cee\u2cf2\u2cf3\u2d00-\u2d25\u2d27\u2d2d\u2d30-\u2d67\u2d6f\u2d80-\u2d96\u2da0-\u2da6\u2da8-\u2dae\u2db0-\u2db6\u2db8-\u2dbe\u2dc0-\u2dc6\u2dc8-\u2dce\u2dd0-\u2dd6\u2dd8-\u2dde\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303c\u3041-\u3096\u309b-\u309f\u30a1-\u30fa\u30fc-\u30ff\u3105-\u312f\u3131-\u318e\u31a0-\u31bf\u31f0-\u31ff\u3400-\u4dbf\u4e00-\u9ffc\ua000-\ua48c\ua4d0-\ua4fd\ua500-\ua60c\ua610-\ua61f\ua62a\ua62b\ua640-\ua66e\ua67f-\ua69d\ua6a0-\ua6ef\ua717-\ua71f\ua722-\ua788\ua78b-\ua7bf\ua7c2-\ua7ca\ua7f5-\ua801\ua803-\ua805\ua807-\ua80a\ua80c-\ua822\ua840-\ua873\ua882-\ua8b3\ua8f2-\ua8f7\ua8fb\ua8fd\ua8fe\ua90a-\ua925\ua930-\ua946\ua960-\ua97c\ua984-\ua9b2\ua9cf\ua9e0-\ua9e4\ua9e6-\ua9ef\ua9fa-\ua9fe\uaa00-\uaa28\uaa40-\uaa42\uaa44-\uaa4b\uaa60-\uaa76\uaa7a\uaa7e-\uaaaf\uaab1\uaab5\uaab6\uaab9-\uaabd\uaac0\uaac2\uaadb-\uaadd\uaae0-\uaaea\uaaf2-\uaaf4\uab01-\uab06\uab09-\uab0e\uab11-\uab16\uab20-\uab26\uab28-\uab2e\uab30-\uab5a\uab5c-\uab69\uab70-\uabe2\uac00-\ud7a3\ud7b0-\ud7c6\ud7cb-\ud7fb\uf900-\ufa6d\ufa70-\ufad9\ufb00-\ufb06\ufb13-\ufb17\ufb1d\ufb1f-\ufb28\ufb2a-\ufb36\ufb38-\ufb3c\ufb3e\ufb40\ufb41\ufb43\ufb44\ufb46-\ufbb1\ufbd3-\ufd3d\ufd50-\ufd8f\ufd92-\ufdc7\ufdf0-\ufdfb\ufe70-\ufe74\ufe76-\ufefc\uff21-\uff3a\uff41-\uff5a\uff66-\uffbe\uffc2-\uffc7\uffca-\uffcf\uffd2-\uffd7\uffda-\uffdc"; | |
var nonASCIIidentifierChars = "\u200c\u200d\xb7\u0300-\u036f\u0387\u0483-\u0487\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u0669\u0670\u06d6-\u06dc\u06df-\u06e4\u06e7\u06e8\u06ea-\u06ed\u06f0-\u06f9\u0711\u0730-\u074a\u07a6-\u07b0\u07c0-\u07c9\u07eb-\u07f3\u07fd\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0859-\u085b\u08d3-\u08e1\u08e3-\u0903\u093a-\u093c\u093e-\u094f\u0951-\u0957\u0962\u0963\u0966-\u096f\u0981-\u0983\u09bc\u09be-\u09c4\u09c7\u09c8\u09cb-\u09cd\u09d7\u09e2\u09e3\u09e6-\u09ef\u09fe\u0a01-\u0a03\u0a3c\u0a3e-\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a66-\u0a71\u0a75\u0a81-\u0a83\u0abc\u0abe-\u0ac5\u0ac7-\u0ac9\u0acb-\u0acd\u0ae2\u0ae3\u0ae6-\u0aef\u0afa-\u0aff\u0b01-\u0b03\u0b3c\u0b3e-\u0b44\u0b47\u0b48\u0b4b-\u0b4d\u0b55-\u0b57\u0b62\u0b63\u0b66-\u0b6f\u0b82\u0bbe-\u0bc2\u0bc6-\u0bc8\u0bca-\u0bcd\u0bd7\u0be6-\u0bef\u0c00-\u0c04\u0c3e-\u0c44\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0c66-\u0c6f\u0c81-\u0c83\u0cbc\u0cbe-\u0cc4\u0cc6-\u0cc8\u0cca-\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0ce6-\u0cef\u0d00-\u0d03\u0d3b\u0d3c\u0d3e-\u0d44\u0d46-\u0d48\u0d4a-\u0d4d\u0d57\u0d62\u0d63\u0d66-\u0d6f\u0d81-\u0d83\u0dca\u0dcf-\u0dd4\u0dd6\u0dd8-\u0ddf\u0de6-\u0def\u0df2\u0df3\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0e50-\u0e59\u0eb1\u0eb4-\u0ebc\u0ec8-\u0ecd\u0ed0-\u0ed9\u0f18\u0f19\u0f20-\u0f29\u0f35\u0f37\u0f39\u0f3e\u0f3f\u0f71-\u0f84\u0f86\u0f87\u0f8d-\u0f97\u0f99-\u0fbc\u0fc6\u102b-\u103e\u1040-\u1049\u1056-\u1059\u105e-\u1060\u1062-\u1064\u1067-\u106d\u1071-\u1074\u1082-\u108d\u108f-\u109d\u135d-\u135f\u1369-\u1371\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b4-\u17d3\u17dd\u17e0-\u17e9\u180b-\u180d\u1810-\u1819\u18a9\u1920-\u192b\u1930-\u193b\u1946-\u194f\u19d0-\u19da\u1a17-\u1a1b\u1a55-\u1a5e\u1a60-\u1a7c\u1a7f-\u1a89\u1a90-\u1a99\u1ab0-\u1abd\u1abf\u1ac0\u1b00-\u1b04\u1b34-\u1b44\u1b50-\u1b59\u1b6b-\u1b73\u1b80-\u1b82\u1ba1-\u1bad\u1bb0-\u1bb9\u1be6-\u1bf3\u1c24-\u1c37\u1c40-\u1c49\u1c50-\u1c59\u1cd0-\u1cd2\u1cd4-\u1ce8\u1ced\u1cf4\u1cf7-\u1cf9\u1dc0-\u1df9\u1dfb-\u1dff\u203f\u2040\u2054\u20d0-\u20dc\u20e1\u20e5-\u20f0\u2cef-\u2cf1\u2d7f\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua620-\ua629\ua66f\ua674-\ua67d\ua69e\ua69f\ua6f0\ua6f1\ua802\ua806\ua80b\ua823-\ua827\ua82c\ua880\ua881\ua8b4-\ua8c5\ua8d0-\ua8d9\ua8e0-\ua8f1\ua8ff-\ua909\ua926-\ua92d\ua947-\ua953\ua980-\ua983\ua9b3-\ua9c0\ua9d0-\ua9d9\ua9e5\ua9f0-\ua9f9\uaa29-\uaa36\uaa43\uaa4c\uaa4d\uaa50-\uaa59\uaa7b-\uaa7d\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uaaeb-\uaaef\uaaf5\uaaf6\uabe3-\uabea\uabec\uabed\uabf0-\uabf9\ufb1e\ufe00-\ufe0f\ufe20-\ufe2f\ufe33\ufe34\ufe4d-\ufe4f\uff10-\uff19\uff3f"; | |
var nonASCIIidentifierStart = new RegExp("[" + nonASCIIidentifierStartChars + "]"); | |
var nonASCIIidentifier = new RegExp("[" + nonASCIIidentifierStartChars + nonASCIIidentifierChars + "]"); | |
nonASCIIidentifierStartChars = nonASCIIidentifierChars = null; // These are a run-length and offset encoded representation of the | |
// >0xffff code points that are a valid part of identifiers. The | |
// offset starts at 0x10000, and each pair of numbers represents an | |
// offset to the next range, and then a size of the range. They were | |
// generated by bin/generate-identifier-regex.js | |
// eslint-disable-next-line comma-spacing | |
var astralIdentifierStartCodes = [0, 11, 2, 25, 2, 18, 2, 1, 2, 14, 3, 13, 35, 122, 70, 52, 268, 28, 4, 48, 48, 31, 14, 29, 6, 37, 11, 29, 3, 35, 5, 7, 2, 4, 43, 157, 19, 35, 5, 35, 5, 39, 9, 51, 157, 310, 10, 21, 11, 7, 153, 5, 3, 0, 2, 43, 2, 1, 4, 0, 3, 22, 11, 22, 10, 30, 66, 18, 2, 1, 11, 21, 11, 25, 71, 55, 7, 1, 65, 0, 16, 3, 2, 2, 2, 28, 43, 28, 4, 28, 36, 7, 2, 27, 28, 53, 11, 21, 11, 18, 14, 17, 111, 72, 56, 50, 14, 50, 14, 35, 349, 41, 7, 1, 79, 28, 11, 0, 9, 21, 107, 20, 28, 22, 13, 52, 76, 44, 33, 24, 27, 35, 30, 0, 3, 0, 9, 34, 4, 0, 13, 47, 15, 3, 22, 0, 2, 0, 36, 17, 2, 24, 85, 6, 2, 0, 2, 3, 2, 14, 2, 9, 8, 46, 39, 7, 3, 1, 3, 21, 2, 6, 2, 1, 2, 4, 4, 0, 19, 0, 13, 4, 159, 52, 19, 3, 21, 2, 31, 47, 21, 1, 2, 0, 185, 46, 42, 3, 37, 47, 21, 0, 60, 42, 14, 0, 72, 26, 230, 43, 117, 63, 32, 7, 3, 0, 3, 7, 2, 1, 2, 23, 16, 0, 2, 0, 95, 7, 3, 38, 17, 0, 2, 0, 29, 0, 11, 39, 8, 0, 22, 0, 12, 45, 20, 0, 35, 56, 264, 8, 2, 36, 18, 0, 50, 29, 113, 6, 2, 1, 2, 37, 22, 0, 26, 5, 2, 1, 2, 31, 15, 0, 328, 18, 190, 0, 80, 921, 103, 110, 18, 195, 2749, 1070, 4050, 582, 8634, 568, 8, 30, 114, 29, 19, 47, 17, 3, 32, 20, 6, 18, 689, 63, 129, 74, 6, 0, 67, 12, 65, 1, 2, 0, 29, 6135, 9, 1237, 43, 8, 8952, 286, 50, 2, 18, 3, 9, 395, 2309, 106, 6, 12, 4, 8, 8, 9, 5991, 84, 2, 70, 2, 1, 3, 0, 3, 1, 3, 3, 2, 11, 2, 0, 2, 6, 2, 64, 2, 3, 3, 7, 2, 6, 2, 27, 2, 3, 2, 4, 2, 0, 4, 6, 2, 339, 3, 24, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 7, 2357, 44, 11, 6, 17, 0, 370, 43, 1301, 196, 60, 67, 8, 0, 1205, 3, 2, 26, 2, 1, 2, 0, 3, 0, 2, 9, 2, 3, 2, 0, 2, 0, 7, 0, 5, 0, 2, 0, 2, 0, 2, 2, 2, 1, 2, 0, 3, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 1, 2, 0, 3, 3, 2, 6, 2, 3, 2, 3, 2, 0, 2, 9, 2, 16, 6, 2, 2, 4, 2, 16, 4421, 42717, 35, 4148, 12, 221, 3, 5761, 15, 7472, 3104, 541, 1507, 4938]; // eslint-disable-next-line comma-spacing | |
var astralIdentifierCodes = [509, 0, 227, 0, 150, 4, 294, 9, 1368, 2, 2, 1, 6, 3, 41, 2, 5, 0, 166, 1, 574, 3, 9, 9, 370, 1, 154, 10, 176, 2, 54, 14, 32, 9, 16, 3, 46, 10, 54, 9, 7, 2, 37, 13, 2, 9, 6, 1, 45, 0, 13, 2, 49, 13, 9, 3, 2, 11, 83, 11, 7, 0, 161, 11, 6, 9, 7, 3, 56, 1, 2, 6, 3, 1, 3, 2, 10, 0, 11, 1, 3, 6, 4, 4, 193, 17, 10, 9, 5, 0, 82, 19, 13, 9, 214, 6, 3, 8, 28, 1, 83, 16, 16, 9, 82, 12, 9, 9, 84, 14, 5, 9, 243, 14, 166, 9, 71, 5, 2, 1, 3, 3, 2, 0, 2, 1, 13, 9, 120, 6, 3, 6, 4, 0, 29, 9, 41, 6, 2, 3, 9, 0, 10, 10, 47, 15, 406, 7, 2, 7, 17, 9, 57, 21, 2, 13, 123, 5, 4, 0, 2, 1, 2, 6, 2, 0, 9, 9, 49, 4, 2, 1, 2, 4, 9, 9, 330, 3, 19306, 9, 135, 4, 60, 6, 26, 9, 1014, 0, 2, 54, 8, 3, 82, 0, 12, 1, 19628, 1, 5319, 4, 4, 5, 9, 7, 3, 6, 31, 3, 149, 2, 1418, 49, 513, 54, 5, 49, 9, 0, 15, 0, 23, 4, 2, 14, 1361, 6, 2, 16, 3, 6, 2, 1, 2, 4, 262, 6, 10, 9, 419, 13, 1495, 6, 110, 6, 6, 9, 4759, 9, 787719, 239]; // This has a complexity linear to the value of the code. The | |
// assumption is that looking up astral identifier characters is | |
// rare. | |
function isInAstralSet(code, set) { | |
var pos = 0x10000; | |
for (var i = 0; i < set.length; i += 2) { | |
pos += set[i]; | |
if (pos > code) { | |
return false; | |
} | |
pos += set[i + 1]; | |
if (pos >= code) { | |
return true; | |
} | |
} | |
} // Test whether a given character code starts an identifier. | |
function isIdentifierStart(code, astral) { | |
if (code < 65) { | |
return code === 36; | |
} | |
if (code < 91) { | |
return true; | |
} | |
if (code < 97) { | |
return code === 95; | |
} | |
if (code < 123) { | |
return true; | |
} | |
if (code <= 0xffff) { | |
return code >= 0xaa && nonASCIIidentifierStart.test(String.fromCharCode(code)); | |
} | |
if (astral === false) { | |
return false; | |
} | |
return isInAstralSet(code, astralIdentifierStartCodes); | |
} // Test whether a given character is part of an identifier. | |
function isIdentifierChar(code, astral) { | |
if (code < 48) { | |
return code === 36; | |
} | |
if (code < 58) { | |
return true; | |
} | |
if (code < 65) { | |
return false; | |
} | |
if (code < 91) { | |
return true; | |
} | |
if (code < 97) { | |
return code === 95; | |
} | |
if (code < 123) { | |
return true; | |
} | |
if (code <= 0xffff) { | |
return code >= 0xaa && nonASCIIidentifier.test(String.fromCharCode(code)); | |
} | |
if (astral === false) { | |
return false; | |
} | |
return isInAstralSet(code, astralIdentifierStartCodes) || isInAstralSet(code, astralIdentifierCodes); | |
} // ## Token types | |
// The assignment of fine-grained, information-carrying type objects | |
// allows the tokenizer to store the information it has about a | |
// token in a way that is very cheap for the parser to look up. | |
// All token type variables start with an underscore, to make them | |
// easy to recognize. | |
// The `beforeExpr` property is used to disambiguate between regular | |
// expressions and divisions. It is set on all token types that can | |
// be followed by an expression (thus, a slash after them would be a | |
// regular expression). | |
// | |
// The `startsExpr` property is used to check if the token ends a | |
// `yield` expression. It is set on all token types that either can | |
// directly start an expression (like a quotation mark) or can | |
// continue an expression (like the body of a string). | |
// | |
// `isLoop` marks a keyword as starting a loop, which is important | |
// to know when parsing a label, in order to allow or disallow | |
// continue jumps to that label. | |
var TokenType = function TokenType(label, conf) { | |
if (conf === void 0) conf = {}; | |
(this || _global$Q).label = label; | |
(this || _global$Q).keyword = conf.keyword; | |
(this || _global$Q).beforeExpr = !!conf.beforeExpr; | |
(this || _global$Q).startsExpr = !!conf.startsExpr; | |
(this || _global$Q).isLoop = !!conf.isLoop; | |
(this || _global$Q).isAssign = !!conf.isAssign; | |
(this || _global$Q).prefix = !!conf.prefix; | |
(this || _global$Q).postfix = !!conf.postfix; | |
(this || _global$Q).binop = conf.binop || null; | |
(this || _global$Q).updateContext = null; | |
}; | |
function binop(name, prec) { | |
return new TokenType(name, { | |
beforeExpr: true, | |
binop: prec | |
}); | |
} | |
var beforeExpr = { | |
beforeExpr: true | |
}, | |
startsExpr = { | |
startsExpr: true | |
}; // Map keyword names to token types. | |
var keywords$1 = {}; // Succinct definitions of keyword token types | |
function kw(name, options) { | |
if (options === void 0) options = {}; | |
options.keyword = name; | |
return keywords$1[name] = new TokenType(name, options); | |
} | |
var types = { | |
num: new TokenType("num", startsExpr), | |
regexp: new TokenType("regexp", startsExpr), | |
string: new TokenType("string", startsExpr), | |
name: new TokenType("name", startsExpr), | |
eof: new TokenType("eof"), | |
// Punctuation token types. | |
bracketL: new TokenType("[", { | |
beforeExpr: true, | |
startsExpr: true | |
}), | |
bracketR: new TokenType("]"), | |
braceL: new TokenType("{", { | |
beforeExpr: true, | |
startsExpr: true | |
}), | |
braceR: new TokenType("}"), | |
parenL: new TokenType("(", { | |
beforeExpr: true, | |
startsExpr: true | |
}), | |
parenR: new TokenType(")"), | |
comma: new TokenType(",", beforeExpr), | |
semi: new TokenType(";", beforeExpr), | |
colon: new TokenType(":", beforeExpr), | |
dot: new TokenType("."), | |
question: new TokenType("?", beforeExpr), | |
questionDot: new TokenType("?."), | |
arrow: new TokenType("=>", beforeExpr), | |
template: new TokenType("template"), | |
invalidTemplate: new TokenType("invalidTemplate"), | |
ellipsis: new TokenType("...", beforeExpr), | |
backQuote: new TokenType("`", startsExpr), | |
dollarBraceL: new TokenType("${", { | |
beforeExpr: true, | |
startsExpr: true | |
}), | |
// Operators. These carry several kinds of properties to help the | |
// parser use them properly (the presence of these properties is | |
// what categorizes them as operators). | |
// | |
// `binop`, when present, specifies that this operator is a binary | |
// operator, and will refer to its precedence. | |
// | |
// `prefix` and `postfix` mark the operator as a prefix or postfix | |
// unary operator. | |
// | |
// `isAssign` marks all of `=`, `+=`, `-=` etcetera, which act as | |
// binary operators with a very low precedence, that should result | |
// in AssignmentExpression nodes. | |
eq: new TokenType("=", { | |
beforeExpr: true, | |
isAssign: true | |
}), | |
assign: new TokenType("_=", { | |
beforeExpr: true, | |
isAssign: true | |
}), | |
incDec: new TokenType("++/--", { | |
prefix: true, | |
postfix: true, | |
startsExpr: true | |
}), | |
prefix: new TokenType("!/~", { | |
beforeExpr: true, | |
prefix: true, | |
startsExpr: true | |
}), | |
logicalOR: binop("||", 1), | |
logicalAND: binop("&&", 2), | |
bitwiseOR: binop("|", 3), | |
bitwiseXOR: binop("^", 4), | |
bitwiseAND: binop("&", 5), | |
equality: binop("==/!=/===/!==", 6), | |
relational: binop("</>/<=/>=", 7), | |
bitShift: binop("<</>>/>>>", 8), | |
plusMin: new TokenType("+/-", { | |
beforeExpr: true, | |
binop: 9, | |
prefix: true, | |
startsExpr: true | |
}), | |
modulo: binop("%", 10), | |
star: binop("*", 10), | |
slash: binop("/", 10), | |
starstar: new TokenType("**", { | |
beforeExpr: true | |
}), | |
coalesce: binop("??", 1), | |
// Keyword token types. | |
_break: kw("break"), | |
_case: kw("case", beforeExpr), | |
_catch: kw("catch"), | |
_continue: kw("continue"), | |
_debugger: kw("debugger"), | |
_default: kw("default", beforeExpr), | |
_do: kw("do", { | |
isLoop: true, | |
beforeExpr: true | |
}), | |
_else: kw("else", beforeExpr), | |
_finally: kw("finally"), | |
_for: kw("for", { | |
isLoop: true | |
}), | |
_function: kw("function", startsExpr), | |
_if: kw("if"), | |
_return: kw("return", beforeExpr), | |
_switch: kw("switch"), | |
_throw: kw("throw", beforeExpr), | |
_try: kw("try"), | |
_var: kw("var"), | |
_const: kw("const"), | |
_while: kw("while", { | |
isLoop: true | |
}), | |
_with: kw("with"), | |
_new: kw("new", { | |
beforeExpr: true, | |
startsExpr: true | |
}), | |
_this: kw("this", startsExpr), | |
_super: kw("super", startsExpr), | |
_class: kw("class", startsExpr), | |
_extends: kw("extends", beforeExpr), | |
_export: kw("export"), | |
_import: kw("import", startsExpr), | |
_null: kw("null", startsExpr), | |
_true: kw("true", startsExpr), | |
_false: kw("false", startsExpr), | |
_in: kw("in", { | |
beforeExpr: true, | |
binop: 7 | |
}), | |
_instanceof: kw("instanceof", { | |
beforeExpr: true, | |
binop: 7 | |
}), | |
_typeof: kw("typeof", { | |
beforeExpr: true, | |
prefix: true, | |
startsExpr: true | |
}), | |
_void: kw("void", { | |
beforeExpr: true, | |
prefix: true, | |
startsExpr: true | |
}), | |
_delete: kw("delete", { | |
beforeExpr: true, | |
prefix: true, | |
startsExpr: true | |
}) | |
}; // Matches a whole line break (where CRLF is considered a single | |
// line break). Used to count lines. | |
var lineBreak = /\r\n?|\n|\u2028|\u2029/; | |
var lineBreakG = new RegExp(lineBreak.source, "g"); | |
function isNewLine(code, ecma2019String) { | |
return code === 10 || code === 13 || !ecma2019String && (code === 0x2028 || code === 0x2029); | |
} | |
var nonASCIIwhitespace = /[\u1680\u2000-\u200a\u202f\u205f\u3000\ufeff]/; | |
var skipWhiteSpace = /(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g; | |
var ref = Object.prototype; | |
var hasOwnProperty = ref.hasOwnProperty; | |
var toString = ref.toString; // Checks if an object has a property. | |
function has(obj, propName) { | |
return hasOwnProperty.call(obj, propName); | |
} | |
var isArray = Array.isArray || function (obj) { | |
return toString.call(obj) === "[object Array]"; | |
}; | |
function wordsRegexp(words) { | |
return new RegExp("^(?:" + words.replace(/ /g, "|") + ")$"); | |
} // These are used when `options.locations` is on, for the | |
// `startLoc` and `endLoc` properties. | |
var Position = function Position(line, col) { | |
(this || _global$Q).line = line; | |
(this || _global$Q).column = col; | |
}; | |
Position.prototype.offset = function offset(n) { | |
return new Position((this || _global$Q).line, (this || _global$Q).column + n); | |
}; | |
var SourceLocation = function SourceLocation(p, start, end) { | |
(this || _global$Q).start = start; | |
(this || _global$Q).end = end; | |
if (p.sourceFile !== null) { | |
(this || _global$Q).source = p.sourceFile; | |
} | |
}; // The `getLineInfo` function is mostly useful when the | |
// `locations` option is off (for performance reasons) and you | |
// want to find the line/column position for a given character | |
// offset. `input` should be the code string that the offset refers | |
// into. | |
function getLineInfo(input, offset) { | |
for (var line = 1, cur = 0;;) { | |
lineBreakG.lastIndex = cur; | |
var match = lineBreakG.exec(input); | |
if (match && match.index < offset) { | |
++line; | |
cur = match.index + match[0].length; | |
} else { | |
return new Position(line, offset - cur); | |
} | |
} | |
} // A second optional argument can be given to further configure | |
// the parser process. These options are recognized: | |
var defaultOptions = { | |
// `ecmaVersion` indicates the ECMAScript version to parse. Must be | |
// either 3, 5, 6 (2015), 7 (2016), 8 (2017), 9 (2018), or 10 | |
// (2019). This influences support for strict mode, the set of | |
// reserved words, and support for new syntax features. The default | |
// is 10. | |
ecmaVersion: 10, | |
// `sourceType` indicates the mode the code should be parsed in. | |
// Can be either `"script"` or `"module"`. This influences global | |
// strict mode and parsing of `import` and `export` declarations. | |
sourceType: "script", | |
// `onInsertedSemicolon` can be a callback that will be called | |
// when a semicolon is automatically inserted. It will be passed | |
// the position of the comma as an offset, and if `locations` is | |
// enabled, it is given the location as a `{line, column}` object | |
// as second argument. | |
onInsertedSemicolon: null, | |
// `onTrailingComma` is similar to `onInsertedSemicolon`, but for | |
// trailing commas. | |
onTrailingComma: null, | |
// By default, reserved words are only enforced if ecmaVersion >= 5. | |
// Set `allowReserved` to a boolean value to explicitly turn this on | |
// an off. When this option has the value "never", reserved words | |
// and keywords can also not be used as property names. | |
allowReserved: null, | |
// When enabled, a return at the top level is not considered an | |
// error. | |
allowReturnOutsideFunction: false, | |
// When enabled, import/export statements are not constrained to | |
// appearing at the top of the program. | |
allowImportExportEverywhere: false, | |
// When enabled, await identifiers are allowed to appear at the top-level scope, | |
// but they are still not allowed in non-async functions. | |
allowAwaitOutsideFunction: false, | |
// When enabled, hashbang directive in the beginning of file | |
// is allowed and treated as a line comment. | |
allowHashBang: false, | |
// When `locations` is on, `loc` properties holding objects with | |
// `start` and `end` properties in `{line, column}` form (with | |
// line being 1-based and column 0-based) will be attached to the | |
// nodes. | |
locations: false, | |
// A function can be passed as `onToken` option, which will | |
// cause Acorn to call that function with object in the same | |
// format as tokens returned from `tokenizer().getToken()`. Note | |
// that you are not allowed to call the parser from the | |
// callback—that will corrupt its internal state. | |
onToken: null, | |
// A function can be passed as `onComment` option, which will | |
// cause Acorn to call that function with `(block, text, start, | |
// end)` parameters whenever a comment is skipped. `block` is a | |
// boolean indicating whether this is a block (`/* */`) comment, | |
// `text` is the content of the comment, and `start` and `end` are | |
// character offsets that denote the start and end of the comment. | |
// When the `locations` option is on, two more parameters are | |
// passed, the full `{line, column}` locations of the start and | |
// end of the comments. Note that you are not allowed to call the | |
// parser from the callback—that will corrupt its internal state. | |
onComment: null, | |
// Nodes have their start and end characters offsets recorded in | |
// `start` and `end` properties (directly on the node, rather than | |
// the `loc` object, which holds line/column data. To also add a | |
// [semi-standardized][range] `range` property holding a `[start, | |
// end]` array with the same numbers, set the `ranges` option to | |
// `true`. | |
// | |
// [range]: https://bugzilla.mozilla.org/show_bug.cgi?id=745678 | |
ranges: false, | |
// It is possible to parse multiple files into a single AST by | |
// passing the tree produced by parsing the first file as | |
// `program` option in subsequent parses. This will add the | |
// toplevel forms of the parsed file to the `Program` (top) node | |
// of an existing parse tree. | |
program: null, | |
// When `locations` is on, you can pass this to record the source | |
// file in every node's `loc` object. | |
sourceFile: null, | |
// This value, if given, is stored in every node, whether | |
// `locations` is on or off. | |
directSourceFile: null, | |
// When enabled, parenthesized expressions are represented by | |
// (non-standard) ParenthesizedExpression nodes | |
preserveParens: false | |
}; // Interpret and default an options object | |
function getOptions(opts) { | |
var options = {}; | |
for (var opt in defaultOptions) { | |
options[opt] = opts && has(opts, opt) ? opts[opt] : defaultOptions[opt]; | |
} | |
if (options.ecmaVersion >= 2015) { | |
options.ecmaVersion -= 2009; | |
} | |
if (options.allowReserved == null) { | |
options.allowReserved = options.ecmaVersion < 5; | |
} | |
if (isArray(options.onToken)) { | |
var tokens = options.onToken; | |
options.onToken = function (token) { | |
return tokens.push(token); | |
}; | |
} | |
if (isArray(options.onComment)) { | |
options.onComment = pushComment(options, options.onComment); | |
} | |
return options; | |
} | |
function pushComment(options, array) { | |
return function (block, text, start, end, startLoc, endLoc) { | |
var comment = { | |
type: block ? "Block" : "Line", | |
value: text, | |
start: start, | |
end: end | |
}; | |
if (options.locations) { | |
comment.loc = new SourceLocation(this || _global$Q, startLoc, endLoc); | |
} | |
if (options.ranges) { | |
comment.range = [start, end]; | |
} | |
array.push(comment); | |
}; | |
} // Each scope gets a bitset that may contain these flags | |
var SCOPE_TOP = 1, | |
SCOPE_FUNCTION = 2, | |
SCOPE_VAR = SCOPE_TOP | SCOPE_FUNCTION, | |
SCOPE_ASYNC = 4, | |
SCOPE_GENERATOR = 8, | |
SCOPE_ARROW = 16, | |
SCOPE_SIMPLE_CATCH = 32, | |
SCOPE_SUPER = 64, | |
SCOPE_DIRECT_SUPER = 128; | |
function functionFlags(async, generator) { | |
return SCOPE_FUNCTION | (async ? SCOPE_ASYNC : 0) | (generator ? SCOPE_GENERATOR : 0); | |
} // Used in checkLVal and declareName to determine the type of a binding | |
var BIND_NONE = 0, | |
// Not a binding | |
BIND_VAR = 1, | |
// Var-style binding | |
BIND_LEXICAL = 2, | |
// Let- or const-style binding | |
BIND_FUNCTION = 3, | |
// Function declaration | |
BIND_SIMPLE_CATCH = 4, | |
// Simple (identifier pattern) catch binding | |
BIND_OUTSIDE = 5; // Special case for function names as bound inside the function | |
var Parser = function Parser(options, input, startPos) { | |
(this || _global$Q).options = options = getOptions(options); | |
(this || _global$Q).sourceFile = options.sourceFile; | |
(this || _global$Q).keywords = wordsRegexp(keywords[options.ecmaVersion >= 6 ? 6 : options.sourceType === "module" ? "5module" : 5]); | |
var reserved = ""; | |
if (options.allowReserved !== true) { | |
for (var v = options.ecmaVersion;; v--) { | |
if (reserved = reservedWords[v]) { | |
break; | |
} | |
} | |
if (options.sourceType === "module") { | |
reserved += " await"; | |
} | |
} | |
(this || _global$Q).reservedWords = wordsRegexp(reserved); | |
var reservedStrict = (reserved ? reserved + " " : "") + reservedWords.strict; | |
(this || _global$Q).reservedWordsStrict = wordsRegexp(reservedStrict); | |
(this || _global$Q).reservedWordsStrictBind = wordsRegexp(reservedStrict + " " + reservedWords.strictBind); | |
(this || _global$Q).input = String(input); // Used to signal to callers of `readWord1` whether the word | |
// contained any escape sequences. This is needed because words with | |
// escape sequences must not be interpreted as keywords. | |
(this || _global$Q).containsEsc = false; // Set up token state | |
// The current position of the tokenizer in the input. | |
if (startPos) { | |
(this || _global$Q).pos = startPos; | |
(this || _global$Q).lineStart = (this || _global$Q).input.lastIndexOf("\n", startPos - 1) + 1; | |
(this || _global$Q).curLine = (this || _global$Q).input.slice(0, (this || _global$Q).lineStart).split(lineBreak).length; | |
} else { | |
(this || _global$Q).pos = (this || _global$Q).lineStart = 0; | |
(this || _global$Q).curLine = 1; | |
} // Properties of the current token: | |
// Its type | |
(this || _global$Q).type = types.eof; // For tokens that include more information than their type, the value | |
(this || _global$Q).value = null; // Its start and end offset | |
(this || _global$Q).start = (this || _global$Q).end = (this || _global$Q).pos; // And, if locations are used, the {line, column} object | |
// corresponding to those offsets | |
(this || _global$Q).startLoc = (this || _global$Q).endLoc = this.curPosition(); // Position information for the previous token | |
(this || _global$Q).lastTokEndLoc = (this || _global$Q).lastTokStartLoc = null; | |
(this || _global$Q).lastTokStart = (this || _global$Q).lastTokEnd = (this || _global$Q).pos; // The context stack is used to superficially track syntactic | |
// context to predict whether a regular expression is allowed in a | |
// given position. | |
(this || _global$Q).context = this.initialContext(); | |
(this || _global$Q).exprAllowed = true; // Figure out if it's a module code. | |
(this || _global$Q).inModule = options.sourceType === "module"; | |
(this || _global$Q).strict = (this || _global$Q).inModule || this.strictDirective((this || _global$Q).pos); // Used to signify the start of a potential arrow function | |
(this || _global$Q).potentialArrowAt = -1; // Positions to delayed-check that yield/await does not exist in default parameters. | |
(this || _global$Q).yieldPos = (this || _global$Q).awaitPos = (this || _global$Q).awaitIdentPos = 0; // Labels in scope. | |
(this || _global$Q).labels = []; // Thus-far undefined exports. | |
(this || _global$Q).undefinedExports = {}; // If enabled, skip leading hashbang line. | |
if ((this || _global$Q).pos === 0 && options.allowHashBang && (this || _global$Q).input.slice(0, 2) === "#!") { | |
this.skipLineComment(2); | |
} // Scope tracking for duplicate variable names (see scope.js) | |
(this || _global$Q).scopeStack = []; | |
this.enterScope(SCOPE_TOP); // For RegExp validation | |
(this || _global$Q).regexpState = null; | |
}; | |
var prototypeAccessors = { | |
inFunction: { | |
configurable: true | |
}, | |
inGenerator: { | |
configurable: true | |
}, | |
inAsync: { | |
configurable: true | |
}, | |
allowSuper: { | |
configurable: true | |
}, | |
allowDirectSuper: { | |
configurable: true | |
}, | |
treatFunctionsAsVar: { | |
configurable: true | |
} | |
}; | |
Parser.prototype.parse = function parse() { | |
var node = (this || _global$Q).options.program || this.startNode(); | |
this.nextToken(); | |
return this.parseTopLevel(node); | |
}; | |
prototypeAccessors.inFunction.get = function () { | |
return (this.currentVarScope().flags & SCOPE_FUNCTION) > 0; | |
}; | |
prototypeAccessors.inGenerator.get = function () { | |
return (this.currentVarScope().flags & SCOPE_GENERATOR) > 0; | |
}; | |
prototypeAccessors.inAsync.get = function () { | |
return (this.currentVarScope().flags & SCOPE_ASYNC) > 0; | |
}; | |
prototypeAccessors.allowSuper.get = function () { | |
return (this.currentThisScope().flags & SCOPE_SUPER) > 0; | |
}; | |
prototypeAccessors.allowDirectSuper.get = function () { | |
return (this.currentThisScope().flags & SCOPE_DIRECT_SUPER) > 0; | |
}; | |
prototypeAccessors.treatFunctionsAsVar.get = function () { | |
return this.treatFunctionsAsVarInScope(this.currentScope()); | |
}; // Switch to a getter for 7.0.0. | |
Parser.prototype.inNonArrowFunction = function inNonArrowFunction() { | |
return (this.currentThisScope().flags & SCOPE_FUNCTION) > 0; | |
}; | |
Parser.extend = function extend() { | |
var plugins = [], | |
len = arguments.length; | |
while (len--) plugins[len] = arguments[len]; | |
var cls = this || _global$Q; | |
for (var i = 0; i < plugins.length; i++) { | |
cls = plugins[i](cls); | |
} | |
return cls; | |
}; | |
Parser.parse = function parse(input, options) { | |
return new (this || _global$Q)(options, input).parse(); | |
}; | |
Parser.parseExpressionAt = function parseExpressionAt(input, pos, options) { | |
var parser = new (this || _global$Q)(options, input, pos); | |
parser.nextToken(); | |
return parser.parseExpression(); | |
}; | |
Parser.tokenizer = function tokenizer(input, options) { | |
return new (this || _global$Q)(options, input); | |
}; | |
Object.defineProperties(Parser.prototype, prototypeAccessors); | |
var pp = Parser.prototype; // ## Parser utilities | |
var literal = /^(?:'((?:\\.|[^'\\])*?)'|"((?:\\.|[^"\\])*?)")/; | |
pp.strictDirective = function (start) { | |
for (;;) { | |
// Try to find string literal. | |
skipWhiteSpace.lastIndex = start; | |
start += skipWhiteSpace.exec((this || _global$Q).input)[0].length; | |
var match = literal.exec((this || _global$Q).input.slice(start)); | |
if (!match) { | |
return false; | |
} | |
if ((match[1] || match[2]) === "use strict") { | |
skipWhiteSpace.lastIndex = start + match[0].length; | |
var spaceAfter = skipWhiteSpace.exec((this || _global$Q).input), | |
end = spaceAfter.index + spaceAfter[0].length; | |
var next = (this || _global$Q).input.charAt(end); | |
return next === ";" || next === "}" || lineBreak.test(spaceAfter[0]) && !(/[(`.[+\-/*%<>=,?^&]/.test(next) || next === "!" && (this || _global$Q).input.charAt(end + 1) === "="); | |
} | |
start += match[0].length; // Skip semicolon, if any. | |
skipWhiteSpace.lastIndex = start; | |
start += skipWhiteSpace.exec((this || _global$Q).input)[0].length; | |
if ((this || _global$Q).input[start] === ";") { | |
start++; | |
} | |
} | |
}; // Predicate that tests whether the next token is of the given | |
// type, and if yes, consumes it as a side effect. | |
pp.eat = function (type) { | |
if ((this || _global$Q).type === type) { | |
this.next(); | |
return true; | |
} else { | |
return false; | |
} | |
}; // Tests whether parsed token is a contextual keyword. | |
pp.isContextual = function (name) { | |
return (this || _global$Q).type === types.name && (this || _global$Q).value === name && !(this || _global$Q).containsEsc; | |
}; // Consumes contextual keyword if possible. | |
pp.eatContextual = function (name) { | |
if (!this.isContextual(name)) { | |
return false; | |
} | |
this.next(); | |
return true; | |
}; // Asserts that following token is given contextual keyword. | |
pp.expectContextual = function (name) { | |
if (!this.eatContextual(name)) { | |
this.unexpected(); | |
} | |
}; // Test whether a semicolon can be inserted at the current position. | |
pp.canInsertSemicolon = function () { | |
return (this || _global$Q).type === types.eof || (this || _global$Q).type === types.braceR || lineBreak.test((this || _global$Q).input.slice((this || _global$Q).lastTokEnd, (this || _global$Q).start)); | |
}; | |
pp.insertSemicolon = function () { | |
if (this.canInsertSemicolon()) { | |
if ((this || _global$Q).options.onInsertedSemicolon) { | |
(this || _global$Q).options.onInsertedSemicolon((this || _global$Q).lastTokEnd, (this || _global$Q).lastTokEndLoc); | |
} | |
return true; | |
} | |
}; // Consume a semicolon, or, failing that, see if we are allowed to | |
// pretend that there is a semicolon at this position. | |
pp.semicolon = function () { | |
if (!this.eat(types.semi) && !this.insertSemicolon()) { | |
this.unexpected(); | |
} | |
}; | |
pp.afterTrailingComma = function (tokType, notNext) { | |
if ((this || _global$Q).type === tokType) { | |
if ((this || _global$Q).options.onTrailingComma) { | |
(this || _global$Q).options.onTrailingComma((this || _global$Q).lastTokStart, (this || _global$Q).lastTokStartLoc); | |
} | |
if (!notNext) { | |
this.next(); | |
} | |
return true; | |
} | |
}; // Expect a token of a given type. If found, consume it, otherwise, | |
// raise an unexpected token error. | |
pp.expect = function (type) { | |
this.eat(type) || this.unexpected(); | |
}; // Raise an unexpected token error. | |
pp.unexpected = function (pos) { | |
this.raise(pos != null ? pos : (this || _global$Q).start, "Unexpected token"); | |
}; | |
function DestructuringErrors() { | |
(this || _global$Q).shorthandAssign = (this || _global$Q).trailingComma = (this || _global$Q).parenthesizedAssign = (this || _global$Q).parenthesizedBind = (this || _global$Q).doubleProto = -1; | |
} | |
pp.checkPatternErrors = function (refDestructuringErrors, isAssign) { | |
if (!refDestructuringErrors) { | |
return; | |
} | |
if (refDestructuringErrors.trailingComma > -1) { | |
this.raiseRecoverable(refDestructuringErrors.trailingComma, "Comma is not permitted after the rest element"); | |
} | |
var parens = isAssign ? refDestructuringErrors.parenthesizedAssign : refDestructuringErrors.parenthesizedBind; | |
if (parens > -1) { | |
this.raiseRecoverable(parens, "Parenthesized pattern"); | |
} | |
}; | |
pp.checkExpressionErrors = function (refDestructuringErrors, andThrow) { | |
if (!refDestructuringErrors) { | |
return false; | |
} | |
var shorthandAssign = refDestructuringErrors.shorthandAssign; | |
var doubleProto = refDestructuringErrors.doubleProto; | |
if (!andThrow) { | |
return shorthandAssign >= 0 || doubleProto >= 0; | |
} | |
if (shorthandAssign >= 0) { | |
this.raise(shorthandAssign, "Shorthand property assignments are valid only in destructuring patterns"); | |
} | |
if (doubleProto >= 0) { | |
this.raiseRecoverable(doubleProto, "Redefinition of __proto__ property"); | |
} | |
}; | |
pp.checkYieldAwaitInDefaultParams = function () { | |
if ((this || _global$Q).yieldPos && (!(this || _global$Q).awaitPos || (this || _global$Q).yieldPos < (this || _global$Q).awaitPos)) { | |
this.raise((this || _global$Q).yieldPos, "Yield expression cannot be a default value"); | |
} | |
if ((this || _global$Q).awaitPos) { | |
this.raise((this || _global$Q).awaitPos, "Await expression cannot be a default value"); | |
} | |
}; | |
pp.isSimpleAssignTarget = function (expr) { | |
if (expr.type === "ParenthesizedExpression") { | |
return this.isSimpleAssignTarget(expr.expression); | |
} | |
return expr.type === "Identifier" || expr.type === "MemberExpression"; | |
}; | |
var pp$1 = Parser.prototype; // ### Statement parsing | |
// Parse a program. Initializes the parser, reads any number of | |
// statements, and wraps them in a Program node. Optionally takes a | |
// `program` argument. If present, the statements will be appended | |
// to its body instead of creating a new node. | |
pp$1.parseTopLevel = function (node) { | |
var exports = {}; | |
if (!node.body) { | |
node.body = []; | |
} | |
while ((this || _global$Q).type !== types.eof) { | |
var stmt = this.parseStatement(null, true, exports); | |
node.body.push(stmt); | |
} | |
if ((this || _global$Q).inModule) { | |
for (var i = 0, list = Object.keys((this || _global$Q).undefinedExports); i < list.length; i += 1) { | |
var name = list[i]; | |
this.raiseRecoverable((this || _global$Q).undefinedExports[name].start, "Export '" + name + "' is not defined"); | |
} | |
} | |
this.adaptDirectivePrologue(node.body); | |
this.next(); | |
node.sourceType = (this || _global$Q).options.sourceType; | |
return this.finishNode(node, "Program"); | |
}; | |
var loopLabel = { | |
kind: "loop" | |
}, | |
switchLabel = { | |
kind: "switch" | |
}; | |
pp$1.isLet = function (context) { | |
if ((this || _global$Q).options.ecmaVersion < 6 || !this.isContextual("let")) { | |
return false; | |
} | |
skipWhiteSpace.lastIndex = (this || _global$Q).pos; | |
var skip = skipWhiteSpace.exec((this || _global$Q).input); | |
var next = (this || _global$Q).pos + skip[0].length, | |
nextCh = (this || _global$Q).input.charCodeAt(next); // For ambiguous cases, determine if a LexicalDeclaration (or only a | |
// Statement) is allowed here. If context is not empty then only a Statement | |
// is allowed. However, `let [` is an explicit negative lookahead for | |
// ExpressionStatement, so special-case it first. | |
if (nextCh === 91) { | |
return true; | |
} // '[' | |
if (context) { | |
return false; | |
} | |
if (nextCh === 123) { | |
return true; | |
} // '{' | |
if (isIdentifierStart(nextCh, true)) { | |
var pos = next + 1; | |
while (isIdentifierChar((this || _global$Q).input.charCodeAt(pos), true)) { | |
++pos; | |
} | |
var ident = (this || _global$Q).input.slice(next, pos); | |
if (!keywordRelationalOperator.test(ident)) { | |
return true; | |
} | |
} | |
return false; | |
}; // check 'async [no LineTerminator here] function' | |
// - 'async /*foo*/ function' is OK. | |
// - 'async /*\n*/ function' is invalid. | |
pp$1.isAsyncFunction = function () { | |
if ((this || _global$Q).options.ecmaVersion < 8 || !this.isContextual("async")) { | |
return false; | |
} | |
skipWhiteSpace.lastIndex = (this || _global$Q).pos; | |
var skip = skipWhiteSpace.exec((this || _global$Q).input); | |
var next = (this || _global$Q).pos + skip[0].length; | |
return !lineBreak.test((this || _global$Q).input.slice((this || _global$Q).pos, next)) && (this || _global$Q).input.slice(next, next + 8) === "function" && (next + 8 === (this || _global$Q).input.length || !isIdentifierChar((this || _global$Q).input.charAt(next + 8))); | |
}; // Parse a single statement. | |
// | |
// If expecting a statement and finding a slash operator, parse a | |
// regular expression literal. This is to handle cases like | |
// `if (foo) /blah/.exec(foo)`, where looking at the previous token | |
// does not help. | |
pp$1.parseStatement = function (context, topLevel, exports) { | |
var starttype = (this || _global$Q).type, | |
node = this.startNode(), | |
kind; | |
if (this.isLet(context)) { | |
starttype = types._var; | |
kind = "let"; | |
} // Most types of statements are recognized by the keyword they | |
// start with. Many are trivial to parse, some require a bit of | |
// complexity. | |
switch (starttype) { | |
case types._break: | |
case types._continue: | |
return this.parseBreakContinueStatement(node, starttype.keyword); | |
case types._debugger: | |
return this.parseDebuggerStatement(node); | |
case types._do: | |
return this.parseDoStatement(node); | |
case types._for: | |
return this.parseForStatement(node); | |
case types._function: | |
// Function as sole body of either an if statement or a labeled statement | |
// works, but not when it is part of a labeled statement that is the sole | |
// body of an if statement. | |
if (context && ((this || _global$Q).strict || context !== "if" && context !== "label") && (this || _global$Q).options.ecmaVersion >= 6) { | |
this.unexpected(); | |
} | |
return this.parseFunctionStatement(node, false, !context); | |
case types._class: | |
if (context) { | |
this.unexpected(); | |
} | |
return this.parseClass(node, true); | |
case types._if: | |
return this.parseIfStatement(node); | |
case types._return: | |
return this.parseReturnStatement(node); | |
case types._switch: | |
return this.parseSwitchStatement(node); | |
case types._throw: | |
return this.parseThrowStatement(node); | |
case types._try: | |
return this.parseTryStatement(node); | |
case types._const: | |
case types._var: | |
kind = kind || (this || _global$Q).value; | |
if (context && kind !== "var") { | |
this.unexpected(); | |
} | |
return this.parseVarStatement(node, kind); | |
case types._while: | |
return this.parseWhileStatement(node); | |
case types._with: | |
return this.parseWithStatement(node); | |
case types.braceL: | |
return this.parseBlock(true, node); | |
case types.semi: | |
return this.parseEmptyStatement(node); | |
case types._export: | |
case types._import: | |
if ((this || _global$Q).options.ecmaVersion > 10 && starttype === types._import) { | |
skipWhiteSpace.lastIndex = (this || _global$Q).pos; | |
var skip = skipWhiteSpace.exec((this || _global$Q).input); | |
var next = (this || _global$Q).pos + skip[0].length, | |
nextCh = (this || _global$Q).input.charCodeAt(next); | |
if (nextCh === 40 || nextCh === 46) // '(' or '.' | |
{ | |
return this.parseExpressionStatement(node, this.parseExpression()); | |
} | |
} | |
if (!(this || _global$Q).options.allowImportExportEverywhere) { | |
if (!topLevel) { | |
this.raise((this || _global$Q).start, "'import' and 'export' may only appear at the top level"); | |
} | |
if (!(this || _global$Q).inModule) { | |
this.raise((this || _global$Q).start, "'import' and 'export' may appear only with 'sourceType: module'"); | |
} | |
} | |
return starttype === types._import ? this.parseImport(node) : this.parseExport(node, exports); | |
// If the statement does not start with a statement keyword or a | |
// brace, it's an ExpressionStatement or LabeledStatement. We | |
// simply start parsing an expression, and afterwards, if the | |
// next token is a colon and the expression was a simple | |
// Identifier node, we switch to interpreting it as a label. | |
default: | |
if (this.isAsyncFunction()) { | |
if (context) { | |
this.unexpected(); | |
} | |
this.next(); | |
return this.parseFunctionStatement(node, true, !context); | |
} | |
var maybeName = (this || _global$Q).value, | |
expr = this.parseExpression(); | |
if (starttype === types.name && expr.type === "Identifier" && this.eat(types.colon)) { | |
return this.parseLabeledStatement(node, maybeName, expr, context); | |
} else { | |
return this.parseExpressionStatement(node, expr); | |
} | |
} | |
}; | |
pp$1.parseBreakContinueStatement = function (node, keyword) { | |
var isBreak = keyword === "break"; | |
this.next(); | |
if (this.eat(types.semi) || this.insertSemicolon()) { | |
node.label = null; | |
} else if ((this || _global$Q).type !== types.name) { | |
this.unexpected(); | |
} else { | |
node.label = this.parseIdent(); | |
this.semicolon(); | |
} // Verify that there is an actual destination to break or | |
// continue to. | |
var i = 0; | |
for (; i < (this || _global$Q).labels.length; ++i) { | |
var lab = (this || _global$Q).labels[i]; | |
if (node.label == null || lab.name === node.label.name) { | |
if (lab.kind != null && (isBreak || lab.kind === "loop")) { | |
break; | |
} | |
if (node.label && isBreak) { | |
break; | |
} | |
} | |
} | |
if (i === (this || _global$Q).labels.length) { | |
this.raise(node.start, "Unsyntactic " + keyword); | |
} | |
return this.finishNode(node, isBreak ? "BreakStatement" : "ContinueStatement"); | |
}; | |
pp$1.parseDebuggerStatement = function (node) { | |
this.next(); | |
this.semicolon(); | |
return this.finishNode(node, "DebuggerStatement"); | |
}; | |
pp$1.parseDoStatement = function (node) { | |
this.next(); | |
(this || _global$Q).labels.push(loopLabel); | |
node.body = this.parseStatement("do"); | |
(this || _global$Q).labels.pop(); | |
this.expect(types._while); | |
node.test = this.parseParenExpression(); | |
if ((this || _global$Q).options.ecmaVersion >= 6) { | |
this.eat(types.semi); | |
} else { | |
this.semicolon(); | |
} | |
return this.finishNode(node, "DoWhileStatement"); | |
}; // Disambiguating between a `for` and a `for`/`in` or `for`/`of` | |
// loop is non-trivial. Basically, we have to parse the init `var` | |
// statement or expression, disallowing the `in` operator (see | |
// the second parameter to `parseExpression`), and then check | |
// whether the next token is `in` or `of`. When there is no init | |
// part (semicolon immediately after the opening parenthesis), it | |
// is a regular `for` loop. | |
pp$1.parseForStatement = function (node) { | |
this.next(); | |
var awaitAt = (this || _global$Q).options.ecmaVersion >= 9 && ((this || _global$Q).inAsync || !(this || _global$Q).inFunction && (this || _global$Q).options.allowAwaitOutsideFunction) && this.eatContextual("await") ? (this || _global$Q).lastTokStart : -1; | |
(this || _global$Q).labels.push(loopLabel); | |
this.enterScope(0); | |
this.expect(types.parenL); | |
if ((this || _global$Q).type === types.semi) { | |
if (awaitAt > -1) { | |
this.unexpected(awaitAt); | |
} | |
return this.parseFor(node, null); | |
} | |
var isLet = this.isLet(); | |
if ((this || _global$Q).type === types._var || (this || _global$Q).type === types._const || isLet) { | |
var init$1 = this.startNode(), | |
kind = isLet ? "let" : (this || _global$Q).value; | |
this.next(); | |
this.parseVar(init$1, true, kind); | |
this.finishNode(init$1, "VariableDeclaration"); | |
if (((this || _global$Q).type === types._in || (this || _global$Q).options.ecmaVersion >= 6 && this.isContextual("of")) && init$1.declarations.length === 1) { | |
if ((this || _global$Q).options.ecmaVersion >= 9) { | |
if ((this || _global$Q).type === types._in) { | |
if (awaitAt > -1) { | |
this.unexpected(awaitAt); | |
} | |
} else { | |
node.await = awaitAt > -1; | |
} | |
} | |
return this.parseForIn(node, init$1); | |
} | |
if (awaitAt > -1) { | |
this.unexpected(awaitAt); | |
} | |
return this.parseFor(node, init$1); | |
} | |
var refDestructuringErrors = new DestructuringErrors(); | |
var init = this.parseExpression(true, refDestructuringErrors); | |
if ((this || _global$Q).type === types._in || (this || _global$Q).options.ecmaVersion >= 6 && this.isContextual("of")) { | |
if ((this || _global$Q).options.ecmaVersion >= 9) { | |
if ((this || _global$Q).type === types._in) { | |
if (awaitAt > -1) { | |
this.unexpected(awaitAt); | |
} | |
} else { | |
node.await = awaitAt > -1; | |
} | |
} | |
this.toAssignable(init, false, refDestructuringErrors); | |
this.checkLVal(init); | |
return this.parseForIn(node, init); | |
} else { | |
this.checkExpressionErrors(refDestructuringErrors, true); | |
} | |
if (awaitAt > -1) { | |
this.unexpected(awaitAt); | |
} | |
return this.parseFor(node, init); | |
}; | |
pp$1.parseFunctionStatement = function (node, isAsync, declarationPosition) { | |
this.next(); | |
return this.parseFunction(node, FUNC_STATEMENT | (declarationPosition ? 0 : FUNC_HANGING_STATEMENT), false, isAsync); | |
}; | |
pp$1.parseIfStatement = function (node) { | |
this.next(); | |
node.test = this.parseParenExpression(); // allow function declarations in branches, but only in non-strict mode | |
node.consequent = this.parseStatement("if"); | |
node.alternate = this.eat(types._else) ? this.parseStatement("if") : null; | |
return this.finishNode(node, "IfStatement"); | |
}; | |
pp$1.parseReturnStatement = function (node) { | |
if (!(this || _global$Q).inFunction && !(this || _global$Q).options.allowReturnOutsideFunction) { | |
this.raise((this || _global$Q).start, "'return' outside of function"); | |
} | |
this.next(); // In `return` (and `break`/`continue`), the keywords with | |
// optional arguments, we eagerly look for a semicolon or the | |
// possibility to insert one. | |
if (this.eat(types.semi) || this.insertSemicolon()) { | |
node.argument = null; | |
} else { | |
node.argument = this.parseExpression(); | |
this.semicolon(); | |
} | |
return this.finishNode(node, "ReturnStatement"); | |
}; | |
pp$1.parseSwitchStatement = function (node) { | |
this.next(); | |
node.discriminant = this.parseParenExpression(); | |
node.cases = []; | |
this.expect(types.braceL); | |
(this || _global$Q).labels.push(switchLabel); | |
this.enterScope(0); // Statements under must be grouped (by label) in SwitchCase | |
// nodes. `cur` is used to keep the node that we are currently | |
// adding statements to. | |
var cur; | |
for (var sawDefault = false; (this || _global$Q).type !== types.braceR;) { | |
if ((this || _global$Q).type === types._case || (this || _global$Q).type === types._default) { | |
var isCase = (this || _global$Q).type === types._case; | |
if (cur) { | |
this.finishNode(cur, "SwitchCase"); | |
} | |
node.cases.push(cur = this.startNode()); | |
cur.consequent = []; | |
this.next(); | |
if (isCase) { | |
cur.test = this.parseExpression(); | |
} else { | |
if (sawDefault) { | |
this.raiseRecoverable((this || _global$Q).lastTokStart, "Multiple default clauses"); | |
} | |
sawDefault = true; | |
cur.test = null; | |
} | |
this.expect(types.colon); | |
} else { | |
if (!cur) { | |
this.unexpected(); | |
} | |
cur.consequent.push(this.parseStatement(null)); | |
} | |
} | |
this.exitScope(); | |
if (cur) { | |
this.finishNode(cur, "SwitchCase"); | |
} | |
this.next(); // Closing brace | |
(this || _global$Q).labels.pop(); | |
return this.finishNode(node, "SwitchStatement"); | |
}; | |
pp$1.parseThrowStatement = function (node) { | |
this.next(); | |
if (lineBreak.test((this || _global$Q).input.slice((this || _global$Q).lastTokEnd, (this || _global$Q).start))) { | |
this.raise((this || _global$Q).lastTokEnd, "Illegal newline after throw"); | |
} | |
node.argument = this.parseExpression(); | |
this.semicolon(); | |
return this.finishNode(node, "ThrowStatement"); | |
}; // Reused empty array added for node fields that are always empty. | |
var empty = []; | |
pp$1.parseTryStatement = function (node) { | |
this.next(); | |
node.block = this.parseBlock(); | |
node.handler = null; | |
if ((this || _global$Q).type === types._catch) { | |
var clause = this.startNode(); | |
this.next(); | |
if (this.eat(types.parenL)) { | |
clause.param = this.parseBindingAtom(); | |
var simple = clause.param.type === "Identifier"; | |
this.enterScope(simple ? SCOPE_SIMPLE_CATCH : 0); | |
this.checkLVal(clause.param, simple ? BIND_SIMPLE_CATCH : BIND_LEXICAL); | |
this.expect(types.parenR); | |
} else { | |
if ((this || _global$Q).options.ecmaVersion < 10) { | |
this.unexpected(); | |
} | |
clause.param = null; | |
this.enterScope(0); | |
} | |
clause.body = this.parseBlock(false); | |
this.exitScope(); | |
node.handler = this.finishNode(clause, "CatchClause"); | |
} | |
node.finalizer = this.eat(types._finally) ? this.parseBlock() : null; | |
if (!node.handler && !node.finalizer) { | |
this.raise(node.start, "Missing catch or finally clause"); | |
} | |
return this.finishNode(node, "TryStatement"); | |
}; | |
pp$1.parseVarStatement = function (node, kind) { | |
this.next(); | |
this.parseVar(node, false, kind); | |
this.semicolon(); | |
return this.finishNode(node, "VariableDeclaration"); | |
}; | |
pp$1.parseWhileStatement = function (node) { | |
this.next(); | |
node.test = this.parseParenExpression(); | |
(this || _global$Q).labels.push(loopLabel); | |
node.body = this.parseStatement("while"); | |
(this || _global$Q).labels.pop(); | |
return this.finishNode(node, "WhileStatement"); | |
}; | |
pp$1.parseWithStatement = function (node) { | |
if ((this || _global$Q).strict) { | |
this.raise((this || _global$Q).start, "'with' in strict mode"); | |
} | |
this.next(); | |
node.object = this.parseParenExpression(); | |
node.body = this.parseStatement("with"); | |
return this.finishNode(node, "WithStatement"); | |
}; | |
pp$1.parseEmptyStatement = function (node) { | |
this.next(); | |
return this.finishNode(node, "EmptyStatement"); | |
}; | |
pp$1.parseLabeledStatement = function (node, maybeName, expr, context) { | |
for (var i$1 = 0, list = (this || _global$Q).labels; i$1 < list.length; i$1 += 1) { | |
var label = list[i$1]; | |
if (label.name === maybeName) { | |
this.raise(expr.start, "Label '" + maybeName + "' is already declared"); | |
} | |
} | |
var kind = (this || _global$Q).type.isLoop ? "loop" : (this || _global$Q).type === types._switch ? "switch" : null; | |
for (var i = (this || _global$Q).labels.length - 1; i >= 0; i--) { | |
var label$1 = (this || _global$Q).labels[i]; | |
if (label$1.statementStart === node.start) { | |
// Update information about previous labels on this node | |
label$1.statementStart = (this || _global$Q).start; | |
label$1.kind = kind; | |
} else { | |
break; | |
} | |
} | |
(this || _global$Q).labels.push({ | |
name: maybeName, | |
kind: kind, | |
statementStart: (this || _global$Q).start | |
}); | |
node.body = this.parseStatement(context ? context.indexOf("label") === -1 ? context + "label" : context : "label"); | |
(this || _global$Q).labels.pop(); | |
node.label = expr; | |
return this.finishNode(node, "LabeledStatement"); | |
}; | |
pp$1.parseExpressionStatement = function (node, expr) { | |
node.expression = expr; | |
this.semicolon(); | |
return this.finishNode(node, "ExpressionStatement"); | |
}; // Parse a semicolon-enclosed block of statements, handling `"use | |
// strict"` declarations when `allowStrict` is true (used for | |
// function bodies). | |
pp$1.parseBlock = function (createNewLexicalScope, node, exitStrict) { | |
if (createNewLexicalScope === void 0) createNewLexicalScope = true; | |
if (node === void 0) node = this.startNode(); | |
node.body = []; | |
this.expect(types.braceL); | |
if (createNewLexicalScope) { | |
this.enterScope(0); | |
} | |
while ((this || _global$Q).type !== types.braceR) { | |
var stmt = this.parseStatement(null); | |
node.body.push(stmt); | |
} | |
if (exitStrict) { | |
(this || _global$Q).strict = false; | |
} | |
this.next(); | |
if (createNewLexicalScope) { | |
this.exitScope(); | |
} | |
return this.finishNode(node, "BlockStatement"); | |
}; // Parse a regular `for` loop. The disambiguation code in | |
// `parseStatement` will already have parsed the init statement or | |
// expression. | |
pp$1.parseFor = function (node, init) { | |
node.init = init; | |
this.expect(types.semi); | |
node.test = (this || _global$Q).type === types.semi ? null : this.parseExpression(); | |
this.expect(types.semi); | |
node.update = (this || _global$Q).type === types.parenR ? null : this.parseExpression(); | |
this.expect(types.parenR); | |
node.body = this.parseStatement("for"); | |
this.exitScope(); | |
(this || _global$Q).labels.pop(); | |
return this.finishNode(node, "ForStatement"); | |
}; // Parse a `for`/`in` and `for`/`of` loop, which are almost | |
// same from parser's perspective. | |
pp$1.parseForIn = function (node, init) { | |
var isForIn = (this || _global$Q).type === types._in; | |
this.next(); | |
if (init.type === "VariableDeclaration" && init.declarations[0].init != null && (!isForIn || (this || _global$Q).options.ecmaVersion < 8 || (this || _global$Q).strict || init.kind !== "var" || init.declarations[0].id.type !== "Identifier")) { | |
this.raise(init.start, (isForIn ? "for-in" : "for-of") + " loop variable declaration may not have an initializer"); | |
} else if (init.type === "AssignmentPattern") { | |
this.raise(init.start, "Invalid left-hand side in for-loop"); | |
} | |
node.left = init; | |
node.right = isForIn ? this.parseExpression() : this.parseMaybeAssign(); | |
this.expect(types.parenR); | |
node.body = this.parseStatement("for"); | |
this.exitScope(); | |
(this || _global$Q).labels.pop(); | |
return this.finishNode(node, isForIn ? "ForInStatement" : "ForOfStatement"); | |
}; // Parse a list of variable declarations. | |
pp$1.parseVar = function (node, isFor, kind) { | |
node.declarations = []; | |
node.kind = kind; | |
for (;;) { | |
var decl = this.startNode(); | |
this.parseVarId(decl, kind); | |
if (this.eat(types.eq)) { | |
decl.init = this.parseMaybeAssign(isFor); | |
} else if (kind === "const" && !((this || _global$Q).type === types._in || (this || _global$Q).options.ecmaVersion >= 6 && this.isContextual("of"))) { | |
this.unexpected(); | |
} else if (decl.id.type !== "Identifier" && !(isFor && ((this || _global$Q).type === types._in || this.isContextual("of")))) { | |
this.raise((this || _global$Q).lastTokEnd, "Complex binding patterns require an initialization value"); | |
} else { | |
decl.init = null; | |
} | |
node.declarations.push(this.finishNode(decl, "VariableDeclarator")); | |
if (!this.eat(types.comma)) { | |
break; | |
} | |
} | |
return node; | |
}; | |
pp$1.parseVarId = function (decl, kind) { | |
decl.id = this.parseBindingAtom(); | |
this.checkLVal(decl.id, kind === "var" ? BIND_VAR : BIND_LEXICAL, false); | |
}; | |
var FUNC_STATEMENT = 1, | |
FUNC_HANGING_STATEMENT = 2, | |
FUNC_NULLABLE_ID = 4; // Parse a function declaration or literal (depending on the | |
// `statement & FUNC_STATEMENT`). | |
// Remove `allowExpressionBody` for 7.0.0, as it is only called with false | |
pp$1.parseFunction = function (node, statement, allowExpressionBody, isAsync) { | |
this.initFunction(node); | |
if ((this || _global$Q).options.ecmaVersion >= 9 || (this || _global$Q).options.ecmaVersion >= 6 && !isAsync) { | |
if ((this || _global$Q).type === types.star && statement & FUNC_HANGING_STATEMENT) { | |
this.unexpected(); | |
} | |
node.generator = this.eat(types.star); | |
} | |
if ((this || _global$Q).options.ecmaVersion >= 8) { | |
node.async = !!isAsync; | |
} | |
if (statement & FUNC_STATEMENT) { | |
node.id = statement & FUNC_NULLABLE_ID && (this || _global$Q).type !== types.name ? null : this.parseIdent(); | |
if (node.id && !(statement & FUNC_HANGING_STATEMENT)) // If it is a regular function declaration in sloppy mode, then it is | |
// subject to Annex B semantics (BIND_FUNCTION). Otherwise, the binding | |
// mode depends on properties of the current scope (see | |
// treatFunctionsAsVar). | |
{ | |
this.checkLVal(node.id, (this || _global$Q).strict || node.generator || node.async ? (this || _global$Q).treatFunctionsAsVar ? BIND_VAR : BIND_LEXICAL : BIND_FUNCTION); | |
} | |
} | |
var oldYieldPos = (this || _global$Q).yieldPos, | |
oldAwaitPos = (this || _global$Q).awaitPos, | |
oldAwaitIdentPos = (this || _global$Q).awaitIdentPos; | |
(this || _global$Q).yieldPos = 0; | |
(this || _global$Q).awaitPos = 0; | |
(this || _global$Q).awaitIdentPos = 0; | |
this.enterScope(functionFlags(node.async, node.generator)); | |
if (!(statement & FUNC_STATEMENT)) { | |
node.id = (this || _global$Q).type === types.name ? this.parseIdent() : null; | |
} | |
this.parseFunctionParams(node); | |
this.parseFunctionBody(node, allowExpressionBody, false); | |
(this || _global$Q).yieldPos = oldYieldPos; | |
(this || _global$Q).awaitPos = oldAwaitPos; | |
(this || _global$Q).awaitIdentPos = oldAwaitIdentPos; | |
return this.finishNode(node, statement & FUNC_STATEMENT ? "FunctionDeclaration" : "FunctionExpression"); | |
}; | |
pp$1.parseFunctionParams = function (node) { | |
this.expect(types.parenL); | |
node.params = this.parseBindingList(types.parenR, false, (this || _global$Q).options.ecmaVersion >= 8); | |
this.checkYieldAwaitInDefaultParams(); | |
}; // Parse a class declaration or literal (depending on the | |
// `isStatement` parameter). | |
pp$1.parseClass = function (node, isStatement) { | |
this.next(); // ecma-262 14.6 Class Definitions | |
// A class definition is always strict mode code. | |
var oldStrict = (this || _global$Q).strict; | |
(this || _global$Q).strict = true; | |
this.parseClassId(node, isStatement); | |
this.parseClassSuper(node); | |
var classBody = this.startNode(); | |
var hadConstructor = false; | |
classBody.body = []; | |
this.expect(types.braceL); | |
while ((this || _global$Q).type !== types.braceR) { | |
var element = this.parseClassElement(node.superClass !== null); | |
if (element) { | |
classBody.body.push(element); | |
if (element.type === "MethodDefinition" && element.kind === "constructor") { | |
if (hadConstructor) { | |
this.raise(element.start, "Duplicate constructor in the same class"); | |
} | |
hadConstructor = true; | |
} | |
} | |
} | |
(this || _global$Q).strict = oldStrict; | |
this.next(); | |
node.body = this.finishNode(classBody, "ClassBody"); | |
return this.finishNode(node, isStatement ? "ClassDeclaration" : "ClassExpression"); | |
}; | |
pp$1.parseClassElement = function (constructorAllowsSuper) { | |
var this$1$1 = this || _global$Q; | |
if (this.eat(types.semi)) { | |
return null; | |
} | |
var method = this.startNode(); | |
var tryContextual = function (k, noLineBreak) { | |
if (noLineBreak === void 0) noLineBreak = false; | |
var start = this$1$1.start, | |
startLoc = this$1$1.startLoc; | |
if (!this$1$1.eatContextual(k)) { | |
return false; | |
} | |
if (this$1$1.type !== types.parenL && (!noLineBreak || !this$1$1.canInsertSemicolon())) { | |
return true; | |
} | |
if (method.key) { | |
this$1$1.unexpected(); | |
} | |
method.computed = false; | |
method.key = this$1$1.startNodeAt(start, startLoc); | |
method.key.name = k; | |
this$1$1.finishNode(method.key, "Identifier"); | |
return false; | |
}; | |
method.kind = "method"; | |
method.static = tryContextual("static"); | |
var isGenerator = this.eat(types.star); | |
var isAsync = false; | |
if (!isGenerator) { | |
if ((this || _global$Q).options.ecmaVersion >= 8 && tryContextual("async", true)) { | |
isAsync = true; | |
isGenerator = (this || _global$Q).options.ecmaVersion >= 9 && this.eat(types.star); | |
} else if (tryContextual("get")) { | |
method.kind = "get"; | |
} else if (tryContextual("set")) { | |
method.kind = "set"; | |
} | |
} | |
if (!method.key) { | |
this.parsePropertyName(method); | |
} | |
var key = method.key; | |
var allowsDirectSuper = false; | |
if (!method.computed && !method.static && (key.type === "Identifier" && key.name === "constructor" || key.type === "Literal" && key.value === "constructor")) { | |
if (method.kind !== "method") { | |
this.raise(key.start, "Constructor can't have get/set modifier"); | |
} | |
if (isGenerator) { | |
this.raise(key.start, "Constructor can't be a generator"); | |
} | |
if (isAsync) { | |
this.raise(key.start, "Constructor can't be an async method"); | |
} | |
method.kind = "constructor"; | |
allowsDirectSuper = constructorAllowsSuper; | |
} else if (method.static && key.type === "Identifier" && key.name === "prototype") { | |
this.raise(key.start, "Classes may not have a static property named prototype"); | |
} | |
this.parseClassMethod(method, isGenerator, isAsync, allowsDirectSuper); | |
if (method.kind === "get" && method.value.params.length !== 0) { | |
this.raiseRecoverable(method.value.start, "getter should have no params"); | |
} | |
if (method.kind === "set" && method.value.params.length !== 1) { | |
this.raiseRecoverable(method.value.start, "setter should have exactly one param"); | |
} | |
if (method.kind === "set" && method.value.params[0].type === "RestElement") { | |
this.raiseRecoverable(method.value.params[0].start, "Setter cannot use rest params"); | |
} | |
return method; | |
}; | |
pp$1.parseClassMethod = function (method, isGenerator, isAsync, allowsDirectSuper) { | |
method.value = this.parseMethod(isGenerator, isAsync, allowsDirectSuper); | |
return this.finishNode(method, "MethodDefinition"); | |
}; | |
pp$1.parseClassId = function (node, isStatement) { | |
if ((this || _global$Q).type === types.name) { | |
node.id = this.parseIdent(); | |
if (isStatement) { | |
this.checkLVal(node.id, BIND_LEXICAL, false); | |
} | |
} else { | |
if (isStatement === true) { | |
this.unexpected(); | |
} | |
node.id = null; | |
} | |
}; | |
pp$1.parseClassSuper = function (node) { | |
node.superClass = this.eat(types._extends) ? this.parseExprSubscripts() : null; | |
}; // Parses module export declaration. | |
pp$1.parseExport = function (node, exports) { | |
this.next(); // export * from '...' | |
if (this.eat(types.star)) { | |
if ((this || _global$Q).options.ecmaVersion >= 11) { | |
if (this.eatContextual("as")) { | |
node.exported = this.parseIdent(true); | |
this.checkExport(exports, node.exported.name, (this || _global$Q).lastTokStart); | |
} else { | |
node.exported = null; | |
} | |
} | |
this.expectContextual("from"); | |
if ((this || _global$Q).type !== types.string) { | |
this.unexpected(); | |
} | |
node.source = this.parseExprAtom(); | |
this.semicolon(); | |
return this.finishNode(node, "ExportAllDeclaration"); | |
} | |
if (this.eat(types._default)) { | |
// export default ... | |
this.checkExport(exports, "default", (this || _global$Q).lastTokStart); | |
var isAsync; | |
if ((this || _global$Q).type === types._function || (isAsync = this.isAsyncFunction())) { | |
var fNode = this.startNode(); | |
this.next(); | |
if (isAsync) { | |
this.next(); | |
} | |
node.declaration = this.parseFunction(fNode, FUNC_STATEMENT | FUNC_NULLABLE_ID, false, isAsync); | |
} else if ((this || _global$Q).type === types._class) { | |
var cNode = this.startNode(); | |
node.declaration = this.parseClass(cNode, "nullableID"); | |
} else { | |
node.declaration = this.parseMaybeAssign(); | |
this.semicolon(); | |
} | |
return this.finishNode(node, "ExportDefaultDeclaration"); | |
} // export var|const|let|function|class ... | |
if (this.shouldParseExportStatement()) { | |
node.declaration = this.parseStatement(null); | |
if (node.declaration.type === "VariableDeclaration") { | |
this.checkVariableExport(exports, node.declaration.declarations); | |
} else { | |
this.checkExport(exports, node.declaration.id.name, node.declaration.id.start); | |
} | |
node.specifiers = []; | |
node.source = null; | |
} else { | |
// export { x, y as z } [from '...'] | |
node.declaration = null; | |
node.specifiers = this.parseExportSpecifiers(exports); | |
if (this.eatContextual("from")) { | |
if ((this || _global$Q).type !== types.string) { | |
this.unexpected(); | |
} | |
node.source = this.parseExprAtom(); | |
} else { | |
for (var i = 0, list = node.specifiers; i < list.length; i += 1) { | |
// check for keywords used as local names | |
var spec = list[i]; | |
this.checkUnreserved(spec.local); // check if export is defined | |
this.checkLocalExport(spec.local); | |
} | |
node.source = null; | |
} | |
this.semicolon(); | |
} | |
return this.finishNode(node, "ExportNamedDeclaration"); | |
}; | |
pp$1.checkExport = function (exports, name, pos) { | |
if (!exports) { | |
return; | |
} | |
if (has(exports, name)) { | |
this.raiseRecoverable(pos, "Duplicate export '" + name + "'"); | |
} | |
exports[name] = true; | |
}; | |
pp$1.checkPatternExport = function (exports, pat) { | |
var type = pat.type; | |
if (type === "Identifier") { | |
this.checkExport(exports, pat.name, pat.start); | |
} else if (type === "ObjectPattern") { | |
for (var i = 0, list = pat.properties; i < list.length; i += 1) { | |
var prop = list[i]; | |
this.checkPatternExport(exports, prop); | |
} | |
} else if (type === "ArrayPattern") { | |
for (var i$1 = 0, list$1 = pat.elements; i$1 < list$1.length; i$1 += 1) { | |
var elt = list$1[i$1]; | |
if (elt) { | |
this.checkPatternExport(exports, elt); | |
} | |
} | |
} else if (type === "Property") { | |
this.checkPatternExport(exports, pat.value); | |
} else if (type === "AssignmentPattern") { | |
this.checkPatternExport(exports, pat.left); | |
} else if (type === "RestElement") { | |
this.checkPatternExport(exports, pat.argument); | |
} else if (type === "ParenthesizedExpression") { | |
this.checkPatternExport(exports, pat.expression); | |
} | |
}; | |
pp$1.checkVariableExport = function (exports, decls) { | |
if (!exports) { | |
return; | |
} | |
for (var i = 0, list = decls; i < list.length; i += 1) { | |
var decl = list[i]; | |
this.checkPatternExport(exports, decl.id); | |
} | |
}; | |
pp$1.shouldParseExportStatement = function () { | |
return (this || _global$Q).type.keyword === "var" || (this || _global$Q).type.keyword === "const" || (this || _global$Q).type.keyword === "class" || (this || _global$Q).type.keyword === "function" || this.isLet() || this.isAsyncFunction(); | |
}; // Parses a comma-separated list of module exports. | |
pp$1.parseExportSpecifiers = function (exports) { | |
var nodes = [], | |
first = true; // export { x, y as z } [from '...'] | |
this.expect(types.braceL); | |
while (!this.eat(types.braceR)) { | |
if (!first) { | |
this.expect(types.comma); | |
if (this.afterTrailingComma(types.braceR)) { | |
break; | |
} | |
} else { | |
first = false; | |
} | |
var node = this.startNode(); | |
node.local = this.parseIdent(true); | |
node.exported = this.eatContextual("as") ? this.parseIdent(true) : node.local; | |
this.checkExport(exports, node.exported.name, node.exported.start); | |
nodes.push(this.finishNode(node, "ExportSpecifier")); | |
} | |
return nodes; | |
}; // Parses import declaration. | |
pp$1.parseImport = function (node) { | |
this.next(); // import '...' | |
if ((this || _global$Q).type === types.string) { | |
node.specifiers = empty; | |
node.source = this.parseExprAtom(); | |
} else { | |
node.specifiers = this.parseImportSpecifiers(); | |
this.expectContextual("from"); | |
node.source = (this || _global$Q).type === types.string ? this.parseExprAtom() : this.unexpected(); | |
} | |
this.semicolon(); | |
return this.finishNode(node, "ImportDeclaration"); | |
}; // Parses a comma-separated list of module imports. | |
pp$1.parseImportSpecifiers = function () { | |
var nodes = [], | |
first = true; | |
if ((this || _global$Q).type === types.name) { | |
// import defaultObj, { x, y as z } from '...' | |
var node = this.startNode(); | |
node.local = this.parseIdent(); | |
this.checkLVal(node.local, BIND_LEXICAL); | |
nodes.push(this.finishNode(node, "ImportDefaultSpecifier")); | |
if (!this.eat(types.comma)) { | |
return nodes; | |
} | |
} | |
if ((this || _global$Q).type === types.star) { | |
var node$1 = this.startNode(); | |
this.next(); | |
this.expectContextual("as"); | |
node$1.local = this.parseIdent(); | |
this.checkLVal(node$1.local, BIND_LEXICAL); | |
nodes.push(this.finishNode(node$1, "ImportNamespaceSpecifier")); | |
return nodes; | |
} | |
this.expect(types.braceL); | |
while (!this.eat(types.braceR)) { | |
if (!first) { | |
this.expect(types.comma); | |
if (this.afterTrailingComma(types.braceR)) { | |
break; | |
} | |
} else { | |
first = false; | |
} | |
var node$2 = this.startNode(); | |
node$2.imported = this.parseIdent(true); | |
if (this.eatContextual("as")) { | |
node$2.local = this.parseIdent(); | |
} else { | |
this.checkUnreserved(node$2.imported); | |
node$2.local = node$2.imported; | |
} | |
this.checkLVal(node$2.local, BIND_LEXICAL); | |
nodes.push(this.finishNode(node$2, "ImportSpecifier")); | |
} | |
return nodes; | |
}; // Set `ExpressionStatement#directive` property for directive prologues. | |
pp$1.adaptDirectivePrologue = function (statements) { | |
for (var i = 0; i < statements.length && this.isDirectiveCandidate(statements[i]); ++i) { | |
statements[i].directive = statements[i].expression.raw.slice(1, -1); | |
} | |
}; | |
pp$1.isDirectiveCandidate = function (statement) { | |
return statement.type === "ExpressionStatement" && statement.expression.type === "Literal" && typeof statement.expression.value === "string" && ( // Reject parenthesized strings. | |
(this || _global$Q).input[statement.start] === "\"" || (this || _global$Q).input[statement.start] === "'"); | |
}; | |
var pp$2 = Parser.prototype; // Convert existing expression atom to assignable pattern | |
// if possible. | |
pp$2.toAssignable = function (node, isBinding, refDestructuringErrors) { | |
if ((this || _global$Q).options.ecmaVersion >= 6 && node) { | |
switch (node.type) { | |
case "Identifier": | |
if ((this || _global$Q).inAsync && node.name === "await") { | |
this.raise(node.start, "Cannot use 'await' as identifier inside an async function"); | |
} | |
break; | |
case "ObjectPattern": | |
case "ArrayPattern": | |
case "RestElement": | |
break; | |
case "ObjectExpression": | |
node.type = "ObjectPattern"; | |
if (refDestructuringErrors) { | |
this.checkPatternErrors(refDestructuringErrors, true); | |
} | |
for (var i = 0, list = node.properties; i < list.length; i += 1) { | |
var prop = list[i]; | |
this.toAssignable(prop, isBinding); // Early error: | |
// AssignmentRestProperty[Yield, Await] : | |
// `...` DestructuringAssignmentTarget[Yield, Await] | |
// | |
// It is a Syntax Error if |DestructuringAssignmentTarget| is an |ArrayLiteral| or an |ObjectLiteral|. | |
if (prop.type === "RestElement" && (prop.argument.type === "ArrayPattern" || prop.argument.type === "ObjectPattern")) { | |
this.raise(prop.argument.start, "Unexpected token"); | |
} | |
} | |
break; | |
case "Property": | |
// AssignmentProperty has type === "Property" | |
if (node.kind !== "init") { | |
this.raise(node.key.start, "Object pattern can't contain getter or setter"); | |
} | |
this.toAssignable(node.value, isBinding); | |
break; | |
case "ArrayExpression": | |
node.type = "ArrayPattern"; | |
if (refDestructuringErrors) { | |
this.checkPatternErrors(refDestructuringErrors, true); | |
} | |
this.toAssignableList(node.elements, isBinding); | |
break; | |
case "SpreadElement": | |
node.type = "RestElement"; | |
this.toAssignable(node.argument, isBinding); | |
if (node.argument.type === "AssignmentPattern") { | |
this.raise(node.argument.start, "Rest elements cannot have a default value"); | |
} | |
break; | |
case "AssignmentExpression": | |
if (node.operator !== "=") { | |
this.raise(node.left.end, "Only '=' operator can be used for specifying default value."); | |
} | |
node.type = "AssignmentPattern"; | |
delete node.operator; | |
this.toAssignable(node.left, isBinding); | |
// falls through to AssignmentPattern | |
case "AssignmentPattern": | |
break; | |
case "ParenthesizedExpression": | |
this.toAssignable(node.expression, isBinding, refDestructuringErrors); | |
break; | |
case "ChainExpression": | |
this.raiseRecoverable(node.start, "Optional chaining cannot appear in left-hand side"); | |
break; | |
case "MemberExpression": | |
if (!isBinding) { | |
break; | |
} | |
default: | |
this.raise(node.start, "Assigning to rvalue"); | |
} | |
} else if (refDestructuringErrors) { | |
this.checkPatternErrors(refDestructuringErrors, true); | |
} | |
return node; | |
}; // Convert list of expression atoms to binding list. | |
pp$2.toAssignableList = function (exprList, isBinding) { | |
var end = exprList.length; | |
for (var i = 0; i < end; i++) { | |
var elt = exprList[i]; | |
if (elt) { | |
this.toAssignable(elt, isBinding); | |
} | |
} | |
if (end) { | |
var last = exprList[end - 1]; | |
if ((this || _global$Q).options.ecmaVersion === 6 && isBinding && last && last.type === "RestElement" && last.argument.type !== "Identifier") { | |
this.unexpected(last.argument.start); | |
} | |
} | |
return exprList; | |
}; // Parses spread element. | |
pp$2.parseSpread = function (refDestructuringErrors) { | |
var node = this.startNode(); | |
this.next(); | |
node.argument = this.parseMaybeAssign(false, refDestructuringErrors); | |
return this.finishNode(node, "SpreadElement"); | |
}; | |
pp$2.parseRestBinding = function () { | |
var node = this.startNode(); | |
this.next(); // RestElement inside of a function parameter must be an identifier | |
if ((this || _global$Q).options.ecmaVersion === 6 && (this || _global$Q).type !== types.name) { | |
this.unexpected(); | |
} | |
node.argument = this.parseBindingAtom(); | |
return this.finishNode(node, "RestElement"); | |
}; // Parses lvalue (assignable) atom. | |
pp$2.parseBindingAtom = function () { | |
if ((this || _global$Q).options.ecmaVersion >= 6) { | |
switch ((this || _global$Q).type) { | |
case types.bracketL: | |
var node = this.startNode(); | |
this.next(); | |
node.elements = this.parseBindingList(types.bracketR, true, true); | |
return this.finishNode(node, "ArrayPattern"); | |
case types.braceL: | |
return this.parseObj(true); | |
} | |
} | |
return this.parseIdent(); | |
}; | |
pp$2.parseBindingList = function (close, allowEmpty, allowTrailingComma) { | |
var elts = [], | |
first = true; | |
while (!this.eat(close)) { | |
if (first) { | |
first = false; | |
} else { | |
this.expect(types.comma); | |
} | |
if (allowEmpty && (this || _global$Q).type === types.comma) { | |
elts.push(null); | |
} else if (allowTrailingComma && this.afterTrailingComma(close)) { | |
break; | |
} else if ((this || _global$Q).type === types.ellipsis) { | |
var rest = this.parseRestBinding(); | |
this.parseBindingListItem(rest); | |
elts.push(rest); | |
if ((this || _global$Q).type === types.comma) { | |
this.raise((this || _global$Q).start, "Comma is not permitted after the rest element"); | |
} | |
this.expect(close); | |
break; | |
} else { | |
var elem = this.parseMaybeDefault((this || _global$Q).start, (this || _global$Q).startLoc); | |
this.parseBindingListItem(elem); | |
elts.push(elem); | |
} | |
} | |
return elts; | |
}; | |
pp$2.parseBindingListItem = function (param) { | |
return param; | |
}; // Parses assignment pattern around given atom if possible. | |
pp$2.parseMaybeDefault = function (startPos, startLoc, left) { | |
left = left || this.parseBindingAtom(); | |
if ((this || _global$Q).options.ecmaVersion < 6 || !this.eat(types.eq)) { | |
return left; | |
} | |
var node = this.startNodeAt(startPos, startLoc); | |
node.left = left; | |
node.right = this.parseMaybeAssign(); | |
return this.finishNode(node, "AssignmentPattern"); | |
}; // Verify that a node is an lval — something that can be assigned | |
// to. | |
// bindingType can be either: | |
// 'var' indicating that the lval creates a 'var' binding | |
// 'let' indicating that the lval creates a lexical ('let' or 'const') binding | |
// 'none' indicating that the binding should be checked for illegal identifiers, but not for duplicate references | |
pp$2.checkLVal = function (expr, bindingType, checkClashes) { | |
if (bindingType === void 0) bindingType = BIND_NONE; | |
switch (expr.type) { | |
case "Identifier": | |
if (bindingType === BIND_LEXICAL && expr.name === "let") { | |
this.raiseRecoverable(expr.start, "let is disallowed as a lexically bound name"); | |
} | |
if ((this || _global$Q).strict && (this || _global$Q).reservedWordsStrictBind.test(expr.name)) { | |
this.raiseRecoverable(expr.start, (bindingType ? "Binding " : "Assigning to ") + expr.name + " in strict mode"); | |
} | |
if (checkClashes) { | |
if (has(checkClashes, expr.name)) { | |
this.raiseRecoverable(expr.start, "Argument name clash"); | |
} | |
checkClashes[expr.name] = true; | |
} | |
if (bindingType !== BIND_NONE && bindingType !== BIND_OUTSIDE) { | |
this.declareName(expr.name, bindingType, expr.start); | |
} | |
break; | |
case "ChainExpression": | |
this.raiseRecoverable(expr.start, "Optional chaining cannot appear in left-hand side"); | |
break; | |
case "MemberExpression": | |
if (bindingType) { | |
this.raiseRecoverable(expr.start, "Binding member expression"); | |
} | |
break; | |
case "ObjectPattern": | |
for (var i = 0, list = expr.properties; i < list.length; i += 1) { | |
var prop = list[i]; | |
this.checkLVal(prop, bindingType, checkClashes); | |
} | |
break; | |
case "Property": | |
// AssignmentProperty has type === "Property" | |
this.checkLVal(expr.value, bindingType, checkClashes); | |
break; | |
case "ArrayPattern": | |
for (var i$1 = 0, list$1 = expr.elements; i$1 < list$1.length; i$1 += 1) { | |
var elem = list$1[i$1]; | |
if (elem) { | |
this.checkLVal(elem, bindingType, checkClashes); | |
} | |
} | |
break; | |
case "AssignmentPattern": | |
this.checkLVal(expr.left, bindingType, checkClashes); | |
break; | |
case "RestElement": | |
this.checkLVal(expr.argument, bindingType, checkClashes); | |
break; | |
case "ParenthesizedExpression": | |
this.checkLVal(expr.expression, bindingType, checkClashes); | |
break; | |
default: | |
this.raise(expr.start, (bindingType ? "Binding" : "Assigning to") + " rvalue"); | |
} | |
}; // A recursive descent parser operates by defining functions for all | |
var pp$3 = Parser.prototype; // Check if property name clashes with already added. | |
// Object/class getters and setters are not allowed to clash — | |
// either with each other or with an init property — and in | |
// strict mode, init properties are also not allowed to be repeated. | |
pp$3.checkPropClash = function (prop, propHash, refDestructuringErrors) { | |
if ((this || _global$Q).options.ecmaVersion >= 9 && prop.type === "SpreadElement") { | |
return; | |
} | |
if ((this || _global$Q).options.ecmaVersion >= 6 && (prop.computed || prop.method || prop.shorthand)) { | |
return; | |
} | |
var key = prop.key; | |
var name; | |
switch (key.type) { | |
case "Identifier": | |
name = key.name; | |
break; | |
case "Literal": | |
name = String(key.value); | |
break; | |
default: | |
return; | |
} | |
var kind = prop.kind; | |
if ((this || _global$Q).options.ecmaVersion >= 6) { | |
if (name === "__proto__" && kind === "init") { | |
if (propHash.proto) { | |
if (refDestructuringErrors) { | |
if (refDestructuringErrors.doubleProto < 0) { | |
refDestructuringErrors.doubleProto = key.start; | |
} // Backwards-compat kludge. Can be removed in version 6.0 | |
} else { | |
this.raiseRecoverable(key.start, "Redefinition of __proto__ property"); | |
} | |
} | |
propHash.proto = true; | |
} | |
return; | |
} | |
name = "$" + name; | |
var other = propHash[name]; | |
if (other) { | |
var redefinition; | |
if (kind === "init") { | |
redefinition = (this || _global$Q).strict && other.init || other.get || other.set; | |
} else { | |
redefinition = other.init || other[kind]; | |
} | |
if (redefinition) { | |
this.raiseRecoverable(key.start, "Redefinition of property"); | |
} | |
} else { | |
other = propHash[name] = { | |
init: false, | |
get: false, | |
set: false | |
}; | |
} | |
other[kind] = true; | |
}; // ### Expression parsing | |
// These nest, from the most general expression type at the top to | |
// 'atomic', nondivisible expression types at the bottom. Most of | |
// the functions will simply let the function(s) below them parse, | |
// and, *if* the syntactic construct they handle is present, wrap | |
// the AST node that the inner parser gave them in another node. | |
// Parse a full expression. The optional arguments are used to | |
// forbid the `in` operator (in for loops initalization expressions) | |
// and provide reference for storing '=' operator inside shorthand | |
// property assignment in contexts where both object expression | |
// and object pattern might appear (so it's possible to raise | |
// delayed syntax error at correct position). | |
pp$3.parseExpression = function (noIn, refDestructuringErrors) { | |
var startPos = (this || _global$Q).start, | |
startLoc = (this || _global$Q).startLoc; | |
var expr = this.parseMaybeAssign(noIn, refDestructuringErrors); | |
if ((this || _global$Q).type === types.comma) { | |
var node = this.startNodeAt(startPos, startLoc); | |
node.expressions = [expr]; | |
while (this.eat(types.comma)) { | |
node.expressions.push(this.parseMaybeAssign(noIn, refDestructuringErrors)); | |
} | |
return this.finishNode(node, "SequenceExpression"); | |
} | |
return expr; | |
}; // Parse an assignment expression. This includes applications of | |
// operators like `+=`. | |
pp$3.parseMaybeAssign = function (noIn, refDestructuringErrors, afterLeftParse) { | |
if (this.isContextual("yield")) { | |
if ((this || _global$Q).inGenerator) { | |
return this.parseYield(noIn); | |
} // The tokenizer will assume an expression is allowed after | |
// `yield`, but this isn't that kind of yield | |
else { | |
(this || _global$Q).exprAllowed = false; | |
} | |
} | |
var ownDestructuringErrors = false, | |
oldParenAssign = -1, | |
oldTrailingComma = -1; | |
if (refDestructuringErrors) { | |
oldParenAssign = refDestructuringErrors.parenthesizedAssign; | |
oldTrailingComma = refDestructuringErrors.trailingComma; | |
refDestructuringErrors.parenthesizedAssign = refDestructuringErrors.trailingComma = -1; | |
} else { | |
refDestructuringErrors = new DestructuringErrors(); | |
ownDestructuringErrors = true; | |
} | |
var startPos = (this || _global$Q).start, | |
startLoc = (this || _global$Q).startLoc; | |
if ((this || _global$Q).type === types.parenL || (this || _global$Q).type === types.name) { | |
(this || _global$Q).potentialArrowAt = (this || _global$Q).start; | |
} | |
var left = this.parseMaybeConditional(noIn, refDestructuringErrors); | |
if (afterLeftParse) { | |
left = afterLeftParse.call(this || _global$Q, left, startPos, startLoc); | |
} | |
if ((this || _global$Q).type.isAssign) { | |
var node = this.startNodeAt(startPos, startLoc); | |
node.operator = (this || _global$Q).value; | |
node.left = (this || _global$Q).type === types.eq ? this.toAssignable(left, false, refDestructuringErrors) : left; | |
if (!ownDestructuringErrors) { | |
refDestructuringErrors.parenthesizedAssign = refDestructuringErrors.trailingComma = refDestructuringErrors.doubleProto = -1; | |
} | |
if (refDestructuringErrors.shorthandAssign >= node.left.start) { | |
refDestructuringErrors.shorthandAssign = -1; | |
} // reset because shorthand default was used correctly | |
this.checkLVal(left); | |
this.next(); | |
node.right = this.parseMaybeAssign(noIn); | |
return this.finishNode(node, "AssignmentExpression"); | |
} else { | |
if (ownDestructuringErrors) { | |
this.checkExpressionErrors(refDestructuringErrors, true); | |
} | |
} | |
if (oldParenAssign > -1) { | |
refDestructuringErrors.parenthesizedAssign = oldParenAssign; | |
} | |
if (oldTrailingComma > -1) { | |
refDestructuringErrors.trailingComma = oldTrailingComma; | |
} | |
return left; | |
}; // Parse a ternary conditional (`?:`) operator. | |
pp$3.parseMaybeConditional = function (noIn, refDestructuringErrors) { | |
var startPos = (this || _global$Q).start, | |
startLoc = (this || _global$Q).startLoc; | |
var expr = this.parseExprOps(noIn, refDestructuringErrors); | |
if (this.checkExpressionErrors(refDestructuringErrors)) { | |
return expr; | |
} | |
if (this.eat(types.question)) { | |
var node = this.startNodeAt(startPos, startLoc); | |
node.test = expr; | |
node.consequent = this.parseMaybeAssign(); | |
this.expect(types.colon); | |
node.alternate = this.parseMaybeAssign(noIn); | |
return this.finishNode(node, "ConditionalExpression"); | |
} | |
return expr; | |
}; // Start the precedence parser. | |
pp$3.parseExprOps = function (noIn, refDestructuringErrors) { | |
var startPos = (this || _global$Q).start, | |
startLoc = (this || _global$Q).startLoc; | |
var expr = this.parseMaybeUnary(refDestructuringErrors, false); | |
if (this.checkExpressionErrors(refDestructuringErrors)) { | |
return expr; | |
} | |
return expr.start === startPos && expr.type === "ArrowFunctionExpression" ? expr : this.parseExprOp(expr, startPos, startLoc, -1, noIn); | |
}; // Parse binary operators with the operator precedence parsing | |
// algorithm. `left` is the left-hand side of the operator. | |
// `minPrec` provides context that allows the function to stop and | |
// defer further parser to one of its callers when it encounters an | |
// operator that has a lower precedence than the set it is parsing. | |
pp$3.parseExprOp = function (left, leftStartPos, leftStartLoc, minPrec, noIn) { | |
var prec = (this || _global$Q).type.binop; | |
if (prec != null && (!noIn || (this || _global$Q).type !== types._in)) { | |
if (prec > minPrec) { | |
var logical = (this || _global$Q).type === types.logicalOR || (this || _global$Q).type === types.logicalAND; | |
var coalesce = (this || _global$Q).type === types.coalesce; | |
if (coalesce) { | |
// Handle the precedence of `tt.coalesce` as equal to the range of logical expressions. | |
// In other words, `node.right` shouldn't contain logical expressions in order to check the mixed error. | |
prec = types.logicalAND.binop; | |
} | |
var op = (this || _global$Q).value; | |
this.next(); | |
var startPos = (this || _global$Q).start, | |
startLoc = (this || _global$Q).startLoc; | |
var right = this.parseExprOp(this.parseMaybeUnary(null, false), startPos, startLoc, prec, noIn); | |
var node = this.buildBinary(leftStartPos, leftStartLoc, left, right, op, logical || coalesce); | |
if (logical && (this || _global$Q).type === types.coalesce || coalesce && ((this || _global$Q).type === types.logicalOR || (this || _global$Q).type === types.logicalAND)) { | |
this.raiseRecoverable((this || _global$Q).start, "Logical expressions and coalesce expressions cannot be mixed. Wrap either by parentheses"); | |
} | |
return this.parseExprOp(node, leftStartPos, leftStartLoc, minPrec, noIn); | |
} | |
} | |
return left; | |
}; | |
pp$3.buildBinary = function (startPos, startLoc, left, right, op, logical) { | |
var node = this.startNodeAt(startPos, startLoc); | |
node.left = left; | |
node.operator = op; | |
node.right = right; | |
return this.finishNode(node, logical ? "LogicalExpression" : "BinaryExpression"); | |
}; // Parse unary operators, both prefix and postfix. | |
pp$3.parseMaybeUnary = function (refDestructuringErrors, sawUnary) { | |
var startPos = (this || _global$Q).start, | |
startLoc = (this || _global$Q).startLoc, | |
expr; | |
if (this.isContextual("await") && ((this || _global$Q).inAsync || !(this || _global$Q).inFunction && (this || _global$Q).options.allowAwaitOutsideFunction)) { | |
expr = this.parseAwait(); | |
sawUnary = true; | |
} else if ((this || _global$Q).type.prefix) { | |
var node = this.startNode(), | |
update = (this || _global$Q).type === types.incDec; | |
node.operator = (this || _global$Q).value; | |
node.prefix = true; | |
this.next(); | |
node.argument = this.parseMaybeUnary(null, true); | |
this.checkExpressionErrors(refDestructuringErrors, true); | |
if (update) { | |
this.checkLVal(node.argument); | |
} else if ((this || _global$Q).strict && node.operator === "delete" && node.argument.type === "Identifier") { | |
this.raiseRecoverable(node.start, "Deleting local variable in strict mode"); | |
} else { | |
sawUnary = true; | |
} | |
expr = this.finishNode(node, update ? "UpdateExpression" : "UnaryExpression"); | |
} else { | |
expr = this.parseExprSubscripts(refDestructuringErrors); | |
if (this.checkExpressionErrors(refDestructuringErrors)) { | |
return expr; | |
} | |
while ((this || _global$Q).type.postfix && !this.canInsertSemicolon()) { | |
var node$1 = this.startNodeAt(startPos, startLoc); | |
node$1.operator = (this || _global$Q).value; | |
node$1.prefix = false; | |
node$1.argument = expr; | |
this.checkLVal(expr); | |
this.next(); | |
expr = this.finishNode(node$1, "UpdateExpression"); | |
} | |
} | |
if (!sawUnary && this.eat(types.starstar)) { | |
return this.buildBinary(startPos, startLoc, expr, this.parseMaybeUnary(null, false), "**", false); | |
} else { | |
return expr; | |
} | |
}; // Parse call, dot, and `[]`-subscript expressions. | |
pp$3.parseExprSubscripts = function (refDestructuringErrors) { | |
var startPos = (this || _global$Q).start, | |
startLoc = (this || _global$Q).startLoc; | |
var expr = this.parseExprAtom(refDestructuringErrors); | |
if (expr.type === "ArrowFunctionExpression" && (this || _global$Q).input.slice((this || _global$Q).lastTokStart, (this || _global$Q).lastTokEnd) !== ")") { | |
return expr; | |
} | |
var result = this.parseSubscripts(expr, startPos, startLoc); | |
if (refDestructuringErrors && result.type === "MemberExpression") { | |
if (refDestructuringErrors.parenthesizedAssign >= result.start) { | |
refDestructuringErrors.parenthesizedAssign = -1; | |
} | |
if (refDestructuringErrors.parenthesizedBind >= result.start) { | |
refDestructuringErrors.parenthesizedBind = -1; | |
} | |
} | |
return result; | |
}; | |
pp$3.parseSubscripts = function (base, startPos, startLoc, noCalls) { | |
var maybeAsyncArrow = (this || _global$Q).options.ecmaVersion >= 8 && base.type === "Identifier" && base.name === "async" && (this || _global$Q).lastTokEnd === base.end && !this.canInsertSemicolon() && base.end - base.start === 5 && (this || _global$Q).potentialArrowAt === base.start; | |
var optionalChained = false; | |
while (true) { | |
var element = this.parseSubscript(base, startPos, startLoc, noCalls, maybeAsyncArrow, optionalChained); | |
if (element.optional) { | |
optionalChained = true; | |
} | |
if (element === base || element.type === "ArrowFunctionExpression") { | |
if (optionalChained) { | |
var chainNode = this.startNodeAt(startPos, startLoc); | |
chainNode.expression = element; | |
element = this.finishNode(chainNode, "ChainExpression"); | |
} | |
return element; | |
} | |
base = element; | |
} | |
}; | |
pp$3.parseSubscript = function (base, startPos, startLoc, noCalls, maybeAsyncArrow, optionalChained) { | |
var optionalSupported = (this || _global$Q).options.ecmaVersion >= 11; | |
var optional = optionalSupported && this.eat(types.questionDot); | |
if (noCalls && optional) { | |
this.raise((this || _global$Q).lastTokStart, "Optional chaining cannot appear in the callee of new expressions"); | |
} | |
var computed = this.eat(types.bracketL); | |
if (computed || optional && (this || _global$Q).type !== types.parenL && (this || _global$Q).type !== types.backQuote || this.eat(types.dot)) { | |
var node = this.startNodeAt(startPos, startLoc); | |
node.object = base; | |
node.property = computed ? this.parseExpression() : this.parseIdent((this || _global$Q).options.allowReserved !== "never"); | |
node.computed = !!computed; | |
if (computed) { | |
this.expect(types.bracketR); | |
} | |
if (optionalSupported) { | |
node.optional = optional; | |
} | |
base = this.finishNode(node, "MemberExpression"); | |
} else if (!noCalls && this.eat(types.parenL)) { | |
var refDestructuringErrors = new DestructuringErrors(), | |
oldYieldPos = (this || _global$Q).yieldPos, | |
oldAwaitPos = (this || _global$Q).awaitPos, | |
oldAwaitIdentPos = (this || _global$Q).awaitIdentPos; | |
(this || _global$Q).yieldPos = 0; | |
(this || _global$Q).awaitPos = 0; | |
(this || _global$Q).awaitIdentPos = 0; | |
var exprList = this.parseExprList(types.parenR, (this || _global$Q).options.ecmaVersion >= 8, false, refDestructuringErrors); | |
if (maybeAsyncArrow && !optional && !this.canInsertSemicolon() && this.eat(types.arrow)) { | |
this.checkPatternErrors(refDestructuringErrors, false); | |
this.checkYieldAwaitInDefaultParams(); | |
if ((this || _global$Q).awaitIdentPos > 0) { | |
this.raise((this || _global$Q).awaitIdentPos, "Cannot use 'await' as identifier inside an async function"); | |
} | |
(this || _global$Q).yieldPos = oldYieldPos; | |
(this || _global$Q).awaitPos = oldAwaitPos; | |
(this || _global$Q).awaitIdentPos = oldAwaitIdentPos; | |
return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), exprList, true); | |
} | |
this.checkExpressionErrors(refDestructuringErrors, true); | |
(this || _global$Q).yieldPos = oldYieldPos || (this || _global$Q).yieldPos; | |
(this || _global$Q).awaitPos = oldAwaitPos || (this || _global$Q).awaitPos; | |
(this || _global$Q).awaitIdentPos = oldAwaitIdentPos || (this || _global$Q).awaitIdentPos; | |
var node$1 = this.startNodeAt(startPos, startLoc); | |
node$1.callee = base; | |
node$1.arguments = exprList; | |
if (optionalSupported) { | |
node$1.optional = optional; | |
} | |
base = this.finishNode(node$1, "CallExpression"); | |
} else if ((this || _global$Q).type === types.backQuote) { | |
if (optional || optionalChained) { | |
this.raise((this || _global$Q).start, "Optional chaining cannot appear in the tag of tagged template expressions"); | |
} | |
var node$2 = this.startNodeAt(startPos, startLoc); | |
node$2.tag = base; | |
node$2.quasi = this.parseTemplate({ | |
isTagged: true | |
}); | |
base = this.finishNode(node$2, "TaggedTemplateExpression"); | |
} | |
return base; | |
}; // Parse an atomic expression — either a single token that is an | |
// expression, an expression started by a keyword like `function` or | |
// `new`, or an expression wrapped in punctuation like `()`, `[]`, | |
// or `{}`. | |
pp$3.parseExprAtom = function (refDestructuringErrors) { | |
// If a division operator appears in an expression position, the | |
// tokenizer got confused, and we force it to read a regexp instead. | |
if ((this || _global$Q).type === types.slash) { | |
this.readRegexp(); | |
} | |
var node, | |
canBeArrow = (this || _global$Q).potentialArrowAt === (this || _global$Q).start; | |
switch ((this || _global$Q).type) { | |
case types._super: | |
if (!(this || _global$Q).allowSuper) { | |
this.raise((this || _global$Q).start, "'super' keyword outside a method"); | |
} | |
node = this.startNode(); | |
this.next(); | |
if ((this || _global$Q).type === types.parenL && !(this || _global$Q).allowDirectSuper) { | |
this.raise(node.start, "super() call outside constructor of a subclass"); | |
} // The `super` keyword can appear at below: | |
// SuperProperty: | |
// super [ Expression ] | |
// super . IdentifierName | |
// SuperCall: | |
// super ( Arguments ) | |
if ((this || _global$Q).type !== types.dot && (this || _global$Q).type !== types.bracketL && (this || _global$Q).type !== types.parenL) { | |
this.unexpected(); | |
} | |
return this.finishNode(node, "Super"); | |
case types._this: | |
node = this.startNode(); | |
this.next(); | |
return this.finishNode(node, "ThisExpression"); | |
case types.name: | |
var startPos = (this || _global$Q).start, | |
startLoc = (this || _global$Q).startLoc, | |
containsEsc = (this || _global$Q).containsEsc; | |
var id = this.parseIdent(false); | |
if ((this || _global$Q).options.ecmaVersion >= 8 && !containsEsc && id.name === "async" && !this.canInsertSemicolon() && this.eat(types._function)) { | |
return this.parseFunction(this.startNodeAt(startPos, startLoc), 0, false, true); | |
} | |
if (canBeArrow && !this.canInsertSemicolon()) { | |
if (this.eat(types.arrow)) { | |
return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), [id], false); | |
} | |
if ((this || _global$Q).options.ecmaVersion >= 8 && id.name === "async" && (this || _global$Q).type === types.name && !containsEsc) { | |
id = this.parseIdent(false); | |
if (this.canInsertSemicolon() || !this.eat(types.arrow)) { | |
this.unexpected(); | |
} | |
return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), [id], true); | |
} | |
} | |
return id; | |
case types.regexp: | |
var value = (this || _global$Q).value; | |
node = this.parseLiteral(value.value); | |
node.regex = { | |
pattern: value.pattern, | |
flags: value.flags | |
}; | |
return node; | |
case types.num: | |
case types.string: | |
return this.parseLiteral((this || _global$Q).value); | |
case types._null: | |
case types._true: | |
case types._false: | |
node = this.startNode(); | |
node.value = (this || _global$Q).type === types._null ? null : (this || _global$Q).type === types._true; | |
node.raw = (this || _global$Q).type.keyword; | |
this.next(); | |
return this.finishNode(node, "Literal"); | |
case types.parenL: | |
var start = (this || _global$Q).start, | |
expr = this.parseParenAndDistinguishExpression(canBeArrow); | |
if (refDestructuringErrors) { | |
if (refDestructuringErrors.parenthesizedAssign < 0 && !this.isSimpleAssignTarget(expr)) { | |
refDestructuringErrors.parenthesizedAssign = start; | |
} | |
if (refDestructuringErrors.parenthesizedBind < 0) { | |
refDestructuringErrors.parenthesizedBind = start; | |
} | |
} | |
return expr; | |
case types.bracketL: | |
node = this.startNode(); | |
this.next(); | |
node.elements = this.parseExprList(types.bracketR, true, true, refDestructuringErrors); | |
return this.finishNode(node, "ArrayExpression"); | |
case types.braceL: | |
return this.parseObj(false, refDestructuringErrors); | |
case types._function: | |
node = this.startNode(); | |
this.next(); | |
return this.parseFunction(node, 0); | |
case types._class: | |
return this.parseClass(this.startNode(), false); | |
case types._new: | |
return this.parseNew(); | |
case types.backQuote: | |
return this.parseTemplate(); | |
case types._import: | |
if ((this || _global$Q).options.ecmaVersion >= 11) { | |
return this.parseExprImport(); | |
} else { | |
return this.unexpected(); | |
} | |
default: | |
this.unexpected(); | |
} | |
}; | |
pp$3.parseExprImport = function () { | |
var node = this.startNode(); // Consume `import` as an identifier for `import.meta`. | |
// Because `this.parseIdent(true)` doesn't check escape sequences, it needs the check of `this.containsEsc`. | |
if ((this || _global$Q).containsEsc) { | |
this.raiseRecoverable((this || _global$Q).start, "Escape sequence in keyword import"); | |
} | |
var meta = this.parseIdent(true); | |
switch ((this || _global$Q).type) { | |
case types.parenL: | |
return this.parseDynamicImport(node); | |
case types.dot: | |
node.meta = meta; | |
return this.parseImportMeta(node); | |
default: | |
this.unexpected(); | |
} | |
}; | |
pp$3.parseDynamicImport = function (node) { | |
this.next(); // skip `(` | |
// Parse node.source. | |
node.source = this.parseMaybeAssign(); // Verify ending. | |
if (!this.eat(types.parenR)) { | |
var errorPos = (this || _global$Q).start; | |
if (this.eat(types.comma) && this.eat(types.parenR)) { | |
this.raiseRecoverable(errorPos, "Trailing comma is not allowed in import()"); | |
} else { | |
this.unexpected(errorPos); | |
} | |
} | |
return this.finishNode(node, "ImportExpression"); | |
}; | |
pp$3.parseImportMeta = function (node) { | |
this.next(); // skip `.` | |
var containsEsc = (this || _global$Q).containsEsc; | |
node.property = this.parseIdent(true); | |
if (node.property.name !== "meta") { | |
this.raiseRecoverable(node.property.start, "The only valid meta property for import is 'import.meta'"); | |
} | |
if (containsEsc) { | |
this.raiseRecoverable(node.start, "'import.meta' must not contain escaped characters"); | |
} | |
if ((this || _global$Q).options.sourceType !== "module") { | |
this.raiseRecoverable(node.start, "Cannot use 'import.meta' outside a module"); | |
} | |
return this.finishNode(node, "MetaProperty"); | |
}; | |
pp$3.parseLiteral = function (value) { | |
var node = this.startNode(); | |
node.value = value; | |
node.raw = (this || _global$Q).input.slice((this || _global$Q).start, (this || _global$Q).end); | |
if (node.raw.charCodeAt(node.raw.length - 1) === 110) { | |
node.bigint = node.raw.slice(0, -1).replace(/_/g, ""); | |
} | |
this.next(); | |
return this.finishNode(node, "Literal"); | |
}; | |
pp$3.parseParenExpression = function () { | |
this.expect(types.parenL); | |
var val = this.parseExpression(); | |
this.expect(types.parenR); | |
return val; | |
}; | |
pp$3.parseParenAndDistinguishExpression = function (canBeArrow) { | |
var startPos = (this || _global$Q).start, | |
startLoc = (this || _global$Q).startLoc, | |
val, | |
allowTrailingComma = (this || _global$Q).options.ecmaVersion >= 8; | |
if ((this || _global$Q).options.ecmaVersion >= 6) { | |
this.next(); | |
var innerStartPos = (this || _global$Q).start, | |
innerStartLoc = (this || _global$Q).startLoc; | |
var exprList = [], | |
first = true, | |
lastIsComma = false; | |
var refDestructuringErrors = new DestructuringErrors(), | |
oldYieldPos = (this || _global$Q).yieldPos, | |
oldAwaitPos = (this || _global$Q).awaitPos, | |
spreadStart; | |
(this || _global$Q).yieldPos = 0; | |
(this || _global$Q).awaitPos = 0; // Do not save awaitIdentPos to allow checking awaits nested in parameters | |
while ((this || _global$Q).type !== types.parenR) { | |
first ? first = false : this.expect(types.comma); | |
if (allowTrailingComma && this.afterTrailingComma(types.parenR, true)) { | |
lastIsComma = true; | |
break; | |
} else if ((this || _global$Q).type === types.ellipsis) { | |
spreadStart = (this || _global$Q).start; | |
exprList.push(this.parseParenItem(this.parseRestBinding())); | |
if ((this || _global$Q).type === types.comma) { | |
this.raise((this || _global$Q).start, "Comma is not permitted after the rest element"); | |
} | |
break; | |
} else { | |
exprList.push(this.parseMaybeAssign(false, refDestructuringErrors, (this || _global$Q).parseParenItem)); | |
} | |
} | |
var innerEndPos = (this || _global$Q).start, | |
innerEndLoc = (this || _global$Q).startLoc; | |
this.expect(types.parenR); | |
if (canBeArrow && !this.canInsertSemicolon() && this.eat(types.arrow)) { | |
this.checkPatternErrors(refDestructuringErrors, false); | |
this.checkYieldAwaitInDefaultParams(); | |
(this || _global$Q).yieldPos = oldYieldPos; | |
(this || _global$Q).awaitPos = oldAwaitPos; | |
return this.parseParenArrowList(startPos, startLoc, exprList); | |
} | |
if (!exprList.length || lastIsComma) { | |
this.unexpected((this || _global$Q).lastTokStart); | |
} | |
if (spreadStart) { | |
this.unexpected(spreadStart); | |
} | |
this.checkExpressionErrors(refDestructuringErrors, true); | |
(this || _global$Q).yieldPos = oldYieldPos || (this || _global$Q).yieldPos; | |
(this || _global$Q).awaitPos = oldAwaitPos || (this || _global$Q).awaitPos; | |
if (exprList.length > 1) { | |
val = this.startNodeAt(innerStartPos, innerStartLoc); | |
val.expressions = exprList; | |
this.finishNodeAt(val, "SequenceExpression", innerEndPos, innerEndLoc); | |
} else { | |
val = exprList[0]; | |
} | |
} else { | |
val = this.parseParenExpression(); | |
} | |
if ((this || _global$Q).options.preserveParens) { | |
var par = this.startNodeAt(startPos, startLoc); | |
par.expression = val; | |
return this.finishNode(par, "ParenthesizedExpression"); | |
} else { | |
return val; | |
} | |
}; | |
pp$3.parseParenItem = function (item) { | |
return item; | |
}; | |
pp$3.parseParenArrowList = function (startPos, startLoc, exprList) { | |
return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), exprList); | |
}; // New's precedence is slightly tricky. It must allow its argument to | |
// be a `[]` or dot subscript expression, but not a call — at least, | |
// not without wrapping it in parentheses. Thus, it uses the noCalls | |
// argument to parseSubscripts to prevent it from consuming the | |
// argument list. | |
var empty$1 = []; | |
pp$3.parseNew = function () { | |
if ((this || _global$Q).containsEsc) { | |
this.raiseRecoverable((this || _global$Q).start, "Escape sequence in keyword new"); | |
} | |
var node = this.startNode(); | |
var meta = this.parseIdent(true); | |
if ((this || _global$Q).options.ecmaVersion >= 6 && this.eat(types.dot)) { | |
node.meta = meta; | |
var containsEsc = (this || _global$Q).containsEsc; | |
node.property = this.parseIdent(true); | |
if (node.property.name !== "target") { | |
this.raiseRecoverable(node.property.start, "The only valid meta property for new is 'new.target'"); | |
} | |
if (containsEsc) { | |
this.raiseRecoverable(node.start, "'new.target' must not contain escaped characters"); | |
} | |
if (!this.inNonArrowFunction()) { | |
this.raiseRecoverable(node.start, "'new.target' can only be used in functions"); | |
} | |
return this.finishNode(node, "MetaProperty"); | |
} | |
var startPos = (this || _global$Q).start, | |
startLoc = (this || _global$Q).startLoc, | |
isImport = (this || _global$Q).type === types._import; | |
node.callee = this.parseSubscripts(this.parseExprAtom(), startPos, startLoc, true); | |
if (isImport && node.callee.type === "ImportExpression") { | |
this.raise(startPos, "Cannot use new with import()"); | |
} | |
if (this.eat(types.parenL)) { | |
node.arguments = this.parseExprList(types.parenR, (this || _global$Q).options.ecmaVersion >= 8, false); | |
} else { | |
node.arguments = empty$1; | |
} | |
return this.finishNode(node, "NewExpression"); | |
}; // Parse template expression. | |
pp$3.parseTemplateElement = function (ref) { | |
var isTagged = ref.isTagged; | |
var elem = this.startNode(); | |
if ((this || _global$Q).type === types.invalidTemplate) { | |
if (!isTagged) { | |
this.raiseRecoverable((this || _global$Q).start, "Bad escape sequence in untagged template literal"); | |
} | |
elem.value = { | |
raw: (this || _global$Q).value, | |
cooked: null | |
}; | |
} else { | |
elem.value = { | |
raw: (this || _global$Q).input.slice((this || _global$Q).start, (this || _global$Q).end).replace(/\r\n?/g, "\n"), | |
cooked: (this || _global$Q).value | |
}; | |
} | |
this.next(); | |
elem.tail = (this || _global$Q).type === types.backQuote; | |
return this.finishNode(elem, "TemplateElement"); | |
}; | |
pp$3.parseTemplate = function (ref) { | |
if (ref === void 0) ref = {}; | |
var isTagged = ref.isTagged; | |
if (isTagged === void 0) isTagged = false; | |
var node = this.startNode(); | |
this.next(); | |
node.expressions = []; | |
var curElt = this.parseTemplateElement({ | |
isTagged: isTagged | |
}); | |
node.quasis = [curElt]; | |
while (!curElt.tail) { | |
if ((this || _global$Q).type === types.eof) { | |
this.raise((this || _global$Q).pos, "Unterminated template literal"); | |
} | |
this.expect(types.dollarBraceL); | |
node.expressions.push(this.parseExpression()); | |
this.expect(types.braceR); | |
node.quasis.push(curElt = this.parseTemplateElement({ | |
isTagged: isTagged | |
})); | |
} | |
this.next(); | |
return this.finishNode(node, "TemplateLiteral"); | |
}; | |
pp$3.isAsyncProp = function (prop) { | |
return !prop.computed && prop.key.type === "Identifier" && prop.key.name === "async" && ((this || _global$Q).type === types.name || (this || _global$Q).type === types.num || (this || _global$Q).type === types.string || (this || _global$Q).type === types.bracketL || (this || _global$Q).type.keyword || (this || _global$Q).options.ecmaVersion >= 9 && (this || _global$Q).type === types.star) && !lineBreak.test((this || _global$Q).input.slice((this || _global$Q).lastTokEnd, (this || _global$Q).start)); | |
}; // Parse an object literal or binding pattern. | |
pp$3.parseObj = function (isPattern, refDestructuringErrors) { | |
var node = this.startNode(), | |
first = true, | |
propHash = {}; | |
node.properties = []; | |
this.next(); | |
while (!this.eat(types.braceR)) { | |
if (!first) { | |
this.expect(types.comma); | |
if ((this || _global$Q).options.ecmaVersion >= 5 && this.afterTrailingComma(types.braceR)) { | |
break; | |
} | |
} else { | |
first = false; | |
} | |
var prop = this.parseProperty(isPattern, refDestructuringErrors); | |
if (!isPattern) { | |
this.checkPropClash(prop, propHash, refDestructuringErrors); | |
} | |
node.properties.push(prop); | |
} | |
return this.finishNode(node, isPattern ? "ObjectPattern" : "ObjectExpression"); | |
}; | |
pp$3.parseProperty = function (isPattern, refDestructuringErrors) { | |
var prop = this.startNode(), | |
isGenerator, | |
isAsync, | |
startPos, | |
startLoc; | |
if ((this || _global$Q).options.ecmaVersion >= 9 && this.eat(types.ellipsis)) { | |
if (isPattern) { | |
prop.argument = this.parseIdent(false); | |
if ((this || _global$Q).type === types.comma) { | |
this.raise((this || _global$Q).start, "Comma is not permitted after the rest element"); | |
} | |
return this.finishNode(prop, "RestElement"); | |
} // To disallow parenthesized identifier via `this.toAssignable()`. | |
if ((this || _global$Q).type === types.parenL && refDestructuringErrors) { | |
if (refDestructuringErrors.parenthesizedAssign < 0) { | |
refDestructuringErrors.parenthesizedAssign = (this || _global$Q).start; | |
} | |
if (refDestructuringErrors.parenthesizedBind < 0) { | |
refDestructuringErrors.parenthesizedBind = (this || _global$Q).start; | |
} | |
} // Parse argument. | |
prop.argument = this.parseMaybeAssign(false, refDestructuringErrors); // To disallow trailing comma via `this.toAssignable()`. | |
if ((this || _global$Q).type === types.comma && refDestructuringErrors && refDestructuringErrors.trailingComma < 0) { | |
refDestructuringErrors.trailingComma = (this || _global$Q).start; | |
} // Finish | |
return this.finishNode(prop, "SpreadElement"); | |
} | |
if ((this || _global$Q).options.ecmaVersion >= 6) { | |
prop.method = false; | |
prop.shorthand = false; | |
if (isPattern || refDestructuringErrors) { | |
startPos = (this || _global$Q).start; | |
startLoc = (this || _global$Q).startLoc; | |
} | |
if (!isPattern) { | |
isGenerator = this.eat(types.star); | |
} | |
} | |
var containsEsc = (this || _global$Q).containsEsc; | |
this.parsePropertyName(prop); | |
if (!isPattern && !containsEsc && (this || _global$Q).options.ecmaVersion >= 8 && !isGenerator && this.isAsyncProp(prop)) { | |
isAsync = true; | |
isGenerator = (this || _global$Q).options.ecmaVersion >= 9 && this.eat(types.star); | |
this.parsePropertyName(prop, refDestructuringErrors); | |
} else { | |
isAsync = false; | |
} | |
this.parsePropertyValue(prop, isPattern, isGenerator, isAsync, startPos, startLoc, refDestructuringErrors, containsEsc); | |
return this.finishNode(prop, "Property"); | |
}; | |
pp$3.parsePropertyValue = function (prop, isPattern, isGenerator, isAsync, startPos, startLoc, refDestructuringErrors, containsEsc) { | |
if ((isGenerator || isAsync) && (this || _global$Q).type === types.colon) { | |
this.unexpected(); | |
} | |
if (this.eat(types.colon)) { | |
prop.value = isPattern ? this.parseMaybeDefault((this || _global$Q).start, (this || _global$Q).startLoc) : this.parseMaybeAssign(false, refDestructuringErrors); | |
prop.kind = "init"; | |
} else if ((this || _global$Q).options.ecmaVersion >= 6 && (this || _global$Q).type === types.parenL) { | |
if (isPattern) { | |
this.unexpected(); | |
} | |
prop.kind = "init"; | |
prop.method = true; | |
prop.value = this.parseMethod(isGenerator, isAsync); | |
} else if (!isPattern && !containsEsc && (this || _global$Q).options.ecmaVersion >= 5 && !prop.computed && prop.key.type === "Identifier" && (prop.key.name === "get" || prop.key.name === "set") && (this || _global$Q).type !== types.comma && (this || _global$Q).type !== types.braceR && (this || _global$Q).type !== types.eq) { | |
if (isGenerator || isAsync) { | |
this.unexpected(); | |
} | |
prop.kind = prop.key.name; | |
this.parsePropertyName(prop); | |
prop.value = this.parseMethod(false); | |
var paramCount = prop.kind === "get" ? 0 : 1; | |
if (prop.value.params.length !== paramCount) { | |
var start = prop.value.start; | |
if (prop.kind === "get") { | |
this.raiseRecoverable(start, "getter should have no params"); | |
} else { | |
this.raiseRecoverable(start, "setter should have exactly one param"); | |
} | |
} else { | |
if (prop.kind === "set" && prop.value.params[0].type === "RestElement") { | |
this.raiseRecoverable(prop.value.params[0].start, "Setter cannot use rest params"); | |
} | |
} | |
} else if ((this || _global$Q).options.ecmaVersion >= 6 && !prop.computed && prop.key.type === "Identifier") { | |
if (isGenerator || isAsync) { | |
this.unexpected(); | |
} | |
this.checkUnreserved(prop.key); | |
if (prop.key.name === "await" && !(this || _global$Q).awaitIdentPos) { | |
(this || _global$Q).awaitIdentPos = startPos; | |
} | |
prop.kind = "init"; | |
if (isPattern) { | |
prop.value = this.parseMaybeDefault(startPos, startLoc, prop.key); | |
} else if ((this || _global$Q).type === types.eq && refDestructuringErrors) { | |
if (refDestructuringErrors.shorthandAssign < 0) { | |
refDestructuringErrors.shorthandAssign = (this || _global$Q).start; | |
} | |
prop.value = this.parseMaybeDefault(startPos, startLoc, prop.key); | |
} else { | |
prop.value = prop.key; | |
} | |
prop.shorthand = true; | |
} else { | |
this.unexpected(); | |
} | |
}; | |
pp$3.parsePropertyName = function (prop) { | |
if ((this || _global$Q).options.ecmaVersion >= 6) { | |
if (this.eat(types.bracketL)) { | |
prop.computed = true; | |
prop.key = this.parseMaybeAssign(); | |
this.expect(types.bracketR); | |
return prop.key; | |
} else { | |
prop.computed = false; | |
} | |
} | |
return prop.key = (this || _global$Q).type === types.num || (this || _global$Q).type === types.string ? this.parseExprAtom() : this.parseIdent((this || _global$Q).options.allowReserved !== "never"); | |
}; // Initialize empty function node. | |
pp$3.initFunction = function (node) { | |
node.id = null; | |
if ((this || _global$Q).options.ecmaVersion >= 6) { | |
node.generator = node.expression = false; | |
} | |
if ((this || _global$Q).options.ecmaVersion >= 8) { | |
node.async = false; | |
} | |
}; // Parse object or class method. | |
pp$3.parseMethod = function (isGenerator, isAsync, allowDirectSuper) { | |
var node = this.startNode(), | |
oldYieldPos = (this || _global$Q).yieldPos, | |
oldAwaitPos = (this || _global$Q).awaitPos, | |
oldAwaitIdentPos = (this || _global$Q).awaitIdentPos; | |
this.initFunction(node); | |
if ((this || _global$Q).options.ecmaVersion >= 6) { | |
node.generator = isGenerator; | |
} | |
if ((this || _global$Q).options.ecmaVersion >= 8) { | |
node.async = !!isAsync; | |
} | |
(this || _global$Q).yieldPos = 0; | |
(this || _global$Q).awaitPos = 0; | |
(this || _global$Q).awaitIdentPos = 0; | |
this.enterScope(functionFlags(isAsync, node.generator) | SCOPE_SUPER | (allowDirectSuper ? SCOPE_DIRECT_SUPER : 0)); | |
this.expect(types.parenL); | |
node.params = this.parseBindingList(types.parenR, false, (this || _global$Q).options.ecmaVersion >= 8); | |
this.checkYieldAwaitInDefaultParams(); | |
this.parseFunctionBody(node, false, true); | |
(this || _global$Q).yieldPos = oldYieldPos; | |
(this || _global$Q).awaitPos = oldAwaitPos; | |
(this || _global$Q).awaitIdentPos = oldAwaitIdentPos; | |
return this.finishNode(node, "FunctionExpression"); | |
}; // Parse arrow function expression with given parameters. | |
pp$3.parseArrowExpression = function (node, params, isAsync) { | |
var oldYieldPos = (this || _global$Q).yieldPos, | |
oldAwaitPos = (this || _global$Q).awaitPos, | |
oldAwaitIdentPos = (this || _global$Q).awaitIdentPos; | |
this.enterScope(functionFlags(isAsync, false) | SCOPE_ARROW); | |
this.initFunction(node); | |
if ((this || _global$Q).options.ecmaVersion >= 8) { | |
node.async = !!isAsync; | |
} | |
(this || _global$Q).yieldPos = 0; | |
(this || _global$Q).awaitPos = 0; | |
(this || _global$Q).awaitIdentPos = 0; | |
node.params = this.toAssignableList(params, true); | |
this.parseFunctionBody(node, true, false); | |
(this || _global$Q).yieldPos = oldYieldPos; | |
(this || _global$Q).awaitPos = oldAwaitPos; | |
(this || _global$Q).awaitIdentPos = oldAwaitIdentPos; | |
return this.finishNode(node, "ArrowFunctionExpression"); | |
}; // Parse function body and check parameters. | |
pp$3.parseFunctionBody = function (node, isArrowFunction, isMethod) { | |
var isExpression = isArrowFunction && (this || _global$Q).type !== types.braceL; | |
var oldStrict = (this || _global$Q).strict, | |
useStrict = false; | |
if (isExpression) { | |
node.body = this.parseMaybeAssign(); | |
node.expression = true; | |
this.checkParams(node, false); | |
} else { | |
var nonSimple = (this || _global$Q).options.ecmaVersion >= 7 && !this.isSimpleParamList(node.params); | |
if (!oldStrict || nonSimple) { | |
useStrict = this.strictDirective((this || _global$Q).end); // If this is a strict mode function, verify that argument names | |
// are not repeated, and it does not try to bind the words `eval` | |
// or `arguments`. | |
if (useStrict && nonSimple) { | |
this.raiseRecoverable(node.start, "Illegal 'use strict' directive in function with non-simple parameter list"); | |
} | |
} // Start a new scope with regard to labels and the `inFunction` | |
// flag (restore them to their old value afterwards). | |
var oldLabels = (this || _global$Q).labels; | |
(this || _global$Q).labels = []; | |
if (useStrict) { | |
(this || _global$Q).strict = true; | |
} // Add the params to varDeclaredNames to ensure that an error is thrown | |
// if a let/const declaration in the function clashes with one of the params. | |
this.checkParams(node, !oldStrict && !useStrict && !isArrowFunction && !isMethod && this.isSimpleParamList(node.params)); // Ensure the function name isn't a forbidden identifier in strict mode, e.g. 'eval' | |
if ((this || _global$Q).strict && node.id) { | |
this.checkLVal(node.id, BIND_OUTSIDE); | |
} | |
node.body = this.parseBlock(false, undefined, useStrict && !oldStrict); | |
node.expression = false; | |
this.adaptDirectivePrologue(node.body.body); | |
(this || _global$Q).labels = oldLabels; | |
} | |
this.exitScope(); | |
}; | |
pp$3.isSimpleParamList = function (params) { | |
for (var i = 0, list = params; i < list.length; i += 1) { | |
var param = list[i]; | |
if (param.type !== "Identifier") { | |
return false; | |
} | |
} | |
return true; | |
}; // Checks function params for various disallowed patterns such as using "eval" | |
// or "arguments" and duplicate parameters. | |
pp$3.checkParams = function (node, allowDuplicates) { | |
var nameHash = {}; | |
for (var i = 0, list = node.params; i < list.length; i += 1) { | |
var param = list[i]; | |
this.checkLVal(param, BIND_VAR, allowDuplicates ? null : nameHash); | |
} | |
}; // Parses a comma-separated list of expressions, and returns them as | |
// an array. `close` is the token type that ends the list, and | |
// `allowEmpty` can be turned on to allow subsequent commas with | |
// nothing in between them to be parsed as `null` (which is needed | |
// for array literals). | |
pp$3.parseExprList = function (close, allowTrailingComma, allowEmpty, refDestructuringErrors) { | |
var elts = [], | |
first = true; | |
while (!this.eat(close)) { | |
if (!first) { | |
this.expect(types.comma); | |
if (allowTrailingComma && this.afterTrailingComma(close)) { | |
break; | |
} | |
} else { | |
first = false; | |
} | |
var elt = void 0; | |
if (allowEmpty && (this || _global$Q).type === types.comma) { | |
elt = null; | |
} else if ((this || _global$Q).type === types.ellipsis) { | |
elt = this.parseSpread(refDestructuringErrors); | |
if (refDestructuringErrors && (this || _global$Q).type === types.comma && refDestructuringErrors.trailingComma < 0) { | |
refDestructuringErrors.trailingComma = (this || _global$Q).start; | |
} | |
} else { | |
elt = this.parseMaybeAssign(false, refDestructuringErrors); | |
} | |
elts.push(elt); | |
} | |
return elts; | |
}; | |
pp$3.checkUnreserved = function (ref) { | |
var start = ref.start; | |
var end = ref.end; | |
var name = ref.name; | |
if ((this || _global$Q).inGenerator && name === "yield") { | |
this.raiseRecoverable(start, "Cannot use 'yield' as identifier inside a generator"); | |
} | |
if ((this || _global$Q).inAsync && name === "await") { | |
this.raiseRecoverable(start, "Cannot use 'await' as identifier inside an async function"); | |
} | |
if ((this || _global$Q).keywords.test(name)) { | |
this.raise(start, "Unexpected keyword '" + name + "'"); | |
} | |
if ((this || _global$Q).options.ecmaVersion < 6 && (this || _global$Q).input.slice(start, end).indexOf("\\") !== -1) { | |
return; | |
} | |
var re = (this || _global$Q).strict ? (this || _global$Q).reservedWordsStrict : (this || _global$Q).reservedWords; | |
if (re.test(name)) { | |
if (!(this || _global$Q).inAsync && name === "await") { | |
this.raiseRecoverable(start, "Cannot use keyword 'await' outside an async function"); | |
} | |
this.raiseRecoverable(start, "The keyword '" + name + "' is reserved"); | |
} | |
}; // Parse the next token as an identifier. If `liberal` is true (used | |
// when parsing properties), it will also convert keywords into | |
// identifiers. | |
pp$3.parseIdent = function (liberal, isBinding) { | |
var node = this.startNode(); | |
if ((this || _global$Q).type === types.name) { | |
node.name = (this || _global$Q).value; | |
} else if ((this || _global$Q).type.keyword) { | |
node.name = (this || _global$Q).type.keyword; // To fix https://github.com/acornjs/acorn/issues/575 | |
// `class` and `function` keywords push new context into this.context. | |
// But there is no chance to pop the context if the keyword is consumed as an identifier such as a property name. | |
// If the previous token is a dot, this does not apply because the context-managing code already ignored the keyword | |
if ((node.name === "class" || node.name === "function") && ((this || _global$Q).lastTokEnd !== (this || _global$Q).lastTokStart + 1 || (this || _global$Q).input.charCodeAt((this || _global$Q).lastTokStart) !== 46)) { | |
(this || _global$Q).context.pop(); | |
} | |
} else { | |
this.unexpected(); | |
} | |
this.next(!!liberal); | |
this.finishNode(node, "Identifier"); | |
if (!liberal) { | |
this.checkUnreserved(node); | |
if (node.name === "await" && !(this || _global$Q).awaitIdentPos) { | |
(this || _global$Q).awaitIdentPos = node.start; | |
} | |
} | |
return node; | |
}; // Parses yield expression inside generator. | |
pp$3.parseYield = function (noIn) { | |
if (!(this || _global$Q).yieldPos) { | |
(this || _global$Q).yieldPos = (this || _global$Q).start; | |
} | |
var node = this.startNode(); | |
this.next(); | |
if ((this || _global$Q).type === types.semi || this.canInsertSemicolon() || (this || _global$Q).type !== types.star && !(this || _global$Q).type.startsExpr) { | |
node.delegate = false; | |
node.argument = null; | |
} else { | |
node.delegate = this.eat(types.star); | |
node.argument = this.parseMaybeAssign(noIn); | |
} | |
return this.finishNode(node, "YieldExpression"); | |
}; | |
pp$3.parseAwait = function () { | |
if (!(this || _global$Q).awaitPos) { | |
(this || _global$Q).awaitPos = (this || _global$Q).start; | |
} | |
var node = this.startNode(); | |
this.next(); | |
node.argument = this.parseMaybeUnary(null, false); | |
return this.finishNode(node, "AwaitExpression"); | |
}; | |
var pp$4 = Parser.prototype; // This function is used to raise exceptions on parse errors. It | |
// takes an offset integer (into the current `input`) to indicate | |
// the location of the error, attaches the position to the end | |
// of the error message, and then raises a `SyntaxError` with that | |
// message. | |
pp$4.raise = function (pos, message) { | |
var loc = getLineInfo((this || _global$Q).input, pos); | |
message += " (" + loc.line + ":" + loc.column + ")"; | |
var err = new SyntaxError(message); | |
err.pos = pos; | |
err.loc = loc; | |
err.raisedAt = (this || _global$Q).pos; | |
throw err; | |
}; | |
pp$4.raiseRecoverable = pp$4.raise; | |
pp$4.curPosition = function () { | |
if ((this || _global$Q).options.locations) { | |
return new Position((this || _global$Q).curLine, (this || _global$Q).pos - (this || _global$Q).lineStart); | |
} | |
}; | |
var pp$5 = Parser.prototype; | |
var Scope = function Scope(flags) { | |
(this || _global$Q).flags = flags; // A list of var-declared names in the current lexical scope | |
(this || _global$Q).var = []; // A list of lexically-declared names in the current lexical scope | |
(this || _global$Q).lexical = []; // A list of lexically-declared FunctionDeclaration names in the current lexical scope | |
(this || _global$Q).functions = []; | |
}; // The functions in this module keep track of declared variables in the current scope in order to detect duplicate variable names. | |
pp$5.enterScope = function (flags) { | |
(this || _global$Q).scopeStack.push(new Scope(flags)); | |
}; | |
pp$5.exitScope = function () { | |
(this || _global$Q).scopeStack.pop(); | |
}; // The spec says: | |
// > At the top level of a function, or script, function declarations are | |
// > treated like var declarations rather than like lexical declarations. | |
pp$5.treatFunctionsAsVarInScope = function (scope) { | |
return scope.flags & SCOPE_FUNCTION || !(this || _global$Q).inModule && scope.flags & SCOPE_TOP; | |
}; | |
pp$5.declareName = function (name, bindingType, pos) { | |
var redeclared = false; | |
if (bindingType === BIND_LEXICAL) { | |
var scope = this.currentScope(); | |
redeclared = scope.lexical.indexOf(name) > -1 || scope.functions.indexOf(name) > -1 || scope.var.indexOf(name) > -1; | |
scope.lexical.push(name); | |
if ((this || _global$Q).inModule && scope.flags & SCOPE_TOP) { | |
delete (this || _global$Q).undefinedExports[name]; | |
} | |
} else if (bindingType === BIND_SIMPLE_CATCH) { | |
var scope$1 = this.currentScope(); | |
scope$1.lexical.push(name); | |
} else if (bindingType === BIND_FUNCTION) { | |
var scope$2 = this.currentScope(); | |
if ((this || _global$Q).treatFunctionsAsVar) { | |
redeclared = scope$2.lexical.indexOf(name) > -1; | |
} else { | |
redeclared = scope$2.lexical.indexOf(name) > -1 || scope$2.var.indexOf(name) > -1; | |
} | |
scope$2.functions.push(name); | |
} else { | |
for (var i = (this || _global$Q).scopeStack.length - 1; i >= 0; --i) { | |
var scope$3 = (this || _global$Q).scopeStack[i]; | |
if (scope$3.lexical.indexOf(name) > -1 && !(scope$3.flags & SCOPE_SIMPLE_CATCH && scope$3.lexical[0] === name) || !this.treatFunctionsAsVarInScope(scope$3) && scope$3.functions.indexOf(name) > -1) { | |
redeclared = true; | |
break; | |
} | |
scope$3.var.push(name); | |
if ((this || _global$Q).inModule && scope$3.flags & SCOPE_TOP) { | |
delete (this || _global$Q).undefinedExports[name]; | |
} | |
if (scope$3.flags & SCOPE_VAR) { | |
break; | |
} | |
} | |
} | |
if (redeclared) { | |
this.raiseRecoverable(pos, "Identifier '" + name + "' has already been declared"); | |
} | |
}; | |
pp$5.checkLocalExport = function (id) { | |
// scope.functions must be empty as Module code is always strict. | |
if ((this || _global$Q).scopeStack[0].lexical.indexOf(id.name) === -1 && (this || _global$Q).scopeStack[0].var.indexOf(id.name) === -1) { | |
(this || _global$Q).undefinedExports[id.name] = id; | |
} | |
}; | |
pp$5.currentScope = function () { | |
return (this || _global$Q).scopeStack[(this || _global$Q).scopeStack.length - 1]; | |
}; | |
pp$5.currentVarScope = function () { | |
for (var i = (this || _global$Q).scopeStack.length - 1;; i--) { | |
var scope = (this || _global$Q).scopeStack[i]; | |
if (scope.flags & SCOPE_VAR) { | |
return scope; | |
} | |
} | |
}; // Could be useful for `this`, `new.target`, `super()`, `super.property`, and `super[property]`. | |
pp$5.currentThisScope = function () { | |
for (var i = (this || _global$Q).scopeStack.length - 1;; i--) { | |
var scope = (this || _global$Q).scopeStack[i]; | |
if (scope.flags & SCOPE_VAR && !(scope.flags & SCOPE_ARROW)) { | |
return scope; | |
} | |
} | |
}; | |
var Node = function Node(parser, pos, loc) { | |
(this || _global$Q).type = ""; | |
(this || _global$Q).start = pos; | |
(this || _global$Q).end = 0; | |
if (parser.options.locations) { | |
(this || _global$Q).loc = new SourceLocation(parser, loc); | |
} | |
if (parser.options.directSourceFile) { | |
(this || _global$Q).sourceFile = parser.options.directSourceFile; | |
} | |
if (parser.options.ranges) { | |
(this || _global$Q).range = [pos, 0]; | |
} | |
}; // Start an AST node, attaching a start offset. | |
var pp$6 = Parser.prototype; | |
pp$6.startNode = function () { | |
return new Node(this || _global$Q, (this || _global$Q).start, (this || _global$Q).startLoc); | |
}; | |
pp$6.startNodeAt = function (pos, loc) { | |
return new Node(this || _global$Q, pos, loc); | |
}; // Finish an AST node, adding `type` and `end` properties. | |
function finishNodeAt(node, type, pos, loc) { | |
node.type = type; | |
node.end = pos; | |
if ((this || _global$Q).options.locations) { | |
node.loc.end = loc; | |
} | |
if ((this || _global$Q).options.ranges) { | |
node.range[1] = pos; | |
} | |
return node; | |
} | |
pp$6.finishNode = function (node, type) { | |
return finishNodeAt.call(this || _global$Q, node, type, (this || _global$Q).lastTokEnd, (this || _global$Q).lastTokEndLoc); | |
}; // Finish node at given position | |
pp$6.finishNodeAt = function (node, type, pos, loc) { | |
return finishNodeAt.call(this || _global$Q, node, type, pos, loc); | |
}; // The algorithm used to determine whether a regexp can appear at a | |
var TokContext = function TokContext(token, isExpr, preserveSpace, override, generator) { | |
(this || _global$Q).token = token; | |
(this || _global$Q).isExpr = !!isExpr; | |
(this || _global$Q).preserveSpace = !!preserveSpace; | |
(this || _global$Q).override = override; | |
(this || _global$Q).generator = !!generator; | |
}; | |
var types$1 = { | |
b_stat: new TokContext("{", false), | |
b_expr: new TokContext("{", true), | |
b_tmpl: new TokContext("${", false), | |
p_stat: new TokContext("(", false), | |
p_expr: new TokContext("(", true), | |
q_tmpl: new TokContext("`", true, true, function (p) { | |
return p.tryReadTemplateToken(); | |
}), | |
f_stat: new TokContext("function", false), | |
f_expr: new TokContext("function", true), | |
f_expr_gen: new TokContext("function", true, false, null, true), | |
f_gen: new TokContext("function", false, false, null, true) | |
}; | |
var pp$7 = Parser.prototype; | |
pp$7.initialContext = function () { | |
return [types$1.b_stat]; | |
}; | |
pp$7.braceIsBlock = function (prevType) { | |
var parent = this.curContext(); | |
if (parent === types$1.f_expr || parent === types$1.f_stat) { | |
return true; | |
} | |
if (prevType === types.colon && (parent === types$1.b_stat || parent === types$1.b_expr)) { | |
return !parent.isExpr; | |
} // The check for `tt.name && exprAllowed` detects whether we are | |
// after a `yield` or `of` construct. See the `updateContext` for | |
// `tt.name`. | |
if (prevType === types._return || prevType === types.name && (this || _global$Q).exprAllowed) { | |
return lineBreak.test((this || _global$Q).input.slice((this || _global$Q).lastTokEnd, (this || _global$Q).start)); | |
} | |
if (prevType === types._else || prevType === types.semi || prevType === types.eof || prevType === types.parenR || prevType === types.arrow) { | |
return true; | |
} | |
if (prevType === types.braceL) { | |
return parent === types$1.b_stat; | |
} | |
if (prevType === types._var || prevType === types._const || prevType === types.name) { | |
return false; | |
} | |
return !(this || _global$Q).exprAllowed; | |
}; | |
pp$7.inGeneratorContext = function () { | |
for (var i = (this || _global$Q).context.length - 1; i >= 1; i--) { | |
var context = (this || _global$Q).context[i]; | |
if (context.token === "function") { | |
return context.generator; | |
} | |
} | |
return false; | |
}; | |
pp$7.updateContext = function (prevType) { | |
var update, | |
type = (this || _global$Q).type; | |
if (type.keyword && prevType === types.dot) { | |
(this || _global$Q).exprAllowed = false; | |
} else if (update = type.updateContext) { | |
update.call(this || _global$Q, prevType); | |
} else { | |
(this || _global$Q).exprAllowed = type.beforeExpr; | |
} | |
}; // Token-specific context update code | |
types.parenR.updateContext = types.braceR.updateContext = function () { | |
if ((this || _global$Q).context.length === 1) { | |
(this || _global$Q).exprAllowed = true; | |
return; | |
} | |
var out = (this || _global$Q).context.pop(); | |
if (out === types$1.b_stat && this.curContext().token === "function") { | |
out = (this || _global$Q).context.pop(); | |
} | |
(this || _global$Q).exprAllowed = !out.isExpr; | |
}; | |
types.braceL.updateContext = function (prevType) { | |
(this || _global$Q).context.push(this.braceIsBlock(prevType) ? types$1.b_stat : types$1.b_expr); | |
(this || _global$Q).exprAllowed = true; | |
}; | |
types.dollarBraceL.updateContext = function () { | |
(this || _global$Q).context.push(types$1.b_tmpl); | |
(this || _global$Q).exprAllowed = true; | |
}; | |
types.parenL.updateContext = function (prevType) { | |
var statementParens = prevType === types._if || prevType === types._for || prevType === types._with || prevType === types._while; | |
(this || _global$Q).context.push(statementParens ? types$1.p_stat : types$1.p_expr); | |
(this || _global$Q).exprAllowed = true; | |
}; | |
types.incDec.updateContext = function () {// tokExprAllowed stays unchanged | |
}; | |
types._function.updateContext = types._class.updateContext = function (prevType) { | |
if (prevType.beforeExpr && prevType !== types.semi && prevType !== types._else && !(prevType === types._return && lineBreak.test((this || _global$Q).input.slice((this || _global$Q).lastTokEnd, (this || _global$Q).start))) && !((prevType === types.colon || prevType === types.braceL) && this.curContext() === types$1.b_stat)) { | |
(this || _global$Q).context.push(types$1.f_expr); | |
} else { | |
(this || _global$Q).context.push(types$1.f_stat); | |
} | |
(this || _global$Q).exprAllowed = false; | |
}; | |
types.backQuote.updateContext = function () { | |
if (this.curContext() === types$1.q_tmpl) { | |
(this || _global$Q).context.pop(); | |
} else { | |
(this || _global$Q).context.push(types$1.q_tmpl); | |
} | |
(this || _global$Q).exprAllowed = false; | |
}; | |
types.star.updateContext = function (prevType) { | |
if (prevType === types._function) { | |
var index = (this || _global$Q).context.length - 1; | |
if ((this || _global$Q).context[index] === types$1.f_expr) { | |
(this || _global$Q).context[index] = types$1.f_expr_gen; | |
} else { | |
(this || _global$Q).context[index] = types$1.f_gen; | |
} | |
} | |
(this || _global$Q).exprAllowed = true; | |
}; | |
types.name.updateContext = function (prevType) { | |
var allowed = false; | |
if ((this || _global$Q).options.ecmaVersion >= 6 && prevType !== types.dot) { | |
if ((this || _global$Q).value === "of" && !(this || _global$Q).exprAllowed || (this || _global$Q).value === "yield" && this.inGeneratorContext()) { | |
allowed = true; | |
} | |
} | |
(this || _global$Q).exprAllowed = allowed; | |
}; // This file contains Unicode properties extracted from the ECMAScript | |
// specification. The lists are extracted like so: | |
// $$('#table-binary-unicode-properties > figure > table > tbody > tr > td:nth-child(1) code').map(el => el.innerText) | |
// #table-binary-unicode-properties | |
var ecma9BinaryProperties = "ASCII ASCII_Hex_Digit AHex Alphabetic Alpha Any Assigned Bidi_Control Bidi_C Bidi_Mirrored Bidi_M Case_Ignorable CI Cased Changes_When_Casefolded CWCF Changes_When_Casemapped CWCM Changes_When_Lowercased CWL Changes_When_NFKC_Casefolded CWKCF Changes_When_Titlecased CWT Changes_When_Uppercased CWU Dash Default_Ignorable_Code_Point DI Deprecated Dep Diacritic Dia Emoji Emoji_Component Emoji_Modifier Emoji_Modifier_Base Emoji_Presentation Extender Ext Grapheme_Base Gr_Base Grapheme_Extend Gr_Ext Hex_Digit Hex IDS_Binary_Operator IDSB IDS_Trinary_Operator IDST ID_Continue IDC ID_Start IDS Ideographic Ideo Join_Control Join_C Logical_Order_Exception LOE Lowercase Lower Math Noncharacter_Code_Point NChar Pattern_Syntax Pat_Syn Pattern_White_Space Pat_WS Quotation_Mark QMark Radical Regional_Indicator RI Sentence_Terminal STerm Soft_Dotted SD Terminal_Punctuation Term Unified_Ideograph UIdeo Uppercase Upper Variation_Selector VS White_Space space XID_Continue XIDC XID_Start XIDS"; | |
var ecma10BinaryProperties = ecma9BinaryProperties + " Extended_Pictographic"; | |
var ecma11BinaryProperties = ecma10BinaryProperties; | |
var unicodeBinaryProperties = { | |
9: ecma9BinaryProperties, | |
10: ecma10BinaryProperties, | |
11: ecma11BinaryProperties | |
}; // #table-unicode-general-category-values | |
var unicodeGeneralCategoryValues = "Cased_Letter LC Close_Punctuation Pe Connector_Punctuation Pc Control Cc cntrl Currency_Symbol Sc Dash_Punctuation Pd Decimal_Number Nd digit Enclosing_Mark Me Final_Punctuation Pf Format Cf Initial_Punctuation Pi Letter L Letter_Number Nl Line_Separator Zl Lowercase_Letter Ll Mark M Combining_Mark Math_Symbol Sm Modifier_Letter Lm Modifier_Symbol Sk Nonspacing_Mark Mn Number N Open_Punctuation Ps Other C Other_Letter Lo Other_Number No Other_Punctuation Po Other_Symbol So Paragraph_Separator Zp Private_Use Co Punctuation P punct Separator Z Space_Separator Zs Spacing_Mark Mc Surrogate Cs Symbol S Titlecase_Letter Lt Unassigned Cn Uppercase_Letter Lu"; // #table-unicode-script-values | |
var ecma9ScriptValues = "Adlam Adlm Ahom Ahom Anatolian_Hieroglyphs Hluw Arabic Arab Armenian Armn Avestan Avst Balinese Bali Bamum Bamu Bassa_Vah Bass Batak Batk Bengali Beng Bhaiksuki Bhks Bopomofo Bopo Brahmi Brah Braille Brai Buginese Bugi Buhid Buhd Canadian_Aboriginal Cans Carian Cari Caucasian_Albanian Aghb Chakma Cakm Cham Cham Cherokee Cher Common Zyyy Coptic Copt Qaac Cuneiform Xsux Cypriot Cprt Cyrillic Cyrl Deseret Dsrt Devanagari Deva Duployan Dupl Egyptian_Hieroglyphs Egyp Elbasan Elba Ethiopic Ethi Georgian Geor Glagolitic Glag Gothic Goth Grantha Gran Greek Grek Gujarati Gujr Gurmukhi Guru Han Hani Hangul Hang Hanunoo Hano Hatran Hatr Hebrew Hebr Hiragana Hira Imperial_Aramaic Armi Inherited Zinh Qaai Inscriptional_Pahlavi Phli Inscriptional_Parthian Prti Javanese Java Kaithi Kthi Kannada Knda Katakana Kana Kayah_Li Kali Kharoshthi Khar Khmer Khmr Khojki Khoj Khudawadi Sind Lao Laoo Latin Latn Lepcha Lepc Limbu Limb Linear_A Lina Linear_B Linb Lisu Lisu Lycian Lyci Lydian Lydi Mahajani Mahj Malayalam Mlym Mandaic Mand Manichaean Mani Marchen Marc Masaram_Gondi Gonm Meetei_Mayek Mtei Mende_Kikakui Mend Meroitic_Cursive Merc Meroitic_Hieroglyphs Mero Miao Plrd Modi Modi Mongolian Mong Mro Mroo Multani Mult Myanmar Mymr Nabataean Nbat New_Tai_Lue Talu Newa Newa Nko Nkoo Nushu Nshu Ogham Ogam Ol_Chiki Olck Old_Hungarian Hung Old_Italic Ital Old_North_Arabian Narb Old_Permic Perm Old_Persian Xpeo Old_South_Arabian Sarb Old_Turkic Orkh Oriya Orya Osage Osge Osmanya Osma Pahawh_Hmong Hmng Palmyrene Palm Pau_Cin_Hau Pauc Phags_Pa Phag Phoenician Phnx Psalter_Pahlavi Phlp Rejang Rjng Runic Runr Samaritan Samr Saurashtra Saur Sharada Shrd Shavian Shaw Siddham Sidd SignWriting Sgnw Sinhala Sinh Sora_Sompeng Sora Soyombo Soyo Sundanese Sund Syloti_Nagri Sylo Syriac Syrc Tagalog Tglg Tagbanwa Tagb Tai_Le Tale Tai_Tham Lana Tai_Viet Tavt Takri Takr Tamil Taml Tangut Tang Telugu Telu Thaana Thaa Thai Thai Tibetan Tibt Tifinagh Tfng Tirhuta Tirh Ugaritic Ugar Vai Vaii Warang_Citi Wara Yi Yiii Zanabazar_Square Zanb"; | |
var ecma10ScriptValues = ecma9ScriptValues + " Dogra Dogr Gunjala_Gondi Gong Hanifi_Rohingya Rohg Makasar Maka Medefaidrin Medf Old_Sogdian Sogo Sogdian Sogd"; | |
var ecma11ScriptValues = ecma10ScriptValues + " Elymaic Elym Nandinagari Nand Nyiakeng_Puachue_Hmong Hmnp Wancho Wcho"; | |
var unicodeScriptValues = { | |
9: ecma9ScriptValues, | |
10: ecma10ScriptValues, | |
11: ecma11ScriptValues | |
}; | |
var data = {}; | |
function buildUnicodeData(ecmaVersion) { | |
var d = data[ecmaVersion] = { | |
binary: wordsRegexp(unicodeBinaryProperties[ecmaVersion] + " " + unicodeGeneralCategoryValues), | |
nonBinary: { | |
General_Category: wordsRegexp(unicodeGeneralCategoryValues), | |
Script: wordsRegexp(unicodeScriptValues[ecmaVersion]) | |
} | |
}; | |
d.nonBinary.Script_Extensions = d.nonBinary.Script; | |
d.nonBinary.gc = d.nonBinary.General_Category; | |
d.nonBinary.sc = d.nonBinary.Script; | |
d.nonBinary.scx = d.nonBinary.Script_Extensions; | |
} | |
buildUnicodeData(9); | |
buildUnicodeData(10); | |
buildUnicodeData(11); | |
var pp$8 = Parser.prototype; | |
var RegExpValidationState = function RegExpValidationState(parser) { | |
(this || _global$Q).parser = parser; | |
(this || _global$Q).validFlags = "gim" + (parser.options.ecmaVersion >= 6 ? "uy" : "") + (parser.options.ecmaVersion >= 9 ? "s" : ""); | |
(this || _global$Q).unicodeProperties = data[parser.options.ecmaVersion >= 11 ? 11 : parser.options.ecmaVersion]; | |
(this || _global$Q).source = ""; | |
(this || _global$Q).flags = ""; | |
(this || _global$Q).start = 0; | |
(this || _global$Q).switchU = false; | |
(this || _global$Q).switchN = false; | |
(this || _global$Q).pos = 0; | |
(this || _global$Q).lastIntValue = 0; | |
(this || _global$Q).lastStringValue = ""; | |
(this || _global$Q).lastAssertionIsQuantifiable = false; | |
(this || _global$Q).numCapturingParens = 0; | |
(this || _global$Q).maxBackReference = 0; | |
(this || _global$Q).groupNames = []; | |
(this || _global$Q).backReferenceNames = []; | |
}; | |
RegExpValidationState.prototype.reset = function reset(start, pattern, flags) { | |
var unicode = flags.indexOf("u") !== -1; | |
(this || _global$Q).start = start | 0; | |
(this || _global$Q).source = pattern + ""; | |
(this || _global$Q).flags = flags; | |
(this || _global$Q).switchU = unicode && (this || _global$Q).parser.options.ecmaVersion >= 6; | |
(this || _global$Q).switchN = unicode && (this || _global$Q).parser.options.ecmaVersion >= 9; | |
}; | |
RegExpValidationState.prototype.raise = function raise(message) { | |
(this || _global$Q).parser.raiseRecoverable((this || _global$Q).start, "Invalid regular expression: /" + (this || _global$Q).source + "/: " + message); | |
}; // If u flag is given, this returns the code point at the index (it combines a surrogate pair). | |
// Otherwise, this returns the code unit of the index (can be a part of a surrogate pair). | |
RegExpValidationState.prototype.at = function at(i, forceU) { | |
if (forceU === void 0) forceU = false; | |
var s = (this || _global$Q).source; | |
var l = s.length; | |
if (i >= l) { | |
return -1; | |
} | |
var c = s.charCodeAt(i); | |
if (!(forceU || (this || _global$Q).switchU) || c <= 0xD7FF || c >= 0xE000 || i + 1 >= l) { | |
return c; | |
} | |
var next = s.charCodeAt(i + 1); | |
return next >= 0xDC00 && next <= 0xDFFF ? (c << 10) + next - 0x35FDC00 : c; | |
}; | |
RegExpValidationState.prototype.nextIndex = function nextIndex(i, forceU) { | |
if (forceU === void 0) forceU = false; | |
var s = (this || _global$Q).source; | |
var l = s.length; | |
if (i >= l) { | |
return l; | |
} | |
var c = s.charCodeAt(i), | |
next; | |
if (!(forceU || (this || _global$Q).switchU) || c <= 0xD7FF || c >= 0xE000 || i + 1 >= l || (next = s.charCodeAt(i + 1)) < 0xDC00 || next > 0xDFFF) { | |
return i + 1; | |
} | |
return i + 2; | |
}; | |
RegExpValidationState.prototype.current = function current(forceU) { | |
if (forceU === void 0) forceU = false; | |
return this.at((this || _global$Q).pos, forceU); | |
}; | |
RegExpValidationState.prototype.lookahead = function lookahead(forceU) { | |
if (forceU === void 0) forceU = false; | |
return this.at(this.nextIndex((this || _global$Q).pos, forceU), forceU); | |
}; | |
RegExpValidationState.prototype.advance = function advance(forceU) { | |
if (forceU === void 0) forceU = false; | |
(this || _global$Q).pos = this.nextIndex((this || _global$Q).pos, forceU); | |
}; | |
RegExpValidationState.prototype.eat = function eat(ch, forceU) { | |
if (forceU === void 0) forceU = false; | |
if (this.current(forceU) === ch) { | |
this.advance(forceU); | |
return true; | |
} | |
return false; | |
}; | |
function codePointToString(ch) { | |
if (ch <= 0xFFFF) { | |
return String.fromCharCode(ch); | |
} | |
ch -= 0x10000; | |
return String.fromCharCode((ch >> 10) + 0xD800, (ch & 0x03FF) + 0xDC00); | |
} | |
/** | |
* Validate the flags part of a given RegExpLiteral. | |
* | |
* @param {RegExpValidationState} state The state to validate RegExp. | |
* @returns {void} | |
*/ | |
pp$8.validateRegExpFlags = function (state) { | |
var validFlags = state.validFlags; | |
var flags = state.flags; | |
for (var i = 0; i < flags.length; i++) { | |
var flag = flags.charAt(i); | |
if (validFlags.indexOf(flag) === -1) { | |
this.raise(state.start, "Invalid regular expression flag"); | |
} | |
if (flags.indexOf(flag, i + 1) > -1) { | |
this.raise(state.start, "Duplicate regular expression flag"); | |
} | |
} | |
}; | |
/** | |
* Validate the pattern part of a given RegExpLiteral. | |
* | |
* @param {RegExpValidationState} state The state to validate RegExp. | |
* @returns {void} | |
*/ | |
pp$8.validateRegExpPattern = function (state) { | |
this.regexp_pattern(state); // The goal symbol for the parse is |Pattern[~U, ~N]|. If the result of | |
// parsing contains a |GroupName|, reparse with the goal symbol | |
// |Pattern[~U, +N]| and use this result instead. Throw a *SyntaxError* | |
// exception if _P_ did not conform to the grammar, if any elements of _P_ | |
// were not matched by the parse, or if any Early Error conditions exist. | |
if (!state.switchN && (this || _global$Q).options.ecmaVersion >= 9 && state.groupNames.length > 0) { | |
state.switchN = true; | |
this.regexp_pattern(state); | |
} | |
}; // https://www.ecma-international.org/ecma-262/8.0/#prod-Pattern | |
pp$8.regexp_pattern = function (state) { | |
state.pos = 0; | |
state.lastIntValue = 0; | |
state.lastStringValue = ""; | |
state.lastAssertionIsQuantifiable = false; | |
state.numCapturingParens = 0; | |
state.maxBackReference = 0; | |
state.groupNames.length = 0; | |
state.backReferenceNames.length = 0; | |
this.regexp_disjunction(state); | |
if (state.pos !== state.source.length) { | |
// Make the same messages as V8. | |
if (state.eat(0x29 | |
/* ) */ | |
)) { | |
state.raise("Unmatched ')'"); | |
} | |
if (state.eat(0x5D | |
/* ] */ | |
) || state.eat(0x7D | |
/* } */ | |
)) { | |
state.raise("Lone quantifier brackets"); | |
} | |
} | |
if (state.maxBackReference > state.numCapturingParens) { | |
state.raise("Invalid escape"); | |
} | |
for (var i = 0, list = state.backReferenceNames; i < list.length; i += 1) { | |
var name = list[i]; | |
if (state.groupNames.indexOf(name) === -1) { | |
state.raise("Invalid named capture referenced"); | |
} | |
} | |
}; // https://www.ecma-international.org/ecma-262/8.0/#prod-Disjunction | |
pp$8.regexp_disjunction = function (state) { | |
this.regexp_alternative(state); | |
while (state.eat(0x7C | |
/* | */ | |
)) { | |
this.regexp_alternative(state); | |
} // Make the same message as V8. | |
if (this.regexp_eatQuantifier(state, true)) { | |
state.raise("Nothing to repeat"); | |
} | |
if (state.eat(0x7B | |
/* { */ | |
)) { | |
state.raise("Lone quantifier brackets"); | |
} | |
}; // https://www.ecma-international.org/ecma-262/8.0/#prod-Alternative | |
pp$8.regexp_alternative = function (state) { | |
while (state.pos < state.source.length && this.regexp_eatTerm(state)) {} | |
}; // https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-Term | |
pp$8.regexp_eatTerm = function (state) { | |
if (this.regexp_eatAssertion(state)) { | |
// Handle `QuantifiableAssertion Quantifier` alternative. | |
// `state.lastAssertionIsQuantifiable` is true if the last eaten Assertion | |
// is a QuantifiableAssertion. | |
if (state.lastAssertionIsQuantifiable && this.regexp_eatQuantifier(state)) { | |
// Make the same message as V8. | |
if (state.switchU) { | |
state.raise("Invalid quantifier"); | |
} | |
} | |
return true; | |
} | |
if (state.switchU ? this.regexp_eatAtom(state) : this.regexp_eatExtendedAtom(state)) { | |
this.regexp_eatQuantifier(state); | |
return true; | |
} | |
return false; | |
}; // https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-Assertion | |
pp$8.regexp_eatAssertion = function (state) { | |
var start = state.pos; | |
state.lastAssertionIsQuantifiable = false; // ^, $ | |
if (state.eat(0x5E | |
/* ^ */ | |
) || state.eat(0x24 | |
/* $ */ | |
)) { | |
return true; | |
} // \b \B | |
if (state.eat(0x5C | |
/* \ */ | |
)) { | |
if (state.eat(0x42 | |
/* B */ | |
) || state.eat(0x62 | |
/* b */ | |
)) { | |
return true; | |
} | |
state.pos = start; | |
} // Lookahead / Lookbehind | |
if (state.eat(0x28 | |
/* ( */ | |
) && state.eat(0x3F | |
/* ? */ | |
)) { | |
var lookbehind = false; | |
if ((this || _global$Q).options.ecmaVersion >= 9) { | |
lookbehind = state.eat(0x3C | |
/* < */ | |
); | |
} | |
if (state.eat(0x3D | |
/* = */ | |
) || state.eat(0x21 | |
/* ! */ | |
)) { | |
this.regexp_disjunction(state); | |
if (!state.eat(0x29 | |
/* ) */ | |
)) { | |
state.raise("Unterminated group"); | |
} | |
state.lastAssertionIsQuantifiable = !lookbehind; | |
return true; | |
} | |
} | |
state.pos = start; | |
return false; | |
}; // https://www.ecma-international.org/ecma-262/8.0/#prod-Quantifier | |
pp$8.regexp_eatQuantifier = function (state, noError) { | |
if (noError === void 0) noError = false; | |
if (this.regexp_eatQuantifierPrefix(state, noError)) { | |
state.eat(0x3F | |
/* ? */ | |
); | |
return true; | |
} | |
return false; | |
}; // https://www.ecma-international.org/ecma-262/8.0/#prod-QuantifierPrefix | |
pp$8.regexp_eatQuantifierPrefix = function (state, noError) { | |
return state.eat(0x2A | |
/* * */ | |
) || state.eat(0x2B | |
/* + */ | |
) || state.eat(0x3F | |
/* ? */ | |
) || this.regexp_eatBracedQuantifier(state, noError); | |
}; | |
pp$8.regexp_eatBracedQuantifier = function (state, noError) { | |
var start = state.pos; | |
if (state.eat(0x7B | |
/* { */ | |
)) { | |
var min = 0, | |
max = -1; | |
if (this.regexp_eatDecimalDigits(state)) { | |
min = state.lastIntValue; | |
if (state.eat(0x2C | |
/* , */ | |
) && this.regexp_eatDecimalDigits(state)) { | |
max = state.lastIntValue; | |
} | |
if (state.eat(0x7D | |
/* } */ | |
)) { | |
// SyntaxError in https://www.ecma-international.org/ecma-262/8.0/#sec-term | |
if (max !== -1 && max < min && !noError) { | |
state.raise("numbers out of order in {} quantifier"); | |
} | |
return true; | |
} | |
} | |
if (state.switchU && !noError) { | |
state.raise("Incomplete quantifier"); | |
} | |
state.pos = start; | |
} | |
return false; | |
}; // https://www.ecma-international.org/ecma-262/8.0/#prod-Atom | |
pp$8.regexp_eatAtom = function (state) { | |
return this.regexp_eatPatternCharacters(state) || state.eat(0x2E | |
/* . */ | |
) || this.regexp_eatReverseSolidusAtomEscape(state) || this.regexp_eatCharacterClass(state) || this.regexp_eatUncapturingGroup(state) || this.regexp_eatCapturingGroup(state); | |
}; | |
pp$8.regexp_eatReverseSolidusAtomEscape = function (state) { | |
var start = state.pos; | |
if (state.eat(0x5C | |
/* \ */ | |
)) { | |
if (this.regexp_eatAtomEscape(state)) { | |
return true; | |
} | |
state.pos = start; | |
} | |
return false; | |
}; | |
pp$8.regexp_eatUncapturingGroup = function (state) { | |
var start = state.pos; | |
if (state.eat(0x28 | |
/* ( */ | |
)) { | |
if (state.eat(0x3F | |
/* ? */ | |
) && state.eat(0x3A | |
/* : */ | |
)) { | |
this.regexp_disjunction(state); | |
if (state.eat(0x29 | |
/* ) */ | |
)) { | |
return true; | |
} | |
state.raise("Unterminated group"); | |
} | |
state.pos = start; | |
} | |
return false; | |
}; | |
pp$8.regexp_eatCapturingGroup = function (state) { | |
if (state.eat(0x28 | |
/* ( */ | |
)) { | |
if ((this || _global$Q).options.ecmaVersion >= 9) { | |
this.regexp_groupSpecifier(state); | |
} else if (state.current() === 0x3F | |
/* ? */ | |
) { | |
state.raise("Invalid group"); | |
} | |
this.regexp_disjunction(state); | |
if (state.eat(0x29 | |
/* ) */ | |
)) { | |
state.numCapturingParens += 1; | |
return true; | |
} | |
state.raise("Unterminated group"); | |
} | |
return false; | |
}; // https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-ExtendedAtom | |
pp$8.regexp_eatExtendedAtom = function (state) { | |
return state.eat(0x2E | |
/* . */ | |
) || this.regexp_eatReverseSolidusAtomEscape(state) || this.regexp_eatCharacterClass(state) || this.regexp_eatUncapturingGroup(state) || this.regexp_eatCapturingGroup(state) || this.regexp_eatInvalidBracedQuantifier(state) || this.regexp_eatExtendedPatternCharacter(state); | |
}; // https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-InvalidBracedQuantifier | |
pp$8.regexp_eatInvalidBracedQuantifier = function (state) { | |
if (this.regexp_eatBracedQuantifier(state, true)) { | |
state.raise("Nothing to repeat"); | |
} | |
return false; | |
}; // https://www.ecma-international.org/ecma-262/8.0/#prod-SyntaxCharacter | |
pp$8.regexp_eatSyntaxCharacter = function (state) { | |
var ch = state.current(); | |
if (isSyntaxCharacter(ch)) { | |
state.lastIntValue = ch; | |
state.advance(); | |
return true; | |
} | |
return false; | |
}; | |
function isSyntaxCharacter(ch) { | |
return ch === 0x24 | |
/* $ */ | |
|| ch >= 0x28 | |
/* ( */ | |
&& ch <= 0x2B | |
/* + */ | |
|| ch === 0x2E | |
/* . */ | |
|| ch === 0x3F | |
/* ? */ | |
|| ch >= 0x5B | |
/* [ */ | |
&& ch <= 0x5E | |
/* ^ */ | |
|| ch >= 0x7B | |
/* { */ | |
&& ch <= 0x7D | |
/* } */ | |
; | |
} // https://www.ecma-international.org/ecma-262/8.0/#prod-PatternCharacter | |
// But eat eager. | |
pp$8.regexp_eatPatternCharacters = function (state) { | |
var start = state.pos; | |
var ch = 0; | |
while ((ch = state.current()) !== -1 && !isSyntaxCharacter(ch)) { | |
state.advance(); | |
} | |
return state.pos !== start; | |
}; // https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-ExtendedPatternCharacter | |
pp$8.regexp_eatExtendedPatternCharacter = function (state) { | |
var ch = state.current(); | |
if (ch !== -1 && ch !== 0x24 | |
/* $ */ | |
&& !(ch >= 0x28 | |
/* ( */ | |
&& ch <= 0x2B | |
/* + */ | |
) && ch !== 0x2E | |
/* . */ | |
&& ch !== 0x3F | |
/* ? */ | |
&& ch !== 0x5B | |
/* [ */ | |
&& ch !== 0x5E | |
/* ^ */ | |
&& ch !== 0x7C | |
/* | */ | |
) { | |
state.advance(); | |
return true; | |
} | |
return false; | |
}; // GroupSpecifier :: | |
// [empty] | |
// `?` GroupName | |
pp$8.regexp_groupSpecifier = function (state) { | |
if (state.eat(0x3F | |
/* ? */ | |
)) { | |
if (this.regexp_eatGroupName(state)) { | |
if (state.groupNames.indexOf(state.lastStringValue) !== -1) { | |
state.raise("Duplicate capture group name"); | |
} | |
state.groupNames.push(state.lastStringValue); | |
return; | |
} | |
state.raise("Invalid group"); | |
} | |
}; // GroupName :: | |
// `<` RegExpIdentifierName `>` | |
// Note: this updates `state.lastStringValue` property with the eaten name. | |
pp$8.regexp_eatGroupName = function (state) { | |
state.lastStringValue = ""; | |
if (state.eat(0x3C | |
/* < */ | |
)) { | |
if (this.regexp_eatRegExpIdentifierName(state) && state.eat(0x3E | |
/* > */ | |
)) { | |
return true; | |
} | |
state.raise("Invalid capture group name"); | |
} | |
return false; | |
}; // RegExpIdentifierName :: | |
// RegExpIdentifierStart | |
// RegExpIdentifierName RegExpIdentifierPart | |
// Note: this updates `state.lastStringValue` property with the eaten name. | |
pp$8.regexp_eatRegExpIdentifierName = function (state) { | |
state.lastStringValue = ""; | |
if (this.regexp_eatRegExpIdentifierStart(state)) { | |
state.lastStringValue += codePointToString(state.lastIntValue); | |
while (this.regexp_eatRegExpIdentifierPart(state)) { | |
state.lastStringValue += codePointToString(state.lastIntValue); | |
} | |
return true; | |
} | |
return false; | |
}; // RegExpIdentifierStart :: | |
// UnicodeIDStart | |
// `$` | |
// `_` | |
// `\` RegExpUnicodeEscapeSequence[+U] | |
pp$8.regexp_eatRegExpIdentifierStart = function (state) { | |
var start = state.pos; | |
var forceU = (this || _global$Q).options.ecmaVersion >= 11; | |
var ch = state.current(forceU); | |
state.advance(forceU); | |
if (ch === 0x5C | |
/* \ */ | |
&& this.regexp_eatRegExpUnicodeEscapeSequence(state, forceU)) { | |
ch = state.lastIntValue; | |
} | |
if (isRegExpIdentifierStart(ch)) { | |
state.lastIntValue = ch; | |
return true; | |
} | |
state.pos = start; | |
return false; | |
}; | |
function isRegExpIdentifierStart(ch) { | |
return isIdentifierStart(ch, true) || ch === 0x24 | |
/* $ */ | |
|| ch === 0x5F; | |
/* _ */ | |
} // RegExpIdentifierPart :: | |
// UnicodeIDContinue | |
// `$` | |
// `_` | |
// `\` RegExpUnicodeEscapeSequence[+U] | |
// <ZWNJ> | |
// <ZWJ> | |
pp$8.regexp_eatRegExpIdentifierPart = function (state) { | |
var start = state.pos; | |
var forceU = (this || _global$Q).options.ecmaVersion >= 11; | |
var ch = state.current(forceU); | |
state.advance(forceU); | |
if (ch === 0x5C | |
/* \ */ | |
&& this.regexp_eatRegExpUnicodeEscapeSequence(state, forceU)) { | |
ch = state.lastIntValue; | |
} | |
if (isRegExpIdentifierPart(ch)) { | |
state.lastIntValue = ch; | |
return true; | |
} | |
state.pos = start; | |
return false; | |
}; | |
function isRegExpIdentifierPart(ch) { | |
return isIdentifierChar(ch, true) || ch === 0x24 | |
/* $ */ | |
|| ch === 0x5F | |
/* _ */ | |
|| ch === 0x200C | |
/* <ZWNJ> */ | |
|| ch === 0x200D; | |
/* <ZWJ> */ | |
} // https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-AtomEscape | |
pp$8.regexp_eatAtomEscape = function (state) { | |
if (this.regexp_eatBackReference(state) || this.regexp_eatCharacterClassEscape(state) || this.regexp_eatCharacterEscape(state) || state.switchN && this.regexp_eatKGroupName(state)) { | |
return true; | |
} | |
if (state.switchU) { | |
// Make the same message as V8. | |
if (state.current() === 0x63 | |
/* c */ | |
) { | |
state.raise("Invalid unicode escape"); | |
} | |
state.raise("Invalid escape"); | |
} | |
return false; | |
}; | |
pp$8.regexp_eatBackReference = function (state) { | |
var start = state.pos; | |
if (this.regexp_eatDecimalEscape(state)) { | |
var n = state.lastIntValue; | |
if (state.switchU) { | |
// For SyntaxError in https://www.ecma-international.org/ecma-262/8.0/#sec-atomescape | |
if (n > state.maxBackReference) { | |
state.maxBackReference = n; | |
} | |
return true; | |
} | |
if (n <= state.numCapturingParens) { | |
return true; | |
} | |
state.pos = start; | |
} | |
return false; | |
}; | |
pp$8.regexp_eatKGroupName = function (state) { | |
if (state.eat(0x6B | |
/* k */ | |
)) { | |
if (this.regexp_eatGroupName(state)) { | |
state.backReferenceNames.push(state.lastStringValue); | |
return true; | |
} | |
state.raise("Invalid named reference"); | |
} | |
return false; | |
}; // https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-CharacterEscape | |
pp$8.regexp_eatCharacterEscape = function (state) { | |
return this.regexp_eatControlEscape(state) || this.regexp_eatCControlLetter(state) || this.regexp_eatZero(state) || this.regexp_eatHexEscapeSequence(state) || this.regexp_eatRegExpUnicodeEscapeSequence(state, false) || !state.switchU && this.regexp_eatLegacyOctalEscapeSequence(state) || this.regexp_eatIdentityEscape(state); | |
}; | |
pp$8.regexp_eatCControlLetter = function (state) { | |
var start = state.pos; | |
if (state.eat(0x63 | |
/* c */ | |
)) { | |
if (this.regexp_eatControlLetter(state)) { | |
return true; | |
} | |
state.pos = start; | |
} | |
return false; | |
}; | |
pp$8.regexp_eatZero = function (state) { | |
if (state.current() === 0x30 | |
/* 0 */ | |
&& !isDecimalDigit(state.lookahead())) { | |
state.lastIntValue = 0; | |
state.advance(); | |
return true; | |
} | |
return false; | |
}; // https://www.ecma-international.org/ecma-262/8.0/#prod-ControlEscape | |
pp$8.regexp_eatControlEscape = function (state) { | |
var ch = state.current(); | |
if (ch === 0x74 | |
/* t */ | |
) { | |
state.lastIntValue = 0x09; | |
/* \t */ | |
state.advance(); | |
return true; | |
} | |
if (ch === 0x6E | |
/* n */ | |
) { | |
state.lastIntValue = 0x0A; | |
/* \n */ | |
state.advance(); | |
return true; | |
} | |
if (ch === 0x76 | |
/* v */ | |
) { | |
state.lastIntValue = 0x0B; | |
/* \v */ | |
state.advance(); | |
return true; | |
} | |
if (ch === 0x66 | |
/* f */ | |
) { | |
state.lastIntValue = 0x0C; | |
/* \f */ | |
state.advance(); | |
return true; | |
} | |
if (ch === 0x72 | |
/* r */ | |
) { | |
state.lastIntValue = 0x0D; | |
/* \r */ | |
state.advance(); | |
return true; | |
} | |
return false; | |
}; // https://www.ecma-international.org/ecma-262/8.0/#prod-ControlLetter | |
pp$8.regexp_eatControlLetter = function (state) { | |
var ch = state.current(); | |
if (isControlLetter(ch)) { | |
state.lastIntValue = ch % 0x20; | |
state.advance(); | |
return true; | |
} | |
return false; | |
}; | |
function isControlLetter(ch) { | |
return ch >= 0x41 | |
/* A */ | |
&& ch <= 0x5A | |
/* Z */ | |
|| ch >= 0x61 | |
/* a */ | |
&& ch <= 0x7A | |
/* z */ | |
; | |
} // https://www.ecma-international.org/ecma-262/8.0/#prod-RegExpUnicodeEscapeSequence | |
pp$8.regexp_eatRegExpUnicodeEscapeSequence = function (state, forceU) { | |
if (forceU === void 0) forceU = false; | |
var start = state.pos; | |
var switchU = forceU || state.switchU; | |
if (state.eat(0x75 | |
/* u */ | |
)) { | |
if (this.regexp_eatFixedHexDigits(state, 4)) { | |
var lead = state.lastIntValue; | |
if (switchU && lead >= 0xD800 && lead <= 0xDBFF) { | |
var leadSurrogateEnd = state.pos; | |
if (state.eat(0x5C | |
/* \ */ | |
) && state.eat(0x75 | |
/* u */ | |
) && this.regexp_eatFixedHexDigits(state, 4)) { | |
var trail = state.lastIntValue; | |
if (trail >= 0xDC00 && trail <= 0xDFFF) { | |
state.lastIntValue = (lead - 0xD800) * 0x400 + (trail - 0xDC00) + 0x10000; | |
return true; | |
} | |
} | |
state.pos = leadSurrogateEnd; | |
state.lastIntValue = lead; | |
} | |
return true; | |
} | |
if (switchU && state.eat(0x7B | |
/* { */ | |
) && this.regexp_eatHexDigits(state) && state.eat(0x7D | |
/* } */ | |
) && isValidUnicode(state.lastIntValue)) { | |
return true; | |
} | |
if (switchU) { | |
state.raise("Invalid unicode escape"); | |
} | |
state.pos = start; | |
} | |
return false; | |
}; | |
function isValidUnicode(ch) { | |
return ch >= 0 && ch <= 0x10FFFF; | |
} // https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-IdentityEscape | |
pp$8.regexp_eatIdentityEscape = function (state) { | |
if (state.switchU) { | |
if (this.regexp_eatSyntaxCharacter(state)) { | |
return true; | |
} | |
if (state.eat(0x2F | |
/* / */ | |
)) { | |
state.lastIntValue = 0x2F; | |
/* / */ | |
return true; | |
} | |
return false; | |
} | |
var ch = state.current(); | |
if (ch !== 0x63 | |
/* c */ | |
&& (!state.switchN || ch !== 0x6B | |
/* k */ | |
)) { | |
state.lastIntValue = ch; | |
state.advance(); | |
return true; | |
} | |
return false; | |
}; // https://www.ecma-international.org/ecma-262/8.0/#prod-DecimalEscape | |
pp$8.regexp_eatDecimalEscape = function (state) { | |
state.lastIntValue = 0; | |
var ch = state.current(); | |
if (ch >= 0x31 | |
/* 1 */ | |
&& ch <= 0x39 | |
/* 9 */ | |
) { | |
do { | |
state.lastIntValue = 10 * state.lastIntValue + (ch - 0x30 | |
/* 0 */ | |
); | |
state.advance(); | |
} while ((ch = state.current()) >= 0x30 | |
/* 0 */ | |
&& ch <= 0x39 | |
/* 9 */ | |
); | |
return true; | |
} | |
return false; | |
}; // https://www.ecma-international.org/ecma-262/8.0/#prod-CharacterClassEscape | |
pp$8.regexp_eatCharacterClassEscape = function (state) { | |
var ch = state.current(); | |
if (isCharacterClassEscape(ch)) { | |
state.lastIntValue = -1; | |
state.advance(); | |
return true; | |
} | |
if (state.switchU && (this || _global$Q).options.ecmaVersion >= 9 && (ch === 0x50 | |
/* P */ | |
|| ch === 0x70 | |
/* p */ | |
)) { | |
state.lastIntValue = -1; | |
state.advance(); | |
if (state.eat(0x7B | |
/* { */ | |
) && this.regexp_eatUnicodePropertyValueExpression(state) && state.eat(0x7D | |
/* } */ | |
)) { | |
return true; | |
} | |
state.raise("Invalid property name"); | |
} | |
return false; | |
}; | |
function isCharacterClassEscape(ch) { | |
return ch === 0x64 | |
/* d */ | |
|| ch === 0x44 | |
/* D */ | |
|| ch === 0x73 | |
/* s */ | |
|| ch === 0x53 | |
/* S */ | |
|| ch === 0x77 | |
/* w */ | |
|| ch === 0x57 | |
/* W */ | |
; | |
} // UnicodePropertyValueExpression :: | |
// UnicodePropertyName `=` UnicodePropertyValue | |
// LoneUnicodePropertyNameOrValue | |
pp$8.regexp_eatUnicodePropertyValueExpression = function (state) { | |
var start = state.pos; // UnicodePropertyName `=` UnicodePropertyValue | |
if (this.regexp_eatUnicodePropertyName(state) && state.eat(0x3D | |
/* = */ | |
)) { | |
var name = state.lastStringValue; | |
if (this.regexp_eatUnicodePropertyValue(state)) { | |
var value = state.lastStringValue; | |
this.regexp_validateUnicodePropertyNameAndValue(state, name, value); | |
return true; | |
} | |
} | |
state.pos = start; // LoneUnicodePropertyNameOrValue | |
if (this.regexp_eatLoneUnicodePropertyNameOrValue(state)) { | |
var nameOrValue = state.lastStringValue; | |
this.regexp_validateUnicodePropertyNameOrValue(state, nameOrValue); | |
return true; | |
} | |
return false; | |
}; | |
pp$8.regexp_validateUnicodePropertyNameAndValue = function (state, name, value) { | |
if (!has(state.unicodeProperties.nonBinary, name)) { | |
state.raise("Invalid property name"); | |
} | |
if (!state.unicodeProperties.nonBinary[name].test(value)) { | |
state.raise("Invalid property value"); | |
} | |
}; | |
pp$8.regexp_validateUnicodePropertyNameOrValue = function (state, nameOrValue) { | |
if (!state.unicodeProperties.binary.test(nameOrValue)) { | |
state.raise("Invalid property name"); | |
} | |
}; // UnicodePropertyName :: | |
// UnicodePropertyNameCharacters | |
pp$8.regexp_eatUnicodePropertyName = function (state) { | |
var ch = 0; | |
state.lastStringValue = ""; | |
while (isUnicodePropertyNameCharacter(ch = state.current())) { | |
state.lastStringValue += codePointToString(ch); | |
state.advance(); | |
} | |
return state.lastStringValue !== ""; | |
}; | |
function isUnicodePropertyNameCharacter(ch) { | |
return isControlLetter(ch) || ch === 0x5F; | |
/* _ */ | |
} // UnicodePropertyValue :: | |
// UnicodePropertyValueCharacters | |
pp$8.regexp_eatUnicodePropertyValue = function (state) { | |
var ch = 0; | |
state.lastStringValue = ""; | |
while (isUnicodePropertyValueCharacter(ch = state.current())) { | |
state.lastStringValue += codePointToString(ch); | |
state.advance(); | |
} | |
return state.lastStringValue !== ""; | |
}; | |
function isUnicodePropertyValueCharacter(ch) { | |
return isUnicodePropertyNameCharacter(ch) || isDecimalDigit(ch); | |
} // LoneUnicodePropertyNameOrValue :: | |
// UnicodePropertyValueCharacters | |
pp$8.regexp_eatLoneUnicodePropertyNameOrValue = function (state) { | |
return this.regexp_eatUnicodePropertyValue(state); | |
}; // https://www.ecma-international.org/ecma-262/8.0/#prod-CharacterClass | |
pp$8.regexp_eatCharacterClass = function (state) { | |
if (state.eat(0x5B | |
/* [ */ | |
)) { | |
state.eat(0x5E | |
/* ^ */ | |
); | |
this.regexp_classRanges(state); | |
if (state.eat(0x5D | |
/* ] */ | |
)) { | |
return true; | |
} // Unreachable since it threw "unterminated regular expression" error before. | |
state.raise("Unterminated character class"); | |
} | |
return false; | |
}; // https://www.ecma-international.org/ecma-262/8.0/#prod-ClassRanges | |
// https://www.ecma-international.org/ecma-262/8.0/#prod-NonemptyClassRanges | |
// https://www.ecma-international.org/ecma-262/8.0/#prod-NonemptyClassRangesNoDash | |
pp$8.regexp_classRanges = function (state) { | |
while (this.regexp_eatClassAtom(state)) { | |
var left = state.lastIntValue; | |
if (state.eat(0x2D | |
/* - */ | |
) && this.regexp_eatClassAtom(state)) { | |
var right = state.lastIntValue; | |
if (state.switchU && (left === -1 || right === -1)) { | |
state.raise("Invalid character class"); | |
} | |
if (left !== -1 && right !== -1 && left > right) { | |
state.raise("Range out of order in character class"); | |
} | |
} | |
} | |
}; // https://www.ecma-international.org/ecma-262/8.0/#prod-ClassAtom | |
// https://www.ecma-international.org/ecma-262/8.0/#prod-ClassAtomNoDash | |
pp$8.regexp_eatClassAtom = function (state) { | |
var start = state.pos; | |
if (state.eat(0x5C | |
/* \ */ | |
)) { | |
if (this.regexp_eatClassEscape(state)) { | |
return true; | |
} | |
if (state.switchU) { | |
// Make the same message as V8. | |
var ch$1 = state.current(); | |
if (ch$1 === 0x63 | |
/* c */ | |
|| isOctalDigit(ch$1)) { | |
state.raise("Invalid class escape"); | |
} | |
state.raise("Invalid escape"); | |
} | |
state.pos = start; | |
} | |
var ch = state.current(); | |
if (ch !== 0x5D | |
/* ] */ | |
) { | |
state.lastIntValue = ch; | |
state.advance(); | |
return true; | |
} | |
return false; | |
}; // https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-ClassEscape | |
pp$8.regexp_eatClassEscape = function (state) { | |
var start = state.pos; | |
if (state.eat(0x62 | |
/* b */ | |
)) { | |
state.lastIntValue = 0x08; | |
/* <BS> */ | |
return true; | |
} | |
if (state.switchU && state.eat(0x2D | |
/* - */ | |
)) { | |
state.lastIntValue = 0x2D; | |
/* - */ | |
return true; | |
} | |
if (!state.switchU && state.eat(0x63 | |
/* c */ | |
)) { | |
if (this.regexp_eatClassControlLetter(state)) { | |
return true; | |
} | |
state.pos = start; | |
} | |
return this.regexp_eatCharacterClassEscape(state) || this.regexp_eatCharacterEscape(state); | |
}; // https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-ClassControlLetter | |
pp$8.regexp_eatClassControlLetter = function (state) { | |
var ch = state.current(); | |
if (isDecimalDigit(ch) || ch === 0x5F | |
/* _ */ | |
) { | |
state.lastIntValue = ch % 0x20; | |
state.advance(); | |
return true; | |
} | |
return false; | |
}; // https://www.ecma-international.org/ecma-262/8.0/#prod-HexEscapeSequence | |
pp$8.regexp_eatHexEscapeSequence = function (state) { | |
var start = state.pos; | |
if (state.eat(0x78 | |
/* x */ | |
)) { | |
if (this.regexp_eatFixedHexDigits(state, 2)) { | |
return true; | |
} | |
if (state.switchU) { | |
state.raise("Invalid escape"); | |
} | |
state.pos = start; | |
} | |
return false; | |
}; // https://www.ecma-international.org/ecma-262/8.0/#prod-DecimalDigits | |
pp$8.regexp_eatDecimalDigits = function (state) { | |
var start = state.pos; | |
var ch = 0; | |
state.lastIntValue = 0; | |
while (isDecimalDigit(ch = state.current())) { | |
state.lastIntValue = 10 * state.lastIntValue + (ch - 0x30 | |
/* 0 */ | |
); | |
state.advance(); | |
} | |
return state.pos !== start; | |
}; | |
function isDecimalDigit(ch) { | |
return ch >= 0x30 | |
/* 0 */ | |
&& ch <= 0x39; | |
/* 9 */ | |
} // https://www.ecma-international.org/ecma-262/8.0/#prod-HexDigits | |
pp$8.regexp_eatHexDigits = function (state) { | |
var start = state.pos; | |
var ch = 0; | |
state.lastIntValue = 0; | |
while (isHexDigit(ch = state.current())) { | |
state.lastIntValue = 16 * state.lastIntValue + hexToInt(ch); | |
state.advance(); | |
} | |
return state.pos !== start; | |
}; | |
function isHexDigit(ch) { | |
return ch >= 0x30 | |
/* 0 */ | |
&& ch <= 0x39 | |
/* 9 */ | |
|| ch >= 0x41 | |
/* A */ | |
&& ch <= 0x46 | |
/* F */ | |
|| ch >= 0x61 | |
/* a */ | |
&& ch <= 0x66 | |
/* f */ | |
; | |
} | |
function hexToInt(ch) { | |
if (ch >= 0x41 | |
/* A */ | |
&& ch <= 0x46 | |
/* F */ | |
) { | |
return 10 + (ch - 0x41 | |
/* A */ | |
); | |
} | |
if (ch >= 0x61 | |
/* a */ | |
&& ch <= 0x66 | |
/* f */ | |
) { | |
return 10 + (ch - 0x61 | |
/* a */ | |
); | |
} | |
return ch - 0x30; | |
/* 0 */ | |
} // https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-LegacyOctalEscapeSequence | |
// Allows only 0-377(octal) i.e. 0-255(decimal). | |
pp$8.regexp_eatLegacyOctalEscapeSequence = function (state) { | |
if (this.regexp_eatOctalDigit(state)) { | |
var n1 = state.lastIntValue; | |
if (this.regexp_eatOctalDigit(state)) { | |
var n2 = state.lastIntValue; | |
if (n1 <= 3 && this.regexp_eatOctalDigit(state)) { | |
state.lastIntValue = n1 * 64 + n2 * 8 + state.lastIntValue; | |
} else { | |
state.lastIntValue = n1 * 8 + n2; | |
} | |
} else { | |
state.lastIntValue = n1; | |
} | |
return true; | |
} | |
return false; | |
}; // https://www.ecma-international.org/ecma-262/8.0/#prod-OctalDigit | |
pp$8.regexp_eatOctalDigit = function (state) { | |
var ch = state.current(); | |
if (isOctalDigit(ch)) { | |
state.lastIntValue = ch - 0x30; | |
/* 0 */ | |
state.advance(); | |
return true; | |
} | |
state.lastIntValue = 0; | |
return false; | |
}; | |
function isOctalDigit(ch) { | |
return ch >= 0x30 | |
/* 0 */ | |
&& ch <= 0x37; | |
/* 7 */ | |
} // https://www.ecma-international.org/ecma-262/8.0/#prod-Hex4Digits | |
// https://www.ecma-international.org/ecma-262/8.0/#prod-HexDigit | |
// And HexDigit HexDigit in https://www.ecma-international.org/ecma-262/8.0/#prod-HexEscapeSequence | |
pp$8.regexp_eatFixedHexDigits = function (state, length) { | |
var start = state.pos; | |
state.lastIntValue = 0; | |
for (var i = 0; i < length; ++i) { | |
var ch = state.current(); | |
if (!isHexDigit(ch)) { | |
state.pos = start; | |
return false; | |
} | |
state.lastIntValue = 16 * state.lastIntValue + hexToInt(ch); | |
state.advance(); | |
} | |
return true; | |
}; // Object type used to represent tokens. Note that normally, tokens | |
// simply exist as properties on the parser object. This is only | |
// used for the onToken callback and the external tokenizer. | |
var Token = function Token(p) { | |
(this || _global$Q).type = p.type; | |
(this || _global$Q).value = p.value; | |
(this || _global$Q).start = p.start; | |
(this || _global$Q).end = p.end; | |
if (p.options.locations) { | |
(this || _global$Q).loc = new SourceLocation(p, p.startLoc, p.endLoc); | |
} | |
if (p.options.ranges) { | |
(this || _global$Q).range = [p.start, p.end]; | |
} | |
}; // ## Tokenizer | |
var pp$9 = Parser.prototype; // Move to the next token | |
pp$9.next = function (ignoreEscapeSequenceInKeyword) { | |
if (!ignoreEscapeSequenceInKeyword && (this || _global$Q).type.keyword && (this || _global$Q).containsEsc) { | |
this.raiseRecoverable((this || _global$Q).start, "Escape sequence in keyword " + (this || _global$Q).type.keyword); | |
} | |
if ((this || _global$Q).options.onToken) { | |
(this || _global$Q).options.onToken(new Token(this || _global$Q)); | |
} | |
(this || _global$Q).lastTokEnd = (this || _global$Q).end; | |
(this || _global$Q).lastTokStart = (this || _global$Q).start; | |
(this || _global$Q).lastTokEndLoc = (this || _global$Q).endLoc; | |
(this || _global$Q).lastTokStartLoc = (this || _global$Q).startLoc; | |
this.nextToken(); | |
}; | |
pp$9.getToken = function () { | |
this.next(); | |
return new Token(this || _global$Q); | |
}; // If we're in an ES6 environment, make parsers iterable | |
if (typeof Symbol !== "undefined") { | |
pp$9[Symbol.iterator] = function () { | |
var this$1$1 = this || _global$Q; | |
return { | |
next: function () { | |
var token = this$1$1.getToken(); | |
return { | |
done: token.type === types.eof, | |
value: token | |
}; | |
} | |
}; | |
}; | |
} // Toggle strict mode. Re-reads the next number or string to please | |
// pedantic tests (`"use strict"; 010;` should fail). | |
pp$9.curContext = function () { | |
return (this || _global$Q).context[(this || _global$Q).context.length - 1]; | |
}; // Read a single token, updating the parser object's token-related | |
// properties. | |
pp$9.nextToken = function () { | |
var curContext = this.curContext(); | |
if (!curContext || !curContext.preserveSpace) { | |
this.skipSpace(); | |
} | |
(this || _global$Q).start = (this || _global$Q).pos; | |
if ((this || _global$Q).options.locations) { | |
(this || _global$Q).startLoc = this.curPosition(); | |
} | |
if ((this || _global$Q).pos >= (this || _global$Q).input.length) { | |
return this.finishToken(types.eof); | |
} | |
if (curContext.override) { | |
return curContext.override(this || _global$Q); | |
} else { | |
this.readToken(this.fullCharCodeAtPos()); | |
} | |
}; | |
pp$9.readToken = function (code) { | |
// Identifier or keyword. '\uXXXX' sequences are allowed in | |
// identifiers, so '\' also dispatches to that. | |
if (isIdentifierStart(code, (this || _global$Q).options.ecmaVersion >= 6) || code === 92 | |
/* '\' */ | |
) { | |
return this.readWord(); | |
} | |
return this.getTokenFromCode(code); | |
}; | |
pp$9.fullCharCodeAtPos = function () { | |
var code = (this || _global$Q).input.charCodeAt((this || _global$Q).pos); | |
if (code <= 0xd7ff || code >= 0xe000) { | |
return code; | |
} | |
var next = (this || _global$Q).input.charCodeAt((this || _global$Q).pos + 1); | |
return (code << 10) + next - 0x35fdc00; | |
}; | |
pp$9.skipBlockComment = function () { | |
var startLoc = (this || _global$Q).options.onComment && this.curPosition(); | |
var start = (this || _global$Q).pos, | |
end = (this || _global$Q).input.indexOf("*/", (this || _global$Q).pos += 2); | |
if (end === -1) { | |
this.raise((this || _global$Q).pos - 2, "Unterminated comment"); | |
} | |
(this || _global$Q).pos = end + 2; | |
if ((this || _global$Q).options.locations) { | |
lineBreakG.lastIndex = start; | |
var match; | |
while ((match = lineBreakG.exec((this || _global$Q).input)) && match.index < (this || _global$Q).pos) { | |
++(this || _global$Q).curLine; | |
(this || _global$Q).lineStart = match.index + match[0].length; | |
} | |
} | |
if ((this || _global$Q).options.onComment) { | |
(this || _global$Q).options.onComment(true, (this || _global$Q).input.slice(start + 2, end), start, (this || _global$Q).pos, startLoc, this.curPosition()); | |
} | |
}; | |
pp$9.skipLineComment = function (startSkip) { | |
var start = (this || _global$Q).pos; | |
var startLoc = (this || _global$Q).options.onComment && this.curPosition(); | |
var ch = (this || _global$Q).input.charCodeAt((this || _global$Q).pos += startSkip); | |
while ((this || _global$Q).pos < (this || _global$Q).input.length && !isNewLine(ch)) { | |
ch = (this || _global$Q).input.charCodeAt(++(this || _global$Q).pos); | |
} | |
if ((this || _global$Q).options.onComment) { | |
(this || _global$Q).options.onComment(false, (this || _global$Q).input.slice(start + startSkip, (this || _global$Q).pos), start, (this || _global$Q).pos, startLoc, this.curPosition()); | |
} | |
}; // Called at the start of the parse and after every token. Skips | |
// whitespace and comments, and. | |
pp$9.skipSpace = function () { | |
loop: while ((this || _global$Q).pos < (this || _global$Q).input.length) { | |
var ch = (this || _global$Q).input.charCodeAt((this || _global$Q).pos); | |
switch (ch) { | |
case 32: | |
case 160: | |
// ' ' | |
++(this || _global$Q).pos; | |
break; | |
case 13: | |
if ((this || _global$Q).input.charCodeAt((this || _global$Q).pos + 1) === 10) { | |
++(this || _global$Q).pos; | |
} | |
case 10: | |
case 8232: | |
case 8233: | |
++(this || _global$Q).pos; | |
if ((this || _global$Q).options.locations) { | |
++(this || _global$Q).curLine; | |
(this || _global$Q).lineStart = (this || _global$Q).pos; | |
} | |
break; | |
case 47: | |
// '/' | |
switch ((this || _global$Q).input.charCodeAt((this || _global$Q).pos + 1)) { | |
case 42: | |
// '*' | |
this.skipBlockComment(); | |
break; | |
case 47: | |
this.skipLineComment(2); | |
break; | |
default: | |
break loop; | |
} | |
break; | |
default: | |
if (ch > 8 && ch < 14 || ch >= 5760 && nonASCIIwhitespace.test(String.fromCharCode(ch))) { | |
++(this || _global$Q).pos; | |
} else { | |
break loop; | |
} | |
} | |
} | |
}; // Called at the end of every token. Sets `end`, `val`, and | |
// maintains `context` and `exprAllowed`, and skips the space after | |
// the token, so that the next one's `start` will point at the | |
// right position. | |
pp$9.finishToken = function (type, val) { | |
(this || _global$Q).end = (this || _global$Q).pos; | |
if ((this || _global$Q).options.locations) { | |
(this || _global$Q).endLoc = this.curPosition(); | |
} | |
var prevType = (this || _global$Q).type; | |
(this || _global$Q).type = type; | |
(this || _global$Q).value = val; | |
this.updateContext(prevType); | |
}; // ### Token reading | |
// This is the function that is called to fetch the next token. It | |
// is somewhat obscure, because it works in character codes rather | |
// than characters, and because operator parsing has been inlined | |
// into it. | |
// | |
// All in the name of speed. | |
// | |
pp$9.readToken_dot = function () { | |
var next = (this || _global$Q).input.charCodeAt((this || _global$Q).pos + 1); | |
if (next >= 48 && next <= 57) { | |
return this.readNumber(true); | |
} | |
var next2 = (this || _global$Q).input.charCodeAt((this || _global$Q).pos + 2); | |
if ((this || _global$Q).options.ecmaVersion >= 6 && next === 46 && next2 === 46) { | |
// 46 = dot '.' | |
(this || _global$Q).pos += 3; | |
return this.finishToken(types.ellipsis); | |
} else { | |
++(this || _global$Q).pos; | |
return this.finishToken(types.dot); | |
} | |
}; | |
pp$9.readToken_slash = function () { | |
// '/' | |
var next = (this || _global$Q).input.charCodeAt((this || _global$Q).pos + 1); | |
if ((this || _global$Q).exprAllowed) { | |
++(this || _global$Q).pos; | |
return this.readRegexp(); | |
} | |
if (next === 61) { | |
return this.finishOp(types.assign, 2); | |
} | |
return this.finishOp(types.slash, 1); | |
}; | |
pp$9.readToken_mult_modulo_exp = function (code) { | |
// '%*' | |
var next = (this || _global$Q).input.charCodeAt((this || _global$Q).pos + 1); | |
var size = 1; | |
var tokentype = code === 42 ? types.star : types.modulo; // exponentiation operator ** and **= | |
if ((this || _global$Q).options.ecmaVersion >= 7 && code === 42 && next === 42) { | |
++size; | |
tokentype = types.starstar; | |
next = (this || _global$Q).input.charCodeAt((this || _global$Q).pos + 2); | |
} | |
if (next === 61) { | |
return this.finishOp(types.assign, size + 1); | |
} | |
return this.finishOp(tokentype, size); | |
}; | |
pp$9.readToken_pipe_amp = function (code) { | |
// '|&' | |
var next = (this || _global$Q).input.charCodeAt((this || _global$Q).pos + 1); | |
if (next === code) { | |
if ((this || _global$Q).options.ecmaVersion >= 12) { | |
var next2 = (this || _global$Q).input.charCodeAt((this || _global$Q).pos + 2); | |
if (next2 === 61) { | |
return this.finishOp(types.assign, 3); | |
} | |
} | |
return this.finishOp(code === 124 ? types.logicalOR : types.logicalAND, 2); | |
} | |
if (next === 61) { | |
return this.finishOp(types.assign, 2); | |
} | |
return this.finishOp(code === 124 ? types.bitwiseOR : types.bitwiseAND, 1); | |
}; | |
pp$9.readToken_caret = function () { | |
// '^' | |
var next = (this || _global$Q).input.charCodeAt((this || _global$Q).pos + 1); | |
if (next === 61) { | |
return this.finishOp(types.assign, 2); | |
} | |
return this.finishOp(types.bitwiseXOR, 1); | |
}; | |
pp$9.readToken_plus_min = function (code) { | |
// '+-' | |
var next = (this || _global$Q).input.charCodeAt((this || _global$Q).pos + 1); | |
if (next === code) { | |
if (next === 45 && !(this || _global$Q).inModule && (this || _global$Q).input.charCodeAt((this || _global$Q).pos + 2) === 62 && ((this || _global$Q).lastTokEnd === 0 || lineBreak.test((this || _global$Q).input.slice((this || _global$Q).lastTokEnd, (this || _global$Q).pos)))) { | |
// A `-->` line comment | |
this.skipLineComment(3); | |
this.skipSpace(); | |
return this.nextToken(); | |
} | |
return this.finishOp(types.incDec, 2); | |
} | |
if (next === 61) { | |
return this.finishOp(types.assign, 2); | |
} | |
return this.finishOp(types.plusMin, 1); | |
}; | |
pp$9.readToken_lt_gt = function (code) { | |
// '<>' | |
var next = (this || _global$Q).input.charCodeAt((this || _global$Q).pos + 1); | |
var size = 1; | |
if (next === code) { | |
size = code === 62 && (this || _global$Q).input.charCodeAt((this || _global$Q).pos + 2) === 62 ? 3 : 2; | |
if ((this || _global$Q).input.charCodeAt((this || _global$Q).pos + size) === 61) { | |
return this.finishOp(types.assign, size + 1); | |
} | |
return this.finishOp(types.bitShift, size); | |
} | |
if (next === 33 && code === 60 && !(this || _global$Q).inModule && (this || _global$Q).input.charCodeAt((this || _global$Q).pos + 2) === 45 && (this || _global$Q).input.charCodeAt((this || _global$Q).pos + 3) === 45) { | |
// `<!--`, an XML-style comment that should be interpreted as a line comment | |
this.skipLineComment(4); | |
this.skipSpace(); | |
return this.nextToken(); | |
} | |
if (next === 61) { | |
size = 2; | |
} | |
return this.finishOp(types.relational, size); | |
}; | |
pp$9.readToken_eq_excl = function (code) { | |
// '=!' | |
var next = (this || _global$Q).input.charCodeAt((this || _global$Q).pos + 1); | |
if (next === 61) { | |
return this.finishOp(types.equality, (this || _global$Q).input.charCodeAt((this || _global$Q).pos + 2) === 61 ? 3 : 2); | |
} | |
if (code === 61 && next === 62 && (this || _global$Q).options.ecmaVersion >= 6) { | |
// '=>' | |
(this || _global$Q).pos += 2; | |
return this.finishToken(types.arrow); | |
} | |
return this.finishOp(code === 61 ? types.eq : types.prefix, 1); | |
}; | |
pp$9.readToken_question = function () { | |
// '?' | |
var ecmaVersion = (this || _global$Q).options.ecmaVersion; | |
if (ecmaVersion >= 11) { | |
var next = (this || _global$Q).input.charCodeAt((this || _global$Q).pos + 1); | |
if (next === 46) { | |
var next2 = (this || _global$Q).input.charCodeAt((this || _global$Q).pos + 2); | |
if (next2 < 48 || next2 > 57) { | |
return this.finishOp(types.questionDot, 2); | |
} | |
} | |
if (next === 63) { | |
if (ecmaVersion >= 12) { | |
var next2$1 = (this || _global$Q).input.charCodeAt((this || _global$Q).pos + 2); | |
if (next2$1 === 61) { | |
return this.finishOp(types.assign, 3); | |
} | |
} | |
return this.finishOp(types.coalesce, 2); | |
} | |
} | |
return this.finishOp(types.question, 1); | |
}; | |
pp$9.getTokenFromCode = function (code) { | |
switch (code) { | |
// The interpretation of a dot depends on whether it is followed | |
// by a digit or another two dots. | |
case 46: | |
// '.' | |
return this.readToken_dot(); | |
// Punctuation tokens. | |
case 40: | |
++(this || _global$Q).pos; | |
return this.finishToken(types.parenL); | |
case 41: | |
++(this || _global$Q).pos; | |
return this.finishToken(types.parenR); | |
case 59: | |
++(this || _global$Q).pos; | |
return this.finishToken(types.semi); | |
case 44: | |
++(this || _global$Q).pos; | |
return this.finishToken(types.comma); | |
case 91: | |
++(this || _global$Q).pos; | |
return this.finishToken(types.bracketL); | |
case 93: | |
++(this || _global$Q).pos; | |
return this.finishToken(types.bracketR); | |
case 123: | |
++(this || _global$Q).pos; | |
return this.finishToken(types.braceL); | |
case 125: | |
++(this || _global$Q).pos; | |
return this.finishToken(types.braceR); | |
case 58: | |
++(this || _global$Q).pos; | |
return this.finishToken(types.colon); | |
case 96: | |
// '`' | |
if ((this || _global$Q).options.ecmaVersion < 6) { | |
break; | |
} | |
++(this || _global$Q).pos; | |
return this.finishToken(types.backQuote); | |
case 48: | |
// '0' | |
var next = (this || _global$Q).input.charCodeAt((this || _global$Q).pos + 1); | |
if (next === 120 || next === 88) { | |
return this.readRadixNumber(16); | |
} // '0x', '0X' - hex number | |
if ((this || _global$Q).options.ecmaVersion >= 6) { | |
if (next === 111 || next === 79) { | |
return this.readRadixNumber(8); | |
} // '0o', '0O' - octal number | |
if (next === 98 || next === 66) { | |
return this.readRadixNumber(2); | |
} // '0b', '0B' - binary number | |
} | |
// Anything else beginning with a digit is an integer, octal | |
// number, or float. | |
case 49: | |
case 50: | |
case 51: | |
case 52: | |
case 53: | |
case 54: | |
case 55: | |
case 56: | |
case 57: | |
// 1-9 | |
return this.readNumber(false); | |
// Quotes produce strings. | |
case 34: | |
case 39: | |
// '"', "'" | |
return this.readString(code); | |
// Operators are parsed inline in tiny state machines. '=' (61) is | |
// often referred to. `finishOp` simply skips the amount of | |
// characters it is given as second argument, and returns a token | |
// of the type given by its first argument. | |
case 47: | |
// '/' | |
return this.readToken_slash(); | |
case 37: | |
case 42: | |
// '%*' | |
return this.readToken_mult_modulo_exp(code); | |
case 124: | |
case 38: | |
// '|&' | |
return this.readToken_pipe_amp(code); | |
case 94: | |
// '^' | |
return this.readToken_caret(); | |
case 43: | |
case 45: | |
// '+-' | |
return this.readToken_plus_min(code); | |
case 60: | |
case 62: | |
// '<>' | |
return this.readToken_lt_gt(code); | |
case 61: | |
case 33: | |
// '=!' | |
return this.readToken_eq_excl(code); | |
case 63: | |
// '?' | |
return this.readToken_question(); | |
case 126: | |
// '~' | |
return this.finishOp(types.prefix, 1); | |
} | |
this.raise((this || _global$Q).pos, "Unexpected character '" + codePointToString$1(code) + "'"); | |
}; | |
pp$9.finishOp = function (type, size) { | |
var str = (this || _global$Q).input.slice((this || _global$Q).pos, (this || _global$Q).pos + size); | |
(this || _global$Q).pos += size; | |
return this.finishToken(type, str); | |
}; | |
pp$9.readRegexp = function () { | |
var escaped, | |
inClass, | |
start = (this || _global$Q).pos; | |
for (;;) { | |
if ((this || _global$Q).pos >= (this || _global$Q).input.length) { | |
this.raise(start, "Unterminated regular expression"); | |
} | |
var ch = (this || _global$Q).input.charAt((this || _global$Q).pos); | |
if (lineBreak.test(ch)) { | |
this.raise(start, "Unterminated regular expression"); | |
} | |
if (!escaped) { | |
if (ch === "[") { | |
inClass = true; | |
} else if (ch === "]" && inClass) { | |
inClass = false; | |
} else if (ch === "/" && !inClass) { | |
break; | |
} | |
escaped = ch === "\\"; | |
} else { | |
escaped = false; | |
} | |
++(this || _global$Q).pos; | |
} | |
var pattern = (this || _global$Q).input.slice(start, (this || _global$Q).pos); | |
++(this || _global$Q).pos; | |
var flagsStart = (this || _global$Q).pos; | |
var flags = this.readWord1(); | |
if ((this || _global$Q).containsEsc) { | |
this.unexpected(flagsStart); | |
} // Validate pattern | |
var state = (this || _global$Q).regexpState || ((this || _global$Q).regexpState = new RegExpValidationState(this || _global$Q)); | |
state.reset(start, pattern, flags); | |
this.validateRegExpFlags(state); | |
this.validateRegExpPattern(state); // Create Literal#value property value. | |
var value = null; | |
try { | |
value = new RegExp(pattern, flags); | |
} catch (e) {// ESTree requires null if it failed to instantiate RegExp object. | |
// https://github.com/estree/estree/blob/a27003adf4fd7bfad44de9cef372a2eacd527b1c/es5.md#regexpliteral | |
} | |
return this.finishToken(types.regexp, { | |
pattern: pattern, | |
flags: flags, | |
value: value | |
}); | |
}; // Read an integer in the given radix. Return null if zero digits | |
// were read, the integer value otherwise. When `len` is given, this | |
// will return `null` unless the integer has exactly `len` digits. | |
pp$9.readInt = function (radix, len, maybeLegacyOctalNumericLiteral) { | |
// `len` is used for character escape sequences. In that case, disallow separators. | |
var allowSeparators = (this || _global$Q).options.ecmaVersion >= 12 && len === undefined; // `maybeLegacyOctalNumericLiteral` is true if it doesn't have prefix (0x,0o,0b) | |
// and isn't fraction part nor exponent part. In that case, if the first digit | |
// is zero then disallow separators. | |
var isLegacyOctalNumericLiteral = maybeLegacyOctalNumericLiteral && (this || _global$Q).input.charCodeAt((this || _global$Q).pos) === 48; | |
var start = (this || _global$Q).pos, | |
total = 0, | |
lastCode = 0; | |
for (var i = 0, e = len == null ? Infinity : len; i < e; ++i, ++(this || _global$Q).pos) { | |
var code = (this || _global$Q).input.charCodeAt((this || _global$Q).pos), | |
val = void 0; | |
if (allowSeparators && code === 95) { | |
if (isLegacyOctalNumericLiteral) { | |
this.raiseRecoverable((this || _global$Q).pos, "Numeric separator is not allowed in legacy octal numeric literals"); | |
} | |
if (lastCode === 95) { | |
this.raiseRecoverable((this || _global$Q).pos, "Numeric separator must be exactly one underscore"); | |
} | |
if (i === 0) { | |
this.raiseRecoverable((this || _global$Q).pos, "Numeric separator is not allowed at the first of digits"); | |
} | |
lastCode = code; | |
continue; | |
} | |
if (code >= 97) { | |
val = code - 97 + 10; | |
} // a | |
else if (code >= 65) { | |
val = code - 65 + 10; | |
} // A | |
else if (code >= 48 && code <= 57) { | |
val = code - 48; | |
} // 0-9 | |
else { | |
val = Infinity; | |
} | |
if (val >= radix) { | |
break; | |
} | |
lastCode = code; | |
total = total * radix + val; | |
} | |
if (allowSeparators && lastCode === 95) { | |
this.raiseRecoverable((this || _global$Q).pos - 1, "Numeric separator is not allowed at the last of digits"); | |
} | |
if ((this || _global$Q).pos === start || len != null && (this || _global$Q).pos - start !== len) { | |
return null; | |
} | |
return total; | |
}; | |
function stringToNumber(str, isLegacyOctalNumericLiteral) { | |
if (isLegacyOctalNumericLiteral) { | |
return parseInt(str, 8); | |
} // `parseFloat(value)` stops parsing at the first numeric separator then returns a wrong value. | |
return parseFloat(str.replace(/_/g, "")); | |
} | |
function stringToBigInt(str) { | |
if (typeof BigInt !== "function") { | |
return null; | |
} // `BigInt(value)` throws syntax error if the string contains numeric separators. | |
return BigInt(str.replace(/_/g, "")); | |
} | |
pp$9.readRadixNumber = function (radix) { | |
var start = (this || _global$Q).pos; | |
(this || _global$Q).pos += 2; // 0x | |
var val = this.readInt(radix); | |
if (val == null) { | |
this.raise((this || _global$Q).start + 2, "Expected number in radix " + radix); | |
} | |
if ((this || _global$Q).options.ecmaVersion >= 11 && (this || _global$Q).input.charCodeAt((this || _global$Q).pos) === 110) { | |
val = stringToBigInt((this || _global$Q).input.slice(start, (this || _global$Q).pos)); | |
++(this || _global$Q).pos; | |
} else if (isIdentifierStart(this.fullCharCodeAtPos())) { | |
this.raise((this || _global$Q).pos, "Identifier directly after number"); | |
} | |
return this.finishToken(types.num, val); | |
}; // Read an integer, octal integer, or floating-point number. | |
pp$9.readNumber = function (startsWithDot) { | |
var start = (this || _global$Q).pos; | |
if (!startsWithDot && this.readInt(10, undefined, true) === null) { | |
this.raise(start, "Invalid number"); | |
} | |
var octal = (this || _global$Q).pos - start >= 2 && (this || _global$Q).input.charCodeAt(start) === 48; | |
if (octal && (this || _global$Q).strict) { | |
this.raise(start, "Invalid number"); | |
} | |
var next = (this || _global$Q).input.charCodeAt((this || _global$Q).pos); | |
if (!octal && !startsWithDot && (this || _global$Q).options.ecmaVersion >= 11 && next === 110) { | |
var val$1 = stringToBigInt((this || _global$Q).input.slice(start, (this || _global$Q).pos)); | |
++(this || _global$Q).pos; | |
if (isIdentifierStart(this.fullCharCodeAtPos())) { | |
this.raise((this || _global$Q).pos, "Identifier directly after number"); | |
} | |
return this.finishToken(types.num, val$1); | |
} | |
if (octal && /[89]/.test((this || _global$Q).input.slice(start, (this || _global$Q).pos))) { | |
octal = false; | |
} | |
if (next === 46 && !octal) { | |
// '.' | |
++(this || _global$Q).pos; | |
this.readInt(10); | |
next = (this || _global$Q).input.charCodeAt((this || _global$Q).pos); | |
} | |
if ((next === 69 || next === 101) && !octal) { | |
// 'eE' | |
next = (this || _global$Q).input.charCodeAt(++(this || _global$Q).pos); | |
if (next === 43 || next === 45) { | |
++(this || _global$Q).pos; | |
} // '+-' | |
if (this.readInt(10) === null) { | |
this.raise(start, "Invalid number"); | |
} | |
} | |
if (isIdentifierStart(this.fullCharCodeAtPos())) { | |
this.raise((this || _global$Q).pos, "Identifier directly after number"); | |
} | |
var val = stringToNumber((this || _global$Q).input.slice(start, (this || _global$Q).pos), octal); | |
return this.finishToken(types.num, val); | |
}; // Read a string value, interpreting backslash-escapes. | |
pp$9.readCodePoint = function () { | |
var ch = (this || _global$Q).input.charCodeAt((this || _global$Q).pos), | |
code; | |
if (ch === 123) { | |
// '{' | |
if ((this || _global$Q).options.ecmaVersion < 6) { | |
this.unexpected(); | |
} | |
var codePos = ++(this || _global$Q).pos; | |
code = this.readHexChar((this || _global$Q).input.indexOf("}", (this || _global$Q).pos) - (this || _global$Q).pos); | |
++(this || _global$Q).pos; | |
if (code > 0x10FFFF) { | |
this.invalidStringToken(codePos, "Code point out of bounds"); | |
} | |
} else { | |
code = this.readHexChar(4); | |
} | |
return code; | |
}; | |
function codePointToString$1(code) { | |
// UTF-16 Decoding | |
if (code <= 0xFFFF) { | |
return String.fromCharCode(code); | |
} | |
code -= 0x10000; | |
return String.fromCharCode((code >> 10) + 0xD800, (code & 1023) + 0xDC00); | |
} | |
pp$9.readString = function (quote) { | |
var out = "", | |
chunkStart = ++(this || _global$Q).pos; | |
for (;;) { | |
if ((this || _global$Q).pos >= (this || _global$Q).input.length) { | |
this.raise((this || _global$Q).start, "Unterminated string constant"); | |
} | |
var ch = (this || _global$Q).input.charCodeAt((this || _global$Q).pos); | |
if (ch === quote) { | |
break; | |
} | |
if (ch === 92) { | |
// '\' | |
out += (this || _global$Q).input.slice(chunkStart, (this || _global$Q).pos); | |
out += this.readEscapedChar(false); | |
chunkStart = (this || _global$Q).pos; | |
} else { | |
if (isNewLine(ch, (this || _global$Q).options.ecmaVersion >= 10)) { | |
this.raise((this || _global$Q).start, "Unterminated string constant"); | |
} | |
++(this || _global$Q).pos; | |
} | |
} | |
out += (this || _global$Q).input.slice(chunkStart, (this || _global$Q).pos++); | |
return this.finishToken(types.string, out); | |
}; // Reads template string tokens. | |
var INVALID_TEMPLATE_ESCAPE_ERROR = {}; | |
pp$9.tryReadTemplateToken = function () { | |
(this || _global$Q).inTemplateElement = true; | |
try { | |
this.readTmplToken(); | |
} catch (err) { | |
if (err === INVALID_TEMPLATE_ESCAPE_ERROR) { | |
this.readInvalidTemplateToken(); | |
} else { | |
throw err; | |
} | |
} | |
(this || _global$Q).inTemplateElement = false; | |
}; | |
pp$9.invalidStringToken = function (position, message) { | |
if ((this || _global$Q).inTemplateElement && (this || _global$Q).options.ecmaVersion >= 9) { | |
throw INVALID_TEMPLATE_ESCAPE_ERROR; | |
} else { | |
this.raise(position, message); | |
} | |
}; | |
pp$9.readTmplToken = function () { | |
var out = "", | |
chunkStart = (this || _global$Q).pos; | |
for (;;) { | |
if ((this || _global$Q).pos >= (this || _global$Q).input.length) { | |
this.raise((this || _global$Q).start, "Unterminated template"); | |
} | |
var ch = (this || _global$Q).input.charCodeAt((this || _global$Q).pos); | |
if (ch === 96 || ch === 36 && (this || _global$Q).input.charCodeAt((this || _global$Q).pos + 1) === 123) { | |
// '`', '${' | |
if ((this || _global$Q).pos === (this || _global$Q).start && ((this || _global$Q).type === types.template || (this || _global$Q).type === types.invalidTemplate)) { | |
if (ch === 36) { | |
(this || _global$Q).pos += 2; | |
return this.finishToken(types.dollarBraceL); | |
} else { | |
++(this || _global$Q).pos; | |
return this.finishToken(types.backQuote); | |
} | |
} | |
out += (this || _global$Q).input.slice(chunkStart, (this || _global$Q).pos); | |
return this.finishToken(types.template, out); | |
} | |
if (ch === 92) { | |
// '\' | |
out += (this || _global$Q).input.slice(chunkStart, (this || _global$Q).pos); | |
out += this.readEscapedChar(true); | |
chunkStart = (this || _global$Q).pos; | |
} else if (isNewLine(ch)) { | |
out += (this || _global$Q).input.slice(chunkStart, (this || _global$Q).pos); | |
++(this || _global$Q).pos; | |
switch (ch) { | |
case 13: | |
if ((this || _global$Q).input.charCodeAt((this || _global$Q).pos) === 10) { | |
++(this || _global$Q).pos; | |
} | |
case 10: | |
out += "\n"; | |
break; | |
default: | |
out += String.fromCharCode(ch); | |
break; | |
} | |
if ((this || _global$Q).options.locations) { | |
++(this || _global$Q).curLine; | |
(this || _global$Q).lineStart = (this || _global$Q).pos; | |
} | |
chunkStart = (this || _global$Q).pos; | |
} else { | |
++(this || _global$Q).pos; | |
} | |
} | |
}; // Reads a template token to search for the end, without validating any escape sequences | |
pp$9.readInvalidTemplateToken = function () { | |
for (; (this || _global$Q).pos < (this || _global$Q).input.length; (this || _global$Q).pos++) { | |
switch ((this || _global$Q).input[(this || _global$Q).pos]) { | |
case "\\": | |
++(this || _global$Q).pos; | |
break; | |
case "$": | |
if ((this || _global$Q).input[(this || _global$Q).pos + 1] !== "{") { | |
break; | |
} | |
// falls through | |
case "`": | |
return this.finishToken(types.invalidTemplate, (this || _global$Q).input.slice((this || _global$Q).start, (this || _global$Q).pos)); | |
// no default | |
} | |
} | |
this.raise((this || _global$Q).start, "Unterminated template"); | |
}; // Used to read escaped characters | |
pp$9.readEscapedChar = function (inTemplate) { | |
var ch = (this || _global$Q).input.charCodeAt(++(this || _global$Q).pos); | |
++(this || _global$Q).pos; | |
switch (ch) { | |
case 110: | |
return "\n"; | |
// 'n' -> '\n' | |
case 114: | |
return "\r"; | |
// 'r' -> '\r' | |
case 120: | |
return String.fromCharCode(this.readHexChar(2)); | |
// 'x' | |
case 117: | |
return codePointToString$1(this.readCodePoint()); | |
// 'u' | |
case 116: | |
return "\t"; | |
// 't' -> '\t' | |
case 98: | |
return "\b"; | |
// 'b' -> '\b' | |
case 118: | |
return "\u000b"; | |
// 'v' -> '\u000b' | |
case 102: | |
return "\f"; | |
// 'f' -> '\f' | |
case 13: | |
if ((this || _global$Q).input.charCodeAt((this || _global$Q).pos) === 10) { | |
++(this || _global$Q).pos; | |
} | |
// '\r\n' | |
case 10: | |
// ' \n' | |
if ((this || _global$Q).options.locations) { | |
(this || _global$Q).lineStart = (this || _global$Q).pos; | |
++(this || _global$Q).curLine; | |
} | |
return ""; | |
case 56: | |
case 57: | |
if (inTemplate) { | |
var codePos = (this || _global$Q).pos - 1; | |
this.invalidStringToken(codePos, "Invalid escape sequence in template string"); | |
return null; | |
} | |
default: | |
if (ch >= 48 && ch <= 55) { | |
var octalStr = (this || _global$Q).input.substr((this || _global$Q).pos - 1, 3).match(/^[0-7]+/)[0]; | |
var octal = parseInt(octalStr, 8); | |
if (octal > 255) { | |
octalStr = octalStr.slice(0, -1); | |
octal = parseInt(octalStr, 8); | |
} | |
(this || _global$Q).pos += octalStr.length - 1; | |
ch = (this || _global$Q).input.charCodeAt((this || _global$Q).pos); | |
if ((octalStr !== "0" || ch === 56 || ch === 57) && ((this || _global$Q).strict || inTemplate)) { | |
this.invalidStringToken((this || _global$Q).pos - 1 - octalStr.length, inTemplate ? "Octal literal in template string" : "Octal literal in strict mode"); | |
} | |
return String.fromCharCode(octal); | |
} | |
if (isNewLine(ch)) { | |
// Unicode new line characters after \ get removed from output in both | |
// template literals and strings | |
return ""; | |
} | |
return String.fromCharCode(ch); | |
} | |
}; // Used to read character escape sequences ('\x', '\u', '\U'). | |
pp$9.readHexChar = function (len) { | |
var codePos = (this || _global$Q).pos; | |
var n = this.readInt(16, len); | |
if (n === null) { | |
this.invalidStringToken(codePos, "Bad character escape sequence"); | |
} | |
return n; | |
}; // Read an identifier, and return it as a string. Sets `this.containsEsc` | |
// to whether the word contained a '\u' escape. | |
// | |
// Incrementally adds only escaped chars, adding other chunks as-is | |
// as a micro-optimization. | |
pp$9.readWord1 = function () { | |
(this || _global$Q).containsEsc = false; | |
var word = "", | |
first = true, | |
chunkStart = (this || _global$Q).pos; | |
var astral = (this || _global$Q).options.ecmaVersion >= 6; | |
while ((this || _global$Q).pos < (this || _global$Q).input.length) { | |
var ch = this.fullCharCodeAtPos(); | |
if (isIdentifierChar(ch, astral)) { | |
(this || _global$Q).pos += ch <= 0xffff ? 1 : 2; | |
} else if (ch === 92) { | |
// "\" | |
(this || _global$Q).containsEsc = true; | |
word += (this || _global$Q).input.slice(chunkStart, (this || _global$Q).pos); | |
var escStart = (this || _global$Q).pos; | |
if ((this || _global$Q).input.charCodeAt(++(this || _global$Q).pos) !== 117) // "u" | |
{ | |
this.invalidStringToken((this || _global$Q).pos, "Expecting Unicode escape sequence \\uXXXX"); | |
} | |
++(this || _global$Q).pos; | |
var esc = this.readCodePoint(); | |
if (!(first ? isIdentifierStart : isIdentifierChar)(esc, astral)) { | |
this.invalidStringToken(escStart, "Invalid Unicode escape"); | |
} | |
word += codePointToString$1(esc); | |
chunkStart = (this || _global$Q).pos; | |
} else { | |
break; | |
} | |
first = false; | |
} | |
return word + (this || _global$Q).input.slice(chunkStart, (this || _global$Q).pos); | |
}; // Read an identifier or keyword token. Will check for reserved | |
// words when necessary. | |
pp$9.readWord = function () { | |
var word = this.readWord1(); | |
var type = types.name; | |
if ((this || _global$Q).keywords.test(word)) { | |
type = keywords$1[word]; | |
} | |
return this.finishToken(type, word); | |
}; // Acorn is a tiny, fast JavaScript parser written in JavaScript. | |
var version = "7.4.1"; | |
Parser.acorn = { | |
Parser: Parser, | |
version: version, | |
defaultOptions: defaultOptions, | |
Position: Position, | |
SourceLocation: SourceLocation, | |
getLineInfo: getLineInfo, | |
Node: Node, | |
TokenType: TokenType, | |
tokTypes: types, | |
keywordTypes: keywords$1, | |
TokContext: TokContext, | |
tokContexts: types$1, | |
isIdentifierChar: isIdentifierChar, | |
isIdentifierStart: isIdentifierStart, | |
Token: Token, | |
isNewLine: isNewLine, | |
lineBreak: lineBreak, | |
lineBreakG: lineBreakG, | |
nonASCIIwhitespace: nonASCIIwhitespace | |
}; // The main exported interface (under `self.acorn` when in the | |
// browser) is a `parse` function that takes a code string and | |
// returns an abstract syntax tree as specified by [Mozilla parser | |
// API][api]. | |
// | |
// [api]: https://developer.mozilla.org/en-US/docs/SpiderMonkey/Parser_API | |
function parse(input, options) { | |
return Parser.parse(input, options); | |
} // This function tries to parse a single expression at a given | |
// offset in a string. Useful for parsing mixed-language formats | |
// that embed JavaScript expressions. | |
function parseExpressionAt(input, pos, options) { | |
return Parser.parseExpressionAt(input, pos, options); | |
} // Acorn is organized as a tokenizer and a recursive-descent parser. | |
// The `tokenizer` export provides an interface to the tokenizer. | |
function tokenizer(input, options) { | |
return Parser.tokenizer(input, options); | |
} | |
exports.Node = Node; | |
exports.Parser = Parser; | |
exports.Position = Position; | |
exports.SourceLocation = SourceLocation; | |
exports.TokContext = TokContext; | |
exports.Token = Token; | |
exports.TokenType = TokenType; | |
exports.defaultOptions = defaultOptions; | |
exports.getLineInfo = getLineInfo; | |
exports.isIdentifierChar = isIdentifierChar; | |
exports.isIdentifierStart = isIdentifierStart; | |
exports.isNewLine = isNewLine; | |
exports.keywordTypes = keywords$1; | |
exports.lineBreak = lineBreak; | |
exports.lineBreakG = lineBreakG; | |
exports.nonASCIIwhitespace = nonASCIIwhitespace; | |
exports.parse = parse; | |
exports.parseExpressionAt = parseExpressionAt; | |
exports.tokContexts = types$1; | |
exports.tokTypes = types; | |
exports.tokenizer = tokenizer; | |
exports.version = version; | |
Object.defineProperty(exports, '__esModule', { | |
value: true | |
}); | |
}); | |
return exports$ab; | |
} | |
var exports$aa = {}, | |
_dewExec$9V = false; | |
var _global$P = typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : global; | |
function dew$aa() { | |
if (_dewExec$9V) return exports$aa; | |
_dewExec$9V = true; | |
(function (global, factory) { | |
typeof exports$aa === 'object' && true ? factory(exports$aa) : typeof define === 'function' && define.amd ? define(['exports'], factory) : (global = global || self, factory((global.acorn = global.acorn || {}, global.acorn.walk = {}))); | |
})(exports$aa, function (exports) { | |
// A simple walk is one where you simply specify callbacks to be | |
// called on specific nodes. The last two arguments are optional. A | |
// simple use would be | |
// | |
// walk.simple(myTree, { | |
// Expression: function(node) { ... } | |
// }); | |
// | |
// to do something with all expressions. All Parser API node types | |
// can be used to identify node types, as well as Expression and | |
// Statement, which denote categories of nodes. | |
// | |
// The base argument can be used to pass a custom (recursive) | |
// walker, and state can be used to give this walked an initial | |
// state. | |
function simple(node, visitors, baseVisitor, state, override) { | |
if (!baseVisitor) { | |
baseVisitor = base; | |
} | |
(function c(node, st, override) { | |
var type = override || node.type, | |
found = visitors[type]; | |
baseVisitor[type](node, st, c); | |
if (found) { | |
found(node, st); | |
} | |
})(node, state, override); | |
} // An ancestor walk keeps an array of ancestor nodes (including the | |
// current node) and passes them to the callback as third parameter | |
// (and also as state parameter when no other state is present). | |
function ancestor(node, visitors, baseVisitor, state, override) { | |
var ancestors = []; | |
if (!baseVisitor) { | |
baseVisitor = base; | |
} | |
(function c(node, st, override) { | |
var type = override || node.type, | |
found = visitors[type]; | |
var isNew = node !== ancestors[ancestors.length - 1]; | |
if (isNew) { | |
ancestors.push(node); | |
} | |
baseVisitor[type](node, st, c); | |
if (found) { | |
found(node, st || ancestors, ancestors); | |
} | |
if (isNew) { | |
ancestors.pop(); | |
} | |
})(node, state, override); | |
} // A recursive walk is one where your functions override the default | |
// walkers. They can modify and replace the state parameter that's | |
// threaded through the walk, and can opt how and whether to walk | |
// their child nodes (by calling their third argument on these | |
// nodes). | |
function recursive(node, state, funcs, baseVisitor, override) { | |
var visitor = funcs ? make(funcs, baseVisitor || undefined) : baseVisitor; | |
(function c(node, st, override) { | |
visitor[override || node.type](node, st, c); | |
})(node, state, override); | |
} | |
function makeTest(test) { | |
if (typeof test === "string") { | |
return function (type) { | |
return type === test; | |
}; | |
} else if (!test) { | |
return function () { | |
return true; | |
}; | |
} else { | |
return test; | |
} | |
} | |
var Found = function Found(node, state) { | |
(this || _global$P).node = node; | |
(this || _global$P).state = state; | |
}; // A full walk triggers the callback on each node | |
function full(node, callback, baseVisitor, state, override) { | |
if (!baseVisitor) { | |
baseVisitor = base; | |
} | |
(function c(node, st, override) { | |
var type = override || node.type; | |
baseVisitor[type](node, st, c); | |
if (!override) { | |
callback(node, st, type); | |
} | |
})(node, state, override); | |
} // An fullAncestor walk is like an ancestor walk, but triggers | |
// the callback on each node | |
function fullAncestor(node, callback, baseVisitor, state) { | |
if (!baseVisitor) { | |
baseVisitor = base; | |
} | |
var ancestors = []; | |
(function c(node, st, override) { | |
var type = override || node.type; | |
var isNew = node !== ancestors[ancestors.length - 1]; | |
if (isNew) { | |
ancestors.push(node); | |
} | |
baseVisitor[type](node, st, c); | |
if (!override) { | |
callback(node, st || ancestors, ancestors, type); | |
} | |
if (isNew) { | |
ancestors.pop(); | |
} | |
})(node, state); | |
} // Find a node with a given start, end, and type (all are optional, | |
// null can be used as wildcard). Returns a {node, state} object, or | |
// undefined when it doesn't find a matching node. | |
function findNodeAt(node, start, end, test, baseVisitor, state) { | |
if (!baseVisitor) { | |
baseVisitor = base; | |
} | |
test = makeTest(test); | |
try { | |
(function c(node, st, override) { | |
var type = override || node.type; | |
if ((start == null || node.start <= start) && (end == null || node.end >= end)) { | |
baseVisitor[type](node, st, c); | |
} | |
if ((start == null || node.start === start) && (end == null || node.end === end) && test(type, node)) { | |
throw new Found(node, st); | |
} | |
})(node, state); | |
} catch (e) { | |
if (e instanceof Found) { | |
return e; | |
} | |
throw e; | |
} | |
} // Find the innermost node of a given type that contains the given | |
// position. Interface similar to findNodeAt. | |
function findNodeAround(node, pos, test, baseVisitor, state) { | |
test = makeTest(test); | |
if (!baseVisitor) { | |
baseVisitor = base; | |
} | |
try { | |
(function c(node, st, override) { | |
var type = override || node.type; | |
if (node.start > pos || node.end < pos) { | |
return; | |
} | |
baseVisitor[type](node, st, c); | |
if (test(type, node)) { | |
throw new Found(node, st); | |
} | |
})(node, state); | |
} catch (e) { | |
if (e instanceof Found) { | |
return e; | |
} | |
throw e; | |
} | |
} // Find the outermost matching node after a given position. | |
function findNodeAfter(node, pos, test, baseVisitor, state) { | |
test = makeTest(test); | |
if (!baseVisitor) { | |
baseVisitor = base; | |
} | |
try { | |
(function c(node, st, override) { | |
if (node.end < pos) { | |
return; | |
} | |
var type = override || node.type; | |
if (node.start >= pos && test(type, node)) { | |
throw new Found(node, st); | |
} | |
baseVisitor[type](node, st, c); | |
})(node, state); | |
} catch (e) { | |
if (e instanceof Found) { | |
return e; | |
} | |
throw e; | |
} | |
} // Find the outermost matching node before a given position. | |
function findNodeBefore(node, pos, test, baseVisitor, state) { | |
test = makeTest(test); | |
if (!baseVisitor) { | |
baseVisitor = base; | |
} | |
var max; | |
(function c(node, st, override) { | |
if (node.start > pos) { | |
return; | |
} | |
var type = override || node.type; | |
if (node.end <= pos && (!max || max.node.end < node.end) && test(type, node)) { | |
max = new Found(node, st); | |
} | |
baseVisitor[type](node, st, c); | |
})(node, state); | |
return max; | |
} // Fallback to an Object.create polyfill for older environments. | |
var create = Object.create || function (proto) { | |
function Ctor() {} | |
Ctor.prototype = proto; | |
return new Ctor(); | |
}; // Used to create a custom walker. Will fill in all missing node | |
// type properties with the defaults. | |
function make(funcs, baseVisitor) { | |
var visitor = create(baseVisitor || base); | |
for (var type in funcs) { | |
visitor[type] = funcs[type]; | |
} | |
return visitor; | |
} | |
function skipThrough(node, st, c) { | |
c(node, st); | |
} | |
function ignore(_node, _st, _c) {} // Node walkers. | |
var base = {}; | |
base.Program = base.BlockStatement = function (node, st, c) { | |
for (var i = 0, list = node.body; i < list.length; i += 1) { | |
var stmt = list[i]; | |
c(stmt, st, "Statement"); | |
} | |
}; | |
base.Statement = skipThrough; | |
base.EmptyStatement = ignore; | |
base.ExpressionStatement = base.ParenthesizedExpression = base.ChainExpression = function (node, st, c) { | |
return c(node.expression, st, "Expression"); | |
}; | |
base.IfStatement = function (node, st, c) { | |
c(node.test, st, "Expression"); | |
c(node.consequent, st, "Statement"); | |
if (node.alternate) { | |
c(node.alternate, st, "Statement"); | |
} | |
}; | |
base.LabeledStatement = function (node, st, c) { | |
return c(node.body, st, "Statement"); | |
}; | |
base.BreakStatement = base.ContinueStatement = ignore; | |
base.WithStatement = function (node, st, c) { | |
c(node.object, st, "Expression"); | |
c(node.body, st, "Statement"); | |
}; | |
base.SwitchStatement = function (node, st, c) { | |
c(node.discriminant, st, "Expression"); | |
for (var i$1 = 0, list$1 = node.cases; i$1 < list$1.length; i$1 += 1) { | |
var cs = list$1[i$1]; | |
if (cs.test) { | |
c(cs.test, st, "Expression"); | |
} | |
for (var i = 0, list = cs.consequent; i < list.length; i += 1) { | |
var cons = list[i]; | |
c(cons, st, "Statement"); | |
} | |
} | |
}; | |
base.SwitchCase = function (node, st, c) { | |
if (node.test) { | |
c(node.test, st, "Expression"); | |
} | |
for (var i = 0, list = node.consequent; i < list.length; i += 1) { | |
var cons = list[i]; | |
c(cons, st, "Statement"); | |
} | |
}; | |
base.ReturnStatement = base.YieldExpression = base.AwaitExpression = function (node, st, c) { | |
if (node.argument) { | |
c(node.argument, st, "Expression"); | |
} | |
}; | |
base.ThrowStatement = base.SpreadElement = function (node, st, c) { | |
return c(node.argument, st, "Expression"); | |
}; | |
base.TryStatement = function (node, st, c) { | |
c(node.block, st, "Statement"); | |
if (node.handler) { | |
c(node.handler, st); | |
} | |
if (node.finalizer) { | |
c(node.finalizer, st, "Statement"); | |
} | |
}; | |
base.CatchClause = function (node, st, c) { | |
if (node.param) { | |
c(node.param, st, "Pattern"); | |
} | |
c(node.body, st, "Statement"); | |
}; | |
base.WhileStatement = base.DoWhileStatement = function (node, st, c) { | |
c(node.test, st, "Expression"); | |
c(node.body, st, "Statement"); | |
}; | |
base.ForStatement = function (node, st, c) { | |
if (node.init) { | |
c(node.init, st, "ForInit"); | |
} | |
if (node.test) { | |
c(node.test, st, "Expression"); | |
} | |
if (node.update) { | |
c(node.update, st, "Expression"); | |
} | |
c(node.body, st, "Statement"); | |
}; | |
base.ForInStatement = base.ForOfStatement = function (node, st, c) { | |
c(node.left, st, "ForInit"); | |
c(node.right, st, "Expression"); | |
c(node.body, st, "Statement"); | |
}; | |
base.ForInit = function (node, st, c) { | |
if (node.type === "VariableDeclaration") { | |
c(node, st); | |
} else { | |
c(node, st, "Expression"); | |
} | |
}; | |
base.DebuggerStatement = ignore; | |
base.FunctionDeclaration = function (node, st, c) { | |
return c(node, st, "Function"); | |
}; | |
base.VariableDeclaration = function (node, st, c) { | |
for (var i = 0, list = node.declarations; i < list.length; i += 1) { | |
var decl = list[i]; | |
c(decl, st); | |
} | |
}; | |
base.VariableDeclarator = function (node, st, c) { | |
c(node.id, st, "Pattern"); | |
if (node.init) { | |
c(node.init, st, "Expression"); | |
} | |
}; | |
base.Function = function (node, st, c) { | |
if (node.id) { | |
c(node.id, st, "Pattern"); | |
} | |
for (var i = 0, list = node.params; i < list.length; i += 1) { | |
var param = list[i]; | |
c(param, st, "Pattern"); | |
} | |
c(node.body, st, node.expression ? "Expression" : "Statement"); | |
}; | |
base.Pattern = function (node, st, c) { | |
if (node.type === "Identifier") { | |
c(node, st, "VariablePattern"); | |
} else if (node.type === "MemberExpression") { | |
c(node, st, "MemberPattern"); | |
} else { | |
c(node, st); | |
} | |
}; | |
base.VariablePattern = ignore; | |
base.MemberPattern = skipThrough; | |
base.RestElement = function (node, st, c) { | |
return c(node.argument, st, "Pattern"); | |
}; | |
base.ArrayPattern = function (node, st, c) { | |
for (var i = 0, list = node.elements; i < list.length; i += 1) { | |
var elt = list[i]; | |
if (elt) { | |
c(elt, st, "Pattern"); | |
} | |
} | |
}; | |
base.ObjectPattern = function (node, st, c) { | |
for (var i = 0, list = node.properties; i < list.length; i += 1) { | |
var prop = list[i]; | |
if (prop.type === "Property") { | |
if (prop.computed) { | |
c(prop.key, st, "Expression"); | |
} | |
c(prop.value, st, "Pattern"); | |
} else if (prop.type === "RestElement") { | |
c(prop.argument, st, "Pattern"); | |
} | |
} | |
}; | |
base.Expression = skipThrough; | |
base.ThisExpression = base.Super = base.MetaProperty = ignore; | |
base.ArrayExpression = function (node, st, c) { | |
for (var i = 0, list = node.elements; i < list.length; i += 1) { | |
var elt = list[i]; | |
if (elt) { | |
c(elt, st, "Expression"); | |
} | |
} | |
}; | |
base.ObjectExpression = function (node, st, c) { | |
for (var i = 0, list = node.properties; i < list.length; i += 1) { | |
var prop = list[i]; | |
c(prop, st); | |
} | |
}; | |
base.FunctionExpression = base.ArrowFunctionExpression = base.FunctionDeclaration; | |
base.SequenceExpression = function (node, st, c) { | |
for (var i = 0, list = node.expressions; i < list.length; i += 1) { | |
var expr = list[i]; | |
c(expr, st, "Expression"); | |
} | |
}; | |
base.TemplateLiteral = function (node, st, c) { | |
for (var i = 0, list = node.quasis; i < list.length; i += 1) { | |
var quasi = list[i]; | |
c(quasi, st); | |
} | |
for (var i$1 = 0, list$1 = node.expressions; i$1 < list$1.length; i$1 += 1) { | |
var expr = list$1[i$1]; | |
c(expr, st, "Expression"); | |
} | |
}; | |
base.TemplateElement = ignore; | |
base.UnaryExpression = base.UpdateExpression = function (node, st, c) { | |
c(node.argument, st, "Expression"); | |
}; | |
base.BinaryExpression = base.LogicalExpression = function (node, st, c) { | |
c(node.left, st, "Expression"); | |
c(node.right, st, "Expression"); | |
}; | |
base.AssignmentExpression = base.AssignmentPattern = function (node, st, c) { | |
c(node.left, st, "Pattern"); | |
c(node.right, st, "Expression"); | |
}; | |
base.ConditionalExpression = function (node, st, c) { | |
c(node.test, st, "Expression"); | |
c(node.consequent, st, "Expression"); | |
c(node.alternate, st, "Expression"); | |
}; | |
base.NewExpression = base.CallExpression = function (node, st, c) { | |
c(node.callee, st, "Expression"); | |
if (node.arguments) { | |
for (var i = 0, list = node.arguments; i < list.length; i += 1) { | |
var arg = list[i]; | |
c(arg, st, "Expression"); | |
} | |
} | |
}; | |
base.MemberExpression = function (node, st, c) { | |
c(node.object, st, "Expression"); | |
if (node.computed) { | |
c(node.property, st, "Expression"); | |
} | |
}; | |
base.ExportNamedDeclaration = base.ExportDefaultDeclaration = function (node, st, c) { | |
if (node.declaration) { | |
c(node.declaration, st, node.type === "ExportNamedDeclaration" || node.declaration.id ? "Statement" : "Expression"); | |
} | |
if (node.source) { | |
c(node.source, st, "Expression"); | |
} | |
}; | |
base.ExportAllDeclaration = function (node, st, c) { | |
if (node.exported) { | |
c(node.exported, st); | |
} | |
c(node.source, st, "Expression"); | |
}; | |
base.ImportDeclaration = function (node, st, c) { | |
for (var i = 0, list = node.specifiers; i < list.length; i += 1) { | |
var spec = list[i]; | |
c(spec, st); | |
} | |
c(node.source, st, "Expression"); | |
}; | |
base.ImportExpression = function (node, st, c) { | |
c(node.source, st, "Expression"); | |
}; | |
base.ImportSpecifier = base.ImportDefaultSpecifier = base.ImportNamespaceSpecifier = base.Identifier = base.Literal = ignore; | |
base.TaggedTemplateExpression = function (node, st, c) { | |
c(node.tag, st, "Expression"); | |
c(node.quasi, st, "Expression"); | |
}; | |
base.ClassDeclaration = base.ClassExpression = function (node, st, c) { | |
return c(node, st, "Class"); | |
}; | |
base.Class = function (node, st, c) { | |
if (node.id) { | |
c(node.id, st, "Pattern"); | |
} | |
if (node.superClass) { | |
c(node.superClass, st, "Expression"); | |
} | |
c(node.body, st); | |
}; | |
base.ClassBody = function (node, st, c) { | |
for (var i = 0, list = node.body; i < list.length; i += 1) { | |
var elt = list[i]; | |
c(elt, st); | |
} | |
}; | |
base.MethodDefinition = base.Property = function (node, st, c) { | |
if (node.computed) { | |
c(node.key, st, "Expression"); | |
} | |
c(node.value, st, "Expression"); | |
}; | |
exports.ancestor = ancestor; | |
exports.base = base; | |
exports.findNodeAfter = findNodeAfter; | |
exports.findNodeAround = findNodeAround; | |
exports.findNodeAt = findNodeAt; | |
exports.findNodeBefore = findNodeBefore; | |
exports.full = full; | |
exports.fullAncestor = fullAncestor; | |
exports.make = make; | |
exports.recursive = recursive; | |
exports.simple = simple; | |
Object.defineProperty(exports, '__esModule', { | |
value: true | |
}); | |
}); | |
return exports$aa; | |
} | |
var exports$a9 = {}, | |
_dewExec$9U = false; | |
function dew$a9() { | |
if (_dewExec$9U) return exports$a9; | |
_dewExec$9U = true; | |
var acorn = dew$ab(); | |
var walk = dew$aa(); | |
function isScope(node) { | |
return node.type === 'FunctionExpression' || node.type === 'FunctionDeclaration' || node.type === 'ArrowFunctionExpression' || node.type === 'Program'; | |
} | |
function isBlockScope(node) { | |
return node.type === 'BlockStatement' || isScope(node); | |
} | |
function declaresArguments(node) { | |
return node.type === 'FunctionExpression' || node.type === 'FunctionDeclaration'; | |
} | |
function declaresThis(node) { | |
return node.type === 'FunctionExpression' || node.type === 'FunctionDeclaration'; | |
} | |
function reallyParse(source, options) { | |
var parseOptions = Object.assign({}, options, { | |
allowReturnOutsideFunction: true, | |
allowImportExportEverywhere: true, | |
allowHashBang: true | |
}); | |
return acorn.parse(source, parseOptions); | |
} | |
exports$a9 = findGlobals; | |
exports$a9.parse = reallyParse; | |
function findGlobals(source, options) { | |
options = options || {}; | |
var globals = []; | |
var ast; // istanbul ignore else | |
if (typeof source === 'string') { | |
ast = reallyParse(source, options); | |
} else { | |
ast = source; | |
} // istanbul ignore if | |
if (!(ast && typeof ast === 'object' && ast.type === 'Program')) { | |
throw new TypeError('Source must be either a string of JavaScript or an acorn AST'); | |
} | |
var declareFunction = function (node) { | |
var fn = node; | |
fn.locals = fn.locals || Object.create(null); | |
node.params.forEach(function (node) { | |
declarePattern(node, fn); | |
}); | |
if (node.id) { | |
fn.locals[node.id.name] = true; | |
} | |
}; | |
var declareClass = function (node) { | |
node.locals = node.locals || Object.create(null); | |
if (node.id) { | |
node.locals[node.id.name] = true; | |
} | |
}; | |
var declarePattern = function (node, parent) { | |
switch (node.type) { | |
case 'Identifier': | |
parent.locals[node.name] = true; | |
break; | |
case 'ObjectPattern': | |
node.properties.forEach(function (node) { | |
declarePattern(node.value || node.argument, parent); | |
}); | |
break; | |
case 'ArrayPattern': | |
node.elements.forEach(function (node) { | |
if (node) declarePattern(node, parent); | |
}); | |
break; | |
case 'RestElement': | |
declarePattern(node.argument, parent); | |
break; | |
case 'AssignmentPattern': | |
declarePattern(node.left, parent); | |
break; | |
// istanbul ignore next | |
default: | |
throw new Error('Unrecognized pattern type: ' + node.type); | |
} | |
}; | |
var declareModuleSpecifier = function (node, parents) { | |
ast.locals = ast.locals || Object.create(null); | |
ast.locals[node.local.name] = true; | |
}; | |
walk.ancestor(ast, { | |
'VariableDeclaration': function (node, parents) { | |
var parent = null; | |
for (var i = parents.length - 1; i >= 0 && parent === null; i--) { | |
if (node.kind === 'var' ? isScope(parents[i]) : isBlockScope(parents[i])) { | |
parent = parents[i]; | |
} | |
} | |
parent.locals = parent.locals || Object.create(null); | |
node.declarations.forEach(function (declaration) { | |
declarePattern(declaration.id, parent); | |
}); | |
}, | |
'FunctionDeclaration': function (node, parents) { | |
var parent = null; | |
for (var i = parents.length - 2; i >= 0 && parent === null; i--) { | |
if (isScope(parents[i])) { | |
parent = parents[i]; | |
} | |
} | |
parent.locals = parent.locals || Object.create(null); | |
if (node.id) { | |
parent.locals[node.id.name] = true; | |
} | |
declareFunction(node); | |
}, | |
'Function': declareFunction, | |
'ClassDeclaration': function (node, parents) { | |
var parent = null; | |
for (var i = parents.length - 2; i >= 0 && parent === null; i--) { | |
if (isBlockScope(parents[i])) { | |
parent = parents[i]; | |
} | |
} | |
parent.locals = parent.locals || Object.create(null); | |
if (node.id) { | |
parent.locals[node.id.name] = true; | |
} | |
declareClass(node); | |
}, | |
'Class': declareClass, | |
'TryStatement': function (node) { | |
if (node.handler === null) return; | |
node.handler.locals = node.handler.locals || Object.create(null); | |
declarePattern(node.handler.param, node.handler); | |
}, | |
'ImportDefaultSpecifier': declareModuleSpecifier, | |
'ImportSpecifier': declareModuleSpecifier, | |
'ImportNamespaceSpecifier': declareModuleSpecifier | |
}); | |
function identifier(node, parents) { | |
var name = node.name; | |
if (name === 'undefined') return; | |
for (var i = 0; i < parents.length; i++) { | |
if (name === 'arguments' && declaresArguments(parents[i])) { | |
return; | |
} | |
if (parents[i].locals && name in parents[i].locals) { | |
return; | |
} | |
} | |
node.parents = parents.slice(); | |
globals.push(node); | |
} | |
walk.ancestor(ast, { | |
'VariablePattern': identifier, | |
'Identifier': identifier, | |
'ThisExpression': function (node, parents) { | |
for (var i = 0; i < parents.length; i++) { | |
if (declaresThis(parents[i])) { | |
return; | |
} | |
} | |
node.parents = parents.slice(); | |
globals.push(node); | |
} | |
}); | |
var groupedGlobals = Object.create(null); | |
globals.forEach(function (node) { | |
var name = node.type === 'ThisExpression' ? 'this' : node.name; | |
groupedGlobals[name] = groupedGlobals[name] || []; | |
groupedGlobals[name].push(node); | |
}); | |
return Object.keys(groupedGlobals).sort().map(function (name) { | |
return { | |
name: name, | |
nodes: groupedGlobals[name] | |
}; | |
}); | |
} | |
return exports$a9; | |
} | |
var exports$a8 = {}, | |
_dewExec$9T = false; | |
var _global$O = typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : global; | |
function dew$a8() { | |
if (_dewExec$9T) return exports$a8; | |
_dewExec$9T = true; | |
/* | |
Copyright (C) 2012-2013 Yusuke Suzuki <[email protected]> | |
Copyright (C) 2012 Ariya Hidayat <[email protected]> | |
Redistribution and use in source and binary forms, with or without | |
modification, are permitted provided that the following conditions are met: | |
* Redistributions of source code must retain the above copyright | |
notice, this list of conditions and the following disclaimer. | |
* Redistributions in binary form must reproduce the above copyright | |
notice, this list of conditions and the following disclaimer in the | |
documentation and/or other materials provided with the distribution. | |
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | |
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY | |
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | |
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | |
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | |
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | |
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
*/ | |
/*jslint vars:false, bitwise:true*/ | |
/*jshint indent:4*/ | |
/*global exports:true*/ | |
(function clone(exports) { | |
var Syntax, VisitorOption, VisitorKeys, BREAK, SKIP, REMOVE; | |
function deepCopy(obj) { | |
var ret = {}, | |
key, | |
val; | |
for (key in obj) { | |
if (obj.hasOwnProperty(key)) { | |
val = obj[key]; | |
if (typeof val === 'object' && val !== null) { | |
ret[key] = deepCopy(val); | |
} else { | |
ret[key] = val; | |
} | |
} | |
} | |
return ret; | |
} // based on LLVM libc++ upper_bound / lower_bound | |
// MIT License | |
function upperBound(array, func) { | |
var diff, len, i, current; | |
len = array.length; | |
i = 0; | |
while (len) { | |
diff = len >>> 1; | |
current = i + diff; | |
if (func(array[current])) { | |
len = diff; | |
} else { | |
i = current + 1; | |
len -= diff + 1; | |
} | |
} | |
return i; | |
} | |
Syntax = { | |
AssignmentExpression: 'AssignmentExpression', | |
AssignmentPattern: 'AssignmentPattern', | |
ArrayExpression: 'ArrayExpression', | |
ArrayPattern: 'ArrayPattern', | |
ArrowFunctionExpression: 'ArrowFunctionExpression', | |
AwaitExpression: 'AwaitExpression', | |
// CAUTION: It's deferred to ES7. | |
BlockStatement: 'BlockStatement', | |
BinaryExpression: 'BinaryExpression', | |
BreakStatement: 'BreakStatement', | |
CallExpression: 'CallExpression', | |
CatchClause: 'CatchClause', | |
ChainExpression: 'ChainExpression', | |
ClassBody: 'ClassBody', | |
ClassDeclaration: 'ClassDeclaration', | |
ClassExpression: 'ClassExpression', | |
ComprehensionBlock: 'ComprehensionBlock', | |
// CAUTION: It's deferred to ES7. | |
ComprehensionExpression: 'ComprehensionExpression', | |
// CAUTION: It's deferred to ES7. | |
ConditionalExpression: 'ConditionalExpression', | |
ContinueStatement: 'ContinueStatement', | |
DebuggerStatement: 'DebuggerStatement', | |
DirectiveStatement: 'DirectiveStatement', | |
DoWhileStatement: 'DoWhileStatement', | |
EmptyStatement: 'EmptyStatement', | |
ExportAllDeclaration: 'ExportAllDeclaration', | |
ExportDefaultDeclaration: 'ExportDefaultDeclaration', | |
ExportNamedDeclaration: 'ExportNamedDeclaration', | |
ExportSpecifier: 'ExportSpecifier', | |
ExpressionStatement: 'ExpressionStatement', | |
ForStatement: 'ForStatement', | |
ForInStatement: 'ForInStatement', | |
ForOfStatement: 'ForOfStatement', | |
FunctionDeclaration: 'FunctionDeclaration', | |
FunctionExpression: 'FunctionExpression', | |
GeneratorExpression: 'GeneratorExpression', | |
// CAUTION: It's deferred to ES7. | |
Identifier: 'Identifier', | |
IfStatement: 'IfStatement', | |
ImportExpression: 'ImportExpression', | |
ImportDeclaration: 'ImportDeclaration', | |
ImportDefaultSpecifier: 'ImportDefaultSpecifier', | |
ImportNamespaceSpecifier: 'ImportNamespaceSpecifier', | |
ImportSpecifier: 'ImportSpecifier', | |
Literal: 'Literal', | |
LabeledStatement: 'LabeledStatement', | |
LogicalExpression: 'LogicalExpression', | |
MemberExpression: 'MemberExpression', | |
MetaProperty: 'MetaProperty', | |
MethodDefinition: 'MethodDefinition', | |
ModuleSpecifier: 'ModuleSpecifier', | |
NewExpression: 'NewExpression', | |
ObjectExpression: 'ObjectExpression', | |
ObjectPattern: 'ObjectPattern', | |
PrivateIdentifier: 'PrivateIdentifier', | |
Program: 'Program', | |
Property: 'Property', | |
PropertyDefinition: 'PropertyDefinition', | |
RestElement: 'RestElement', | |
ReturnStatement: 'ReturnStatement', | |
SequenceExpression: 'SequenceExpression', | |
SpreadElement: 'SpreadElement', | |
Super: 'Super', | |
SwitchStatement: 'SwitchStatement', | |
SwitchCase: 'SwitchCase', | |
TaggedTemplateExpression: 'TaggedTemplateExpression', | |
TemplateElement: 'TemplateElement', | |
TemplateLiteral: 'TemplateLiteral', | |
ThisExpression: 'ThisExpression', | |
ThrowStatement: 'ThrowStatement', | |
TryStatement: 'TryStatement', | |
UnaryExpression: 'UnaryExpression', | |
UpdateExpression: 'UpdateExpression', | |
VariableDeclaration: 'VariableDeclaration', | |
VariableDeclarator: 'VariableDeclarator', | |
WhileStatement: 'WhileStatement', | |
WithStatement: 'WithStatement', | |
YieldExpression: 'YieldExpression' | |
}; | |
VisitorKeys = { | |
AssignmentExpression: ['left', 'right'], | |
AssignmentPattern: ['left', 'right'], | |
ArrayExpression: ['elements'], | |
ArrayPattern: ['elements'], | |
ArrowFunctionExpression: ['params', 'body'], | |
AwaitExpression: ['argument'], | |
// CAUTION: It's deferred to ES7. | |
BlockStatement: ['body'], | |
BinaryExpression: ['left', 'right'], | |
BreakStatement: ['label'], | |
CallExpression: ['callee', 'arguments'], | |
CatchClause: ['param', 'body'], | |
ChainExpression: ['expression'], | |
ClassBody: ['body'], | |
ClassDeclaration: ['id', 'superClass', 'body'], | |
ClassExpression: ['id', 'superClass', 'body'], | |
ComprehensionBlock: ['left', 'right'], | |
// CAUTION: It's deferred to ES7. | |
ComprehensionExpression: ['blocks', 'filter', 'body'], | |
// CAUTION: It's deferred to ES7. | |
ConditionalExpression: ['test', 'consequent', 'alternate'], | |
ContinueStatement: ['label'], | |
DebuggerStatement: [], | |
DirectiveStatement: [], | |
DoWhileStatement: ['body', 'test'], | |
EmptyStatement: [], | |
ExportAllDeclaration: ['source'], | |
ExportDefaultDeclaration: ['declaration'], | |
ExportNamedDeclaration: ['declaration', 'specifiers', 'source'], | |
ExportSpecifier: ['exported', 'local'], | |
ExpressionStatement: ['expression'], | |
ForStatement: ['init', 'test', 'update', 'body'], | |
ForInStatement: ['left', 'right', 'body'], | |
ForOfStatement: ['left', 'right', 'body'], | |
FunctionDeclaration: ['id', 'params', 'body'], | |
FunctionExpression: ['id', 'params', 'body'], | |
GeneratorExpression: ['blocks', 'filter', 'body'], | |
// CAUTION: It's deferred to ES7. | |
Identifier: [], | |
IfStatement: ['test', 'consequent', 'alternate'], | |
ImportExpression: ['source'], | |
ImportDeclaration: ['specifiers', 'source'], | |
ImportDefaultSpecifier: ['local'], | |
ImportNamespaceSpecifier: ['local'], | |
ImportSpecifier: ['imported', 'local'], | |
Literal: [], | |
LabeledStatement: ['label', 'body'], | |
LogicalExpression: ['left', 'right'], | |
MemberExpression: ['object', 'property'], | |
MetaProperty: ['meta', 'property'], | |
MethodDefinition: ['key', 'value'], | |
ModuleSpecifier: [], | |
NewExpression: ['callee', 'arguments'], | |
ObjectExpression: ['properties'], | |
ObjectPattern: ['properties'], | |
PrivateIdentifier: [], | |
Program: ['body'], | |
Property: ['key', 'value'], | |
PropertyDefinition: ['key', 'value'], | |
RestElement: ['argument'], | |
ReturnStatement: ['argument'], | |
SequenceExpression: ['expressions'], | |
SpreadElement: ['argument'], | |
Super: [], | |
SwitchStatement: ['discriminant', 'cases'], | |
SwitchCase: ['test', 'consequent'], | |
TaggedTemplateExpression: ['tag', 'quasi'], | |
TemplateElement: [], | |
TemplateLiteral: ['quasis', 'expressions'], | |
ThisExpression: [], | |
ThrowStatement: ['argument'], | |
TryStatement: ['block', 'handler', 'finalizer'], | |
UnaryExpression: ['argument'], | |
UpdateExpression: ['argument'], | |
VariableDeclaration: ['declarations'], | |
VariableDeclarator: ['id', 'init'], | |
WhileStatement: ['test', 'body'], | |
WithStatement: ['object', 'body'], | |
YieldExpression: ['argument'] | |
}; // unique id | |
BREAK = {}; | |
SKIP = {}; | |
REMOVE = {}; | |
VisitorOption = { | |
Break: BREAK, | |
Skip: SKIP, | |
Remove: REMOVE | |
}; | |
function Reference(parent, key) { | |
(this || _global$O).parent = parent; | |
(this || _global$O).key = key; | |
} | |
Reference.prototype.replace = function replace(node) { | |
(this || _global$O).parent[(this || _global$O).key] = node; | |
}; | |
Reference.prototype.remove = function remove() { | |
if (Array.isArray((this || _global$O).parent)) { | |
(this || _global$O).parent.splice((this || _global$O).key, 1); | |
return true; | |
} else { | |
this.replace(null); | |
return false; | |
} | |
}; | |
function Element(node, path, wrap, ref) { | |
(this || _global$O).node = node; | |
(this || _global$O).path = path; | |
(this || _global$O).wrap = wrap; | |
(this || _global$O).ref = ref; | |
} | |
function Controller() {} // API: | |
// return property path array from root to current node | |
Controller.prototype.path = function path() { | |
var i, iz, j, jz, result, element; | |
function addToPath(result, path) { | |
if (Array.isArray(path)) { | |
for (j = 0, jz = path.length; j < jz; ++j) { | |
result.push(path[j]); | |
} | |
} else { | |
result.push(path); | |
} | |
} // root node | |
if (!(this || _global$O).__current.path) { | |
return null; | |
} // first node is sentinel, second node is root element | |
result = []; | |
for (i = 2, iz = (this || _global$O).__leavelist.length; i < iz; ++i) { | |
element = (this || _global$O).__leavelist[i]; | |
addToPath(result, element.path); | |
} | |
addToPath(result, (this || _global$O).__current.path); | |
return result; | |
}; // API: | |
// return type of current node | |
Controller.prototype.type = function () { | |
var node = this.current(); | |
return node.type || (this || _global$O).__current.wrap; | |
}; // API: | |
// return array of parent elements | |
Controller.prototype.parents = function parents() { | |
var i, iz, result; // first node is sentinel | |
result = []; | |
for (i = 1, iz = (this || _global$O).__leavelist.length; i < iz; ++i) { | |
result.push((this || _global$O).__leavelist[i].node); | |
} | |
return result; | |
}; // API: | |
// return current node | |
Controller.prototype.current = function current() { | |
return (this || _global$O).__current.node; | |
}; | |
Controller.prototype.__execute = function __execute(callback, element) { | |
var previous, result; | |
result = undefined; | |
previous = (this || _global$O).__current; | |
(this || _global$O).__current = element; | |
(this || _global$O).__state = null; | |
if (callback) { | |
result = callback.call(this || _global$O, element.node, (this || _global$O).__leavelist[(this || _global$O).__leavelist.length - 1].node); | |
} | |
(this || _global$O).__current = previous; | |
return result; | |
}; // API: | |
// notify control skip / break | |
Controller.prototype.notify = function notify(flag) { | |
(this || _global$O).__state = flag; | |
}; // API: | |
// skip child nodes of current node | |
Controller.prototype.skip = function () { | |
this.notify(SKIP); | |
}; // API: | |
// break traversals | |
Controller.prototype['break'] = function () { | |
this.notify(BREAK); | |
}; // API: | |
// remove node | |
Controller.prototype.remove = function () { | |
this.notify(REMOVE); | |
}; | |
Controller.prototype.__initialize = function (root, visitor) { | |
(this || _global$O).visitor = visitor; | |
(this || _global$O).root = root; | |
(this || _global$O).__worklist = []; | |
(this || _global$O).__leavelist = []; | |
(this || _global$O).__current = null; | |
(this || _global$O).__state = null; | |
(this || _global$O).__fallback = null; | |
if (visitor.fallback === 'iteration') { | |
(this || _global$O).__fallback = Object.keys; | |
} else if (typeof visitor.fallback === 'function') { | |
(this || _global$O).__fallback = visitor.fallback; | |
} | |
(this || _global$O).__keys = VisitorKeys; | |
if (visitor.keys) { | |
(this || _global$O).__keys = Object.assign(Object.create((this || _global$O).__keys), visitor.keys); | |
} | |
}; | |
function isNode(node) { | |
if (node == null) { | |
return false; | |
} | |
return typeof node === 'object' && typeof node.type === 'string'; | |
} | |
function isProperty(nodeType, key) { | |
return (nodeType === Syntax.ObjectExpression || nodeType === Syntax.ObjectPattern) && 'properties' === key; | |
} | |
function candidateExistsInLeaveList(leavelist, candidate) { | |
for (var i = leavelist.length - 1; i >= 0; --i) { | |
if (leavelist[i].node === candidate) { | |
return true; | |
} | |
} | |
return false; | |
} | |
Controller.prototype.traverse = function traverse(root, visitor) { | |
var worklist, leavelist, element, node, nodeType, ret, key, current, current2, candidates, candidate, sentinel; | |
this.__initialize(root, visitor); | |
sentinel = {}; // reference | |
worklist = (this || _global$O).__worklist; | |
leavelist = (this || _global$O).__leavelist; // initialize | |
worklist.push(new Element(root, null, null, null)); | |
leavelist.push(new Element(null, null, null, null)); | |
while (worklist.length) { | |
element = worklist.pop(); | |
if (element === sentinel) { | |
element = leavelist.pop(); | |
ret = this.__execute(visitor.leave, element); | |
if ((this || _global$O).__state === BREAK || ret === BREAK) { | |
return; | |
} | |
continue; | |
} | |
if (element.node) { | |
ret = this.__execute(visitor.enter, element); | |
if ((this || _global$O).__state === BREAK || ret === BREAK) { | |
return; | |
} | |
worklist.push(sentinel); | |
leavelist.push(element); | |
if ((this || _global$O).__state === SKIP || ret === SKIP) { | |
continue; | |
} | |
node = element.node; | |
nodeType = node.type || element.wrap; | |
candidates = (this || _global$O).__keys[nodeType]; | |
if (!candidates) { | |
if ((this || _global$O).__fallback) { | |
candidates = this.__fallback(node); | |
} else { | |
throw new Error('Unknown node type ' + nodeType + '.'); | |
} | |
} | |
current = candidates.length; | |
while ((current -= 1) >= 0) { | |
key = candidates[current]; | |
candidate = node[key]; | |
if (!candidate) { | |
continue; | |
} | |
if (Array.isArray(candidate)) { | |
current2 = candidate.length; | |
while ((current2 -= 1) >= 0) { | |
if (!candidate[current2]) { | |
continue; | |
} | |
if (candidateExistsInLeaveList(leavelist, candidate[current2])) { | |
continue; | |
} | |
if (isProperty(nodeType, candidates[current])) { | |
element = new Element(candidate[current2], [key, current2], 'Property', null); | |
} else if (isNode(candidate[current2])) { | |
element = new Element(candidate[current2], [key, current2], null, null); | |
} else { | |
continue; | |
} | |
worklist.push(element); | |
} | |
} else if (isNode(candidate)) { | |
if (candidateExistsInLeaveList(leavelist, candidate)) { | |
continue; | |
} | |
worklist.push(new Element(candidate, key, null, null)); | |
} | |
} | |
} | |
} | |
}; | |
Controller.prototype.replace = function replace(root, visitor) { | |
var worklist, leavelist, node, nodeType, target, element, current, current2, candidates, candidate, sentinel, outer, key; | |
function removeElem(element) { | |
var i, key, nextElem, parent; | |
if (element.ref.remove()) { | |
// When the reference is an element of an array. | |
key = element.ref.key; | |
parent = element.ref.parent; // If removed from array, then decrease following items' keys. | |
i = worklist.length; | |
while (i--) { | |
nextElem = worklist[i]; | |
if (nextElem.ref && nextElem.ref.parent === parent) { | |
if (nextElem.ref.key < key) { | |
break; | |
} | |
--nextElem.ref.key; | |
} | |
} | |
} | |
} | |
this.__initialize(root, visitor); | |
sentinel = {}; // reference | |
worklist = (this || _global$O).__worklist; | |
leavelist = (this || _global$O).__leavelist; // initialize | |
outer = { | |
root: root | |
}; | |
element = new Element(root, null, null, new Reference(outer, 'root')); | |
worklist.push(element); | |
leavelist.push(element); | |
while (worklist.length) { | |
element = worklist.pop(); | |
if (element === sentinel) { | |
element = leavelist.pop(); | |
target = this.__execute(visitor.leave, element); // node may be replaced with null, | |
// so distinguish between undefined and null in this place | |
if (target !== undefined && target !== BREAK && target !== SKIP && target !== REMOVE) { | |
// replace | |
element.ref.replace(target); | |
} | |
if ((this || _global$O).__state === REMOVE || target === REMOVE) { | |
removeElem(element); | |
} | |
if ((this || _global$O).__state === BREAK || target === BREAK) { | |
return outer.root; | |
} | |
continue; | |
} | |
target = this.__execute(visitor.enter, element); // node may be replaced with null, | |
// so distinguish between undefined and null in this place | |
if (target !== undefined && target !== BREAK && target !== SKIP && target !== REMOVE) { | |
// replace | |
element.ref.replace(target); | |
element.node = target; | |
} | |
if ((this || _global$O).__state === REMOVE || target === REMOVE) { | |
removeElem(element); | |
element.node = null; | |
} | |
if ((this || _global$O).__state === BREAK || target === BREAK) { | |
return outer.root; | |
} // node may be null | |
node = element.node; | |
if (!node) { | |
continue; | |
} | |
worklist.push(sentinel); | |
leavelist.push(element); | |
if ((this || _global$O).__state === SKIP || target === SKIP) { | |
continue; | |
} | |
nodeType = node.type || element.wrap; | |
candidates = (this || _global$O).__keys[nodeType]; | |
if (!candidates) { | |
if ((this || _global$O).__fallback) { | |
candidates = this.__fallback(node); | |
} else { | |
throw new Error('Unknown node type ' + nodeType + '.'); | |
} | |
} | |
current = candidates.length; | |
while ((current -= 1) >= 0) { | |
key = candidates[current]; | |
candidate = node[key]; | |
if (!candidate) { | |
continue; | |
} | |
if (Array.isArray(candidate)) { | |
current2 = candidate.length; | |
while ((current2 -= 1) >= 0) { | |
if (!candidate[current2]) { | |
continue; | |
} | |
if (isProperty(nodeType, candidates[current])) { | |
element = new Element(candidate[current2], [key, current2], 'Property', new Reference(candidate, current2)); | |
} else if (isNode(candidate[current2])) { | |
element = new Element(candidate[current2], [key, current2], null, new Reference(candidate, current2)); | |
} else { | |
continue; | |
} | |
worklist.push(element); | |
} | |
} else if (isNode(candidate)) { | |
worklist.push(new Element(candidate, key, null, new Reference(node, key))); | |
} | |
} | |
} | |
return outer.root; | |
}; | |
function traverse(root, visitor) { | |
var controller = new Controller(); | |
return controller.traverse(root, visitor); | |
} | |
function replace(root, visitor) { | |
var controller = new Controller(); | |
return controller.replace(root, visitor); | |
} | |
function extendCommentRange(comment, tokens) { | |
var target; | |
target = upperBound(tokens, function search(token) { | |
return token.range[0] > comment.range[0]; | |
}); | |
comment.extendedRange = [comment.range[0], comment.range[1]]; | |
if (target !== tokens.length) { | |
comment.extendedRange[1] = tokens[target].range[0]; | |
} | |
target -= 1; | |
if (target >= 0) { | |
comment.extendedRange[0] = tokens[target].range[1]; | |
} | |
return comment; | |
} | |
function attachComments(tree, providedComments, tokens) { | |
// At first, we should calculate extended comment ranges. | |
var comments = [], | |
comment, | |
len, | |
i, | |
cursor; | |
if (!tree.range) { | |
throw new Error('attachComments needs range information'); | |
} // tokens array is empty, we attach comments to tree as 'leadingComments' | |
if (!tokens.length) { | |
if (providedComments.length) { | |
for (i = 0, len = providedComments.length; i < len; i += 1) { | |
comment = deepCopy(providedComments[i]); | |
comment.extendedRange = [0, tree.range[0]]; | |
comments.push(comment); | |
} | |
tree.leadingComments = comments; | |
} | |
return tree; | |
} | |
for (i = 0, len = providedComments.length; i < len; i += 1) { | |
comments.push(extendCommentRange(deepCopy(providedComments[i]), tokens)); | |
} // This is based on John Freeman's implementation. | |
cursor = 0; | |
traverse(tree, { | |
enter: function (node) { | |
var comment; | |
while (cursor < comments.length) { | |
comment = comments[cursor]; | |
if (comment.extendedRange[1] > node.range[0]) { | |
break; | |
} | |
if (comment.extendedRange[1] === node.range[0]) { | |
if (!node.leadingComments) { | |
node.leadingComments = []; | |
} | |
node.leadingComments.push(comment); | |
comments.splice(cursor, 1); | |
} else { | |
cursor += 1; | |
} | |
} // already out of owned node | |
if (cursor === comments.length) { | |
return VisitorOption.Break; | |
} | |
if (comments[cursor].extendedRange[0] > node.range[1]) { | |
return VisitorOption.Skip; | |
} | |
} | |
}); | |
cursor = 0; | |
traverse(tree, { | |
leave: function (node) { | |
var comment; | |
while (cursor < comments.length) { | |
comment = comments[cursor]; | |
if (node.range[1] < comment.extendedRange[0]) { | |
break; | |
} | |
if (node.range[1] === comment.extendedRange[0]) { | |
if (!node.trailingComments) { | |
node.trailingComments = []; | |
} | |
node.trailingComments.push(comment); | |
comments.splice(cursor, 1); | |
} else { | |
cursor += 1; | |
} | |
} // already out of owned node | |
if (cursor === comments.length) { | |
return VisitorOption.Break; | |
} | |
if (comments[cursor].extendedRange[0] > node.range[1]) { | |
return VisitorOption.Skip; | |
} | |
} | |
}); | |
return tree; | |
} | |
exports.Syntax = Syntax; | |
exports.traverse = traverse; | |
exports.replace = replace; | |
exports.attachComments = attachComments; | |
exports.VisitorKeys = VisitorKeys; | |
exports.VisitorOption = VisitorOption; | |
exports.Controller = Controller; | |
exports.cloneEnvironment = function () { | |
return clone({}); | |
}; | |
return exports; | |
})(exports$a8); | |
/* vim: set sw=4 ts=4 et tw=80 : */ | |
return exports$a8; | |
} | |
var exports$a7 = {}, | |
_dewExec$9S = false; | |
function dew$a7() { | |
if (_dewExec$9S) return exports$a7; | |
_dewExec$9S = true; | |
/* | |
Copyright (C) 2013 Yusuke Suzuki <[email protected]> | |
Redistribution and use in source and binary forms, with or without | |
modification, are permitted provided that the following conditions are met: | |
* Redistributions of source code must retain the above copyright | |
notice, this list of conditions and the following disclaimer. | |
* Redistributions in binary form must reproduce the above copyright | |
notice, this list of conditions and the following disclaimer in the | |
documentation and/or other materials provided with the distribution. | |
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS' | |
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY | |
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | |
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | |
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | |
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | |
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
*/ | |
(function () { | |
function isExpression(node) { | |
if (node == null) { | |
return false; | |
} | |
switch (node.type) { | |
case 'ArrayExpression': | |
case 'AssignmentExpression': | |
case 'BinaryExpression': | |
case 'CallExpression': | |
case 'ConditionalExpression': | |
case 'FunctionExpression': | |
case 'Identifier': | |
case 'Literal': | |
case 'LogicalExpression': | |
case 'MemberExpression': | |
case 'NewExpression': | |
case 'ObjectExpression': | |
case 'SequenceExpression': | |
case 'ThisExpression': | |
case 'UnaryExpression': | |
case 'UpdateExpression': | |
return true; | |
} | |
return false; | |
} | |
function isIterationStatement(node) { | |
if (node == null) { | |
return false; | |
} | |
switch (node.type) { | |
case 'DoWhileStatement': | |
case 'ForInStatement': | |
case 'ForStatement': | |
case 'WhileStatement': | |
return true; | |
} | |
return false; | |
} | |
function isStatement(node) { | |
if (node == null) { | |
return false; | |
} | |
switch (node.type) { | |
case 'BlockStatement': | |
case 'BreakStatement': | |
case 'ContinueStatement': | |
case 'DebuggerStatement': | |
case 'DoWhileStatement': | |
case 'EmptyStatement': | |
case 'ExpressionStatement': | |
case 'ForInStatement': | |
case 'ForStatement': | |
case 'IfStatement': | |
case 'LabeledStatement': | |
case 'ReturnStatement': | |
case 'SwitchStatement': | |
case 'ThrowStatement': | |
case 'TryStatement': | |
case 'VariableDeclaration': | |
case 'WhileStatement': | |
case 'WithStatement': | |
return true; | |
} | |
return false; | |
} | |
function isSourceElement(node) { | |
return isStatement(node) || node != null && node.type === 'FunctionDeclaration'; | |
} | |
function trailingStatement(node) { | |
switch (node.type) { | |
case 'IfStatement': | |
if (node.alternate != null) { | |
return node.alternate; | |
} | |
return node.consequent; | |
case 'LabeledStatement': | |
case 'ForStatement': | |
case 'ForInStatement': | |
case 'WhileStatement': | |
case 'WithStatement': | |
return node.body; | |
} | |
return null; | |
} | |
function isProblematicIfStatement(node) { | |
var current; | |
if (node.type !== 'IfStatement') { | |
return false; | |
} | |
if (node.alternate == null) { | |
return false; | |
} | |
current = node.consequent; | |
do { | |
if (current.type === 'IfStatement') { | |
if (current.alternate == null) { | |
return true; | |
} | |
} | |
current = trailingStatement(current); | |
} while (current); | |
return false; | |
} | |
exports$a7 = { | |
isExpression: isExpression, | |
isStatement: isStatement, | |
isIterationStatement: isIterationStatement, | |
isSourceElement: isSourceElement, | |
isProblematicIfStatement: isProblematicIfStatement, | |
trailingStatement: trailingStatement | |
}; | |
})(); | |
/* vim: set sw=4 ts=4 et tw=80 : */ | |
return exports$a7; | |
} | |
var exports$a6 = {}, | |
_dewExec$9R = false; | |
function dew$a6() { | |
if (_dewExec$9R) return exports$a6; | |
_dewExec$9R = true; | |
/* | |
Copyright (C) 2013-2014 Yusuke Suzuki <[email protected]> | |
Copyright (C) 2014 Ivan Nikulin <[email protected]> | |
Redistribution and use in source and binary forms, with or without | |
modification, are permitted provided that the following conditions are met: | |
* Redistributions of source code must retain the above copyright | |
notice, this list of conditions and the following disclaimer. | |
* Redistributions in binary form must reproduce the above copyright | |
notice, this list of conditions and the following disclaimer in the | |
documentation and/or other materials provided with the distribution. | |
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | |
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY | |
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | |
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | |
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | |
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | |
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
*/ | |
(function () { | |
var ES6Regex, ES5Regex, NON_ASCII_WHITESPACES, IDENTIFIER_START, IDENTIFIER_PART, ch; // See `tools/generate-identifier-regex.js`. | |
ES5Regex = { | |
// ECMAScript 5.1/Unicode v9.0.0 NonAsciiIdentifierStart: | |
NonAsciiIdentifierStart: /[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]/, | |
// ECMAScript 5.1/Unicode v9.0.0 NonAsciiIdentifierPart: | |
NonAsciiIdentifierPart: /[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u08A0-\u08B4\u08B6-\u08BD\u08D4-\u08E1\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C80-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D01-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D54-\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19D9\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1CD0-\u1CD2\u1CD4-\u1CF6\u1CF8\u1CF9\u1D00-\u1DF5\u1DFB-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u200C\u200D\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u2E2F\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099\u309A\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]/ | |
}; | |
ES6Regex = { | |
// ECMAScript 6/Unicode v9.0.0 NonAsciiIdentifierStart: | |
NonAsciiIdentifierStart: /[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309B-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF30-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF19]|\uD806[\uDCA0-\uDCDF\uDCFF\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50\uDF93-\uDF9F\uDFE0]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00\uDC01]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1]|\uD87E[\uDC00-\uDE1D]/, | |
// ECMAScript 6/Unicode v9.0.0 NonAsciiIdentifierPart: | |
NonAsciiIdentifierPart: /[\xAA\xB5\xB7\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u08A0-\u08B4\u08B6-\u08BD\u08D4-\u08E1\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C80-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D01-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D54-\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1369-\u1371\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19DA\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1CD0-\u1CD2\u1CD4-\u1CF6\u1CF8\u1CF9\u1D00-\u1DF5\u1DFB-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u200C\u200D\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0\uDF00-\uDF1F\uDF30-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDCA-\uDDCC\uDDD0-\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE37\uDE3E\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3C-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF50\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC00-\uDC4A\uDC50-\uDC59\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDDD8-\uDDDD\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB7\uDEC0-\uDEC9\uDF00-\uDF19\uDF1D-\uDF2B\uDF30-\uDF39]|\uD806[\uDCA0-\uDCE9\uDCFF\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC36\uDC38-\uDC40\uDC50-\uDC59\uDC72-\uDC8F\uDC92-\uDCA7\uDCA9-\uDCB6]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50-\uDF7E\uDF8F-\uDF9F\uDFE0]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00\uDC01]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6\uDD00-\uDD4A\uDD50-\uDD59]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF]/ | |
}; | |
function isDecimalDigit(ch) { | |
return 0x30 <= ch && ch <= 0x39; // 0..9 | |
} | |
function isHexDigit(ch) { | |
return 0x30 <= ch && ch <= 0x39 || // 0..9 | |
0x61 <= ch && ch <= 0x66 || // a..f | |
0x41 <= ch && ch <= 0x46; // A..F | |
} | |
function isOctalDigit(ch) { | |
return ch >= 0x30 && ch <= 0x37; // 0..7 | |
} // 7.2 White Space | |
NON_ASCII_WHITESPACES = [0x1680, 0x2000, 0x2001, 0x2002, 0x2003, 0x2004, 0x2005, 0x2006, 0x2007, 0x2008, 0x2009, 0x200A, 0x202F, 0x205F, 0x3000, 0xFEFF]; | |
function isWhiteSpace(ch) { | |
return ch === 0x20 || ch === 0x09 || ch === 0x0B || ch === 0x0C || ch === 0xA0 || ch >= 0x1680 && NON_ASCII_WHITESPACES.indexOf(ch) >= 0; | |
} // 7.3 Line Terminators | |
function isLineTerminator(ch) { | |
return ch === 0x0A || ch === 0x0D || ch === 0x2028 || ch === 0x2029; | |
} // 7.6 Identifier Names and Identifiers | |
function fromCodePoint(cp) { | |
if (cp <= 0xFFFF) { | |
return String.fromCharCode(cp); | |
} | |
var cu1 = String.fromCharCode(Math.floor((cp - 0x10000) / 0x400) + 0xD800); | |
var cu2 = String.fromCharCode((cp - 0x10000) % 0x400 + 0xDC00); | |
return cu1 + cu2; | |
} | |
IDENTIFIER_START = new Array(0x80); | |
for (ch = 0; ch < 0x80; ++ch) { | |
IDENTIFIER_START[ch] = ch >= 0x61 && ch <= 0x7A || // a..z | |
ch >= 0x41 && ch <= 0x5A || // A..Z | |
ch === 0x24 || ch === 0x5F; // $ (dollar) and _ (underscore) | |
} | |
IDENTIFIER_PART = new Array(0x80); | |
for (ch = 0; ch < 0x80; ++ch) { | |
IDENTIFIER_PART[ch] = ch >= 0x61 && ch <= 0x7A || // a..z | |
ch >= 0x41 && ch <= 0x5A || // A..Z | |
ch >= 0x30 && ch <= 0x39 || // 0..9 | |
ch === 0x24 || ch === 0x5F; // $ (dollar) and _ (underscore) | |
} | |
function isIdentifierStartES5(ch) { | |
return ch < 0x80 ? IDENTIFIER_START[ch] : ES5Regex.NonAsciiIdentifierStart.test(fromCodePoint(ch)); | |
} | |
function isIdentifierPartES5(ch) { | |
return ch < 0x80 ? IDENTIFIER_PART[ch] : ES5Regex.NonAsciiIdentifierPart.test(fromCodePoint(ch)); | |
} | |
function isIdentifierStartES6(ch) { | |
return ch < 0x80 ? IDENTIFIER_START[ch] : ES6Regex.NonAsciiIdentifierStart.test(fromCodePoint(ch)); | |
} | |
function isIdentifierPartES6(ch) { | |
return ch < 0x80 ? IDENTIFIER_PART[ch] : ES6Regex.NonAsciiIdentifierPart.test(fromCodePoint(ch)); | |
} | |
exports$a6 = { | |
isDecimalDigit: isDecimalDigit, | |
isHexDigit: isHexDigit, | |
isOctalDigit: isOctalDigit, | |
isWhiteSpace: isWhiteSpace, | |
isLineTerminator: isLineTerminator, | |
isIdentifierStartES5: isIdentifierStartES5, | |
isIdentifierPartES5: isIdentifierPartES5, | |
isIdentifierStartES6: isIdentifierStartES6, | |
isIdentifierPartES6: isIdentifierPartES6 | |
}; | |
})(); | |
/* vim: set sw=4 ts=4 et tw=80 : */ | |
return exports$a6; | |
} | |
var exports$a5 = {}, | |
_dewExec$9Q = false; | |
function dew$a5() { | |
if (_dewExec$9Q) return exports$a5; | |
_dewExec$9Q = true; | |
/* | |
Copyright (C) 2013 Yusuke Suzuki <[email protected]> | |
Redistribution and use in source and binary forms, with or without | |
modification, are permitted provided that the following conditions are met: | |
* Redistributions of source code must retain the above copyright | |
notice, this list of conditions and the following disclaimer. | |
* Redistributions in binary form must reproduce the above copyright | |
notice, this list of conditions and the following disclaimer in the | |
documentation and/or other materials provided with the distribution. | |
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | |
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY | |
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | |
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | |
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | |
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | |
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
*/ | |
(function () { | |
var code = dew$a6(); | |
function isStrictModeReservedWordES6(id) { | |
switch (id) { | |
case 'implements': | |
case 'interface': | |
case 'package': | |
case 'private': | |
case 'protected': | |
case 'public': | |
case 'static': | |
case 'let': | |
return true; | |
default: | |
return false; | |
} | |
} | |
function isKeywordES5(id, strict) { | |
// yield should not be treated as keyword under non-strict mode. | |
if (!strict && id === 'yield') { | |
return false; | |
} | |
return isKeywordES6(id, strict); | |
} | |
function isKeywordES6(id, strict) { | |
if (strict && isStrictModeReservedWordES6(id)) { | |
return true; | |
} | |
switch (id.length) { | |
case 2: | |
return id === 'if' || id === 'in' || id === 'do'; | |
case 3: | |
return id === 'var' || id === 'for' || id === 'new' || id === 'try'; | |
case 4: | |
return id === 'this' || id === 'else' || id === 'case' || id === 'void' || id === 'with' || id === 'enum'; | |
case 5: | |
return id === 'while' || id === 'break' || id === 'catch' || id === 'throw' || id === 'const' || id === 'yield' || id === 'class' || id === 'super'; | |
case 6: | |
return id === 'return' || id === 'typeof' || id === 'delete' || id === 'switch' || id === 'export' || id === 'import'; | |
case 7: | |
return id === 'default' || id === 'finally' || id === 'extends'; | |
case 8: | |
return id === 'function' || id === 'continue' || id === 'debugger'; | |
case 10: | |
return id === 'instanceof'; | |
default: | |
return false; | |
} | |
} | |
function isReservedWordES5(id, strict) { | |
return id === 'null' || id === 'true' || id === 'false' || isKeywordES5(id, strict); | |
} | |
function isReservedWordES6(id, strict) { | |
return id === 'null' || id === 'true' || id === 'false' || isKeywordES6(id, strict); | |
} | |
function isRestrictedWord(id) { | |
return id === 'eval' || id === 'arguments'; | |
} | |
function isIdentifierNameES5(id) { | |
var i, iz, ch; | |
if (id.length === 0) { | |
return false; | |
} | |
ch = id.charCodeAt(0); | |
if (!code.isIdentifierStartES5(ch)) { | |
return false; | |
} | |
for (i = 1, iz = id.length; i < iz; ++i) { | |
ch = id.charCodeAt(i); | |
if (!code.isIdentifierPartES5(ch)) { | |
return false; | |
} | |
} | |
return true; | |
} | |
function decodeUtf16(lead, trail) { | |
return (lead - 0xD800) * 0x400 + (trail - 0xDC00) + 0x10000; | |
} | |
function isIdentifierNameES6(id) { | |
var i, iz, ch, lowCh, check; | |
if (id.length === 0) { | |
return false; | |
} | |
check = code.isIdentifierStartES6; | |
for (i = 0, iz = id.length; i < iz; ++i) { | |
ch = id.charCodeAt(i); | |
if (0xD800 <= ch && ch <= 0xDBFF) { | |
++i; | |
if (i >= iz) { | |
return false; | |
} | |
lowCh = id.charCodeAt(i); | |
if (!(0xDC00 <= lowCh && lowCh <= 0xDFFF)) { | |
return false; | |
} | |
ch = decodeUtf16(ch, lowCh); | |
} | |
if (!check(ch)) { | |
return false; | |
} | |
check = code.isIdentifierPartES6; | |
} | |
return true; | |
} | |
function isIdentifierES5(id, strict) { | |
return isIdentifierNameES5(id) && !isReservedWordES5(id, strict); | |
} | |
function isIdentifierES6(id, strict) { | |
return isIdentifierNameES6(id) && !isReservedWordES6(id, strict); | |
} | |
exports$a5 = { | |
isKeywordES5: isKeywordES5, | |
isKeywordES6: isKeywordES6, | |
isReservedWordES5: isReservedWordES5, | |
isReservedWordES6: isReservedWordES6, | |
isRestrictedWord: isRestrictedWord, | |
isIdentifierNameES5: isIdentifierNameES5, | |
isIdentifierNameES6: isIdentifierNameES6, | |
isIdentifierES5: isIdentifierES5, | |
isIdentifierES6: isIdentifierES6 | |
}; | |
})(); | |
/* vim: set sw=4 ts=4 et tw=80 : */ | |
return exports$a5; | |
} | |
var exports$a4 = {}, | |
_dewExec$9P = false; | |
function dew$a4() { | |
if (_dewExec$9P) return exports$a4; | |
_dewExec$9P = true; | |
/* | |
Copyright (C) 2013 Yusuke Suzuki <[email protected]> | |
Redistribution and use in source and binary forms, with or without | |
modification, are permitted provided that the following conditions are met: | |
* Redistributions of source code must retain the above copyright | |
notice, this list of conditions and the following disclaimer. | |
* Redistributions in binary form must reproduce the above copyright | |
notice, this list of conditions and the following disclaimer in the | |
documentation and/or other materials provided with the distribution. | |
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | |
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY | |
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | |
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | |
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | |
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | |
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
*/ | |
(function () { | |
exports$a4.ast = dew$a7(); | |
exports$a4.code = dew$a6(); | |
exports$a4.keyword = dew$a5(); | |
})(); | |
/* vim: set sw=4 ts=4 et tw=80 : */ | |
return exports$a4; | |
} | |
var exports$a3 = {}, | |
_dewExec$9O = false; | |
function dew$a3() { | |
if (_dewExec$9O) return exports$a3; | |
_dewExec$9O = true; | |
/* -*- Mode: js; js-indent-level: 2; -*- */ | |
/* | |
* Copyright 2011 Mozilla Foundation and contributors | |
* Licensed under the New BSD license. See LICENSE or: | |
* http://opensource.org/licenses/BSD-3-Clause | |
*/ | |
var intToCharMap = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'.split(''); | |
/** | |
* Encode an integer in the range of 0 to 63 to a single base 64 digit. | |
*/ | |
exports$a3.encode = function (number) { | |
if (0 <= number && number < intToCharMap.length) { | |
return intToCharMap[number]; | |
} | |
throw new TypeError("Must be between 0 and 63: " + number); | |
}; | |
/** | |
* Decode a single base 64 character code digit to an integer. Returns -1 on | |
* failure. | |
*/ | |
exports$a3.decode = function (charCode) { | |
var bigA = 65; // 'A' | |
var bigZ = 90; // 'Z' | |
var littleA = 97; // 'a' | |
var littleZ = 122; // 'z' | |
var zero = 48; // '0' | |
var nine = 57; // '9' | |
var plus = 43; // '+' | |
var slash = 47; // '/' | |
var littleOffset = 26; | |
var numberOffset = 52; // 0 - 25: ABCDEFGHIJKLMNOPQRSTUVWXYZ | |
if (bigA <= charCode && charCode <= bigZ) { | |
return charCode - bigA; | |
} // 26 - 51: abcdefghijklmnopqrstuvwxyz | |
if (littleA <= charCode && charCode <= littleZ) { | |
return charCode - littleA + littleOffset; | |
} // 52 - 61: 0123456789 | |
if (zero <= charCode && charCode <= nine) { | |
return charCode - zero + numberOffset; | |
} // 62: + | |
if (charCode == plus) { | |
return 62; | |
} // 63: / | |
if (charCode == slash) { | |
return 63; | |
} // Invalid base64 digit. | |
return -1; | |
}; | |
return exports$a3; | |
} | |
var exports$a2 = {}, | |
_dewExec$9N = false; | |
function dew$a2() { | |
if (_dewExec$9N) return exports$a2; | |
_dewExec$9N = true; | |
/* -*- Mode: js; js-indent-level: 2; -*- */ | |
/* | |
* Copyright 2011 Mozilla Foundation and contributors | |
* Licensed under the New BSD license. See LICENSE or: | |
* http://opensource.org/licenses/BSD-3-Clause | |
* | |
* Based on the Base 64 VLQ implementation in Closure Compiler: | |
* https://code.google.com/p/closure-compiler/source/browse/trunk/src/com/google/debugging/sourcemap/Base64VLQ.java | |
* | |
* Copyright 2011 The Closure Compiler Authors. All rights reserved. | |
* Redistribution and use in source and binary forms, with or without | |
* modification, are permitted provided that the following conditions are | |
* met: | |
* | |
* * Redistributions of source code must retain the above copyright | |
* notice, this list of conditions and the following disclaimer. | |
* * Redistributions in binary form must reproduce the above | |
* copyright notice, this list of conditions and the following | |
* disclaimer in the documentation and/or other materials provided | |
* with the distribution. | |
* * Neither the name of Google Inc. nor the names of its | |
* contributors may be used to endorse or promote products derived | |
* from this software without specific prior written permission. | |
* | |
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | |
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | |
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | |
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
*/ | |
var base64 = dew$a3(); // A single base 64 digit can contain 6 bits of data. For the base 64 variable | |
// length quantities we use in the source map spec, the first bit is the sign, | |
// the next four bits are the actual value, and the 6th bit is the | |
// continuation bit. The continuation bit tells us whether there are more | |
// digits in this value following this digit. | |
// | |
// Continuation | |
// | Sign | |
// | | | |
// V V | |
// 101011 | |
var VLQ_BASE_SHIFT = 5; // binary: 100000 | |
var VLQ_BASE = 1 << VLQ_BASE_SHIFT; // binary: 011111 | |
var VLQ_BASE_MASK = VLQ_BASE - 1; // binary: 100000 | |
var VLQ_CONTINUATION_BIT = VLQ_BASE; | |
/** | |
* Converts from a two-complement value to a value where the sign bit is | |
* placed in the least significant bit. For example, as decimals: | |
* 1 becomes 2 (10 binary), -1 becomes 3 (11 binary) | |
* 2 becomes 4 (100 binary), -2 becomes 5 (101 binary) | |
*/ | |
function toVLQSigned(aValue) { | |
return aValue < 0 ? (-aValue << 1) + 1 : (aValue << 1) + 0; | |
} | |
/** | |
* Converts to a two-complement value from a value where the sign bit is | |
* placed in the least significant bit. For example, as decimals: | |
* 2 (10 binary) becomes 1, 3 (11 binary) becomes -1 | |
* 4 (100 binary) becomes 2, 5 (101 binary) becomes -2 | |
*/ | |
function fromVLQSigned(aValue) { | |
var isNegative = (aValue & 1) === 1; | |
var shifted = aValue >> 1; | |
return isNegative ? -shifted : shifted; | |
} | |
/** | |
* Returns the base 64 VLQ encoded value. | |
*/ | |
exports$a2.encode = function base64VLQ_encode(aValue) { | |
var encoded = ""; | |
var digit; | |
var vlq = toVLQSigned(aValue); | |
do { | |
digit = vlq & VLQ_BASE_MASK; | |
vlq >>>= VLQ_BASE_SHIFT; | |
if (vlq > 0) { | |
// There are still more digits in this value, so we must make sure the | |
// continuation bit is marked. | |
digit |= VLQ_CONTINUATION_BIT; | |
} | |
encoded += base64.encode(digit); | |
} while (vlq > 0); | |
return encoded; | |
}; | |
/** | |
* Decodes the next base 64 VLQ value from the given string and returns the | |
* value and the rest of the string via the out parameter. | |
*/ | |
exports$a2.decode = function base64VLQ_decode(aStr, aIndex, aOutParam) { | |
var strLen = aStr.length; | |
var result = 0; | |
var shift = 0; | |
var continuation, digit; | |
do { | |
if (aIndex >= strLen) { | |
throw new Error("Expected more digits in base 64 VLQ value."); | |
} | |
digit = base64.decode(aStr.charCodeAt(aIndex++)); | |
if (digit === -1) { | |
throw new Error("Invalid base64 digit: " + aStr.charAt(aIndex - 1)); | |
} | |
continuation = !!(digit & VLQ_CONTINUATION_BIT); | |
digit &= VLQ_BASE_MASK; | |
result = result + (digit << shift); | |
shift += VLQ_BASE_SHIFT; | |
} while (continuation); | |
aOutParam.value = fromVLQSigned(result); | |
aOutParam.rest = aIndex; | |
}; | |
return exports$a2; | |
} | |
var exports$a1 = {}, | |
_dewExec$9M = false; | |
function dew$a1() { | |
if (_dewExec$9M) return exports$a1; | |
_dewExec$9M = true; | |
/* -*- Mode: js; js-indent-level: 2; -*- */ | |
/* | |
* Copyright 2011 Mozilla Foundation and contributors | |
* Licensed under the New BSD license. See LICENSE or: | |
* http://opensource.org/licenses/BSD-3-Clause | |
*/ | |
/** | |
* This is a helper function for getting values from parameter/options | |
* objects. | |
* | |
* @param args The object we are extracting values from | |
* @param name The name of the property we are getting. | |
* @param defaultValue An optional value to return if the property is missing | |
* from the object. If this is not specified and the property is missing, an | |
* error will be thrown. | |
*/ | |
function getArg(aArgs, aName, aDefaultValue) { | |
if (aName in aArgs) { | |
return aArgs[aName]; | |
} else if (arguments.length === 3) { | |
return aDefaultValue; | |
} else { | |
throw new Error('"' + aName + '" is a required argument.'); | |
} | |
} | |
exports$a1.getArg = getArg; | |
var urlRegexp = /^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.-]*)(?::(\d+))?(.*)$/; | |
var dataUrlRegexp = /^data:.+\,.+$/; | |
function urlParse(aUrl) { | |
var match = aUrl.match(urlRegexp); | |
if (!match) { | |
return null; | |
} | |
return { | |
scheme: match[1], | |
auth: match[2], | |
host: match[3], | |
port: match[4], | |
path: match[5] | |
}; | |
} | |
exports$a1.urlParse = urlParse; | |
function urlGenerate(aParsedUrl) { | |
var url = ''; | |
if (aParsedUrl.scheme) { | |
url += aParsedUrl.scheme + ':'; | |
} | |
url += '//'; | |
if (aParsedUrl.auth) { | |
url += aParsedUrl.auth + '@'; | |
} | |
if (aParsedUrl.host) { | |
url += aParsedUrl.host; | |
} | |
if (aParsedUrl.port) { | |
url += ":" + aParsedUrl.port; | |
} | |
if (aParsedUrl.path) { | |
url += aParsedUrl.path; | |
} | |
return url; | |
} | |
exports$a1.urlGenerate = urlGenerate; | |
/** | |
* Normalizes a path, or the path portion of a URL: | |
* | |
* - Replaces consecutive slashes with one slash. | |
* - Removes unnecessary '.' parts. | |
* - Removes unnecessary '<dir>/..' parts. | |
* | |
* Based on code in the Node.js 'path' core module. | |
* | |
* @param aPath The path or url to normalize. | |
*/ | |
function normalize(aPath) { | |
var path = aPath; | |
var url = urlParse(aPath); | |
if (url) { | |
if (!url.path) { | |
return aPath; | |
} | |
path = url.path; | |
} | |
var isAbsolute = exports$a1.isAbsolute(path); | |
var parts = path.split(/\/+/); | |
for (var part, up = 0, i = parts.length - 1; i >= 0; i--) { | |
part = parts[i]; | |
if (part === '.') { | |
parts.splice(i, 1); | |
} else if (part === '..') { | |
up++; | |
} else if (up > 0) { | |
if (part === '') { | |
// The first part is blank if the path is absolute. Trying to go | |
// above the root is a no-op. Therefore we can remove all '..' parts | |
// directly after the root. | |
parts.splice(i + 1, up); | |
up = 0; | |
} else { | |
parts.splice(i, 2); | |
up--; | |
} | |
} | |
} | |
path = parts.join('/'); | |
if (path === '') { | |
path = isAbsolute ? '/' : '.'; | |
} | |
if (url) { | |
url.path = path; | |
return urlGenerate(url); | |
} | |
return path; | |
} | |
exports$a1.normalize = normalize; | |
/** | |
* Joins two paths/URLs. | |
* | |
* @param aRoot The root path or URL. | |
* @param aPath The path or URL to be joined with the root. | |
* | |
* - If aPath is a URL or a data URI, aPath is returned, unless aPath is a | |
* scheme-relative URL: Then the scheme of aRoot, if any, is prepended | |
* first. | |
* - Otherwise aPath is a path. If aRoot is a URL, then its path portion | |
* is updated with the result and aRoot is returned. Otherwise the result | |
* is returned. | |
* - If aPath is absolute, the result is aPath. | |
* - Otherwise the two paths are joined with a slash. | |
* - Joining for example 'http://' and 'www.example.com' is also supported. | |
*/ | |
function join(aRoot, aPath) { | |
if (aRoot === "") { | |
aRoot = "."; | |
} | |
if (aPath === "") { | |
aPath = "."; | |
} | |
var aPathUrl = urlParse(aPath); | |
var aRootUrl = urlParse(aRoot); | |
if (aRootUrl) { | |
aRoot = aRootUrl.path || '/'; | |
} // `join(foo, '//www.example.org')` | |
if (aPathUrl && !aPathUrl.scheme) { | |
if (aRootUrl) { | |
aPathUrl.scheme = aRootUrl.scheme; | |
} | |
return urlGenerate(aPathUrl); | |
} | |
if (aPathUrl || aPath.match(dataUrlRegexp)) { | |
return aPath; | |
} // `join('http://', 'www.example.com')` | |
if (aRootUrl && !aRootUrl.host && !aRootUrl.path) { | |
aRootUrl.host = aPath; | |
return urlGenerate(aRootUrl); | |
} | |
var joined = aPath.charAt(0) === '/' ? aPath : normalize(aRoot.replace(/\/+$/, '') + '/' + aPath); | |
if (aRootUrl) { | |
aRootUrl.path = joined; | |
return urlGenerate(aRootUrl); | |
} | |
return joined; | |
} | |
exports$a1.join = join; | |
exports$a1.isAbsolute = function (aPath) { | |
return aPath.charAt(0) === '/' || urlRegexp.test(aPath); | |
}; | |
/** | |
* Make a path relative to a URL or another path. | |
* | |
* @param aRoot The root path or URL. | |
* @param aPath The path or URL to be made relative to aRoot. | |
*/ | |
function relative(aRoot, aPath) { | |
if (aRoot === "") { | |
aRoot = "."; | |
} | |
aRoot = aRoot.replace(/\/$/, ''); // It is possible for the path to be above the root. In this case, simply | |
// checking whether the root is a prefix of the path won't work. Instead, we | |
// need to remove components from the root one by one, until either we find | |
// a prefix that fits, or we run out of components to remove. | |
var level = 0; | |
while (aPath.indexOf(aRoot + '/') !== 0) { | |
var index = aRoot.lastIndexOf("/"); | |
if (index < 0) { | |
return aPath; | |
} // If the only part of the root that is left is the scheme (i.e. http://, | |
// file:///, etc.), one or more slashes (/), or simply nothing at all, we | |
// have exhausted all components, so the path is not relative to the root. | |
aRoot = aRoot.slice(0, index); | |
if (aRoot.match(/^([^\/]+:\/)?\/*$/)) { | |
return aPath; | |
} | |
++level; | |
} // Make sure we add a "../" for each component we removed from the root. | |
return Array(level + 1).join("../") + aPath.substr(aRoot.length + 1); | |
} | |
exports$a1.relative = relative; | |
var supportsNullProto = function () { | |
var obj = Object.create(null); | |
return !('__proto__' in obj); | |
}(); | |
function identity(s) { | |
return s; | |
} | |
/** | |
* Because behavior goes wacky when you set `__proto__` on objects, we | |
* have to prefix all the strings in our set with an arbitrary character. | |
* | |
* See https://github.com/mozilla/source-map/pull/31 and | |
* https://github.com/mozilla/source-map/issues/30 | |
* | |
* @param String aStr | |
*/ | |
function toSetString(aStr) { | |
if (isProtoString(aStr)) { | |
return '$' + aStr; | |
} | |
return aStr; | |
} | |
exports$a1.toSetString = supportsNullProto ? identity : toSetString; | |
function fromSetString(aStr) { | |
if (isProtoString(aStr)) { | |
return aStr.slice(1); | |
} | |
return aStr; | |
} | |
exports$a1.fromSetString = supportsNullProto ? identity : fromSetString; | |
function isProtoString(s) { | |
if (!s) { | |
return false; | |
} | |
var length = s.length; | |
if (length < 9 | |
/* "__proto__".length */ | |
) { | |
return false; | |
} | |
if (s.charCodeAt(length - 1) !== 95 | |
/* '_' */ | |
|| s.charCodeAt(length - 2) !== 95 | |
/* '_' */ | |
|| s.charCodeAt(length - 3) !== 111 | |
/* 'o' */ | |
|| s.charCodeAt(length - 4) !== 116 | |
/* 't' */ | |
|| s.charCodeAt(length - 5) !== 111 | |
/* 'o' */ | |
|| s.charCodeAt(length - 6) !== 114 | |
/* 'r' */ | |
|| s.charCodeAt(length - 7) !== 112 | |
/* 'p' */ | |
|| s.charCodeAt(length - 8) !== 95 | |
/* '_' */ | |
|| s.charCodeAt(length - 9) !== 95 | |
/* '_' */ | |
) { | |
return false; | |
} | |
for (var i = length - 10; i >= 0; i--) { | |
if (s.charCodeAt(i) !== 36 | |
/* '$' */ | |
) { | |
return false; | |
} | |
} | |
return true; | |
} | |
/** | |
* Comparator between two mappings where the original positions are compared. | |
* | |
* Optionally pass in `true` as `onlyCompareGenerated` to consider two | |
* mappings with the same original source/line/column, but different generated | |
* line and column the same. Useful when searching for a mapping with a | |
* stubbed out mapping. | |
*/ | |
function compareByOriginalPositions(mappingA, mappingB, onlyCompareOriginal) { | |
var cmp = strcmp(mappingA.source, mappingB.source); | |
if (cmp !== 0) { | |
return cmp; | |
} | |
cmp = mappingA.originalLine - mappingB.originalLine; | |
if (cmp !== 0) { | |
return cmp; | |
} | |
cmp = mappingA.originalColumn - mappingB.originalColumn; | |
if (cmp !== 0 || onlyCompareOriginal) { | |
return cmp; | |
} | |
cmp = mappingA.generatedColumn - mappingB.generatedColumn; | |
if (cmp !== 0) { | |
return cmp; | |
} | |
cmp = mappingA.generatedLine - mappingB.generatedLine; | |
if (cmp !== 0) { | |
return cmp; | |
} | |
return strcmp(mappingA.name, mappingB.name); | |
} | |
exports$a1.compareByOriginalPositions = compareByOriginalPositions; | |
/** | |
* Comparator between two mappings with deflated source and name indices where | |
* the generated positions are compared. | |
* | |
* Optionally pass in `true` as `onlyCompareGenerated` to consider two | |
* mappings with the same generated line and column, but different | |
* source/name/original line and column the same. Useful when searching for a | |
* mapping with a stubbed out mapping. | |
*/ | |
function compareByGeneratedPositionsDeflated(mappingA, mappingB, onlyCompareGenerated) { | |
var cmp = mappingA.generatedLine - mappingB.generatedLine; | |
if (cmp !== 0) { | |
return cmp; | |
} | |
cmp = mappingA.generatedColumn - mappingB.generatedColumn; | |
if (cmp !== 0 || onlyCompareGenerated) { | |
return cmp; | |
} | |
cmp = strcmp(mappingA.source, mappingB.source); | |
if (cmp !== 0) { | |
return cmp; | |
} | |
cmp = mappingA.originalLine - mappingB.originalLine; | |
if (cmp !== 0) { | |
return cmp; | |
} | |
cmp = mappingA.originalColumn - mappingB.originalColumn; | |
if (cmp !== 0) { | |
return cmp; | |
} | |
return strcmp(mappingA.name, mappingB.name); | |
} | |
exports$a1.compareByGeneratedPositionsDeflated = compareByGeneratedPositionsDeflated; | |
function strcmp(aStr1, aStr2) { | |
if (aStr1 === aStr2) { | |
return 0; | |
} | |
if (aStr1 === null) { | |
return 1; // aStr2 !== null | |
} | |
if (aStr2 === null) { | |
return -1; // aStr1 !== null | |
} | |
if (aStr1 > aStr2) { | |
return 1; | |
} | |
return -1; | |
} | |
/** | |
* Comparator between two mappings with inflated source and name strings where | |
* the generated positions are compared. | |
*/ | |
function compareByGeneratedPositionsInflated(mappingA, mappingB) { | |
var cmp = mappingA.generatedLine - mappingB.generatedLine; | |
if (cmp !== 0) { | |
return cmp; | |
} | |
cmp = mappingA.generatedColumn - mappingB.generatedColumn; | |
if (cmp !== 0) { | |
return cmp; | |
} | |
cmp = strcmp(mappingA.source, mappingB.source); | |
if (cmp !== 0) { | |
return cmp; | |
} | |
cmp = mappingA.originalLine - mappingB.originalLine; | |
if (cmp !== 0) { | |
return cmp; | |
} | |
cmp = mappingA.originalColumn - mappingB.originalColumn; | |
if (cmp !== 0) { | |
return cmp; | |
} | |
return strcmp(mappingA.name, mappingB.name); | |
} | |
exports$a1.compareByGeneratedPositionsInflated = compareByGeneratedPositionsInflated; | |
/** | |
* Strip any JSON XSSI avoidance prefix from the string (as documented | |
* in the source maps specification), and then parse the string as | |
* JSON. | |
*/ | |
function parseSourceMapInput(str) { | |
return JSON.parse(str.replace(/^\)]}'[^\n]*\n/, '')); | |
} | |
exports$a1.parseSourceMapInput = parseSourceMapInput; | |
/** | |
* Compute the URL of a source given the the source root, the source's | |
* URL, and the source map's URL. | |
*/ | |
function computeSourceURL(sourceRoot, sourceURL, sourceMapURL) { | |
sourceURL = sourceURL || ''; | |
if (sourceRoot) { | |
// This follows what Chrome does. | |
if (sourceRoot[sourceRoot.length - 1] !== '/' && sourceURL[0] !== '/') { | |
sourceRoot += '/'; | |
} // The spec says: | |
// Line 4: An optional source root, useful for relocating source | |
// files on a server or removing repeated values in the | |
// “sources” entry. This value is prepended to the individual | |
// entries in the “source” field. | |
sourceURL = sourceRoot + sourceURL; | |
} // Historically, SourceMapConsumer did not take the sourceMapURL as | |
// a parameter. This mode is still somewhat supported, which is why | |
// this code block is conditional. However, it's preferable to pass | |
// the source map URL to SourceMapConsumer, so that this function | |
// can implement the source URL resolution algorithm as outlined in | |
// the spec. This block is basically the equivalent of: | |
// new URL(sourceURL, sourceMapURL).toString() | |
// ... except it avoids using URL, which wasn't available in the | |
// older releases of node still supported by this library. | |
// | |
// The spec says: | |
// If the sources are not absolute URLs after prepending of the | |
// “sourceRoot”, the sources are resolved relative to the | |
// SourceMap (like resolving script src in a html document). | |
if (sourceMapURL) { | |
var parsed = urlParse(sourceMapURL); | |
if (!parsed) { | |
throw new Error("sourceMapURL could not be parsed"); | |
} | |
if (parsed.path) { | |
// Strip the last path component, but keep the "/". | |
var index = parsed.path.lastIndexOf('/'); | |
if (index >= 0) { | |
parsed.path = parsed.path.substring(0, index + 1); | |
} | |
} | |
sourceURL = join(urlGenerate(parsed), sourceURL); | |
} | |
return normalize(sourceURL); | |
} | |
exports$a1.computeSourceURL = computeSourceURL; | |
return exports$a1; | |
} | |
var exports$a0 = {}, | |
_dewExec$9L = false; | |
var _global$N = typeof self !== "undefined" ? self : global; | |
function dew$a0() { | |
if (_dewExec$9L) return exports$a0; | |
_dewExec$9L = true; | |
/* -*- Mode: js; js-indent-level: 2; -*- */ | |
/* | |
* Copyright 2011 Mozilla Foundation and contributors | |
* Licensed under the New BSD license. See LICENSE or: | |
* http://opensource.org/licenses/BSD-3-Clause | |
*/ | |
var util = dew$a1(); | |
var has = Object.prototype.hasOwnProperty; | |
var hasNativeMap = typeof Map !== "undefined"; | |
/** | |
* A data structure which is a combination of an array and a set. Adding a new | |
* member is O(1), testing for membership is O(1), and finding the index of an | |
* element is O(1). Removing elements from the set is not supported. Only | |
* strings are supported for membership. | |
*/ | |
function ArraySet() { | |
(this || _global$N)._array = []; | |
(this || _global$N)._set = hasNativeMap ? new Map() : Object.create(null); | |
} | |
/** | |
* Static method for creating ArraySet instances from an existing array. | |
*/ | |
ArraySet.fromArray = function ArraySet_fromArray(aArray, aAllowDuplicates) { | |
var set = new ArraySet(); | |
for (var i = 0, len = aArray.length; i < len; i++) { | |
set.add(aArray[i], aAllowDuplicates); | |
} | |
return set; | |
}; | |
/** | |
* Return how many unique items are in this ArraySet. If duplicates have been | |
* added, than those do not count towards the size. | |
* | |
* @returns Number | |
*/ | |
ArraySet.prototype.size = function ArraySet_size() { | |
return hasNativeMap ? (this || _global$N)._set.size : Object.getOwnPropertyNames((this || _global$N)._set).length; | |
}; | |
/** | |
* Add the given string to this set. | |
* | |
* @param String aStr | |
*/ | |
ArraySet.prototype.add = function ArraySet_add(aStr, aAllowDuplicates) { | |
var sStr = hasNativeMap ? aStr : util.toSetString(aStr); | |
var isDuplicate = hasNativeMap ? this.has(aStr) : has.call((this || _global$N)._set, sStr); | |
var idx = (this || _global$N)._array.length; | |
if (!isDuplicate || aAllowDuplicates) { | |
(this || _global$N)._array.push(aStr); | |
} | |
if (!isDuplicate) { | |
if (hasNativeMap) { | |
(this || _global$N)._set.set(aStr, idx); | |
} else { | |
(this || _global$N)._set[sStr] = idx; | |
} | |
} | |
}; | |
/** | |
* Is the given string a member of this set? | |
* | |
* @param String aStr | |
*/ | |
ArraySet.prototype.has = function ArraySet_has(aStr) { | |
if (hasNativeMap) { | |
return (this || _global$N)._set.has(aStr); | |
} else { | |
var sStr = util.toSetString(aStr); | |
return has.call((this || _global$N)._set, sStr); | |
} | |
}; | |
/** | |
* What is the index of the given string in the array? | |
* | |
* @param String aStr | |
*/ | |
ArraySet.prototype.indexOf = function ArraySet_indexOf(aStr) { | |
if (hasNativeMap) { | |
var idx = (this || _global$N)._set.get(aStr); | |
if (idx >= 0) { | |
return idx; | |
} | |
} else { | |
var sStr = util.toSetString(aStr); | |
if (has.call((this || _global$N)._set, sStr)) { | |
return (this || _global$N)._set[sStr]; | |
} | |
} | |
throw new Error('"' + aStr + '" is not in the set.'); | |
}; | |
/** | |
* What is the element at the given index? | |
* | |
* @param Number aIdx | |
*/ | |
ArraySet.prototype.at = function ArraySet_at(aIdx) { | |
if (aIdx >= 0 && aIdx < (this || _global$N)._array.length) { | |
return (this || _global$N)._array[aIdx]; | |
} | |
throw new Error('No element indexed by ' + aIdx); | |
}; | |
/** | |
* Returns the array representation of this set (which has the proper indices | |
* indicated by indexOf). Note that this is a copy of the internal array used | |
* for storing the members so that no one can mess with internal state. | |
*/ | |
ArraySet.prototype.toArray = function ArraySet_toArray() { | |
return (this || _global$N)._array.slice(); | |
}; | |
exports$a0.ArraySet = ArraySet; | |
return exports$a0; | |
} | |
var exports$9$ = {}, | |
_dewExec$9K = false; | |
var _global$M = typeof self !== "undefined" ? self : global; | |
function dew$9$() { | |
if (_dewExec$9K) return exports$9$; | |
_dewExec$9K = true; | |
/* -*- Mode: js; js-indent-level: 2; -*- */ | |
/* | |
* Copyright 2014 Mozilla Foundation and contributors | |
* Licensed under the New BSD license. See LICENSE or: | |
* http://opensource.org/licenses/BSD-3-Clause | |
*/ | |
var util = dew$a1(); | |
/** | |
* Determine whether mappingB is after mappingA with respect to generated | |
* position. | |
*/ | |
function generatedPositionAfter(mappingA, mappingB) { | |
// Optimized for most common case | |
var lineA = mappingA.generatedLine; | |
var lineB = mappingB.generatedLine; | |
var columnA = mappingA.generatedColumn; | |
var columnB = mappingB.generatedColumn; | |
return lineB > lineA || lineB == lineA && columnB >= columnA || util.compareByGeneratedPositionsInflated(mappingA, mappingB) <= 0; | |
} | |
/** | |
* A data structure to provide a sorted view of accumulated mappings in a | |
* performance conscious manner. It trades a neglibable overhead in general | |
* case for a large speedup in case of mappings being added in order. | |
*/ | |
function MappingList() { | |
(this || _global$M)._array = []; | |
(this || _global$M)._sorted = true; // Serves as infimum | |
(this || _global$M)._last = { | |
generatedLine: -1, | |
generatedColumn: 0 | |
}; | |
} | |
/** | |
* Iterate through internal items. This method takes the same arguments that | |
* `Array.prototype.forEach` takes. | |
* | |
* NOTE: The order of the mappings is NOT guaranteed. | |
*/ | |
MappingList.prototype.unsortedForEach = function MappingList_forEach(aCallback, aThisArg) { | |
(this || _global$M)._array.forEach(aCallback, aThisArg); | |
}; | |
/** | |
* Add the given source mapping. | |
* | |
* @param Object aMapping | |
*/ | |
MappingList.prototype.add = function MappingList_add(aMapping) { | |
if (generatedPositionAfter((this || _global$M)._last, aMapping)) { | |
(this || _global$M)._last = aMapping; | |
(this || _global$M)._array.push(aMapping); | |
} else { | |
(this || _global$M)._sorted = false; | |
(this || _global$M)._array.push(aMapping); | |
} | |
}; | |
/** | |
* Returns the flat, sorted array of mappings. The mappings are sorted by | |
* generated position. | |
* | |
* WARNING: This method returns internal data without copying, for | |
* performance. The return value must NOT be mutated, and should be treated as | |
* an immutable borrow. If you want to take ownership, you must make your own | |
* copy. | |
*/ | |
MappingList.prototype.toArray = function MappingList_toArray() { | |
if (!(this || _global$M)._sorted) { | |
(this || _global$M)._array.sort(util.compareByGeneratedPositionsInflated); | |
(this || _global$M)._sorted = true; | |
} | |
return (this || _global$M)._array; | |
}; | |
exports$9$.MappingList = MappingList; | |
return exports$9$; | |
} | |
var exports$9_ = {}, | |
_dewExec$9J = false; | |
var _global$L = typeof self !== "undefined" ? self : global; | |
function dew$9_() { | |
if (_dewExec$9J) return exports$9_; | |
_dewExec$9J = true; | |
/* -*- Mode: js; js-indent-level: 2; -*- */ | |
/* | |
* Copyright 2011 Mozilla Foundation and contributors | |
* Licensed under the New BSD license. See LICENSE or: | |
* http://opensource.org/licenses/BSD-3-Clause | |
*/ | |
var base64VLQ = dew$a2(); | |
var util = dew$a1(); | |
var ArraySet = dew$a0().ArraySet; | |
var MappingList = dew$9$().MappingList; | |
/** | |
* An instance of the SourceMapGenerator represents a source map which is | |
* being built incrementally. You may pass an object with the following | |
* properties: | |
* | |
* - file: The filename of the generated source. | |
* - sourceRoot: A root for all relative URLs in this source map. | |
*/ | |
function SourceMapGenerator(aArgs) { | |
if (!aArgs) { | |
aArgs = {}; | |
} | |
(this || _global$L)._file = util.getArg(aArgs, 'file', null); | |
(this || _global$L)._sourceRoot = util.getArg(aArgs, 'sourceRoot', null); | |
(this || _global$L)._skipValidation = util.getArg(aArgs, 'skipValidation', false); | |
(this || _global$L)._sources = new ArraySet(); | |
(this || _global$L)._names = new ArraySet(); | |
(this || _global$L)._mappings = new MappingList(); | |
(this || _global$L)._sourcesContents = null; | |
} | |
SourceMapGenerator.prototype._version = 3; | |
/** | |
* Creates a new SourceMapGenerator based on a SourceMapConsumer | |
* | |
* @param aSourceMapConsumer The SourceMap. | |
*/ | |
SourceMapGenerator.fromSourceMap = function SourceMapGenerator_fromSourceMap(aSourceMapConsumer) { | |
var sourceRoot = aSourceMapConsumer.sourceRoot; | |
var generator = new SourceMapGenerator({ | |
file: aSourceMapConsumer.file, | |
sourceRoot: sourceRoot | |
}); | |
aSourceMapConsumer.eachMapping(function (mapping) { | |
var newMapping = { | |
generated: { | |
line: mapping.generatedLine, | |
column: mapping.generatedColumn | |
} | |
}; | |
if (mapping.source != null) { | |
newMapping.source = mapping.source; | |
if (sourceRoot != null) { | |
newMapping.source = util.relative(sourceRoot, newMapping.source); | |
} | |
newMapping.original = { | |
line: mapping.originalLine, | |
column: mapping.originalColumn | |
}; | |
if (mapping.name != null) { | |
newMapping.name = mapping.name; | |
} | |
} | |
generator.addMapping(newMapping); | |
}); | |
aSourceMapConsumer.sources.forEach(function (sourceFile) { | |
var sourceRelative = sourceFile; | |
if (sourceRoot !== null) { | |
sourceRelative = util.relative(sourceRoot, sourceFile); | |
} | |
if (!generator._sources.has(sourceRelative)) { | |
generator._sources.add(sourceRelative); | |
} | |
var content = aSourceMapConsumer.sourceContentFor(sourceFile); | |
if (content != null) { | |
generator.setSourceContent(sourceFile, content); | |
} | |
}); | |
return generator; | |
}; | |
/** | |
* Add a single mapping from original source line and column to the generated | |
* source's line and column for this source map being created. The mapping | |
* object should have the following properties: | |
* | |
* - generated: An object with the generated line and column positions. | |
* - original: An object with the original line and column positions. | |
* - source: The original source file (relative to the sourceRoot). | |
* - name: An optional original token name for this mapping. | |
*/ | |
SourceMapGenerator.prototype.addMapping = function SourceMapGenerator_addMapping(aArgs) { | |
var generated = util.getArg(aArgs, 'generated'); | |
var original = util.getArg(aArgs, 'original', null); | |
var source = util.getArg(aArgs, 'source', null); | |
var name = util.getArg(aArgs, 'name', null); | |
if (!(this || _global$L)._skipValidation) { | |
this._validateMapping(generated, original, source, name); | |
} | |
if (source != null) { | |
source = String(source); | |
if (!(this || _global$L)._sources.has(source)) { | |
(this || _global$L)._sources.add(source); | |
} | |
} | |
if (name != null) { | |
name = String(name); | |
if (!(this || _global$L)._names.has(name)) { | |
(this || _global$L)._names.add(name); | |
} | |
} | |
(this || _global$L)._mappings.add({ | |
generatedLine: generated.line, | |
generatedColumn: generated.column, | |
originalLine: original != null && original.line, | |
originalColumn: original != null && original.column, | |
source: source, | |
name: name | |
}); | |
}; | |
/** | |
* Set the source content for a source file. | |
*/ | |
SourceMapGenerator.prototype.setSourceContent = function SourceMapGenerator_setSourceContent(aSourceFile, aSourceContent) { | |
var source = aSourceFile; | |
if ((this || _global$L)._sourceRoot != null) { | |
source = util.relative((this || _global$L)._sourceRoot, source); | |
} | |
if (aSourceContent != null) { | |
// Add the source content to the _sourcesContents map. | |
// Create a new _sourcesContents map if the property is null. | |
if (!(this || _global$L)._sourcesContents) { | |
(this || _global$L)._sourcesContents = Object.create(null); | |
} | |
(this || _global$L)._sourcesContents[util.toSetString(source)] = aSourceContent; | |
} else if ((this || _global$L)._sourcesContents) { | |
// Remove the source file from the _sourcesContents map. | |
// If the _sourcesContents map is empty, set the property to null. | |
delete (this || _global$L)._sourcesContents[util.toSetString(source)]; | |
if (Object.keys((this || _global$L)._sourcesContents).length === 0) { | |
(this || _global$L)._sourcesContents = null; | |
} | |
} | |
}; | |
/** | |
* Applies the mappings of a sub-source-map for a specific source file to the | |
* source map being generated. Each mapping to the supplied source file is | |
* rewritten using the supplied source map. Note: The resolution for the | |
* resulting mappings is the minimium of this map and the supplied map. | |
* | |
* @param aSourceMapConsumer The source map to be applied. | |
* @param aSourceFile Optional. The filename of the source file. | |
* If omitted, SourceMapConsumer's file property will be used. | |
* @param aSourceMapPath Optional. The dirname of the path to the source map | |
* to be applied. If relative, it is relative to the SourceMapConsumer. | |
* This parameter is needed when the two source maps aren't in the same | |
* directory, and the source map to be applied contains relative source | |
* paths. If so, those relative source paths need to be rewritten | |
* relative to the SourceMapGenerator. | |
*/ | |
SourceMapGenerator.prototype.applySourceMap = function SourceMapGenerator_applySourceMap(aSourceMapConsumer, aSourceFile, aSourceMapPath) { | |
var sourceFile = aSourceFile; // If aSourceFile is omitted, we will use the file property of the SourceMap | |
if (aSourceFile == null) { | |
if (aSourceMapConsumer.file == null) { | |
throw new Error('SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, ' + 'or the source map\'s "file" property. Both were omitted.'); | |
} | |
sourceFile = aSourceMapConsumer.file; | |
} | |
var sourceRoot = (this || _global$L)._sourceRoot; // Make "sourceFile" relative if an absolute Url is passed. | |
if (sourceRoot != null) { | |
sourceFile = util.relative(sourceRoot, sourceFile); | |
} // Applying the SourceMap can add and remove items from the sources and | |
// the names array. | |
var newSources = new ArraySet(); | |
var newNames = new ArraySet(); // Find mappings for the "sourceFile" | |
(this || _global$L)._mappings.unsortedForEach(function (mapping) { | |
if (mapping.source === sourceFile && mapping.originalLine != null) { | |
// Check if it can be mapped by the source map, then update the mapping. | |
var original = aSourceMapConsumer.originalPositionFor({ | |
line: mapping.originalLine, | |
column: mapping.originalColumn | |
}); | |
if (original.source != null) { | |
// Copy mapping | |
mapping.source = original.source; | |
if (aSourceMapPath != null) { | |
mapping.source = util.join(aSourceMapPath, mapping.source); | |
} | |
if (sourceRoot != null) { | |
mapping.source = util.relative(sourceRoot, mapping.source); | |
} | |
mapping.originalLine = original.line; | |
mapping.originalColumn = original.column; | |
if (original.name != null) { | |
mapping.name = original.name; | |
} | |
} | |
} | |
var source = mapping.source; | |
if (source != null && !newSources.has(source)) { | |
newSources.add(source); | |
} | |
var name = mapping.name; | |
if (name != null && !newNames.has(name)) { | |
newNames.add(name); | |
} | |
}, this || _global$L); | |
(this || _global$L)._sources = newSources; | |
(this || _global$L)._names = newNames; // Copy sourcesContents of applied map. | |
aSourceMapConsumer.sources.forEach(function (sourceFile) { | |
var content = aSourceMapConsumer.sourceContentFor(sourceFile); | |
if (content != null) { | |
if (aSourceMapPath != null) { | |
sourceFile = util.join(aSourceMapPath, sourceFile); | |
} | |
if (sourceRoot != null) { | |
sourceFile = util.relative(sourceRoot, sourceFile); | |
} | |
this.setSourceContent(sourceFile, content); | |
} | |
}, this || _global$L); | |
}; | |
/** | |
* A mapping can have one of the three levels of data: | |
* | |
* 1. Just the generated position. | |
* 2. The Generated position, original position, and original source. | |
* 3. Generated and original position, original source, as well as a name | |
* token. | |
* | |
* To maintain consistency, we validate that any new mapping being added falls | |
* in to one of these categories. | |
*/ | |
SourceMapGenerator.prototype._validateMapping = function SourceMapGenerator_validateMapping(aGenerated, aOriginal, aSource, aName) { | |
// When aOriginal is truthy but has empty values for .line and .column, | |
// it is most likely a programmer error. In this case we throw a very | |
// specific error message to try to guide them the right way. | |
// For example: https://github.com/Polymer/polymer-bundler/pull/519 | |
if (aOriginal && typeof aOriginal.line !== 'number' && typeof aOriginal.column !== 'number') { | |
throw new Error('original.line and original.column are not numbers -- you probably meant to omit ' + 'the original mapping entirely and only map the generated position. If so, pass ' + 'null for the original mapping instead of an object with empty or null values.'); | |
} | |
if (aGenerated && 'line' in aGenerated && 'column' in aGenerated && aGenerated.line > 0 && aGenerated.column >= 0 && !aOriginal && !aSource && !aName) { | |
// Case 1. | |
return; | |
} else if (aGenerated && 'line' in aGenerated && 'column' in aGenerated && aOriginal && 'line' in aOriginal && 'column' in aOriginal && aGenerated.line > 0 && aGenerated.column >= 0 && aOriginal.line > 0 && aOriginal.column >= 0 && aSource) { | |
// Cases 2 and 3. | |
return; | |
} else { | |
throw new Error('Invalid mapping: ' + JSON.stringify({ | |
generated: aGenerated, | |
source: aSource, | |
original: aOriginal, | |
name: aName | |
})); | |
} | |
}; | |
/** | |
* Serialize the accumulated mappings in to the stream of base 64 VLQs | |
* specified by the source map format. | |
*/ | |
SourceMapGenerator.prototype._serializeMappings = function SourceMapGenerator_serializeMappings() { | |
var previousGeneratedColumn = 0; | |
var previousGeneratedLine = 1; | |
var previousOriginalColumn = 0; | |
var previousOriginalLine = 0; | |
var previousName = 0; | |
var previousSource = 0; | |
var result = ''; | |
var next; | |
var mapping; | |
var nameIdx; | |
var sourceIdx; | |
var mappings = (this || _global$L)._mappings.toArray(); | |
for (var i = 0, len = mappings.length; i < len; i++) { | |
mapping = mappings[i]; | |
next = ''; | |
if (mapping.generatedLine !== previousGeneratedLine) { | |
previousGeneratedColumn = 0; | |
while (mapping.generatedLine !== previousGeneratedLine) { | |
next += ';'; | |
previousGeneratedLine++; | |
} | |
} else { | |
if (i > 0) { | |
if (!util.compareByGeneratedPositionsInflated(mapping, mappings[i - 1])) { | |
continue; | |
} | |
next += ','; | |
} | |
} | |
next += base64VLQ.encode(mapping.generatedColumn - previousGeneratedColumn); | |
previousGeneratedColumn = mapping.generatedColumn; | |
if (mapping.source != null) { | |
sourceIdx = (this || _global$L)._sources.indexOf(mapping.source); | |
next += base64VLQ.encode(sourceIdx - previousSource); | |
previousSource = sourceIdx; // lines are stored 0-based in SourceMap spec version 3 | |
next += base64VLQ.encode(mapping.originalLine - 1 - previousOriginalLine); | |
previousOriginalLine = mapping.originalLine - 1; | |
next += base64VLQ.encode(mapping.originalColumn - previousOriginalColumn); | |
previousOriginalColumn = mapping.originalColumn; | |
if (mapping.name != null) { | |
nameIdx = (this || _global$L)._names.indexOf(mapping.name); | |
next += base64VLQ.encode(nameIdx - previousName); | |
previousName = nameIdx; | |
} | |
} | |
result += next; | |
} | |
return result; | |
}; | |
SourceMapGenerator.prototype._generateSourcesContent = function SourceMapGenerator_generateSourcesContent(aSources, aSourceRoot) { | |
return aSources.map(function (source) { | |
if (!(this || _global$L)._sourcesContents) { | |
return null; | |
} | |
if (aSourceRoot != null) { | |
source = util.relative(aSourceRoot, source); | |
} | |
var key = util.toSetString(source); | |
return Object.prototype.hasOwnProperty.call((this || _global$L)._sourcesContents, key) ? (this || _global$L)._sourcesContents[key] : null; | |
}, this || _global$L); | |
}; | |
/** | |
* Externalize the source map. | |
*/ | |
SourceMapGenerator.prototype.toJSON = function SourceMapGenerator_toJSON() { | |
var map = { | |
version: (this || _global$L)._version, | |
sources: (this || _global$L)._sources.toArray(), | |
names: (this || _global$L)._names.toArray(), | |
mappings: this._serializeMappings() | |
}; | |
if ((this || _global$L)._file != null) { | |
map.file = (this || _global$L)._file; | |
} | |
if ((this || _global$L)._sourceRoot != null) { | |
map.sourceRoot = (this || _global$L)._sourceRoot; | |
} | |
if ((this || _global$L)._sourcesContents) { | |
map.sourcesContent = this._generateSourcesContent(map.sources, map.sourceRoot); | |
} | |
return map; | |
}; | |
/** | |
* Render the source map being generated to a string. | |
*/ | |
SourceMapGenerator.prototype.toString = function SourceMapGenerator_toString() { | |
return JSON.stringify(this.toJSON()); | |
}; | |
exports$9_.SourceMapGenerator = SourceMapGenerator; | |
return exports$9_; | |
} | |
var exports$9Z = {}, | |
_dewExec$9I = false; | |
function dew$9Z() { | |
if (_dewExec$9I) return exports$9Z; | |
_dewExec$9I = true; | |
/* -*- Mode: js; js-indent-level: 2; -*- */ | |
/* | |
* Copyright 2011 Mozilla Foundation and contributors | |
* Licensed under the New BSD license. See LICENSE or: | |
* http://opensource.org/licenses/BSD-3-Clause | |
*/ | |
exports$9Z.GREATEST_LOWER_BOUND = 1; | |
exports$9Z.LEAST_UPPER_BOUND = 2; | |
/** | |
* Recursive implementation of binary search. | |
* | |
* @param aLow Indices here and lower do not contain the needle. | |
* @param aHigh Indices here and higher do not contain the needle. | |
* @param aNeedle The element being searched for. | |
* @param aHaystack The non-empty array being searched. | |
* @param aCompare Function which takes two elements and returns -1, 0, or 1. | |
* @param aBias Either 'binarySearch.GREATEST_LOWER_BOUND' or | |
* 'binarySearch.LEAST_UPPER_BOUND'. Specifies whether to return the | |
* closest element that is smaller than or greater than the one we are | |
* searching for, respectively, if the exact element cannot be found. | |
*/ | |
function recursiveSearch(aLow, aHigh, aNeedle, aHaystack, aCompare, aBias) { | |
// This function terminates when one of the following is true: | |
// | |
// 1. We find the exact element we are looking for. | |
// | |
// 2. We did not find the exact element, but we can return the index of | |
// the next-closest element. | |
// | |
// 3. We did not find the exact element, and there is no next-closest | |
// element than the one we are searching for, so we return -1. | |
var mid = Math.floor((aHigh - aLow) / 2) + aLow; | |
var cmp = aCompare(aNeedle, aHaystack[mid], true); | |
if (cmp === 0) { | |
// Found the element we are looking for. | |
return mid; | |
} else if (cmp > 0) { | |
// Our needle is greater than aHaystack[mid]. | |
if (aHigh - mid > 1) { | |
// The element is in the upper half. | |
return recursiveSearch(mid, aHigh, aNeedle, aHaystack, aCompare, aBias); | |
} // The exact needle element was not found in this haystack. Determine if | |
// we are in termination case (3) or (2) and return the appropriate thing. | |
if (aBias == exports$9Z.LEAST_UPPER_BOUND) { | |
return aHigh < aHaystack.length ? aHigh : -1; | |
} else { | |
return mid; | |
} | |
} else { | |
// Our needle is less than aHaystack[mid]. | |
if (mid - aLow > 1) { | |
// The element is in the lower half. | |
return recursiveSearch(aLow, mid, aNeedle, aHaystack, aCompare, aBias); | |
} // we are in termination case (3) or (2) and return the appropriate thing. | |
if (aBias == exports$9Z.LEAST_UPPER_BOUND) { | |
return mid; | |
} else { | |
return aLow < 0 ? -1 : aLow; | |
} | |
} | |
} | |
/** | |
* This is an implementation of binary search which will always try and return | |
* the index of the closest element if there is no exact hit. This is because | |
* mappings between original and generated line/col pairs are single points, | |
* and there is an implicit region between each of them, so a miss just means | |
* that you aren't on the very start of a region. | |
* | |
* @param aNeedle The element you are looking for. | |
* @param aHaystack The array that is being searched. | |
* @param aCompare A function which takes the needle and an element in the | |
* array and returns -1, 0, or 1 depending on whether the needle is less | |
* than, equal to, or greater than the element, respectively. | |
* @param aBias Either 'binarySearch.GREATEST_LOWER_BOUND' or | |
* 'binarySearch.LEAST_UPPER_BOUND'. Specifies whether to return the | |
* closest element that is smaller than or greater than the one we are | |
* searching for, respectively, if the exact element cannot be found. | |
* Defaults to 'binarySearch.GREATEST_LOWER_BOUND'. | |
*/ | |
exports$9Z.search = function search(aNeedle, aHaystack, aCompare, aBias) { | |
if (aHaystack.length === 0) { | |
return -1; | |
} | |
var index = recursiveSearch(-1, aHaystack.length, aNeedle, aHaystack, aCompare, aBias || exports$9Z.GREATEST_LOWER_BOUND); | |
if (index < 0) { | |
return -1; | |
} // We have found either the exact element, or the next-closest element than | |
// the one we are searching for. However, there may be more than one such | |
// element. Make sure we always return the smallest of these. | |
while (index - 1 >= 0) { | |
if (aCompare(aHaystack[index], aHaystack[index - 1], true) !== 0) { | |
break; | |
} | |
--index; | |
} | |
return index; | |
}; | |
return exports$9Z; | |
} | |
var exports$9Y = {}, | |
_dewExec$9H = false; | |
function dew$9Y() { | |
if (_dewExec$9H) return exports$9Y; | |
_dewExec$9H = true; | |
/* -*- Mode: js; js-indent-level: 2; -*- */ | |
/* | |
* Copyright 2011 Mozilla Foundation and contributors | |
* Licensed under the New BSD license. See LICENSE or: | |
* http://opensource.org/licenses/BSD-3-Clause | |
*/ | |
// It turns out that some (most?) JavaScript engines don't self-host | |
// `Array.prototype.sort`. This makes sense because C++ will likely remain | |
// faster than JS when doing raw CPU-intensive sorting. However, when using a | |
// custom comparator function, calling back and forth between the VM's C++ and | |
// JIT'd JS is rather slow *and* loses JIT type information, resulting in | |
// worse generated code for the comparator function than would be optimal. In | |
// fact, when sorting with a comparator, these costs outweigh the benefits of | |
// sorting in C++. By using our own JS-implemented Quick Sort (below), we get | |
// a ~3500ms mean speed-up in `bench/bench.html`. | |
/** | |
* Swap the elements indexed by `x` and `y` in the array `ary`. | |
* | |
* @param {Array} ary | |
* The array. | |
* @param {Number} x | |
* The index of the first item. | |
* @param {Number} y | |
* The index of the second item. | |
*/ | |
function swap(ary, x, y) { | |
var temp = ary[x]; | |
ary[x] = ary[y]; | |
ary[y] = temp; | |
} | |
/** | |
* Returns a random integer within the range `low .. high` inclusive. | |
* | |
* @param {Number} low | |
* The lower bound on the range. | |
* @param {Number} high | |
* The upper bound on the range. | |
*/ | |
function randomIntInRange(low, high) { | |
return Math.round(low + Math.random() * (high - low)); | |
} | |
/** | |
* The Quick Sort algorithm. | |
* | |
* @param {Array} ary | |
* An array to sort. | |
* @param {function} comparator | |
* Function to use to compare two items. | |
* @param {Number} p | |
* Start index of the array | |
* @param {Number} r | |
* End index of the array | |
*/ | |
function doQuickSort(ary, comparator, p, r) { | |
// If our lower bound is less than our upper bound, we (1) partition the | |
// array into two pieces and (2) recurse on each half. If it is not, this is | |
// the empty array and our base case. | |
if (p < r) { | |
// (1) Partitioning. | |
// | |
// The partitioning chooses a pivot between `p` and `r` and moves all | |
// elements that are less than or equal to the pivot to the before it, and | |
// all the elements that are greater than it after it. The effect is that | |
// once partition is done, the pivot is in the exact place it will be when | |
// the array is put in sorted order, and it will not need to be moved | |
// again. This runs in O(n) time. | |
// Always choose a random pivot so that an input array which is reverse | |
// sorted does not cause O(n^2) running time. | |
var pivotIndex = randomIntInRange(p, r); | |
var i = p - 1; | |
swap(ary, pivotIndex, r); | |
var pivot = ary[r]; // Immediately after `j` is incremented in this loop, the following hold | |
// true: | |
// | |
// * Every element in `ary[p .. i]` is less than or equal to the pivot. | |
// | |
// * Every element in `ary[i+1 .. j-1]` is greater than the pivot. | |
for (var j = p; j < r; j++) { | |
if (comparator(ary[j], pivot) <= 0) { | |
i += 1; | |
swap(ary, i, j); | |
} | |
} | |
swap(ary, i + 1, j); | |
var q = i + 1; // (2) Recurse on each half. | |
doQuickSort(ary, comparator, p, q - 1); | |
doQuickSort(ary, comparator, q + 1, r); | |
} | |
} | |
/** | |
* Sort the given array in-place with the given comparator function. | |
* | |
* @param {Array} ary | |
* An array to sort. | |
* @param {function} comparator | |
* Function to use to compare two items. | |
*/ | |
exports$9Y.quickSort = function (ary, comparator) { | |
doQuickSort(ary, comparator, 0, ary.length - 1); | |
}; | |
return exports$9Y; | |
} | |
var exports$9X = {}, | |
_dewExec$9G = false; | |
var _global$K = typeof self !== "undefined" ? self : global; | |
function dew$9X() { | |
if (_dewExec$9G) return exports$9X; | |
_dewExec$9G = true; | |
/* -*- Mode: js; js-indent-level: 2; -*- */ | |
/* | |
* Copyright 2011 Mozilla Foundation and contributors | |
* Licensed under the New BSD license. See LICENSE or: | |
* http://opensource.org/licenses/BSD-3-Clause | |
*/ | |
var util = dew$a1(); | |
var binarySearch = dew$9Z(); | |
var ArraySet = dew$a0().ArraySet; | |
var base64VLQ = dew$a2(); | |
var quickSort = dew$9Y().quickSort; | |
function SourceMapConsumer(aSourceMap, aSourceMapURL) { | |
var sourceMap = aSourceMap; | |
if (typeof aSourceMap === 'string') { | |
sourceMap = util.parseSourceMapInput(aSourceMap); | |
} | |
return sourceMap.sections != null ? new IndexedSourceMapConsumer(sourceMap, aSourceMapURL) : new BasicSourceMapConsumer(sourceMap, aSourceMapURL); | |
} | |
SourceMapConsumer.fromSourceMap = function (aSourceMap, aSourceMapURL) { | |
return BasicSourceMapConsumer.fromSourceMap(aSourceMap, aSourceMapURL); | |
}; | |
/** | |
* The version of the source mapping spec that we are consuming. | |
*/ | |
SourceMapConsumer.prototype._version = 3; // `__generatedMappings` and `__originalMappings` are arrays that hold the | |
// parsed mapping coordinates from the source map's "mappings" attribute. They | |
// are lazily instantiated, accessed via the `_generatedMappings` and | |
// `_originalMappings` getters respectively, and we only parse the mappings | |
// and create these arrays once queried for a source location. We jump through | |
// these hoops because there can be many thousands of mappings, and parsing | |
// them is expensive, so we only want to do it if we must. | |
// | |
// Each object in the arrays is of the form: | |
// | |
// { | |
// generatedLine: The line number in the generated code, | |
// generatedColumn: The column number in the generated code, | |
// source: The path to the original source file that generated this | |
// chunk of code, | |
// originalLine: The line number in the original source that | |
// corresponds to this chunk of generated code, | |
// originalColumn: The column number in the original source that | |
// corresponds to this chunk of generated code, | |
// name: The name of the original symbol which generated this chunk of | |
// code. | |
// } | |
// | |
// All properties except for `generatedLine` and `generatedColumn` can be | |
// `null`. | |
// | |
// `_generatedMappings` is ordered by the generated positions. | |
// | |
// `_originalMappings` is ordered by the original positions. | |
SourceMapConsumer.prototype.__generatedMappings = null; | |
Object.defineProperty(SourceMapConsumer.prototype, '_generatedMappings', { | |
configurable: true, | |
enumerable: true, | |
get: function () { | |
if (!(this || _global$K).__generatedMappings) { | |
this._parseMappings((this || _global$K)._mappings, (this || _global$K).sourceRoot); | |
} | |
return (this || _global$K).__generatedMappings; | |
} | |
}); | |
SourceMapConsumer.prototype.__originalMappings = null; | |
Object.defineProperty(SourceMapConsumer.prototype, '_originalMappings', { | |
configurable: true, | |
enumerable: true, | |
get: function () { | |
if (!(this || _global$K).__originalMappings) { | |
this._parseMappings((this || _global$K)._mappings, (this || _global$K).sourceRoot); | |
} | |
return (this || _global$K).__originalMappings; | |
} | |
}); | |
SourceMapConsumer.prototype._charIsMappingSeparator = function SourceMapConsumer_charIsMappingSeparator(aStr, index) { | |
var c = aStr.charAt(index); | |
return c === ";" || c === ","; | |
}; | |
/** | |
* Parse the mappings in a string in to a data structure which we can easily | |
* query (the ordered arrays in the `this.__generatedMappings` and | |
* `this.__originalMappings` properties). | |
*/ | |
SourceMapConsumer.prototype._parseMappings = function SourceMapConsumer_parseMappings(aStr, aSourceRoot) { | |
throw new Error("Subclasses must implement _parseMappings"); | |
}; | |
SourceMapConsumer.GENERATED_ORDER = 1; | |
SourceMapConsumer.ORIGINAL_ORDER = 2; | |
SourceMapConsumer.GREATEST_LOWER_BOUND = 1; | |
SourceMapConsumer.LEAST_UPPER_BOUND = 2; | |
/** | |
* Iterate over each mapping between an original source/line/column and a | |
* generated line/column in this source map. | |
* | |
* @param Function aCallback | |
* The function that is called with each mapping. | |
* @param Object aContext | |
* Optional. If specified, this object will be the value of `this` every | |
* time that `aCallback` is called. | |
* @param aOrder | |
* Either `SourceMapConsumer.GENERATED_ORDER` or | |
* `SourceMapConsumer.ORIGINAL_ORDER`. Specifies whether you want to | |
* iterate over the mappings sorted by the generated file's line/column | |
* order or the original's source/line/column order, respectively. Defaults to | |
* `SourceMapConsumer.GENERATED_ORDER`. | |
*/ | |
SourceMapConsumer.prototype.eachMapping = function SourceMapConsumer_eachMapping(aCallback, aContext, aOrder) { | |
var context = aContext || null; | |
var order = aOrder || SourceMapConsumer.GENERATED_ORDER; | |
var mappings; | |
switch (order) { | |
case SourceMapConsumer.GENERATED_ORDER: | |
mappings = (this || _global$K)._generatedMappings; | |
break; | |
case SourceMapConsumer.ORIGINAL_ORDER: | |
mappings = (this || _global$K)._originalMappings; | |
break; | |
default: | |
throw new Error("Unknown order of iteration."); | |
} | |
var sourceRoot = (this || _global$K).sourceRoot; | |
mappings.map(function (mapping) { | |
var source = mapping.source === null ? null : (this || _global$K)._sources.at(mapping.source); | |
source = util.computeSourceURL(sourceRoot, source, (this || _global$K)._sourceMapURL); | |
return { | |
source: source, | |
generatedLine: mapping.generatedLine, | |
generatedColumn: mapping.generatedColumn, | |
originalLine: mapping.originalLine, | |
originalColumn: mapping.originalColumn, | |
name: mapping.name === null ? null : (this || _global$K)._names.at(mapping.name) | |
}; | |
}, this || _global$K).forEach(aCallback, context); | |
}; | |
/** | |
* Returns all generated line and column information for the original source, | |
* line, and column provided. If no column is provided, returns all mappings | |
* corresponding to a either the line we are searching for or the next | |
* closest line that has any mappings. Otherwise, returns all mappings | |
* corresponding to the given line and either the column we are searching for | |
* or the next closest column that has any offsets. | |
* | |
* The only argument is an object with the following properties: | |
* | |
* - source: The filename of the original source. | |
* - line: The line number in the original source. The line number is 1-based. | |
* - column: Optional. the column number in the original source. | |
* The column number is 0-based. | |
* | |
* and an array of objects is returned, each with the following properties: | |
* | |
* - line: The line number in the generated source, or null. The | |
* line number is 1-based. | |
* - column: The column number in the generated source, or null. | |
* The column number is 0-based. | |
*/ | |
SourceMapConsumer.prototype.allGeneratedPositionsFor = function SourceMapConsumer_allGeneratedPositionsFor(aArgs) { | |
var line = util.getArg(aArgs, 'line'); // When there is no exact match, BasicSourceMapConsumer.prototype._findMapping | |
// returns the index of the closest mapping less than the needle. By | |
// setting needle.originalColumn to 0, we thus find the last mapping for | |
// the given line, provided such a mapping exists. | |
var needle = { | |
source: util.getArg(aArgs, 'source'), | |
originalLine: line, | |
originalColumn: util.getArg(aArgs, 'column', 0) | |
}; | |
needle.source = this._findSourceIndex(needle.source); | |
if (needle.source < 0) { | |
return []; | |
} | |
var mappings = []; | |
var index = this._findMapping(needle, (this || _global$K)._originalMappings, "originalLine", "originalColumn", util.compareByOriginalPositions, binarySearch.LEAST_UPPER_BOUND); | |
if (index >= 0) { | |
var mapping = (this || _global$K)._originalMappings[index]; | |
if (aArgs.column === undefined) { | |
var originalLine = mapping.originalLine; // Iterate until either we run out of mappings, or we run into | |
// a mapping for a different line than the one we found. Since | |
// mappings are sorted, this is guaranteed to find all mappings for | |
// the line we found. | |
while (mapping && mapping.originalLine === originalLine) { | |
mappings.push({ | |
line: util.getArg(mapping, 'generatedLine', null), | |
column: util.getArg(mapping, 'generatedColumn', null), | |
lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null) | |
}); | |
mapping = (this || _global$K)._originalMappings[++index]; | |
} | |
} else { | |
var originalColumn = mapping.originalColumn; // Iterate until either we run out of mappings, or we run into | |
// a mapping for a different line than the one we were searching for. | |
// Since mappings are sorted, this is guaranteed to find all mappings for | |
// the line we are searching for. | |
while (mapping && mapping.originalLine === line && mapping.originalColumn == originalColumn) { | |
mappings.push({ | |
line: util.getArg(mapping, 'generatedLine', null), | |
column: util.getArg(mapping, 'generatedColumn', null), | |
lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null) | |
}); | |
mapping = (this || _global$K)._originalMappings[++index]; | |
} | |
} | |
} | |
return mappings; | |
}; | |
exports$9X.SourceMapConsumer = SourceMapConsumer; | |
/** | |
* A BasicSourceMapConsumer instance represents a parsed source map which we can | |
* query for information about the original file positions by giving it a file | |
* position in the generated source. | |
* | |
* The first parameter is the raw source map (either as a JSON string, or | |
* already parsed to an object). According to the spec, source maps have the | |
* following attributes: | |
* | |
* - version: Which version of the source map spec this map is following. | |
* - sources: An array of URLs to the original source files. | |
* - names: An array of identifiers which can be referrenced by individual mappings. | |
* - sourceRoot: Optional. The URL root from which all sources are relative. | |
* - sourcesContent: Optional. An array of contents of the original source files. | |
* - mappings: A string of base64 VLQs which contain the actual mappings. | |
* - file: Optional. The generated file this source map is associated with. | |
* | |
* Here is an example source map, taken from the source map spec[0]: | |
* | |
* { | |
* version : 3, | |
* file: "out.js", | |
* sourceRoot : "", | |
* sources: ["foo.js", "bar.js"], | |
* names: ["src", "maps", "are", "fun"], | |
* mappings: "AA,AB;;ABCDE;" | |
* } | |
* | |
* The second parameter, if given, is a string whose value is the URL | |
* at which the source map was found. This URL is used to compute the | |
* sources array. | |
* | |
* [0]: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit?pli=1# | |
*/ | |
function BasicSourceMapConsumer(aSourceMap, aSourceMapURL) { | |
var sourceMap = aSourceMap; | |
if (typeof aSourceMap === 'string') { | |
sourceMap = util.parseSourceMapInput(aSourceMap); | |
} | |
var version = util.getArg(sourceMap, 'version'); | |
var sources = util.getArg(sourceMap, 'sources'); // Sass 3.3 leaves out the 'names' array, so we deviate from the spec (which | |
// requires the array) to play nice here. | |
var names = util.getArg(sourceMap, 'names', []); | |
var sourceRoot = util.getArg(sourceMap, 'sourceRoot', null); | |
var sourcesContent = util.getArg(sourceMap, 'sourcesContent', null); | |
var mappings = util.getArg(sourceMap, 'mappings'); | |
var file = util.getArg(sourceMap, 'file', null); // Once again, Sass deviates from the spec and supplies the version as a | |
// string rather than a number, so we use loose equality checking here. | |
if (version != (this || _global$K)._version) { | |
throw new Error('Unsupported version: ' + version); | |
} | |
if (sourceRoot) { | |
sourceRoot = util.normalize(sourceRoot); | |
} | |
sources = sources.map(String) // Some source maps produce relative source paths like "./foo.js" instead of | |
// "foo.js". Normalize these first so that future comparisons will succeed. | |
// See bugzil.la/1090768. | |
.map(util.normalize) // Always ensure that absolute sources are internally stored relative to | |
// the source root, if the source root is absolute. Not doing this would | |
// be particularly problematic when the source root is a prefix of the | |
// source (valid, but why??). See github issue #199 and bugzil.la/1188982. | |
.map(function (source) { | |
return sourceRoot && util.isAbsolute(sourceRoot) && util.isAbsolute(source) ? util.relative(sourceRoot, source) : source; | |
}); // Pass `true` below to allow duplicate names and sources. While source maps | |
// are intended to be compressed and deduplicated, the TypeScript compiler | |
// sometimes generates source maps with duplicates in them. See Github issue | |
// #72 and bugzil.la/889492. | |
(this || _global$K)._names = ArraySet.fromArray(names.map(String), true); | |
(this || _global$K)._sources = ArraySet.fromArray(sources, true); | |
(this || _global$K)._absoluteSources = (this || _global$K)._sources.toArray().map(function (s) { | |
return util.computeSourceURL(sourceRoot, s, aSourceMapURL); | |
}); | |
(this || _global$K).sourceRoot = sourceRoot; | |
(this || _global$K).sourcesContent = sourcesContent; | |
(this || _global$K)._mappings = mappings; | |
(this || _global$K)._sourceMapURL = aSourceMapURL; | |
(this || _global$K).file = file; | |
} | |
BasicSourceMapConsumer.prototype = Object.create(SourceMapConsumer.prototype); | |
BasicSourceMapConsumer.prototype.consumer = SourceMapConsumer; | |
/** | |
* Utility function to find the index of a source. Returns -1 if not | |
* found. | |
*/ | |
BasicSourceMapConsumer.prototype._findSourceIndex = function (aSource) { | |
var relativeSource = aSource; | |
if ((this || _global$K).sourceRoot != null) { | |
relativeSource = util.relative((this || _global$K).sourceRoot, relativeSource); | |
} | |
if ((this || _global$K)._sources.has(relativeSource)) { | |
return (this || _global$K)._sources.indexOf(relativeSource); | |
} // Maybe aSource is an absolute URL as returned by |sources|. In | |
// this case we can't simply undo the transform. | |
var i; | |
for (i = 0; i < (this || _global$K)._absoluteSources.length; ++i) { | |
if ((this || _global$K)._absoluteSources[i] == aSource) { | |
return i; | |
} | |
} | |
return -1; | |
}; | |
/** | |
* Create a BasicSourceMapConsumer from a SourceMapGenerator. | |
* | |
* @param SourceMapGenerator aSourceMap | |
* The source map that will be consumed. | |
* @param String aSourceMapURL | |
* The URL at which the source map can be found (optional) | |
* @returns BasicSourceMapConsumer | |
*/ | |
BasicSourceMapConsumer.fromSourceMap = function SourceMapConsumer_fromSourceMap(aSourceMap, aSourceMapURL) { | |
var smc = Object.create(BasicSourceMapConsumer.prototype); | |
var names = smc._names = ArraySet.fromArray(aSourceMap._names.toArray(), true); | |
var sources = smc._sources = ArraySet.fromArray(aSourceMap._sources.toArray(), true); | |
smc.sourceRoot = aSourceMap._sourceRoot; | |
smc.sourcesContent = aSourceMap._generateSourcesContent(smc._sources.toArray(), smc.sourceRoot); | |
smc.file = aSourceMap._file; | |
smc._sourceMapURL = aSourceMapURL; | |
smc._absoluteSources = smc._sources.toArray().map(function (s) { | |
return util.computeSourceURL(smc.sourceRoot, s, aSourceMapURL); | |
}); // Because we are modifying the entries (by converting string sources and | |
// names to indices into the sources and names ArraySets), we have to make | |
// a copy of the entry or else bad things happen. Shared mutable state | |
// strikes again! See github issue #191. | |
var generatedMappings = aSourceMap._mappings.toArray().slice(); | |
var destGeneratedMappings = smc.__generatedMappings = []; | |
var destOriginalMappings = smc.__originalMappings = []; | |
for (var i = 0, length = generatedMappings.length; i < length; i++) { | |
var srcMapping = generatedMappings[i]; | |
var destMapping = new Mapping(); | |
destMapping.generatedLine = srcMapping.generatedLine; | |
destMapping.generatedColumn = srcMapping.generatedColumn; | |
if (srcMapping.source) { | |
destMapping.source = sources.indexOf(srcMapping.source); | |
destMapping.originalLine = srcMapping.originalLine; | |
destMapping.originalColumn = srcMapping.originalColumn; | |
if (srcMapping.name) { | |
destMapping.name = names.indexOf(srcMapping.name); | |
} | |
destOriginalMappings.push(destMapping); | |
} | |
destGeneratedMappings.push(destMapping); | |
} | |
quickSort(smc.__originalMappings, util.compareByOriginalPositions); | |
return smc; | |
}; | |
/** | |
* The version of the source mapping spec that we are consuming. | |
*/ | |
BasicSourceMapConsumer.prototype._version = 3; | |
/** | |
* The list of original sources. | |
*/ | |
Object.defineProperty(BasicSourceMapConsumer.prototype, 'sources', { | |
get: function () { | |
return (this || _global$K)._absoluteSources.slice(); | |
} | |
}); | |
/** | |
* Provide the JIT with a nice shape / hidden class. | |
*/ | |
function Mapping() { | |
(this || _global$K).generatedLine = 0; | |
(this || _global$K).generatedColumn = 0; | |
(this || _global$K).source = null; | |
(this || _global$K).originalLine = null; | |
(this || _global$K).originalColumn = null; | |
(this || _global$K).name = null; | |
} | |
/** | |
* Parse the mappings in a string in to a data structure which we can easily | |
* query (the ordered arrays in the `this.__generatedMappings` and | |
* `this.__originalMappings` properties). | |
*/ | |
BasicSourceMapConsumer.prototype._parseMappings = function SourceMapConsumer_parseMappings(aStr, aSourceRoot) { | |
var generatedLine = 1; | |
var previousGeneratedColumn = 0; | |
var previousOriginalLine = 0; | |
var previousOriginalColumn = 0; | |
var previousSource = 0; | |
var previousName = 0; | |
var length = aStr.length; | |
var index = 0; | |
var cachedSegments = {}; | |
var temp = {}; | |
var originalMappings = []; | |
var generatedMappings = []; | |
var mapping, str, segment, end, value; | |
while (index < length) { | |
if (aStr.charAt(index) === ';') { | |
generatedLine++; | |
index++; | |
previousGeneratedColumn = 0; | |
} else if (aStr.charAt(index) === ',') { | |
index++; | |
} else { | |
mapping = new Mapping(); | |
mapping.generatedLine = generatedLine; // Because each offset is encoded relative to the previous one, | |
// many segments often have the same encoding. We can exploit this | |
// fact by caching the parsed variable length fields of each segment, | |
// allowing us to avoid a second parse if we encounter the same | |
// segment again. | |
for (end = index; end < length; end++) { | |
if (this._charIsMappingSeparator(aStr, end)) { | |
break; | |
} | |
} | |
str = aStr.slice(index, end); | |
segment = cachedSegments[str]; | |
if (segment) { | |
index += str.length; | |
} else { | |
segment = []; | |
while (index < end) { | |
base64VLQ.decode(aStr, index, temp); | |
value = temp.value; | |
index = temp.rest; | |
segment.push(value); | |
} | |
if (segment.length === 2) { | |
throw new Error('Found a source, but no line and column'); | |
} | |
if (segment.length === 3) { | |
throw new Error('Found a source and line, but no column'); | |
} | |
cachedSegments[str] = segment; | |
} // Generated column. | |
mapping.generatedColumn = previousGeneratedColumn + segment[0]; | |
previousGeneratedColumn = mapping.generatedColumn; | |
if (segment.length > 1) { | |
// Original source. | |
mapping.source = previousSource + segment[1]; | |
previousSource += segment[1]; // Original line. | |
mapping.originalLine = previousOriginalLine + segment[2]; | |
previousOriginalLine = mapping.originalLine; // Lines are stored 0-based | |
mapping.originalLine += 1; // Original column. | |
mapping.originalColumn = previousOriginalColumn + segment[3]; | |
previousOriginalColumn = mapping.originalColumn; | |
if (segment.length > 4) { | |
// Original name. | |
mapping.name = previousName + segment[4]; | |
previousName += segment[4]; | |
} | |
} | |
generatedMappings.push(mapping); | |
if (typeof mapping.originalLine === 'number') { | |
originalMappings.push(mapping); | |
} | |
} | |
} | |
quickSort(generatedMappings, util.compareByGeneratedPositionsDeflated); | |
(this || _global$K).__generatedMappings = generatedMappings; | |
quickSort(originalMappings, util.compareByOriginalPositions); | |
(this || _global$K).__originalMappings = originalMappings; | |
}; | |
/** | |
* Find the mapping that best matches the hypothetical "needle" mapping that | |
* we are searching for in the given "haystack" of mappings. | |
*/ | |
BasicSourceMapConsumer.prototype._findMapping = function SourceMapConsumer_findMapping(aNeedle, aMappings, aLineName, aColumnName, aComparator, aBias) { | |
// To return the position we are searching for, we must first find the | |
// mapping for the given position and then return the opposite position it | |
// points to. Because the mappings are sorted, we can use binary search to | |
// find the best mapping. | |
if (aNeedle[aLineName] <= 0) { | |
throw new TypeError('Line must be greater than or equal to 1, got ' + aNeedle[aLineName]); | |
} | |
if (aNeedle[aColumnName] < 0) { | |
throw new TypeError('Column must be greater than or equal to 0, got ' + aNeedle[aColumnName]); | |
} | |
return binarySearch.search(aNeedle, aMappings, aComparator, aBias); | |
}; | |
/** | |
* Compute the last column for each generated mapping. The last column is | |
* inclusive. | |
*/ | |
BasicSourceMapConsumer.prototype.computeColumnSpans = function SourceMapConsumer_computeColumnSpans() { | |
for (var index = 0; index < (this || _global$K)._generatedMappings.length; ++index) { | |
var mapping = (this || _global$K)._generatedMappings[index]; // Mappings do not contain a field for the last generated columnt. We | |
// can come up with an optimistic estimate, however, by assuming that | |
// mappings are contiguous (i.e. given two consecutive mappings, the | |
// first mapping ends where the second one starts). | |
if (index + 1 < (this || _global$K)._generatedMappings.length) { | |
var nextMapping = (this || _global$K)._generatedMappings[index + 1]; | |
if (mapping.generatedLine === nextMapping.generatedLine) { | |
mapping.lastGeneratedColumn = nextMapping.generatedColumn - 1; | |
continue; | |
} | |
} // The last mapping for each line spans the entire line. | |
mapping.lastGeneratedColumn = Infinity; | |
} | |
}; | |
/** | |
* Returns the original source, line, and column information for the generated | |
* source's line and column positions provided. The only argument is an object | |
* with the following properties: | |
* | |
* - line: The line number in the generated source. The line number | |
* is 1-based. | |
* - column: The column number in the generated source. The column | |
* number is 0-based. | |
* - bias: Either 'SourceMapConsumer.GREATEST_LOWER_BOUND' or | |
* 'SourceMapConsumer.LEAST_UPPER_BOUND'. Specifies whether to return the | |
* closest element that is smaller than or greater than the one we are | |
* searching for, respectively, if the exact element cannot be found. | |
* Defaults to 'SourceMapConsumer.GREATEST_LOWER_BOUND'. | |
* | |
* and an object is returned with the following properties: | |
* | |
* - source: The original source file, or null. | |
* - line: The line number in the original source, or null. The | |
* line number is 1-based. | |
* - column: The column number in the original source, or null. The | |
* column number is 0-based. | |
* - name: The original identifier, or null. | |
*/ | |
BasicSourceMapConsumer.prototype.originalPositionFor = function SourceMapConsumer_originalPositionFor(aArgs) { | |
var needle = { | |
generatedLine: util.getArg(aArgs, 'line'), | |
generatedColumn: util.getArg(aArgs, 'column') | |
}; | |
var index = this._findMapping(needle, (this || _global$K)._generatedMappings, "generatedLine", "generatedColumn", util.compareByGeneratedPositionsDeflated, util.getArg(aArgs, 'bias', SourceMapConsumer.GREATEST_LOWER_BOUND)); | |
if (index >= 0) { | |
var mapping = (this || _global$K)._generatedMappings[index]; | |
if (mapping.generatedLine === needle.generatedLine) { | |
var source = util.getArg(mapping, 'source', null); | |
if (source !== null) { | |
source = (this || _global$K)._sources.at(source); | |
source = util.computeSourceURL((this || _global$K).sourceRoot, source, (this || _global$K)._sourceMapURL); | |
} | |
var name = util.getArg(mapping, 'name', null); | |
if (name !== null) { | |
name = (this || _global$K)._names.at(name); | |
} | |
return { | |
source: source, | |
line: util.getArg(mapping, 'originalLine', null), | |
column: util.getArg(mapping, 'originalColumn', null), | |
name: name | |
}; | |
} | |
} | |
return { | |
source: null, | |
line: null, | |
column: null, | |
name: null | |
}; | |
}; | |
/** | |
* Return true if we have the source content for every source in the source | |
* map, false otherwise. | |
*/ | |
BasicSourceMapConsumer.prototype.hasContentsOfAllSources = function BasicSourceMapConsumer_hasContentsOfAllSources() { | |
if (!(this || _global$K).sourcesContent) { | |
return false; | |
} | |
return (this || _global$K).sourcesContent.length >= (this || _global$K)._sources.size() && !(this || _global$K).sourcesContent.some(function (sc) { | |
return sc == null; | |
}); | |
}; | |
/** | |
* Returns the original source content. The only argument is the url of the | |
* original source file. Returns null if no original source content is | |
* available. | |
*/ | |
BasicSourceMapConsumer.prototype.sourceContentFor = function SourceMapConsumer_sourceContentFor(aSource, nullOnMissing) { | |
if (!(this || _global$K).sourcesContent) { | |
return null; | |
} | |
var index = this._findSourceIndex(aSource); | |
if (index >= 0) { | |
return (this || _global$K).sourcesContent[index]; | |
} | |
var relativeSource = aSource; | |
if ((this || _global$K).sourceRoot != null) { | |
relativeSource = util.relative((this || _global$K).sourceRoot, relativeSource); | |
} | |
var url; | |
if ((this || _global$K).sourceRoot != null && (url = util.urlParse((this || _global$K).sourceRoot))) { | |
// XXX: file:// URIs and absolute paths lead to unexpected behavior for | |
// many users. We can help them out when they expect file:// URIs to | |
// behave like it would if they were running a local HTTP server. See | |
// https://bugzilla.mozilla.org/show_bug.cgi?id=885597. | |
var fileUriAbsPath = relativeSource.replace(/^file:\/\//, ""); | |
if (url.scheme == "file" && (this || _global$K)._sources.has(fileUriAbsPath)) { | |
return (this || _global$K).sourcesContent[(this || _global$K)._sources.indexOf(fileUriAbsPath)]; | |
} | |
if ((!url.path || url.path == "/") && (this || _global$K)._sources.has("/" + relativeSource)) { | |
return (this || _global$K).sourcesContent[(this || _global$K)._sources.indexOf("/" + relativeSource)]; | |
} | |
} // This function is used recursively from | |
// IndexedSourceMapConsumer.prototype.sourceContentFor. In that case, we | |
// don't want to throw if we can't find the source - we just want to | |
// return null, so we provide a flag to exit gracefully. | |
if (nullOnMissing) { | |
return null; | |
} else { | |
throw new Error('"' + relativeSource + '" is not in the SourceMap.'); | |
} | |
}; | |
/** | |
* Returns the generated line and column information for the original source, | |
* line, and column positions provided. The only argument is an object with | |
* the following properties: | |
* | |
* - source: The filename of the original source. | |
* - line: The line number in the original source. The line number | |
* is 1-based. | |
* - column: The column number in the original source. The column | |
* number is 0-based. | |
* - bias: Either 'SourceMapConsumer.GREATEST_LOWER_BOUND' or | |
* 'SourceMapConsumer.LEAST_UPPER_BOUND'. Specifies whether to return the | |
* closest element that is smaller than or greater than the one we are | |
* searching for, respectively, if the exact element cannot be found. | |
* Defaults to 'SourceMapConsumer.GREATEST_LOWER_BOUND'. | |
* | |
* and an object is returned with the following properties: | |
* | |
* - line: The line number in the generated source, or null. The | |
* line number is 1-based. | |
* - column: The column number in the generated source, or null. | |
* The column number is 0-based. | |
*/ | |
BasicSourceMapConsumer.prototype.generatedPositionFor = function SourceMapConsumer_generatedPositionFor(aArgs) { | |
var source = util.getArg(aArgs, 'source'); | |
source = this._findSourceIndex(source); | |
if (source < 0) { | |
return { | |
line: null, | |
column: null, | |
lastColumn: null | |
}; | |
} | |
var needle = { | |
source: source, | |
originalLine: util.getArg(aArgs, 'line'), | |
originalColumn: util.getArg(aArgs, 'column') | |
}; | |
var index = this._findMapping(needle, (this || _global$K)._originalMappings, "originalLine", "originalColumn", util.compareByOriginalPositions, util.getArg(aArgs, 'bias', SourceMapConsumer.GREATEST_LOWER_BOUND)); | |
if (index >= 0) { | |
var mapping = (this || _global$K)._originalMappings[index]; | |
if (mapping.source === needle.source) { | |
return { | |
line: util.getArg(mapping, 'generatedLine', null), | |
column: util.getArg(mapping, 'generatedColumn', null), | |
lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null) | |
}; | |
} | |
} | |
return { | |
line: null, | |
column: null, | |
lastColumn: null | |
}; | |
}; | |
exports$9X.BasicSourceMapConsumer = BasicSourceMapConsumer; | |
/** | |
* An IndexedSourceMapConsumer instance represents a parsed source map which | |
* we can query for information. It differs from BasicSourceMapConsumer in | |
* that it takes "indexed" source maps (i.e. ones with a "sections" field) as | |
* input. | |
* | |
* The first parameter is a raw source map (either as a JSON string, or already | |
* parsed to an object). According to the spec for indexed source maps, they | |
* have the following attributes: | |
* | |
* - version: Which version of the source map spec this map is following. | |
* - file: Optional. The generated file this source map is associated with. | |
* - sections: A list of section definitions. | |
* | |
* Each value under the "sections" field has two fields: | |
* - offset: The offset into the original specified at which this section | |
* begins to apply, defined as an object with a "line" and "column" | |
* field. | |
* - map: A source map definition. This source map could also be indexed, | |
* but doesn't have to be. | |
* | |
* Instead of the "map" field, it's also possible to have a "url" field | |
* specifying a URL to retrieve a source map from, but that's currently | |
* unsupported. | |
* | |
* Here's an example source map, taken from the source map spec[0], but | |
* modified to omit a section which uses the "url" field. | |
* | |
* { | |
* version : 3, | |
* file: "app.js", | |
* sections: [{ | |
* offset: {line:100, column:10}, | |
* map: { | |
* version : 3, | |
* file: "section.js", | |
* sources: ["foo.js", "bar.js"], | |
* names: ["src", "maps", "are", "fun"], | |
* mappings: "AAAA,E;;ABCDE;" | |
* } | |
* }], | |
* } | |
* | |
* The second parameter, if given, is a string whose value is the URL | |
* at which the source map was found. This URL is used to compute the | |
* sources array. | |
* | |
* [0]: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit#heading=h.535es3xeprgt | |
*/ | |
function IndexedSourceMapConsumer(aSourceMap, aSourceMapURL) { | |
var sourceMap = aSourceMap; | |
if (typeof aSourceMap === 'string') { | |
sourceMap = util.parseSourceMapInput(aSourceMap); | |
} | |
var version = util.getArg(sourceMap, 'version'); | |
var sections = util.getArg(sourceMap, 'sections'); | |
if (version != (this || _global$K)._version) { | |
throw new Error('Unsupported version: ' + version); | |
} | |
(this || _global$K)._sources = new ArraySet(); | |
(this || _global$K)._names = new ArraySet(); | |
var lastOffset = { | |
line: -1, | |
column: 0 | |
}; | |
(this || _global$K)._sections = sections.map(function (s) { | |
if (s.url) { | |
// The url field will require support for asynchronicity. | |
// See https://github.com/mozilla/source-map/issues/16 | |
throw new Error('Support for url field in sections not implemented.'); | |
} | |
var offset = util.getArg(s, 'offset'); | |
var offsetLine = util.getArg(offset, 'line'); | |
var offsetColumn = util.getArg(offset, 'column'); | |
if (offsetLine < lastOffset.line || offsetLine === lastOffset.line && offsetColumn < lastOffset.column) { | |
throw new Error('Section offsets must be ordered and non-overlapping.'); | |
} | |
lastOffset = offset; | |
return { | |
generatedOffset: { | |
// The offset fields are 0-based, but we use 1-based indices when | |
// encoding/decoding from VLQ. | |
generatedLine: offsetLine + 1, | |
generatedColumn: offsetColumn + 1 | |
}, | |
consumer: new SourceMapConsumer(util.getArg(s, 'map'), aSourceMapURL) | |
}; | |
}); | |
} | |
IndexedSourceMapConsumer.prototype = Object.create(SourceMapConsumer.prototype); | |
IndexedSourceMapConsumer.prototype.constructor = SourceMapConsumer; | |
/** | |
* The version of the source mapping spec that we are consuming. | |
*/ | |
IndexedSourceMapConsumer.prototype._version = 3; | |
/** | |
* The list of original sources. | |
*/ | |
Object.defineProperty(IndexedSourceMapConsumer.prototype, 'sources', { | |
get: function () { | |
var sources = []; | |
for (var i = 0; i < (this || _global$K)._sections.length; i++) { | |
for (var j = 0; j < (this || _global$K)._sections[i].consumer.sources.length; j++) { | |
sources.push((this || _global$K)._sections[i].consumer.sources[j]); | |
} | |
} | |
return sources; | |
} | |
}); | |
/** | |
* Returns the original source, line, and column information for the generated | |
* source's line and column positions provided. The only argument is an object | |
* with the following properties: | |
* | |
* - line: The line number in the generated source. The line number | |
* is 1-based. | |
* - column: The column number in the generated source. The column | |
* number is 0-based. | |
* | |
* and an object is returned with the following properties: | |
* | |
* - source: The original source file, or null. | |
* - line: The line number in the original source, or null. The | |
* line number is 1-based. | |
* - column: The column number in the original source, or null. The | |
* column number is 0-based. | |
* - name: The original identifier, or null. | |
*/ | |
IndexedSourceMapConsumer.prototype.originalPositionFor = function IndexedSourceMapConsumer_originalPositionFor(aArgs) { | |
var needle = { | |
generatedLine: util.getArg(aArgs, 'line'), | |
generatedColumn: util.getArg(aArgs, 'column') | |
}; // Find the section containing the generated position we're trying to map | |
// to an original position. | |
var sectionIndex = binarySearch.search(needle, (this || _global$K)._sections, function (needle, section) { | |
var cmp = needle.generatedLine - section.generatedOffset.generatedLine; | |
if (cmp) { | |
return cmp; | |
} | |
return needle.generatedColumn - section.generatedOffset.generatedColumn; | |
}); | |
var section = (this || _global$K)._sections[sectionIndex]; | |
if (!section) { | |
return { | |
source: null, | |
line: null, | |
column: null, | |
name: null | |
}; | |
} | |
return section.consumer.originalPositionFor({ | |
line: needle.generatedLine - (section.generatedOffset.generatedLine - 1), | |
column: needle.generatedColumn - (section.generatedOffset.generatedLine === needle.generatedLine ? section.generatedOffset.generatedColumn - 1 : 0), | |
bias: aArgs.bias | |
}); | |
}; | |
/** | |
* Return true if we have the source content for every source in the source | |
* map, false otherwise. | |
*/ | |
IndexedSourceMapConsumer.prototype.hasContentsOfAllSources = function IndexedSourceMapConsumer_hasContentsOfAllSources() { | |
return (this || _global$K)._sections.every(function (s) { | |
return s.consumer.hasContentsOfAllSources(); | |
}); | |
}; | |
/** | |
* Returns the original source content. The only argument is the url of the | |
* original source file. Returns null if no original source content is | |
* available. | |
*/ | |
IndexedSourceMapConsumer.prototype.sourceContentFor = function IndexedSourceMapConsumer_sourceContentFor(aSource, nullOnMissing) { | |
for (var i = 0; i < (this || _global$K)._sections.length; i++) { | |
var section = (this || _global$K)._sections[i]; | |
var content = section.consumer.sourceContentFor(aSource, true); | |
if (content) { | |
return content; | |
} | |
} | |
if (nullOnMissing) { | |
return null; | |
} else { | |
throw new Error('"' + aSource + '" is not in the SourceMap.'); | |
} | |
}; | |
/** | |
* Returns the generated line and column information for the original source, | |
* line, and column positions provided. The only argument is an object with | |
* the following properties: | |
* | |
* - source: The filename of the original source. | |
* - line: The line number in the original source. The line number | |
* is 1-based. | |
* - column: The column number in the original source. The column | |
* number is 0-based. | |
* | |
* and an object is returned with the following properties: | |
* | |
* - line: The line number in the generated source, or null. The | |
* line number is 1-based. | |
* - column: The column number in the generated source, or null. | |
* The column number is 0-based. | |
*/ | |
IndexedSourceMapConsumer.prototype.generatedPositionFor = function IndexedSourceMapConsumer_generatedPositionFor(aArgs) { | |
for (var i = 0; i < (this || _global$K)._sections.length; i++) { | |
var section = (this || _global$K)._sections[i]; // Only consider this section if the requested source is in the list of | |
// sources of the consumer. | |
if (section.consumer._findSourceIndex(util.getArg(aArgs, 'source')) === -1) { | |
continue; | |
} | |
var generatedPosition = section.consumer.generatedPositionFor(aArgs); | |
if (generatedPosition) { | |
var ret = { | |
line: generatedPosition.line + (section.generatedOffset.generatedLine - 1), | |
column: generatedPosition.column + (section.generatedOffset.generatedLine === generatedPosition.line ? section.generatedOffset.generatedColumn - 1 : 0) | |
}; | |
return ret; | |
} | |
} | |
return { | |
line: null, | |
column: null | |
}; | |
}; | |
/** | |
* Parse the mappings in a string in to a data structure which we can easily | |
* query (the ordered arrays in the `this.__generatedMappings` and | |
* `this.__originalMappings` properties). | |
*/ | |
IndexedSourceMapConsumer.prototype._parseMappings = function IndexedSourceMapConsumer_parseMappings(aStr, aSourceRoot) { | |
(this || _global$K).__generatedMappings = []; | |
(this || _global$K).__originalMappings = []; | |
for (var i = 0; i < (this || _global$K)._sections.length; i++) { | |
var section = (this || _global$K)._sections[i]; | |
var sectionMappings = section.consumer._generatedMappings; | |
for (var j = 0; j < sectionMappings.length; j++) { | |
var mapping = sectionMappings[j]; | |
var source = section.consumer._sources.at(mapping.source); | |
source = util.computeSourceURL(section.consumer.sourceRoot, source, (this || _global$K)._sourceMapURL); | |
(this || _global$K)._sources.add(source); | |
source = (this || _global$K)._sources.indexOf(source); | |
var name = null; | |
if (mapping.name) { | |
name = section.consumer._names.at(mapping.name); | |
(this || _global$K)._names.add(name); | |
name = (this || _global$K)._names.indexOf(name); | |
} // The mappings coming from the consumer for the section have | |
// generated positions relative to the start of the section, so we | |
// need to offset them to be relative to the start of the concatenated | |
// generated file. | |
var adjustedMapping = { | |
source: source, | |
generatedLine: mapping.generatedLine + (section.generatedOffset.generatedLine - 1), | |
generatedColumn: mapping.generatedColumn + (section.generatedOffset.generatedLine === mapping.generatedLine ? section.generatedOffset.generatedColumn - 1 : 0), | |
originalLine: mapping.originalLine, | |
originalColumn: mapping.originalColumn, | |
name: name | |
}; | |
(this || _global$K).__generatedMappings.push(adjustedMapping); | |
if (typeof adjustedMapping.originalLine === 'number') { | |
(this || _global$K).__originalMappings.push(adjustedMapping); | |
} | |
} | |
} | |
quickSort((this || _global$K).__generatedMappings, util.compareByGeneratedPositionsDeflated); | |
quickSort((this || _global$K).__originalMappings, util.compareByOriginalPositions); | |
}; | |
exports$9X.IndexedSourceMapConsumer = IndexedSourceMapConsumer; | |
return exports$9X; | |
} | |
var exports$9W = {}, | |
_dewExec$9F = false; | |
var _global$J = typeof self !== "undefined" ? self : global; | |
function dew$9W() { | |
if (_dewExec$9F) return exports$9W; | |
_dewExec$9F = true; | |
/* -*- Mode: js; js-indent-level: 2; -*- */ | |
/* | |
* Copyright 2011 Mozilla Foundation and contributors | |
* Licensed under the New BSD license. See LICENSE or: | |
* http://opensource.org/licenses/BSD-3-Clause | |
*/ | |
var SourceMapGenerator = dew$9_().SourceMapGenerator; | |
var util = dew$a1(); // Matches a Windows-style `\r\n` newline or a `\n` newline used by all other | |
// operating systems these days (capturing the result). | |
var REGEX_NEWLINE = /(\r?\n)/; // Newline character code for charCodeAt() comparisons | |
var NEWLINE_CODE = 10; // Private symbol for identifying `SourceNode`s when multiple versions of | |
// the source-map library are loaded. This MUST NOT CHANGE across | |
// versions! | |
var isSourceNode = "$$$isSourceNode$$$"; | |
/** | |
* SourceNodes provide a way to abstract over interpolating/concatenating | |
* snippets of generated JavaScript source code while maintaining the line and | |
* column information associated with the original source code. | |
* | |
* @param aLine The original line number. | |
* @param aColumn The original column number. | |
* @param aSource The original source's filename. | |
* @param aChunks Optional. An array of strings which are snippets of | |
* generated JS, or other SourceNodes. | |
* @param aName The original identifier. | |
*/ | |
function SourceNode(aLine, aColumn, aSource, aChunks, aName) { | |
(this || _global$J).children = []; | |
(this || _global$J).sourceContents = {}; | |
(this || _global$J).line = aLine == null ? null : aLine; | |
(this || _global$J).column = aColumn == null ? null : aColumn; | |
(this || _global$J).source = aSource == null ? null : aSource; | |
(this || _global$J).name = aName == null ? null : aName; | |
(this || _global$J)[isSourceNode] = true; | |
if (aChunks != null) this.add(aChunks); | |
} | |
/** | |
* Creates a SourceNode from generated code and a SourceMapConsumer. | |
* | |
* @param aGeneratedCode The generated code | |
* @param aSourceMapConsumer The SourceMap for the generated code | |
* @param aRelativePath Optional. The path that relative sources in the | |
* SourceMapConsumer should be relative to. | |
*/ | |
SourceNode.fromStringWithSourceMap = function SourceNode_fromStringWithSourceMap(aGeneratedCode, aSourceMapConsumer, aRelativePath) { | |
// The SourceNode we want to fill with the generated code | |
// and the SourceMap | |
var node = new SourceNode(); // All even indices of this array are one line of the generated code, | |
// while all odd indices are the newlines between two adjacent lines | |
// (since `REGEX_NEWLINE` captures its match). | |
// Processed fragments are accessed by calling `shiftNextLine`. | |
var remainingLines = aGeneratedCode.split(REGEX_NEWLINE); | |
var remainingLinesIndex = 0; | |
var shiftNextLine = function () { | |
var lineContents = getNextLine(); // The last line of a file might not have a newline. | |
var newLine = getNextLine() || ""; | |
return lineContents + newLine; | |
function getNextLine() { | |
return remainingLinesIndex < remainingLines.length ? remainingLines[remainingLinesIndex++] : undefined; | |
} | |
}; // We need to remember the position of "remainingLines" | |
var lastGeneratedLine = 1, | |
lastGeneratedColumn = 0; // The generate SourceNodes we need a code range. | |
// To extract it current and last mapping is used. | |
// Here we store the last mapping. | |
var lastMapping = null; | |
aSourceMapConsumer.eachMapping(function (mapping) { | |
if (lastMapping !== null) { | |
// We add the code from "lastMapping" to "mapping": | |
// First check if there is a new line in between. | |
if (lastGeneratedLine < mapping.generatedLine) { | |
// Associate first line with "lastMapping" | |
addMappingWithCode(lastMapping, shiftNextLine()); | |
lastGeneratedLine++; | |
lastGeneratedColumn = 0; // The remaining code is added without mapping | |
} else { | |
// There is no new line in between. | |
// Associate the code between "lastGeneratedColumn" and | |
// "mapping.generatedColumn" with "lastMapping" | |
var nextLine = remainingLines[remainingLinesIndex] || ''; | |
var code = nextLine.substr(0, mapping.generatedColumn - lastGeneratedColumn); | |
remainingLines[remainingLinesIndex] = nextLine.substr(mapping.generatedColumn - lastGeneratedColumn); | |
lastGeneratedColumn = mapping.generatedColumn; | |
addMappingWithCode(lastMapping, code); // No more remaining code, continue | |
lastMapping = mapping; | |
return; | |
} | |
} // We add the generated code until the first mapping | |
// to the SourceNode without any mapping. | |
// Each line is added as separate string. | |
while (lastGeneratedLine < mapping.generatedLine) { | |
node.add(shiftNextLine()); | |
lastGeneratedLine++; | |
} | |
if (lastGeneratedColumn < mapping.generatedColumn) { | |
var nextLine = remainingLines[remainingLinesIndex] || ''; | |
node.add(nextLine.substr(0, mapping.generatedColumn)); | |
remainingLines[remainingLinesIndex] = nextLine.substr(mapping.generatedColumn); | |
lastGeneratedColumn = mapping.generatedColumn; | |
} | |
lastMapping = mapping; | |
}, this || _global$J); // We have processed all mappings. | |
if (remainingLinesIndex < remainingLines.length) { | |
if (lastMapping) { | |
// Associate the remaining code in the current line with "lastMapping" | |
addMappingWithCode(lastMapping, shiftNextLine()); | |
} // and add the remaining lines without any mapping | |
node.add(remainingLines.splice(remainingLinesIndex).join("")); | |
} // Copy sourcesContent into SourceNode | |
aSourceMapConsumer.sources.forEach(function (sourceFile) { | |
var content = aSourceMapConsumer.sourceContentFor(sourceFile); | |
if (content != null) { | |
if (aRelativePath != null) { | |
sourceFile = util.join(aRelativePath, sourceFile); | |
} | |
node.setSourceContent(sourceFile, content); | |
} | |
}); | |
return node; | |
function addMappingWithCode(mapping, code) { | |
if (mapping === null || mapping.source === undefined) { | |
node.add(code); | |
} else { | |
var source = aRelativePath ? util.join(aRelativePath, mapping.source) : mapping.source; | |
node.add(new SourceNode(mapping.originalLine, mapping.originalColumn, source, code, mapping.name)); | |
} | |
} | |
}; | |
/** | |
* Add a chunk of generated JS to this source node. | |
* | |
* @param aChunk A string snippet of generated JS code, another instance of | |
* SourceNode, or an array where each member is one of those things. | |
*/ | |
SourceNode.prototype.add = function SourceNode_add(aChunk) { | |
if (Array.isArray(aChunk)) { | |
aChunk.forEach(function (chunk) { | |
this.add(chunk); | |
}, this || _global$J); | |
} else if (aChunk[isSourceNode] || typeof aChunk === "string") { | |
if (aChunk) { | |
(this || _global$J).children.push(aChunk); | |
} | |
} else { | |
throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got " + aChunk); | |
} | |
return this || _global$J; | |
}; | |
/** | |
* Add a chunk of generated JS to the beginning of this source node. | |
* | |
* @param aChunk A string snippet of generated JS code, another instance of | |
* SourceNode, or an array where each member is one of those things. | |
*/ | |
SourceNode.prototype.prepend = function SourceNode_prepend(aChunk) { | |
if (Array.isArray(aChunk)) { | |
for (var i = aChunk.length - 1; i >= 0; i--) { | |
this.prepend(aChunk[i]); | |
} | |
} else if (aChunk[isSourceNode] || typeof aChunk === "string") { | |
(this || _global$J).children.unshift(aChunk); | |
} else { | |
throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got " + aChunk); | |
} | |
return this || _global$J; | |
}; | |
/** | |
* Walk over the tree of JS snippets in this node and its children. The | |
* walking function is called once for each snippet of JS and is passed that | |
* snippet and the its original associated source's line/column location. | |
* | |
* @param aFn The traversal function. | |
*/ | |
SourceNode.prototype.walk = function SourceNode_walk(aFn) { | |
var chunk; | |
for (var i = 0, len = (this || _global$J).children.length; i < len; i++) { | |
chunk = (this || _global$J).children[i]; | |
if (chunk[isSourceNode]) { | |
chunk.walk(aFn); | |
} else { | |
if (chunk !== '') { | |
aFn(chunk, { | |
source: (this || _global$J).source, | |
line: (this || _global$J).line, | |
column: (this || _global$J).column, | |
name: (this || _global$J).name | |
}); | |
} | |
} | |
} | |
}; | |
/** | |
* Like `String.prototype.join` except for SourceNodes. Inserts `aStr` between | |
* each of `this.children`. | |
* | |
* @param aSep The separator. | |
*/ | |
SourceNode.prototype.join = function SourceNode_join(aSep) { | |
var newChildren; | |
var i; | |
var len = (this || _global$J).children.length; | |
if (len > 0) { | |
newChildren = []; | |
for (i = 0; i < len - 1; i++) { | |
newChildren.push((this || _global$J).children[i]); | |
newChildren.push(aSep); | |
} | |
newChildren.push((this || _global$J).children[i]); | |
(this || _global$J).children = newChildren; | |
} | |
return this || _global$J; | |
}; | |
/** | |
* Call String.prototype.replace on the very right-most source snippet. Useful | |
* for trimming whitespace from the end of a source node, etc. | |
* | |
* @param aPattern The pattern to replace. | |
* @param aReplacement The thing to replace the pattern with. | |
*/ | |
SourceNode.prototype.replaceRight = function SourceNode_replaceRight(aPattern, aReplacement) { | |
var lastChild = (this || _global$J).children[(this || _global$J).children.length - 1]; | |
if (lastChild[isSourceNode]) { | |
lastChild.replaceRight(aPattern, aReplacement); | |
} else if (typeof lastChild === 'string') { | |
(this || _global$J).children[(this || _global$J).children.length - 1] = lastChild.replace(aPattern, aReplacement); | |
} else { | |
(this || _global$J).children.push(''.replace(aPattern, aReplacement)); | |
} | |
return this || _global$J; | |
}; | |
/** | |
* Set the source content for a source file. This will be added to the SourceMapGenerator | |
* in the sourcesContent field. | |
* | |
* @param aSourceFile The filename of the source file | |
* @param aSourceContent The content of the source file | |
*/ | |
SourceNode.prototype.setSourceContent = function SourceNode_setSourceContent(aSourceFile, aSourceContent) { | |
(this || _global$J).sourceContents[util.toSetString(aSourceFile)] = aSourceContent; | |
}; | |
/** | |
* Walk over the tree of SourceNodes. The walking function is called for each | |
* source file content and is passed the filename and source content. | |
* | |
* @param aFn The traversal function. | |
*/ | |
SourceNode.prototype.walkSourceContents = function SourceNode_walkSourceContents(aFn) { | |
for (var i = 0, len = (this || _global$J).children.length; i < len; i++) { | |
if ((this || _global$J).children[i][isSourceNode]) { | |
(this || _global$J).children[i].walkSourceContents(aFn); | |
} | |
} | |
var sources = Object.keys((this || _global$J).sourceContents); | |
for (var i = 0, len = sources.length; i < len; i++) { | |
aFn(util.fromSetString(sources[i]), (this || _global$J).sourceContents[sources[i]]); | |
} | |
}; | |
/** | |
* Return the string representation of this source node. Walks over the tree | |
* and concatenates all the various snippets together to one string. | |
*/ | |
SourceNode.prototype.toString = function SourceNode_toString() { | |
var str = ""; | |
this.walk(function (chunk) { | |
str += chunk; | |
}); | |
return str; | |
}; | |
/** | |
* Returns the string representation of this source node along with a source | |
* map. | |
*/ | |
SourceNode.prototype.toStringWithSourceMap = function SourceNode_toStringWithSourceMap(aArgs) { | |
var generated = { | |
code: "", | |
line: 1, | |
column: 0 | |
}; | |
var map = new SourceMapGenerator(aArgs); | |
var sourceMappingActive = false; | |
var lastOriginalSource = null; | |
var lastOriginalLine = null; | |
var lastOriginalColumn = null; | |
var lastOriginalName = null; | |
this.walk(function (chunk, original) { | |
generated.code += chunk; | |
if (original.source !== null && original.line !== null && original.column !== null) { | |
if (lastOriginalSource !== original.source || lastOriginalLine !== original.line || lastOriginalColumn !== original.column || lastOriginalName !== original.name) { | |
map.addMapping({ | |
source: original.source, | |
original: { | |
line: original.line, | |
column: original.column | |
}, | |
generated: { | |
line: generated.line, | |
column: generated.column | |
}, | |
name: original.name | |
}); | |
} | |
lastOriginalSource = original.source; | |
lastOriginalLine = original.line; | |
lastOriginalColumn = original.column; | |
lastOriginalName = original.name; | |
sourceMappingActive = true; | |
} else if (sourceMappingActive) { | |
map.addMapping({ | |
generated: { | |
line: generated.line, | |
column: generated.column | |
} | |
}); | |
lastOriginalSource = null; | |
sourceMappingActive = false; | |
} | |
for (var idx = 0, length = chunk.length; idx < length; idx++) { | |
if (chunk.charCodeAt(idx) === NEWLINE_CODE) { | |
generated.line++; | |
generated.column = 0; // Mappings end at eol | |
if (idx + 1 === length) { | |
lastOriginalSource = null; | |
sourceMappingActive = false; | |
} else if (sourceMappingActive) { | |
map.addMapping({ | |
source: original.source, | |
original: { | |
line: original.line, | |
column: original.column | |
}, | |
generated: { | |
line: generated.line, | |
column: generated.column | |
}, | |
name: original.name | |
}); | |
} | |
} else { | |
generated.column++; | |
} | |
} | |
}); | |
this.walkSourceContents(function (sourceFile, sourceContent) { | |
map.setSourceContent(sourceFile, sourceContent); | |
}); | |
return { | |
code: generated.code, | |
map: map | |
}; | |
}; | |
exports$9W.SourceNode = SourceNode; | |
return exports$9W; | |
} | |
var exports$9V = {}, | |
_dewExec$9E = false; | |
function dew$9V() { | |
if (_dewExec$9E) return exports$9V; | |
_dewExec$9E = true; | |
/* | |
* Copyright 2009-2011 Mozilla Foundation and contributors | |
* Licensed under the New BSD license. See LICENSE.txt or: | |
* http://opensource.org/licenses/BSD-3-Clause | |
*/ | |
exports$9V.SourceMapGenerator = dew$9_().SourceMapGenerator; | |
exports$9V.SourceMapConsumer = dew$9X().SourceMapConsumer; | |
exports$9V.SourceNode = dew$9W().SourceNode; | |
return exports$9V; | |
} | |
function dew$9U () { return exports$9U } | |
var exports$9U = { | |
"name": "escodegen", | |
"description": "ECMAScript code generator", | |
"homepage": "http://github.com/estools/escodegen", | |
"main": "escodegen.js", | |
"bin": { | |
"esgenerate": "./bin/esgenerate.js", | |
"escodegen": "./bin/escodegen.js" | |
}, | |
"files": [ | |
"LICENSE.BSD", | |
"README.md", | |
"bin", | |
"escodegen.js", | |
"package.json" | |
], | |
"version": "2.0.0", | |
"engines": { | |
"node": ">=6.0" | |
}, | |
"maintainers": [ | |
{ | |
"name": "Yusuke Suzuki", | |
"email": "[email protected]", | |
"web": "http://github.com/Constellation" | |
} | |
], | |
"repository": { | |
"type": "git", | |
"url": "http://github.com/estools/escodegen.git" | |
}, | |
"dependencies": { | |
"estraverse": "^5.2.0", | |
"esutils": "^2.0.2", | |
"esprima": "^4.0.1", | |
"optionator": "^0.8.1" | |
}, | |
"optionalDependencies": { | |
"source-map": "~0.6.1" | |
}, | |
"devDependencies": { | |
"acorn": "^7.3.1", | |
"bluebird": "^3.4.7", | |
"bower-registry-client": "^1.0.0", | |
"chai": "^4.2.0", | |
"chai-exclude": "^2.0.2", | |
"commonjs-everywhere": "^0.9.7", | |
"gulp": "^3.8.10", | |
"gulp-eslint": "^3.0.1", | |
"gulp-mocha": "^3.0.1", | |
"semver": "^5.1.0" | |
}, | |
"license": "BSD-2-Clause", | |
"scripts": { | |
"test": "gulp travis", | |
"unit-test": "gulp test", | |
"lint": "gulp lint", | |
"release": "node tools/release.js", | |
"build-min": "./node_modules/.bin/cjsify -ma path: tools/entry-point.js > escodegen.browser.min.js", | |
"build": "./node_modules/.bin/cjsify -a path: tools/entry-point.js > escodegen.browser.js" | |
} | |
} | |
; | |
var exports$9T = {}, | |
_dewExec$9D = false; | |
var _global$I = typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : global; | |
function dew$9T() { | |
if (_dewExec$9D) return exports$9T; | |
_dewExec$9D = true; | |
/* | |
Copyright (C) 2012-2014 Yusuke Suzuki <[email protected]> | |
Copyright (C) 2015 Ingvar Stepanyan <[email protected]> | |
Copyright (C) 2014 Ivan Nikulin <[email protected]> | |
Copyright (C) 2012-2013 Michael Ficarra <[email protected]> | |
Copyright (C) 2012-2013 Mathias Bynens <[email protected]> | |
Copyright (C) 2013 Irakli Gozalishvili <[email protected]> | |
Copyright (C) 2012 Robert Gust-Bardon <[email protected]> | |
Copyright (C) 2012 John Freeman <[email protected]> | |
Copyright (C) 2011-2012 Ariya Hidayat <[email protected]> | |
Copyright (C) 2012 Joost-Wim Boekesteijn <[email protected]> | |
Copyright (C) 2012 Kris Kowal <[email protected]> | |
Copyright (C) 2012 Arpad Borsos <[email protected]> | |
Redistribution and use in source and binary forms, with or without | |
modification, are permitted provided that the following conditions are met: | |
* Redistributions of source code must retain the above copyright | |
notice, this list of conditions and the following disclaimer. | |
* Redistributions in binary form must reproduce the above copyright | |
notice, this list of conditions and the following disclaimer in the | |
documentation and/or other materials provided with the distribution. | |
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | |
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY | |
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | |
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | |
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | |
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | |
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
*/ | |
/*global exports:true, require:true, global:true*/ | |
(function () { | |
var Syntax, Precedence, BinaryPrecedence, SourceNode, estraverse, esutils, base, indent, json, renumber, hexadecimal, quotes, escapeless, newline, space, parentheses, semicolons, safeConcatenation, directive, extra, parse, sourceMap, sourceCode, preserveBlankLines, FORMAT_MINIFY, FORMAT_DEFAULTS; | |
estraverse = dew$a8(); | |
esutils = dew$a4(); | |
Syntax = estraverse.Syntax; // Generation is done by generateExpression. | |
function isExpression(node) { | |
return CodeGenerator.Expression.hasOwnProperty(node.type); | |
} // Generation is done by generateStatement. | |
function isStatement(node) { | |
return CodeGenerator.Statement.hasOwnProperty(node.type); | |
} | |
Precedence = { | |
Sequence: 0, | |
Yield: 1, | |
Assignment: 1, | |
Conditional: 2, | |
ArrowFunction: 2, | |
LogicalOR: 3, | |
LogicalAND: 4, | |
BitwiseOR: 5, | |
BitwiseXOR: 6, | |
BitwiseAND: 7, | |
Equality: 8, | |
Relational: 9, | |
BitwiseSHIFT: 10, | |
Additive: 11, | |
Multiplicative: 12, | |
Exponentiation: 13, | |
Await: 14, | |
Unary: 14, | |
Postfix: 15, | |
OptionalChaining: 16, | |
Call: 17, | |
New: 18, | |
TaggedTemplate: 19, | |
Member: 20, | |
Primary: 21 | |
}; | |
BinaryPrecedence = { | |
'||': Precedence.LogicalOR, | |
'&&': Precedence.LogicalAND, | |
'|': Precedence.BitwiseOR, | |
'^': Precedence.BitwiseXOR, | |
'&': Precedence.BitwiseAND, | |
'==': Precedence.Equality, | |
'!=': Precedence.Equality, | |
'===': Precedence.Equality, | |
'!==': Precedence.Equality, | |
'is': Precedence.Equality, | |
'isnt': Precedence.Equality, | |
'<': Precedence.Relational, | |
'>': Precedence.Relational, | |
'<=': Precedence.Relational, | |
'>=': Precedence.Relational, | |
'in': Precedence.Relational, | |
'instanceof': Precedence.Relational, | |
'<<': Precedence.BitwiseSHIFT, | |
'>>': Precedence.BitwiseSHIFT, | |
'>>>': Precedence.BitwiseSHIFT, | |
'+': Precedence.Additive, | |
'-': Precedence.Additive, | |
'*': Precedence.Multiplicative, | |
'%': Precedence.Multiplicative, | |
'/': Precedence.Multiplicative, | |
'**': Precedence.Exponentiation | |
}; //Flags | |
var F_ALLOW_IN = 1, | |
F_ALLOW_CALL = 1 << 1, | |
F_ALLOW_UNPARATH_NEW = 1 << 2, | |
F_FUNC_BODY = 1 << 3, | |
F_DIRECTIVE_CTX = 1 << 4, | |
F_SEMICOLON_OPT = 1 << 5; //Expression flag sets | |
//NOTE: Flag order: | |
// F_ALLOW_IN | |
// F_ALLOW_CALL | |
// F_ALLOW_UNPARATH_NEW | |
var E_FTT = F_ALLOW_CALL | F_ALLOW_UNPARATH_NEW, | |
E_TTF = F_ALLOW_IN | F_ALLOW_CALL, | |
E_TTT = F_ALLOW_IN | F_ALLOW_CALL | F_ALLOW_UNPARATH_NEW, | |
E_TFF = F_ALLOW_IN, | |
E_FFT = F_ALLOW_UNPARATH_NEW, | |
E_TFT = F_ALLOW_IN | F_ALLOW_UNPARATH_NEW; //Statement flag sets | |
//NOTE: Flag order: | |
// F_ALLOW_IN | |
// F_FUNC_BODY | |
// F_DIRECTIVE_CTX | |
// F_SEMICOLON_OPT | |
var S_TFFF = F_ALLOW_IN, | |
S_TFFT = F_ALLOW_IN | F_SEMICOLON_OPT, | |
S_FFFF = 0x00, | |
S_TFTF = F_ALLOW_IN | F_DIRECTIVE_CTX, | |
S_TTFF = F_ALLOW_IN | F_FUNC_BODY; | |
function getDefaultOptions() { | |
// default options | |
return { | |
indent: null, | |
base: null, | |
parse: null, | |
comment: false, | |
format: { | |
indent: { | |
style: ' ', | |
base: 0, | |
adjustMultilineComment: false | |
}, | |
newline: '\n', | |
space: ' ', | |
json: false, | |
renumber: false, | |
hexadecimal: false, | |
quotes: 'single', | |
escapeless: false, | |
compact: false, | |
parentheses: true, | |
semicolons: true, | |
safeConcatenation: false, | |
preserveBlankLines: false | |
}, | |
moz: { | |
comprehensionExpressionStartsWithAssignment: false, | |
starlessGenerator: false | |
}, | |
sourceMap: null, | |
sourceMapRoot: null, | |
sourceMapWithCode: false, | |
directive: false, | |
raw: true, | |
verbatim: null, | |
sourceCode: null | |
}; | |
} | |
function stringRepeat(str, num) { | |
var result = ''; | |
for (num |= 0; num > 0; num >>>= 1, str += str) { | |
if (num & 1) { | |
result += str; | |
} | |
} | |
return result; | |
} | |
function hasLineTerminator(str) { | |
return /[\r\n]/g.test(str); | |
} | |
function endsWithLineTerminator(str) { | |
var len = str.length; | |
return len && esutils.code.isLineTerminator(str.charCodeAt(len - 1)); | |
} | |
function merge(target, override) { | |
var key; | |
for (key in override) { | |
if (override.hasOwnProperty(key)) { | |
target[key] = override[key]; | |
} | |
} | |
return target; | |
} | |
function updateDeeply(target, override) { | |
var key, val; | |
function isHashObject(target) { | |
return typeof target === 'object' && target instanceof Object && !(target instanceof RegExp); | |
} | |
for (key in override) { | |
if (override.hasOwnProperty(key)) { | |
val = override[key]; | |
if (isHashObject(val)) { | |
if (isHashObject(target[key])) { | |
updateDeeply(target[key], val); | |
} else { | |
target[key] = updateDeeply({}, val); | |
} | |
} else { | |
target[key] = val; | |
} | |
} | |
} | |
return target; | |
} | |
function generateNumber(value) { | |
var result, point, temp, exponent, pos; | |
if (value !== value) { | |
throw new Error('Numeric literal whose value is NaN'); | |
} | |
if (value < 0 || value === 0 && 1 / value < 0) { | |
throw new Error('Numeric literal whose value is negative'); | |
} | |
if (value === 1 / 0) { | |
return json ? 'null' : renumber ? '1e400' : '1e+400'; | |
} | |
result = '' + value; | |
if (!renumber || result.length < 3) { | |
return result; | |
} | |
point = result.indexOf('.'); | |
if (!json && result.charCodeAt(0) === 0x30 | |
/* 0 */ | |
&& point === 1) { | |
point = 0; | |
result = result.slice(1); | |
} | |
temp = result; | |
result = result.replace('e+', 'e'); | |
exponent = 0; | |
if ((pos = temp.indexOf('e')) > 0) { | |
exponent = +temp.slice(pos + 1); | |
temp = temp.slice(0, pos); | |
} | |
if (point >= 0) { | |
exponent -= temp.length - point - 1; | |
temp = +(temp.slice(0, point) + temp.slice(point + 1)) + ''; | |
} | |
pos = 0; | |
while (temp.charCodeAt(temp.length + pos - 1) === 0x30 | |
/* 0 */ | |
) { | |
--pos; | |
} | |
if (pos !== 0) { | |
exponent -= pos; | |
temp = temp.slice(0, pos); | |
} | |
if (exponent !== 0) { | |
temp += 'e' + exponent; | |
} | |
if ((temp.length < result.length || hexadecimal && value > 1e12 && Math.floor(value) === value && (temp = '0x' + value.toString(16)).length < result.length) && +temp === value) { | |
result = temp; | |
} | |
return result; | |
} // Generate valid RegExp expression. | |
// This function is based on https://github.com/Constellation/iv Engine | |
function escapeRegExpCharacter(ch, previousIsBackslash) { | |
// not handling '\' and handling \u2028 or \u2029 to unicode escape sequence | |
if ((ch & ~1) === 0x2028) { | |
return (previousIsBackslash ? 'u' : '\\u') + (ch === 0x2028 ? '2028' : '2029'); | |
} else if (ch === 10 || ch === 13) { | |
// \n, \r | |
return (previousIsBackslash ? '' : '\\') + (ch === 10 ? 'n' : 'r'); | |
} | |
return String.fromCharCode(ch); | |
} | |
function generateRegExp(reg) { | |
var match, result, flags, i, iz, ch, characterInBrack, previousIsBackslash; | |
result = reg.toString(); | |
if (reg.source) { | |
// extract flag from toString result | |
match = result.match(/\/([^/]*)$/); | |
if (!match) { | |
return result; | |
} | |
flags = match[1]; | |
result = ''; | |
characterInBrack = false; | |
previousIsBackslash = false; | |
for (i = 0, iz = reg.source.length; i < iz; ++i) { | |
ch = reg.source.charCodeAt(i); | |
if (!previousIsBackslash) { | |
if (characterInBrack) { | |
if (ch === 93) { | |
// ] | |
characterInBrack = false; | |
} | |
} else { | |
if (ch === 47) { | |
// / | |
result += '\\'; | |
} else if (ch === 91) { | |
// [ | |
characterInBrack = true; | |
} | |
} | |
result += escapeRegExpCharacter(ch, previousIsBackslash); | |
previousIsBackslash = ch === 92; // \ | |
} else { | |
// if new RegExp("\\\n') is provided, create /\n/ | |
result += escapeRegExpCharacter(ch, previousIsBackslash); // prevent like /\\[/]/ | |
previousIsBackslash = false; | |
} | |
} | |
return '/' + result + '/' + flags; | |
} | |
return result; | |
} | |
function escapeAllowedCharacter(code, next) { | |
var hex; | |
if (code === 0x08 | |
/* \b */ | |
) { | |
return '\\b'; | |
} | |
if (code === 0x0C | |
/* \f */ | |
) { | |
return '\\f'; | |
} | |
if (code === 0x09 | |
/* \t */ | |
) { | |
return '\\t'; | |
} | |
hex = code.toString(16).toUpperCase(); | |
if (json || code > 0xFF) { | |
return '\\u' + '0000'.slice(hex.length) + hex; | |
} else if (code === 0x0000 && !esutils.code.isDecimalDigit(next)) { | |
return '\\0'; | |
} else if (code === 0x000B | |
/* \v */ | |
) { | |
// '\v' | |
return '\\x0B'; | |
} else { | |
return '\\x' + '00'.slice(hex.length) + hex; | |
} | |
} | |
function escapeDisallowedCharacter(code) { | |
if (code === 0x5C | |
/* \ */ | |
) { | |
return '\\\\'; | |
} | |
if (code === 0x0A | |
/* \n */ | |
) { | |
return '\\n'; | |
} | |
if (code === 0x0D | |
/* \r */ | |
) { | |
return '\\r'; | |
} | |
if (code === 0x2028) { | |
return '\\u2028'; | |
} | |
if (code === 0x2029) { | |
return '\\u2029'; | |
} | |
throw new Error('Incorrectly classified character'); | |
} | |
function escapeDirective(str) { | |
var i, iz, code, quote; | |
quote = quotes === 'double' ? '"' : '\''; | |
for (i = 0, iz = str.length; i < iz; ++i) { | |
code = str.charCodeAt(i); | |
if (code === 0x27 | |
/* ' */ | |
) { | |
quote = '"'; | |
break; | |
} else if (code === 0x22 | |
/* " */ | |
) { | |
quote = '\''; | |
break; | |
} else if (code === 0x5C | |
/* \ */ | |
) { | |
++i; | |
} | |
} | |
return quote + str + quote; | |
} | |
function escapeString(str) { | |
var result = '', | |
i, | |
len, | |
code, | |
singleQuotes = 0, | |
doubleQuotes = 0, | |
single, | |
quote; | |
for (i = 0, len = str.length; i < len; ++i) { | |
code = str.charCodeAt(i); | |
if (code === 0x27 | |
/* ' */ | |
) { | |
++singleQuotes; | |
} else if (code === 0x22 | |
/* " */ | |
) { | |
++doubleQuotes; | |
} else if (code === 0x2F | |
/* / */ | |
&& json) { | |
result += '\\'; | |
} else if (esutils.code.isLineTerminator(code) || code === 0x5C | |
/* \ */ | |
) { | |
result += escapeDisallowedCharacter(code); | |
continue; | |
} else if (!esutils.code.isIdentifierPartES5(code) && (json && code < 0x20 | |
/* SP */ | |
|| !json && !escapeless && (code < 0x20 | |
/* SP */ | |
|| code > 0x7E | |
/* ~ */ | |
))) { | |
result += escapeAllowedCharacter(code, str.charCodeAt(i + 1)); | |
continue; | |
} | |
result += String.fromCharCode(code); | |
} | |
single = !(quotes === 'double' || quotes === 'auto' && doubleQuotes < singleQuotes); | |
quote = single ? '\'' : '"'; | |
if (!(single ? singleQuotes : doubleQuotes)) { | |
return quote + result + quote; | |
} | |
str = result; | |
result = quote; | |
for (i = 0, len = str.length; i < len; ++i) { | |
code = str.charCodeAt(i); | |
if (code === 0x27 | |
/* ' */ | |
&& single || code === 0x22 | |
/* " */ | |
&& !single) { | |
result += '\\'; | |
} | |
result += String.fromCharCode(code); | |
} | |
return result + quote; | |
} | |
/** | |
* flatten an array to a string, where the array can contain | |
* either strings or nested arrays | |
*/ | |
function flattenToString(arr) { | |
var i, | |
iz, | |
elem, | |
result = ''; | |
for (i = 0, iz = arr.length; i < iz; ++i) { | |
elem = arr[i]; | |
result += Array.isArray(elem) ? flattenToString(elem) : elem; | |
} | |
return result; | |
} | |
/** | |
* convert generated to a SourceNode when source maps are enabled. | |
*/ | |
function toSourceNodeWhenNeeded(generated, node) { | |
if (!sourceMap) { | |
// with no source maps, generated is either an | |
// array or a string. if an array, flatten it. | |
// if a string, just return it | |
if (Array.isArray(generated)) { | |
return flattenToString(generated); | |
} else { | |
return generated; | |
} | |
} | |
if (node == null) { | |
if (generated instanceof SourceNode) { | |
return generated; | |
} else { | |
node = {}; | |
} | |
} | |
if (node.loc == null) { | |
return new SourceNode(null, null, sourceMap, generated, node.name || null); | |
} | |
return new SourceNode(node.loc.start.line, node.loc.start.column, sourceMap === true ? node.loc.source || null : sourceMap, generated, node.name || null); | |
} | |
function noEmptySpace() { | |
return space ? space : ' '; | |
} | |
function join(left, right) { | |
var leftSource, rightSource, leftCharCode, rightCharCode; | |
leftSource = toSourceNodeWhenNeeded(left).toString(); | |
if (leftSource.length === 0) { | |
return [right]; | |
} | |
rightSource = toSourceNodeWhenNeeded(right).toString(); | |
if (rightSource.length === 0) { | |
return [left]; | |
} | |
leftCharCode = leftSource.charCodeAt(leftSource.length - 1); | |
rightCharCode = rightSource.charCodeAt(0); | |
if ((leftCharCode === 0x2B | |
/* + */ | |
|| leftCharCode === 0x2D | |
/* - */ | |
) && leftCharCode === rightCharCode || esutils.code.isIdentifierPartES5(leftCharCode) && esutils.code.isIdentifierPartES5(rightCharCode) || leftCharCode === 0x2F | |
/* / */ | |
&& rightCharCode === 0x69 | |
/* i */ | |
) { | |
// infix word operators all start with `i` | |
return [left, noEmptySpace(), right]; | |
} else if (esutils.code.isWhiteSpace(leftCharCode) || esutils.code.isLineTerminator(leftCharCode) || esutils.code.isWhiteSpace(rightCharCode) || esutils.code.isLineTerminator(rightCharCode)) { | |
return [left, right]; | |
} | |
return [left, space, right]; | |
} | |
function addIndent(stmt) { | |
return [base, stmt]; | |
} | |
function withIndent(fn) { | |
var previousBase; | |
previousBase = base; | |
base += indent; | |
fn(base); | |
base = previousBase; | |
} | |
function calculateSpaces(str) { | |
var i; | |
for (i = str.length - 1; i >= 0; --i) { | |
if (esutils.code.isLineTerminator(str.charCodeAt(i))) { | |
break; | |
} | |
} | |
return str.length - 1 - i; | |
} | |
function adjustMultilineComment(value, specialBase) { | |
var array, i, len, line, j, spaces, previousBase, sn; | |
array = value.split(/\r\n|[\r\n]/); | |
spaces = Number.MAX_VALUE; // first line doesn't have indentation | |
for (i = 1, len = array.length; i < len; ++i) { | |
line = array[i]; | |
j = 0; | |
while (j < line.length && esutils.code.isWhiteSpace(line.charCodeAt(j))) { | |
++j; | |
} | |
if (spaces > j) { | |
spaces = j; | |
} | |
} | |
if (typeof specialBase !== 'undefined') { | |
// pattern like | |
// { | |
// var t = 20; /* | |
// * this is comment | |
// */ | |
// } | |
previousBase = base; | |
if (array[1][spaces] === '*') { | |
specialBase += ' '; | |
} | |
base = specialBase; | |
} else { | |
if (spaces & 1) { | |
// /* | |
// * | |
// */ | |
// If spaces are odd number, above pattern is considered. | |
// We waste 1 space. | |
--spaces; | |
} | |
previousBase = base; | |
} | |
for (i = 1, len = array.length; i < len; ++i) { | |
sn = toSourceNodeWhenNeeded(addIndent(array[i].slice(spaces))); | |
array[i] = sourceMap ? sn.join('') : sn; | |
} | |
base = previousBase; | |
return array.join('\n'); | |
} | |
function generateComment(comment, specialBase) { | |
if (comment.type === 'Line') { | |
if (endsWithLineTerminator(comment.value)) { | |
return '//' + comment.value; | |
} else { | |
// Always use LineTerminator | |
var result = '//' + comment.value; | |
if (!preserveBlankLines) { | |
result += '\n'; | |
} | |
return result; | |
} | |
} | |
if (extra.format.indent.adjustMultilineComment && /[\n\r]/.test(comment.value)) { | |
return adjustMultilineComment('/*' + comment.value + '*/', specialBase); | |
} | |
return '/*' + comment.value + '*/'; | |
} | |
function addComments(stmt, result) { | |
var i, len, comment, save, tailingToStatement, specialBase, fragment, extRange, range, prevRange, prefix, infix, suffix, count; | |
if (stmt.leadingComments && stmt.leadingComments.length > 0) { | |
save = result; | |
if (preserveBlankLines) { | |
comment = stmt.leadingComments[0]; | |
result = []; | |
extRange = comment.extendedRange; | |
range = comment.range; | |
prefix = sourceCode.substring(extRange[0], range[0]); | |
count = (prefix.match(/\n/g) || []).length; | |
if (count > 0) { | |
result.push(stringRepeat('\n', count)); | |
result.push(addIndent(generateComment(comment))); | |
} else { | |
result.push(prefix); | |
result.push(generateComment(comment)); | |
} | |
prevRange = range; | |
for (i = 1, len = stmt.leadingComments.length; i < len; i++) { | |
comment = stmt.leadingComments[i]; | |
range = comment.range; | |
infix = sourceCode.substring(prevRange[1], range[0]); | |
count = (infix.match(/\n/g) || []).length; | |
result.push(stringRepeat('\n', count)); | |
result.push(addIndent(generateComment(comment))); | |
prevRange = range; | |
} | |
suffix = sourceCode.substring(range[1], extRange[1]); | |
count = (suffix.match(/\n/g) || []).length; | |
result.push(stringRepeat('\n', count)); | |
} else { | |
comment = stmt.leadingComments[0]; | |
result = []; | |
if (safeConcatenation && stmt.type === Syntax.Program && stmt.body.length === 0) { | |
result.push('\n'); | |
} | |
result.push(generateComment(comment)); | |
if (!endsWithLineTerminator(toSourceNodeWhenNeeded(result).toString())) { | |
result.push('\n'); | |
} | |
for (i = 1, len = stmt.leadingComments.length; i < len; ++i) { | |
comment = stmt.leadingComments[i]; | |
fragment = [generateComment(comment)]; | |
if (!endsWithLineTerminator(toSourceNodeWhenNeeded(fragment).toString())) { | |
fragment.push('\n'); | |
} | |
result.push(addIndent(fragment)); | |
} | |
} | |
result.push(addIndent(save)); | |
} | |
if (stmt.trailingComments) { | |
if (preserveBlankLines) { | |
comment = stmt.trailingComments[0]; | |
extRange = comment.extendedRange; | |
range = comment.range; | |
prefix = sourceCode.substring(extRange[0], range[0]); | |
count = (prefix.match(/\n/g) || []).length; | |
if (count > 0) { | |
result.push(stringRepeat('\n', count)); | |
result.push(addIndent(generateComment(comment))); | |
} else { | |
result.push(prefix); | |
result.push(generateComment(comment)); | |
} | |
} else { | |
tailingToStatement = !endsWithLineTerminator(toSourceNodeWhenNeeded(result).toString()); | |
specialBase = stringRepeat(' ', calculateSpaces(toSourceNodeWhenNeeded([base, result, indent]).toString())); | |
for (i = 0, len = stmt.trailingComments.length; i < len; ++i) { | |
comment = stmt.trailingComments[i]; | |
if (tailingToStatement) { | |
// We assume target like following script | |
// | |
// var t = 20; /** | |
// * This is comment of t | |
// */ | |
if (i === 0) { | |
// first case | |
result = [result, indent]; | |
} else { | |
result = [result, specialBase]; | |
} | |
result.push(generateComment(comment, specialBase)); | |
} else { | |
result = [result, addIndent(generateComment(comment))]; | |
} | |
if (i !== len - 1 && !endsWithLineTerminator(toSourceNodeWhenNeeded(result).toString())) { | |
result = [result, '\n']; | |
} | |
} | |
} | |
} | |
return result; | |
} | |
function generateBlankLines(start, end, result) { | |
var j, | |
newlineCount = 0; | |
for (j = start; j < end; j++) { | |
if (sourceCode[j] === '\n') { | |
newlineCount++; | |
} | |
} | |
for (j = 1; j < newlineCount; j++) { | |
result.push(newline); | |
} | |
} | |
function parenthesize(text, current, should) { | |
if (current < should) { | |
return ['(', text, ')']; | |
} | |
return text; | |
} | |
function generateVerbatimString(string) { | |
var i, iz, result; | |
result = string.split(/\r\n|\n/); | |
for (i = 1, iz = result.length; i < iz; i++) { | |
result[i] = newline + base + result[i]; | |
} | |
return result; | |
} | |
function generateVerbatim(expr, precedence) { | |
var verbatim, result, prec; | |
verbatim = expr[extra.verbatim]; | |
if (typeof verbatim === 'string') { | |
result = parenthesize(generateVerbatimString(verbatim), Precedence.Sequence, precedence); | |
} else { | |
// verbatim is object | |
result = generateVerbatimString(verbatim.content); | |
prec = verbatim.precedence != null ? verbatim.precedence : Precedence.Sequence; | |
result = parenthesize(result, prec, precedence); | |
} | |
return toSourceNodeWhenNeeded(result, expr); | |
} | |
function CodeGenerator() {} // Helpers. | |
CodeGenerator.prototype.maybeBlock = function (stmt, flags) { | |
var result, | |
noLeadingComment, | |
that = this || _global$I; | |
noLeadingComment = !extra.comment || !stmt.leadingComments; | |
if (stmt.type === Syntax.BlockStatement && noLeadingComment) { | |
return [space, this.generateStatement(stmt, flags)]; | |
} | |
if (stmt.type === Syntax.EmptyStatement && noLeadingComment) { | |
return ';'; | |
} | |
withIndent(function () { | |
result = [newline, addIndent(that.generateStatement(stmt, flags))]; | |
}); | |
return result; | |
}; | |
CodeGenerator.prototype.maybeBlockSuffix = function (stmt, result) { | |
var ends = endsWithLineTerminator(toSourceNodeWhenNeeded(result).toString()); | |
if (stmt.type === Syntax.BlockStatement && (!extra.comment || !stmt.leadingComments) && !ends) { | |
return [result, space]; | |
} | |
if (ends) { | |
return [result, base]; | |
} | |
return [result, newline, base]; | |
}; | |
function generateIdentifier(node) { | |
return toSourceNodeWhenNeeded(node.name, node); | |
} | |
function generateAsyncPrefix(node, spaceRequired) { | |
return node.async ? 'async' + (spaceRequired ? noEmptySpace() : space) : ''; | |
} | |
function generateStarSuffix(node) { | |
var isGenerator = node.generator && !extra.moz.starlessGenerator; | |
return isGenerator ? '*' + space : ''; | |
} | |
function generateMethodPrefix(prop) { | |
var func = prop.value, | |
prefix = ''; | |
if (func.async) { | |
prefix += generateAsyncPrefix(func, !prop.computed); | |
} | |
if (func.generator) { | |
// avoid space before method name | |
prefix += generateStarSuffix(func) ? '*' : ''; | |
} | |
return prefix; | |
} | |
CodeGenerator.prototype.generatePattern = function (node, precedence, flags) { | |
if (node.type === Syntax.Identifier) { | |
return generateIdentifier(node); | |
} | |
return this.generateExpression(node, precedence, flags); | |
}; | |
CodeGenerator.prototype.generateFunctionParams = function (node) { | |
var i, iz, result, hasDefault; | |
hasDefault = false; | |
if (node.type === Syntax.ArrowFunctionExpression && !node.rest && (!node.defaults || node.defaults.length === 0) && node.params.length === 1 && node.params[0].type === Syntax.Identifier) { | |
// arg => { } case | |
result = [generateAsyncPrefix(node, true), generateIdentifier(node.params[0])]; | |
} else { | |
result = node.type === Syntax.ArrowFunctionExpression ? [generateAsyncPrefix(node, false)] : []; | |
result.push('('); | |
if (node.defaults) { | |
hasDefault = true; | |
} | |
for (i = 0, iz = node.params.length; i < iz; ++i) { | |
if (hasDefault && node.defaults[i]) { | |
// Handle default values. | |
result.push(this.generateAssignment(node.params[i], node.defaults[i], '=', Precedence.Assignment, E_TTT)); | |
} else { | |
result.push(this.generatePattern(node.params[i], Precedence.Assignment, E_TTT)); | |
} | |
if (i + 1 < iz) { | |
result.push(',' + space); | |
} | |
} | |
if (node.rest) { | |
if (node.params.length) { | |
result.push(',' + space); | |
} | |
result.push('...'); | |
result.push(generateIdentifier(node.rest)); | |
} | |
result.push(')'); | |
} | |
return result; | |
}; | |
CodeGenerator.prototype.generateFunctionBody = function (node) { | |
var result, expr; | |
result = this.generateFunctionParams(node); | |
if (node.type === Syntax.ArrowFunctionExpression) { | |
result.push(space); | |
result.push('=>'); | |
} | |
if (node.expression) { | |
result.push(space); | |
expr = this.generateExpression(node.body, Precedence.Assignment, E_TTT); | |
if (expr.toString().charAt(0) === '{') { | |
expr = ['(', expr, ')']; | |
} | |
result.push(expr); | |
} else { | |
result.push(this.maybeBlock(node.body, S_TTFF)); | |
} | |
return result; | |
}; | |
CodeGenerator.prototype.generateIterationForStatement = function (operator, stmt, flags) { | |
var result = ['for' + (stmt.await ? noEmptySpace() + 'await' : '') + space + '('], | |
that = this || _global$I; | |
withIndent(function () { | |
if (stmt.left.type === Syntax.VariableDeclaration) { | |
withIndent(function () { | |
result.push(stmt.left.kind + noEmptySpace()); | |
result.push(that.generateStatement(stmt.left.declarations[0], S_FFFF)); | |
}); | |
} else { | |
result.push(that.generateExpression(stmt.left, Precedence.Call, E_TTT)); | |
} | |
result = join(result, operator); | |
result = [join(result, that.generateExpression(stmt.right, Precedence.Assignment, E_TTT)), ')']; | |
}); | |
result.push(this.maybeBlock(stmt.body, flags)); | |
return result; | |
}; | |
CodeGenerator.prototype.generatePropertyKey = function (expr, computed) { | |
var result = []; | |
if (computed) { | |
result.push('['); | |
} | |
result.push(this.generateExpression(expr, Precedence.Assignment, E_TTT)); | |
if (computed) { | |
result.push(']'); | |
} | |
return result; | |
}; | |
CodeGenerator.prototype.generateAssignment = function (left, right, operator, precedence, flags) { | |
if (Precedence.Assignment < precedence) { | |
flags |= F_ALLOW_IN; | |
} | |
return parenthesize([this.generateExpression(left, Precedence.Call, flags), space + operator + space, this.generateExpression(right, Precedence.Assignment, flags)], Precedence.Assignment, precedence); | |
}; | |
CodeGenerator.prototype.semicolon = function (flags) { | |
if (!semicolons && flags & F_SEMICOLON_OPT) { | |
return ''; | |
} | |
return ';'; | |
}; // Statements. | |
CodeGenerator.Statement = { | |
BlockStatement: function (stmt, flags) { | |
var range, | |
content, | |
result = ['{', newline], | |
that = this || _global$I; | |
withIndent(function () { | |
// handle functions without any code | |
if (stmt.body.length === 0 && preserveBlankLines) { | |
range = stmt.range; | |
if (range[1] - range[0] > 2) { | |
content = sourceCode.substring(range[0] + 1, range[1] - 1); | |
if (content[0] === '\n') { | |
result = ['{']; | |
} | |
result.push(content); | |
} | |
} | |
var i, iz, fragment, bodyFlags; | |
bodyFlags = S_TFFF; | |
if (flags & F_FUNC_BODY) { | |
bodyFlags |= F_DIRECTIVE_CTX; | |
} | |
for (i = 0, iz = stmt.body.length; i < iz; ++i) { | |
if (preserveBlankLines) { | |
// handle spaces before the first line | |
if (i === 0) { | |
if (stmt.body[0].leadingComments) { | |
range = stmt.body[0].leadingComments[0].extendedRange; | |
content = sourceCode.substring(range[0], range[1]); | |
if (content[0] === '\n') { | |
result = ['{']; | |
} | |
} | |
if (!stmt.body[0].leadingComments) { | |
generateBlankLines(stmt.range[0], stmt.body[0].range[0], result); | |
} | |
} // handle spaces between lines | |
if (i > 0) { | |
if (!stmt.body[i - 1].trailingComments && !stmt.body[i].leadingComments) { | |
generateBlankLines(stmt.body[i - 1].range[1], stmt.body[i].range[0], result); | |
} | |
} | |
} | |
if (i === iz - 1) { | |
bodyFlags |= F_SEMICOLON_OPT; | |
} | |
if (stmt.body[i].leadingComments && preserveBlankLines) { | |
fragment = that.generateStatement(stmt.body[i], bodyFlags); | |
} else { | |
fragment = addIndent(that.generateStatement(stmt.body[i], bodyFlags)); | |
} | |
result.push(fragment); | |
if (!endsWithLineTerminator(toSourceNodeWhenNeeded(fragment).toString())) { | |
if (preserveBlankLines && i < iz - 1) { | |
// don't add a new line if there are leading coments | |
// in the next statement | |
if (!stmt.body[i + 1].leadingComments) { | |
result.push(newline); | |
} | |
} else { | |
result.push(newline); | |
} | |
} | |
if (preserveBlankLines) { | |
// handle spaces after the last line | |
if (i === iz - 1) { | |
if (!stmt.body[i].trailingComments) { | |
generateBlankLines(stmt.body[i].range[1], stmt.range[1], result); | |
} | |
} | |
} | |
} | |
}); | |
result.push(addIndent('}')); | |
return result; | |
}, | |
BreakStatement: function (stmt, flags) { | |
if (stmt.label) { | |
return 'break ' + stmt.label.name + this.semicolon(flags); | |
} | |
return 'break' + this.semicolon(flags); | |
}, | |
ContinueStatement: function (stmt, flags) { | |
if (stmt.label) { | |
return 'continue ' + stmt.label.name + this.semicolon(flags); | |
} | |
return 'continue' + this.semicolon(flags); | |
}, | |
ClassBody: function (stmt, flags) { | |
var result = ['{', newline], | |
that = this || _global$I; | |
withIndent(function (indent) { | |
var i, iz; | |
for (i = 0, iz = stmt.body.length; i < iz; ++i) { | |
result.push(indent); | |
result.push(that.generateExpression(stmt.body[i], Precedence.Sequence, E_TTT)); | |
if (i + 1 < iz) { | |
result.push(newline); | |
} | |
} | |
}); | |
if (!endsWithLineTerminator(toSourceNodeWhenNeeded(result).toString())) { | |
result.push(newline); | |
} | |
result.push(base); | |
result.push('}'); | |
return result; | |
}, | |
ClassDeclaration: function (stmt, flags) { | |
var result, fragment; | |
result = ['class']; | |
if (stmt.id) { | |
result = join(result, this.generateExpression(stmt.id, Precedence.Sequence, E_TTT)); | |
} | |
if (stmt.superClass) { | |
fragment = join('extends', this.generateExpression(stmt.superClass, Precedence.Unary, E_TTT)); | |
result = join(result, fragment); | |
} | |
result.push(space); | |
result.push(this.generateStatement(stmt.body, S_TFFT)); | |
return result; | |
}, | |
DirectiveStatement: function (stmt, flags) { | |
if (extra.raw && stmt.raw) { | |
return stmt.raw + this.semicolon(flags); | |
} | |
return escapeDirective(stmt.directive) + this.semicolon(flags); | |
}, | |
DoWhileStatement: function (stmt, flags) { | |
// Because `do 42 while (cond)` is Syntax Error. We need semicolon. | |
var result = join('do', this.maybeBlock(stmt.body, S_TFFF)); | |
result = this.maybeBlockSuffix(stmt.body, result); | |
return join(result, ['while' + space + '(', this.generateExpression(stmt.test, Precedence.Sequence, E_TTT), ')' + this.semicolon(flags)]); | |
}, | |
CatchClause: function (stmt, flags) { | |
var result, | |
that = this || _global$I; | |
withIndent(function () { | |
var guard; | |
if (stmt.param) { | |
result = ['catch' + space + '(', that.generateExpression(stmt.param, Precedence.Sequence, E_TTT), ')']; | |
if (stmt.guard) { | |
guard = that.generateExpression(stmt.guard, Precedence.Sequence, E_TTT); | |
result.splice(2, 0, ' if ', guard); | |
} | |
} else { | |
result = ['catch']; | |
} | |
}); | |
result.push(this.maybeBlock(stmt.body, S_TFFF)); | |
return result; | |
}, | |
DebuggerStatement: function (stmt, flags) { | |
return 'debugger' + this.semicolon(flags); | |
}, | |
EmptyStatement: function (stmt, flags) { | |
return ';'; | |
}, | |
ExportDefaultDeclaration: function (stmt, flags) { | |
var result = ['export'], | |
bodyFlags; | |
bodyFlags = flags & F_SEMICOLON_OPT ? S_TFFT : S_TFFF; // export default HoistableDeclaration[Default] | |
// export default AssignmentExpression[In] ; | |
result = join(result, 'default'); | |
if (isStatement(stmt.declaration)) { | |
result = join(result, this.generateStatement(stmt.declaration, bodyFlags)); | |
} else { | |
result = join(result, this.generateExpression(stmt.declaration, Precedence.Assignment, E_TTT) + this.semicolon(flags)); | |
} | |
return result; | |
}, | |
ExportNamedDeclaration: function (stmt, flags) { | |
var result = ['export'], | |
bodyFlags, | |
that = this || _global$I; | |
bodyFlags = flags & F_SEMICOLON_OPT ? S_TFFT : S_TFFF; // export VariableStatement | |
// export Declaration[Default] | |
if (stmt.declaration) { | |
return join(result, this.generateStatement(stmt.declaration, bodyFlags)); | |
} // export ExportClause[NoReference] FromClause ; | |
// export ExportClause ; | |
if (stmt.specifiers) { | |
if (stmt.specifiers.length === 0) { | |
result = join(result, '{' + space + '}'); | |
} else if (stmt.specifiers[0].type === Syntax.ExportBatchSpecifier) { | |
result = join(result, this.generateExpression(stmt.specifiers[0], Precedence.Sequence, E_TTT)); | |
} else { | |
result = join(result, '{'); | |
withIndent(function (indent) { | |
var i, iz; | |
result.push(newline); | |
for (i = 0, iz = stmt.specifiers.length; i < iz; ++i) { | |
result.push(indent); | |
result.push(that.generateExpression(stmt.specifiers[i], Precedence.Sequence, E_TTT)); | |
if (i + 1 < iz) { | |
result.push(',' + newline); | |
} | |
} | |
}); | |
if (!endsWithLineTerminator(toSourceNodeWhenNeeded(result).toString())) { | |
result.push(newline); | |
} | |
result.push(base + '}'); | |
} | |
if (stmt.source) { | |
result = join(result, ['from' + space, // ModuleSpecifier | |
this.generateExpression(stmt.source, Precedence.Sequence, E_TTT), this.semicolon(flags)]); | |
} else { | |
result.push(this.semicolon(flags)); | |
} | |
} | |
return result; | |
}, | |
ExportAllDeclaration: function (stmt, flags) { | |
// export * FromClause ; | |
return ['export' + space, '*' + space, 'from' + space, // ModuleSpecifier | |
this.generateExpression(stmt.source, Precedence.Sequence, E_TTT), this.semicolon(flags)]; | |
}, | |
ExpressionStatement: function (stmt, flags) { | |
var result, fragment; | |
function isClassPrefixed(fragment) { | |
var code; | |
if (fragment.slice(0, 5) !== 'class') { | |
return false; | |
} | |
code = fragment.charCodeAt(5); | |
return code === 0x7B | |
/* '{' */ | |
|| esutils.code.isWhiteSpace(code) || esutils.code.isLineTerminator(code); | |
} | |
function isFunctionPrefixed(fragment) { | |
var code; | |
if (fragment.slice(0, 8) !== 'function') { | |
return false; | |
} | |
code = fragment.charCodeAt(8); | |
return code === 0x28 | |
/* '(' */ | |
|| esutils.code.isWhiteSpace(code) || code === 0x2A | |
/* '*' */ | |
|| esutils.code.isLineTerminator(code); | |
} | |
function isAsyncPrefixed(fragment) { | |
var code, i, iz; | |
if (fragment.slice(0, 5) !== 'async') { | |
return false; | |
} | |
if (!esutils.code.isWhiteSpace(fragment.charCodeAt(5))) { | |
return false; | |
} | |
for (i = 6, iz = fragment.length; i < iz; ++i) { | |
if (!esutils.code.isWhiteSpace(fragment.charCodeAt(i))) { | |
break; | |
} | |
} | |
if (i === iz) { | |
return false; | |
} | |
if (fragment.slice(i, i + 8) !== 'function') { | |
return false; | |
} | |
code = fragment.charCodeAt(i + 8); | |
return code === 0x28 | |
/* '(' */ | |
|| esutils.code.isWhiteSpace(code) || code === 0x2A | |
/* '*' */ | |
|| esutils.code.isLineTerminator(code); | |
} | |
result = [this.generateExpression(stmt.expression, Precedence.Sequence, E_TTT)]; // 12.4 '{', 'function', 'class' is not allowed in this position. | |
// wrap expression with parentheses | |
fragment = toSourceNodeWhenNeeded(result).toString(); | |
if (fragment.charCodeAt(0) === 0x7B | |
/* '{' */ | |
|| // ObjectExpression | |
isClassPrefixed(fragment) || isFunctionPrefixed(fragment) || isAsyncPrefixed(fragment) || directive && flags & F_DIRECTIVE_CTX && stmt.expression.type === Syntax.Literal && typeof stmt.expression.value === 'string') { | |
result = ['(', result, ')' + this.semicolon(flags)]; | |
} else { | |
result.push(this.semicolon(flags)); | |
} | |
return result; | |
}, | |
ImportDeclaration: function (stmt, flags) { | |
// ES6: 15.2.1 valid import declarations: | |
// - import ImportClause FromClause ; | |
// - import ModuleSpecifier ; | |
var result, | |
cursor, | |
that = this || _global$I; // If no ImportClause is present, | |
// this should be `import ModuleSpecifier` so skip `from` | |
// ModuleSpecifier is StringLiteral. | |
if (stmt.specifiers.length === 0) { | |
// import ModuleSpecifier ; | |
return ['import', space, // ModuleSpecifier | |
this.generateExpression(stmt.source, Precedence.Sequence, E_TTT), this.semicolon(flags)]; | |
} // import ImportClause FromClause ; | |
result = ['import']; | |
cursor = 0; // ImportedBinding | |
if (stmt.specifiers[cursor].type === Syntax.ImportDefaultSpecifier) { | |
result = join(result, [this.generateExpression(stmt.specifiers[cursor], Precedence.Sequence, E_TTT)]); | |
++cursor; | |
} | |
if (stmt.specifiers[cursor]) { | |
if (cursor !== 0) { | |
result.push(','); | |
} | |
if (stmt.specifiers[cursor].type === Syntax.ImportNamespaceSpecifier) { | |
// NameSpaceImport | |
result = join(result, [space, this.generateExpression(stmt.specifiers[cursor], Precedence.Sequence, E_TTT)]); | |
} else { | |
// NamedImports | |
result.push(space + '{'); | |
if (stmt.specifiers.length - cursor === 1) { | |
// import { ... } from "..."; | |
result.push(space); | |
result.push(this.generateExpression(stmt.specifiers[cursor], Precedence.Sequence, E_TTT)); | |
result.push(space + '}' + space); | |
} else { | |
// import { | |
// ..., | |
// ..., | |
// } from "..."; | |
withIndent(function (indent) { | |
var i, iz; | |
result.push(newline); | |
for (i = cursor, iz = stmt.specifiers.length; i < iz; ++i) { | |
result.push(indent); | |
result.push(that.generateExpression(stmt.specifiers[i], Precedence.Sequence, E_TTT)); | |
if (i + 1 < iz) { | |
result.push(',' + newline); | |
} | |
} | |
}); | |
if (!endsWithLineTerminator(toSourceNodeWhenNeeded(result).toString())) { | |
result.push(newline); | |
} | |
result.push(base + '}' + space); | |
} | |
} | |
} | |
result = join(result, ['from' + space, // ModuleSpecifier | |
this.generateExpression(stmt.source, Precedence.Sequence, E_TTT), this.semicolon(flags)]); | |
return result; | |
}, | |
VariableDeclarator: function (stmt, flags) { | |
var itemFlags = flags & F_ALLOW_IN ? E_TTT : E_FTT; | |
if (stmt.init) { | |
return [this.generateExpression(stmt.id, Precedence.Assignment, itemFlags), space, '=', space, this.generateExpression(stmt.init, Precedence.Assignment, itemFlags)]; | |
} | |
return this.generatePattern(stmt.id, Precedence.Assignment, itemFlags); | |
}, | |
VariableDeclaration: function (stmt, flags) { | |
// VariableDeclarator is typed as Statement, | |
// but joined with comma (not LineTerminator). | |
// So if comment is attached to target node, we should specialize. | |
var result, | |
i, | |
iz, | |
node, | |
bodyFlags, | |
that = this || _global$I; | |
result = [stmt.kind]; | |
bodyFlags = flags & F_ALLOW_IN ? S_TFFF : S_FFFF; | |
function block() { | |
node = stmt.declarations[0]; | |
if (extra.comment && node.leadingComments) { | |
result.push('\n'); | |
result.push(addIndent(that.generateStatement(node, bodyFlags))); | |
} else { | |
result.push(noEmptySpace()); | |
result.push(that.generateStatement(node, bodyFlags)); | |
} | |
for (i = 1, iz = stmt.declarations.length; i < iz; ++i) { | |
node = stmt.declarations[i]; | |
if (extra.comment && node.leadingComments) { | |
result.push(',' + newline); | |
result.push(addIndent(that.generateStatement(node, bodyFlags))); | |
} else { | |
result.push(',' + space); | |
result.push(that.generateStatement(node, bodyFlags)); | |
} | |
} | |
} | |
if (stmt.declarations.length > 1) { | |
withIndent(block); | |
} else { | |
block(); | |
} | |
result.push(this.semicolon(flags)); | |
return result; | |
}, | |
ThrowStatement: function (stmt, flags) { | |
return [join('throw', this.generateExpression(stmt.argument, Precedence.Sequence, E_TTT)), this.semicolon(flags)]; | |
}, | |
TryStatement: function (stmt, flags) { | |
var result, i, iz, guardedHandlers; | |
result = ['try', this.maybeBlock(stmt.block, S_TFFF)]; | |
result = this.maybeBlockSuffix(stmt.block, result); | |
if (stmt.handlers) { | |
// old interface | |
for (i = 0, iz = stmt.handlers.length; i < iz; ++i) { | |
result = join(result, this.generateStatement(stmt.handlers[i], S_TFFF)); | |
if (stmt.finalizer || i + 1 !== iz) { | |
result = this.maybeBlockSuffix(stmt.handlers[i].body, result); | |
} | |
} | |
} else { | |
guardedHandlers = stmt.guardedHandlers || []; | |
for (i = 0, iz = guardedHandlers.length; i < iz; ++i) { | |
result = join(result, this.generateStatement(guardedHandlers[i], S_TFFF)); | |
if (stmt.finalizer || i + 1 !== iz) { | |
result = this.maybeBlockSuffix(guardedHandlers[i].body, result); | |
} | |
} // new interface | |
if (stmt.handler) { | |
if (Array.isArray(stmt.handler)) { | |
for (i = 0, iz = stmt.handler.length; i < iz; ++i) { | |
result = join(result, this.generateStatement(stmt.handler[i], S_TFFF)); | |
if (stmt.finalizer || i + 1 !== iz) { | |
result = this.maybeBlockSuffix(stmt.handler[i].body, result); | |
} | |
} | |
} else { | |
result = join(result, this.generateStatement(stmt.handler, S_TFFF)); | |
if (stmt.finalizer) { | |
result = this.maybeBlockSuffix(stmt.handler.body, result); | |
} | |
} | |
} | |
} | |
if (stmt.finalizer) { | |
result = join(result, ['finally', this.maybeBlock(stmt.finalizer, S_TFFF)]); | |
} | |
return result; | |
}, | |
SwitchStatement: function (stmt, flags) { | |
var result, | |
fragment, | |
i, | |
iz, | |
bodyFlags, | |
that = this || _global$I; | |
withIndent(function () { | |
result = ['switch' + space + '(', that.generateExpression(stmt.discriminant, Precedence.Sequence, E_TTT), ')' + space + '{' + newline]; | |
}); | |
if (stmt.cases) { | |
bodyFlags = S_TFFF; | |
for (i = 0, iz = stmt.cases.length; i < iz; ++i) { | |
if (i === iz - 1) { | |
bodyFlags |= F_SEMICOLON_OPT; | |
} | |
fragment = addIndent(this.generateStatement(stmt.cases[i], bodyFlags)); | |
result.push(fragment); | |
if (!endsWithLineTerminator(toSourceNodeWhenNeeded(fragment).toString())) { | |
result.push(newline); | |
} | |
} | |
} | |
result.push(addIndent('}')); | |
return result; | |
}, | |
SwitchCase: function (stmt, flags) { | |
var result, | |
fragment, | |
i, | |
iz, | |
bodyFlags, | |
that = this || _global$I; | |
withIndent(function () { | |
if (stmt.test) { | |
result = [join('case', that.generateExpression(stmt.test, Precedence.Sequence, E_TTT)), ':']; | |
} else { | |
result = ['default:']; | |
} | |
i = 0; | |
iz = stmt.consequent.length; | |
if (iz && stmt.consequent[0].type === Syntax.BlockStatement) { | |
fragment = that.maybeBlock(stmt.consequent[0], S_TFFF); | |
result.push(fragment); | |
i = 1; | |
} | |
if (i !== iz && !endsWithLineTerminator(toSourceNodeWhenNeeded(result).toString())) { | |
result.push(newline); | |
} | |
bodyFlags = S_TFFF; | |
for (; i < iz; ++i) { | |
if (i === iz - 1 && flags & F_SEMICOLON_OPT) { | |
bodyFlags |= F_SEMICOLON_OPT; | |
} | |
fragment = addIndent(that.generateStatement(stmt.consequent[i], bodyFlags)); | |
result.push(fragment); | |
if (i + 1 !== iz && !endsWithLineTerminator(toSourceNodeWhenNeeded(fragment).toString())) { | |
result.push(newline); | |
} | |
} | |
}); | |
return result; | |
}, | |
IfStatement: function (stmt, flags) { | |
var result, | |
bodyFlags, | |
semicolonOptional, | |
that = this || _global$I; | |
withIndent(function () { | |
result = ['if' + space + '(', that.generateExpression(stmt.test, Precedence.Sequence, E_TTT), ')']; | |
}); | |
semicolonOptional = flags & F_SEMICOLON_OPT; | |
bodyFlags = S_TFFF; | |
if (semicolonOptional) { | |
bodyFlags |= F_SEMICOLON_OPT; | |
} | |
if (stmt.alternate) { | |
result.push(this.maybeBlock(stmt.consequent, S_TFFF)); | |
result = this.maybeBlockSuffix(stmt.consequent, result); | |
if (stmt.alternate.type === Syntax.IfStatement) { | |
result = join(result, ['else ', this.generateStatement(stmt.alternate, bodyFlags)]); | |
} else { | |
result = join(result, join('else', this.maybeBlock(stmt.alternate, bodyFlags))); | |
} | |
} else { | |
result.push(this.maybeBlock(stmt.consequent, bodyFlags)); | |
} | |
return result; | |
}, | |
ForStatement: function (stmt, flags) { | |
var result, | |
that = this || _global$I; | |
withIndent(function () { | |
result = ['for' + space + '(']; | |
if (stmt.init) { | |
if (stmt.init.type === Syntax.VariableDeclaration) { | |
result.push(that.generateStatement(stmt.init, S_FFFF)); | |
} else { | |
// F_ALLOW_IN becomes false. | |
result.push(that.generateExpression(stmt.init, Precedence.Sequence, E_FTT)); | |
result.push(';'); | |
} | |
} else { | |
result.push(';'); | |
} | |
if (stmt.test) { | |
result.push(space); | |
result.push(that.generateExpression(stmt.test, Precedence.Sequence, E_TTT)); | |
result.push(';'); | |
} else { | |
result.push(';'); | |
} | |
if (stmt.update) { | |
result.push(space); | |
result.push(that.generateExpression(stmt.update, Precedence.Sequence, E_TTT)); | |
result.push(')'); | |
} else { | |
result.push(')'); | |
} | |
}); | |
result.push(this.maybeBlock(stmt.body, flags & F_SEMICOLON_OPT ? S_TFFT : S_TFFF)); | |
return result; | |
}, | |
ForInStatement: function (stmt, flags) { | |
return this.generateIterationForStatement('in', stmt, flags & F_SEMICOLON_OPT ? S_TFFT : S_TFFF); | |
}, | |
ForOfStatement: function (stmt, flags) { | |
return this.generateIterationForStatement('of', stmt, flags & F_SEMICOLON_OPT ? S_TFFT : S_TFFF); | |
}, | |
LabeledStatement: function (stmt, flags) { | |
return [stmt.label.name + ':', this.maybeBlock(stmt.body, flags & F_SEMICOLON_OPT ? S_TFFT : S_TFFF)]; | |
}, | |
Program: function (stmt, flags) { | |
var result, fragment, i, iz, bodyFlags; | |
iz = stmt.body.length; | |
result = [safeConcatenation && iz > 0 ? '\n' : '']; | |
bodyFlags = S_TFTF; | |
for (i = 0; i < iz; ++i) { | |
if (!safeConcatenation && i === iz - 1) { | |
bodyFlags |= F_SEMICOLON_OPT; | |
} | |
if (preserveBlankLines) { | |
// handle spaces before the first line | |
if (i === 0) { | |
if (!stmt.body[0].leadingComments) { | |
generateBlankLines(stmt.range[0], stmt.body[i].range[0], result); | |
} | |
} // handle spaces between lines | |
if (i > 0) { | |
if (!stmt.body[i - 1].trailingComments && !stmt.body[i].leadingComments) { | |
generateBlankLines(stmt.body[i - 1].range[1], stmt.body[i].range[0], result); | |
} | |
} | |
} | |
fragment = addIndent(this.generateStatement(stmt.body[i], bodyFlags)); | |
result.push(fragment); | |
if (i + 1 < iz && !endsWithLineTerminator(toSourceNodeWhenNeeded(fragment).toString())) { | |
if (preserveBlankLines) { | |
if (!stmt.body[i + 1].leadingComments) { | |
result.push(newline); | |
} | |
} else { | |
result.push(newline); | |
} | |
} | |
if (preserveBlankLines) { | |
// handle spaces after the last line | |
if (i === iz - 1) { | |
if (!stmt.body[i].trailingComments) { | |
generateBlankLines(stmt.body[i].range[1], stmt.range[1], result); | |
} | |
} | |
} | |
} | |
return result; | |
}, | |
FunctionDeclaration: function (stmt, flags) { | |
return [generateAsyncPrefix(stmt, true), 'function', generateStarSuffix(stmt) || noEmptySpace(), stmt.id ? generateIdentifier(stmt.id) : '', this.generateFunctionBody(stmt)]; | |
}, | |
ReturnStatement: function (stmt, flags) { | |
if (stmt.argument) { | |
return [join('return', this.generateExpression(stmt.argument, Precedence.Sequence, E_TTT)), this.semicolon(flags)]; | |
} | |
return ['return' + this.semicolon(flags)]; | |
}, | |
WhileStatement: function (stmt, flags) { | |
var result, | |
that = this || _global$I; | |
withIndent(function () { | |
result = ['while' + space + '(', that.generateExpression(stmt.test, Precedence.Sequence, E_TTT), ')']; | |
}); | |
result.push(this.maybeBlock(stmt.body, flags & F_SEMICOLON_OPT ? S_TFFT : S_TFFF)); | |
return result; | |
}, | |
WithStatement: function (stmt, flags) { | |
var result, | |
that = this || _global$I; | |
withIndent(function () { | |
result = ['with' + space + '(', that.generateExpression(stmt.object, Precedence.Sequence, E_TTT), ')']; | |
}); | |
result.push(this.maybeBlock(stmt.body, flags & F_SEMICOLON_OPT ? S_TFFT : S_TFFF)); | |
return result; | |
} | |
}; | |
merge(CodeGenerator.prototype, CodeGenerator.Statement); // Expressions. | |
CodeGenerator.Expression = { | |
SequenceExpression: function (expr, precedence, flags) { | |
var result, i, iz; | |
if (Precedence.Sequence < precedence) { | |
flags |= F_ALLOW_IN; | |
} | |
result = []; | |
for (i = 0, iz = expr.expressions.length; i < iz; ++i) { | |
result.push(this.generateExpression(expr.expressions[i], Precedence.Assignment, flags)); | |
if (i + 1 < iz) { | |
result.push(',' + space); | |
} | |
} | |
return parenthesize(result, Precedence.Sequence, precedence); | |
}, | |
AssignmentExpression: function (expr, precedence, flags) { | |
return this.generateAssignment(expr.left, expr.right, expr.operator, precedence, flags); | |
}, | |
ArrowFunctionExpression: function (expr, precedence, flags) { | |
return parenthesize(this.generateFunctionBody(expr), Precedence.ArrowFunction, precedence); | |
}, | |
ConditionalExpression: function (expr, precedence, flags) { | |
if (Precedence.Conditional < precedence) { | |
flags |= F_ALLOW_IN; | |
} | |
return parenthesize([this.generateExpression(expr.test, Precedence.LogicalOR, flags), space + '?' + space, this.generateExpression(expr.consequent, Precedence.Assignment, flags), space + ':' + space, this.generateExpression(expr.alternate, Precedence.Assignment, flags)], Precedence.Conditional, precedence); | |
}, | |
LogicalExpression: function (expr, precedence, flags) { | |
return this.BinaryExpression(expr, precedence, flags); | |
}, | |
BinaryExpression: function (expr, precedence, flags) { | |
var result, leftPrecedence, rightPrecedence, currentPrecedence, fragment, leftSource; | |
currentPrecedence = BinaryPrecedence[expr.operator]; | |
leftPrecedence = expr.operator === '**' ? Precedence.Postfix : currentPrecedence; | |
rightPrecedence = expr.operator === '**' ? currentPrecedence : currentPrecedence + 1; | |
if (currentPrecedence < precedence) { | |
flags |= F_ALLOW_IN; | |
} | |
fragment = this.generateExpression(expr.left, leftPrecedence, flags); | |
leftSource = fragment.toString(); | |
if (leftSource.charCodeAt(leftSource.length - 1) === 0x2F | |
/* / */ | |
&& esutils.code.isIdentifierPartES5(expr.operator.charCodeAt(0))) { | |
result = [fragment, noEmptySpace(), expr.operator]; | |
} else { | |
result = join(fragment, expr.operator); | |
} | |
fragment = this.generateExpression(expr.right, rightPrecedence, flags); | |
if (expr.operator === '/' && fragment.toString().charAt(0) === '/' || expr.operator.slice(-1) === '<' && fragment.toString().slice(0, 3) === '!--') { | |
// If '/' concats with '/' or `<` concats with `!--`, it is interpreted as comment start | |
result.push(noEmptySpace()); | |
result.push(fragment); | |
} else { | |
result = join(result, fragment); | |
} | |
if (expr.operator === 'in' && !(flags & F_ALLOW_IN)) { | |
return ['(', result, ')']; | |
} | |
return parenthesize(result, currentPrecedence, precedence); | |
}, | |
CallExpression: function (expr, precedence, flags) { | |
var result, i, iz; // F_ALLOW_UNPARATH_NEW becomes false. | |
result = [this.generateExpression(expr.callee, Precedence.Call, E_TTF)]; | |
if (expr.optional) { | |
result.push('?.'); | |
} | |
result.push('('); | |
for (i = 0, iz = expr['arguments'].length; i < iz; ++i) { | |
result.push(this.generateExpression(expr['arguments'][i], Precedence.Assignment, E_TTT)); | |
if (i + 1 < iz) { | |
result.push(',' + space); | |
} | |
} | |
result.push(')'); | |
if (!(flags & F_ALLOW_CALL)) { | |
return ['(', result, ')']; | |
} | |
return parenthesize(result, Precedence.Call, precedence); | |
}, | |
ChainExpression: function (expr, precedence, flags) { | |
if (Precedence.OptionalChaining < precedence) { | |
flags |= F_ALLOW_CALL; | |
} | |
var result = this.generateExpression(expr.expression, Precedence.OptionalChaining, flags); | |
return parenthesize(result, Precedence.OptionalChaining, precedence); | |
}, | |
NewExpression: function (expr, precedence, flags) { | |
var result, length, i, iz, itemFlags; | |
length = expr['arguments'].length; // F_ALLOW_CALL becomes false. | |
// F_ALLOW_UNPARATH_NEW may become false. | |
itemFlags = flags & F_ALLOW_UNPARATH_NEW && !parentheses && length === 0 ? E_TFT : E_TFF; | |
result = join('new', this.generateExpression(expr.callee, Precedence.New, itemFlags)); | |
if (!(flags & F_ALLOW_UNPARATH_NEW) || parentheses || length > 0) { | |
result.push('('); | |
for (i = 0, iz = length; i < iz; ++i) { | |
result.push(this.generateExpression(expr['arguments'][i], Precedence.Assignment, E_TTT)); | |
if (i + 1 < iz) { | |
result.push(',' + space); | |
} | |
} | |
result.push(')'); | |
} | |
return parenthesize(result, Precedence.New, precedence); | |
}, | |
MemberExpression: function (expr, precedence, flags) { | |
var result, fragment; // F_ALLOW_UNPARATH_NEW becomes false. | |
result = [this.generateExpression(expr.object, Precedence.Call, flags & F_ALLOW_CALL ? E_TTF : E_TFF)]; | |
if (expr.computed) { | |
if (expr.optional) { | |
result.push('?.'); | |
} | |
result.push('['); | |
result.push(this.generateExpression(expr.property, Precedence.Sequence, flags & F_ALLOW_CALL ? E_TTT : E_TFT)); | |
result.push(']'); | |
} else { | |
if (!expr.optional && expr.object.type === Syntax.Literal && typeof expr.object.value === 'number') { | |
fragment = toSourceNodeWhenNeeded(result).toString(); // When the following conditions are all true, | |
// 1. No floating point | |
// 2. Don't have exponents | |
// 3. The last character is a decimal digit | |
// 4. Not hexadecimal OR octal number literal | |
// we should add a floating point. | |
if (fragment.indexOf('.') < 0 && !/[eExX]/.test(fragment) && esutils.code.isDecimalDigit(fragment.charCodeAt(fragment.length - 1)) && !(fragment.length >= 2 && fragment.charCodeAt(0) === 48) // '0' | |
) { | |
result.push(' '); | |
} | |
} | |
result.push(expr.optional ? '?.' : '.'); | |
result.push(generateIdentifier(expr.property)); | |
} | |
return parenthesize(result, Precedence.Member, precedence); | |
}, | |
MetaProperty: function (expr, precedence, flags) { | |
var result; | |
result = []; | |
result.push(typeof expr.meta === "string" ? expr.meta : generateIdentifier(expr.meta)); | |
result.push('.'); | |
result.push(typeof expr.property === "string" ? expr.property : generateIdentifier(expr.property)); | |
return parenthesize(result, Precedence.Member, precedence); | |
}, | |
UnaryExpression: function (expr, precedence, flags) { | |
var result, fragment, rightCharCode, leftSource, leftCharCode; | |
fragment = this.generateExpression(expr.argument, Precedence.Unary, E_TTT); | |
if (space === '') { | |
result = join(expr.operator, fragment); | |
} else { | |
result = [expr.operator]; | |
if (expr.operator.length > 2) { | |
// delete, void, typeof | |
// get `typeof []`, not `typeof[]` | |
result = join(result, fragment); | |
} else { | |
// Prevent inserting spaces between operator and argument if it is unnecessary | |
// like, `!cond` | |
leftSource = toSourceNodeWhenNeeded(result).toString(); | |
leftCharCode = leftSource.charCodeAt(leftSource.length - 1); | |
rightCharCode = fragment.toString().charCodeAt(0); | |
if ((leftCharCode === 0x2B | |
/* + */ | |
|| leftCharCode === 0x2D | |
/* - */ | |
) && leftCharCode === rightCharCode || esutils.code.isIdentifierPartES5(leftCharCode) && esutils.code.isIdentifierPartES5(rightCharCode)) { | |
result.push(noEmptySpace()); | |
result.push(fragment); | |
} else { | |
result.push(fragment); | |
} | |
} | |
} | |
return parenthesize(result, Precedence.Unary, precedence); | |
}, | |
YieldExpression: function (expr, precedence, flags) { | |
var result; | |
if (expr.delegate) { | |
result = 'yield*'; | |
} else { | |
result = 'yield'; | |
} | |
if (expr.argument) { | |
result = join(result, this.generateExpression(expr.argument, Precedence.Yield, E_TTT)); | |
} | |
return parenthesize(result, Precedence.Yield, precedence); | |
}, | |
AwaitExpression: function (expr, precedence, flags) { | |
var result = join(expr.all ? 'await*' : 'await', this.generateExpression(expr.argument, Precedence.Await, E_TTT)); | |
return parenthesize(result, Precedence.Await, precedence); | |
}, | |
UpdateExpression: function (expr, precedence, flags) { | |
if (expr.prefix) { | |
return parenthesize([expr.operator, this.generateExpression(expr.argument, Precedence.Unary, E_TTT)], Precedence.Unary, precedence); | |
} | |
return parenthesize([this.generateExpression(expr.argument, Precedence.Postfix, E_TTT), expr.operator], Precedence.Postfix, precedence); | |
}, | |
FunctionExpression: function (expr, precedence, flags) { | |
var result = [generateAsyncPrefix(expr, true), 'function']; | |
if (expr.id) { | |
result.push(generateStarSuffix(expr) || noEmptySpace()); | |
result.push(generateIdentifier(expr.id)); | |
} else { | |
result.push(generateStarSuffix(expr) || space); | |
} | |
result.push(this.generateFunctionBody(expr)); | |
return result; | |
}, | |
ArrayPattern: function (expr, precedence, flags) { | |
return this.ArrayExpression(expr, precedence, flags, true); | |
}, | |
ArrayExpression: function (expr, precedence, flags, isPattern) { | |
var result, | |
multiline, | |
that = this || _global$I; | |
if (!expr.elements.length) { | |
return '[]'; | |
} | |
multiline = isPattern ? false : expr.elements.length > 1; | |
result = ['[', multiline ? newline : '']; | |
withIndent(function (indent) { | |
var i, iz; | |
for (i = 0, iz = expr.elements.length; i < iz; ++i) { | |
if (!expr.elements[i]) { | |
if (multiline) { | |
result.push(indent); | |
} | |
if (i + 1 === iz) { | |
result.push(','); | |
} | |
} else { | |
result.push(multiline ? indent : ''); | |
result.push(that.generateExpression(expr.elements[i], Precedence.Assignment, E_TTT)); | |
} | |
if (i + 1 < iz) { | |
result.push(',' + (multiline ? newline : space)); | |
} | |
} | |
}); | |
if (multiline && !endsWithLineTerminator(toSourceNodeWhenNeeded(result).toString())) { | |
result.push(newline); | |
} | |
result.push(multiline ? base : ''); | |
result.push(']'); | |
return result; | |
}, | |
RestElement: function (expr, precedence, flags) { | |
return '...' + this.generatePattern(expr.argument); | |
}, | |
ClassExpression: function (expr, precedence, flags) { | |
var result, fragment; | |
result = ['class']; | |
if (expr.id) { | |
result = join(result, this.generateExpression(expr.id, Precedence.Sequence, E_TTT)); | |
} | |
if (expr.superClass) { | |
fragment = join('extends', this.generateExpression(expr.superClass, Precedence.Unary, E_TTT)); | |
result = join(result, fragment); | |
} | |
result.push(space); | |
result.push(this.generateStatement(expr.body, S_TFFT)); | |
return result; | |
}, | |
MethodDefinition: function (expr, precedence, flags) { | |
var result, fragment; | |
if (expr['static']) { | |
result = ['static' + space]; | |
} else { | |
result = []; | |
} | |
if (expr.kind === 'get' || expr.kind === 'set') { | |
fragment = [join(expr.kind, this.generatePropertyKey(expr.key, expr.computed)), this.generateFunctionBody(expr.value)]; | |
} else { | |
fragment = [generateMethodPrefix(expr), this.generatePropertyKey(expr.key, expr.computed), this.generateFunctionBody(expr.value)]; | |
} | |
return join(result, fragment); | |
}, | |
Property: function (expr, precedence, flags) { | |
if (expr.kind === 'get' || expr.kind === 'set') { | |
return [expr.kind, noEmptySpace(), this.generatePropertyKey(expr.key, expr.computed), this.generateFunctionBody(expr.value)]; | |
} | |
if (expr.shorthand) { | |
if (expr.value.type === "AssignmentPattern") { | |
return this.AssignmentPattern(expr.value, Precedence.Sequence, E_TTT); | |
} | |
return this.generatePropertyKey(expr.key, expr.computed); | |
} | |
if (expr.method) { | |
return [generateMethodPrefix(expr), this.generatePropertyKey(expr.key, expr.computed), this.generateFunctionBody(expr.value)]; | |
} | |
return [this.generatePropertyKey(expr.key, expr.computed), ':' + space, this.generateExpression(expr.value, Precedence.Assignment, E_TTT)]; | |
}, | |
ObjectExpression: function (expr, precedence, flags) { | |
var multiline, | |
result, | |
fragment, | |
that = this || _global$I; | |
if (!expr.properties.length) { | |
return '{}'; | |
} | |
multiline = expr.properties.length > 1; | |
withIndent(function () { | |
fragment = that.generateExpression(expr.properties[0], Precedence.Sequence, E_TTT); | |
}); | |
if (!multiline) { | |
// issues 4 | |
// Do not transform from | |
// dejavu.Class.declare({ | |
// method2: function () {} | |
// }); | |
// to | |
// dejavu.Class.declare({method2: function () { | |
// }}); | |
if (!hasLineTerminator(toSourceNodeWhenNeeded(fragment).toString())) { | |
return ['{', space, fragment, space, '}']; | |
} | |
} | |
withIndent(function (indent) { | |
var i, iz; | |
result = ['{', newline, indent, fragment]; | |
if (multiline) { | |
result.push(',' + newline); | |
for (i = 1, iz = expr.properties.length; i < iz; ++i) { | |
result.push(indent); | |
result.push(that.generateExpression(expr.properties[i], Precedence.Sequence, E_TTT)); | |
if (i + 1 < iz) { | |
result.push(',' + newline); | |
} | |
} | |
} | |
}); | |
if (!endsWithLineTerminator(toSourceNodeWhenNeeded(result).toString())) { | |
result.push(newline); | |
} | |
result.push(base); | |
result.push('}'); | |
return result; | |
}, | |
AssignmentPattern: function (expr, precedence, flags) { | |
return this.generateAssignment(expr.left, expr.right, '=', precedence, flags); | |
}, | |
ObjectPattern: function (expr, precedence, flags) { | |
var result, | |
i, | |
iz, | |
multiline, | |
property, | |
that = this || _global$I; | |
if (!expr.properties.length) { | |
return '{}'; | |
} | |
multiline = false; | |
if (expr.properties.length === 1) { | |
property = expr.properties[0]; | |
if (property.type === Syntax.Property && property.value.type !== Syntax.Identifier) { | |
multiline = true; | |
} | |
} else { | |
for (i = 0, iz = expr.properties.length; i < iz; ++i) { | |
property = expr.properties[i]; | |
if (property.type === Syntax.Property && !property.shorthand) { | |
multiline = true; | |
break; | |
} | |
} | |
} | |
result = ['{', multiline ? newline : '']; | |
withIndent(function (indent) { | |
var i, iz; | |
for (i = 0, iz = expr.properties.length; i < iz; ++i) { | |
result.push(multiline ? indent : ''); | |
result.push(that.generateExpression(expr.properties[i], Precedence.Sequence, E_TTT)); | |
if (i + 1 < iz) { | |
result.push(',' + (multiline ? newline : space)); | |
} | |
} | |
}); | |
if (multiline && !endsWithLineTerminator(toSourceNodeWhenNeeded(result).toString())) { | |
result.push(newline); | |
} | |
result.push(multiline ? base : ''); | |
result.push('}'); | |
return result; | |
}, | |
ThisExpression: function (expr, precedence, flags) { | |
return 'this'; | |
}, | |
Super: function (expr, precedence, flags) { | |
return 'super'; | |
}, | |
Identifier: function (expr, precedence, flags) { | |
return generateIdentifier(expr); | |
}, | |
ImportDefaultSpecifier: function (expr, precedence, flags) { | |
return generateIdentifier(expr.id || expr.local); | |
}, | |
ImportNamespaceSpecifier: function (expr, precedence, flags) { | |
var result = ['*']; | |
var id = expr.id || expr.local; | |
if (id) { | |
result.push(space + 'as' + noEmptySpace() + generateIdentifier(id)); | |
} | |
return result; | |
}, | |
ImportSpecifier: function (expr, precedence, flags) { | |
var imported = expr.imported; | |
var result = [imported.name]; | |
var local = expr.local; | |
if (local && local.name !== imported.name) { | |
result.push(noEmptySpace() + 'as' + noEmptySpace() + generateIdentifier(local)); | |
} | |
return result; | |
}, | |
ExportSpecifier: function (expr, precedence, flags) { | |
var local = expr.local; | |
var result = [local.name]; | |
var exported = expr.exported; | |
if (exported && exported.name !== local.name) { | |
result.push(noEmptySpace() + 'as' + noEmptySpace() + generateIdentifier(exported)); | |
} | |
return result; | |
}, | |
Literal: function (expr, precedence, flags) { | |
var raw; | |
if (expr.hasOwnProperty('raw') && parse && extra.raw) { | |
try { | |
raw = parse(expr.raw).body[0].expression; | |
if (raw.type === Syntax.Literal) { | |
if (raw.value === expr.value) { | |
return expr.raw; | |
} | |
} | |
} catch (e) {// not use raw property | |
} | |
} | |
if (expr.regex) { | |
return '/' + expr.regex.pattern + '/' + expr.regex.flags; | |
} | |
if (expr.value === null) { | |
return 'null'; | |
} | |
if (typeof expr.value === 'string') { | |
return escapeString(expr.value); | |
} | |
if (typeof expr.value === 'number') { | |
return generateNumber(expr.value); | |
} | |
if (typeof expr.value === 'boolean') { | |
return expr.value ? 'true' : 'false'; | |
} | |
return generateRegExp(expr.value); | |
}, | |
GeneratorExpression: function (expr, precedence, flags) { | |
return this.ComprehensionExpression(expr, precedence, flags); | |
}, | |
ComprehensionExpression: function (expr, precedence, flags) { | |
// GeneratorExpression should be parenthesized with (...), ComprehensionExpression with [...] | |
// Due to https://bugzilla.mozilla.org/show_bug.cgi?id=883468 position of expr.body can differ in Spidermonkey and ES6 | |
var result, | |
i, | |
iz, | |
fragment, | |
that = this || _global$I; | |
result = expr.type === Syntax.GeneratorExpression ? ['('] : ['[']; | |
if (extra.moz.comprehensionExpressionStartsWithAssignment) { | |
fragment = this.generateExpression(expr.body, Precedence.Assignment, E_TTT); | |
result.push(fragment); | |
} | |
if (expr.blocks) { | |
withIndent(function () { | |
for (i = 0, iz = expr.blocks.length; i < iz; ++i) { | |
fragment = that.generateExpression(expr.blocks[i], Precedence.Sequence, E_TTT); | |
if (i > 0 || extra.moz.comprehensionExpressionStartsWithAssignment) { | |
result = join(result, fragment); | |
} else { | |
result.push(fragment); | |
} | |
} | |
}); | |
} | |
if (expr.filter) { | |
result = join(result, 'if' + space); | |
fragment = this.generateExpression(expr.filter, Precedence.Sequence, E_TTT); | |
result = join(result, ['(', fragment, ')']); | |
} | |
if (!extra.moz.comprehensionExpressionStartsWithAssignment) { | |
fragment = this.generateExpression(expr.body, Precedence.Assignment, E_TTT); | |
result = join(result, fragment); | |
} | |
result.push(expr.type === Syntax.GeneratorExpression ? ')' : ']'); | |
return result; | |
}, | |
ComprehensionBlock: function (expr, precedence, flags) { | |
var fragment; | |
if (expr.left.type === Syntax.VariableDeclaration) { | |
fragment = [expr.left.kind, noEmptySpace(), this.generateStatement(expr.left.declarations[0], S_FFFF)]; | |
} else { | |
fragment = this.generateExpression(expr.left, Precedence.Call, E_TTT); | |
} | |
fragment = join(fragment, expr.of ? 'of' : 'in'); | |
fragment = join(fragment, this.generateExpression(expr.right, Precedence.Sequence, E_TTT)); | |
return ['for' + space + '(', fragment, ')']; | |
}, | |
SpreadElement: function (expr, precedence, flags) { | |
return ['...', this.generateExpression(expr.argument, Precedence.Assignment, E_TTT)]; | |
}, | |
TaggedTemplateExpression: function (expr, precedence, flags) { | |
var itemFlags = E_TTF; | |
if (!(flags & F_ALLOW_CALL)) { | |
itemFlags = E_TFF; | |
} | |
var result = [this.generateExpression(expr.tag, Precedence.Call, itemFlags), this.generateExpression(expr.quasi, Precedence.Primary, E_FFT)]; | |
return parenthesize(result, Precedence.TaggedTemplate, precedence); | |
}, | |
TemplateElement: function (expr, precedence, flags) { | |
// Don't use "cooked". Since tagged template can use raw template | |
// representation. So if we do so, it breaks the script semantics. | |
return expr.value.raw; | |
}, | |
TemplateLiteral: function (expr, precedence, flags) { | |
var result, i, iz; | |
result = ['`']; | |
for (i = 0, iz = expr.quasis.length; i < iz; ++i) { | |
result.push(this.generateExpression(expr.quasis[i], Precedence.Primary, E_TTT)); | |
if (i + 1 < iz) { | |
result.push('${' + space); | |
result.push(this.generateExpression(expr.expressions[i], Precedence.Sequence, E_TTT)); | |
result.push(space + '}'); | |
} | |
} | |
result.push('`'); | |
return result; | |
}, | |
ModuleSpecifier: function (expr, precedence, flags) { | |
return this.Literal(expr, precedence, flags); | |
}, | |
ImportExpression: function (expr, precedence, flag) { | |
return parenthesize(['import(', this.generateExpression(expr.source, Precedence.Assignment, E_TTT), ')'], Precedence.Call, precedence); | |
} | |
}; | |
merge(CodeGenerator.prototype, CodeGenerator.Expression); | |
CodeGenerator.prototype.generateExpression = function (expr, precedence, flags) { | |
var result, type; | |
type = expr.type || Syntax.Property; | |
if (extra.verbatim && expr.hasOwnProperty(extra.verbatim)) { | |
return generateVerbatim(expr, precedence); | |
} | |
result = this[type](expr, precedence, flags); | |
if (extra.comment) { | |
result = addComments(expr, result); | |
} | |
return toSourceNodeWhenNeeded(result, expr); | |
}; | |
CodeGenerator.prototype.generateStatement = function (stmt, flags) { | |
var result, fragment; | |
result = this[stmt.type](stmt, flags); // Attach comments | |
if (extra.comment) { | |
result = addComments(stmt, result); | |
} | |
fragment = toSourceNodeWhenNeeded(result).toString(); | |
if (stmt.type === Syntax.Program && !safeConcatenation && newline === '' && fragment.charAt(fragment.length - 1) === '\n') { | |
result = sourceMap ? toSourceNodeWhenNeeded(result).replaceRight(/\s+$/, '') : fragment.replace(/\s+$/, ''); | |
} | |
return toSourceNodeWhenNeeded(result, stmt); | |
}; | |
function generateInternal(node) { | |
var codegen; | |
codegen = new CodeGenerator(); | |
if (isStatement(node)) { | |
return codegen.generateStatement(node, S_TFFF); | |
} | |
if (isExpression(node)) { | |
return codegen.generateExpression(node, Precedence.Sequence, E_TTT); | |
} | |
throw new Error('Unknown node type: ' + node.type); | |
} | |
function generate(node, options) { | |
var defaultOptions = getDefaultOptions(), | |
result, | |
pair; | |
if (options != null) { | |
// Obsolete options | |
// | |
// `options.indent` | |
// `options.base` | |
// | |
// Instead of them, we can use `option.format.indent`. | |
if (typeof options.indent === 'string') { | |
defaultOptions.format.indent.style = options.indent; | |
} | |
if (typeof options.base === 'number') { | |
defaultOptions.format.indent.base = options.base; | |
} | |
options = updateDeeply(defaultOptions, options); | |
indent = options.format.indent.style; | |
if (typeof options.base === 'string') { | |
base = options.base; | |
} else { | |
base = stringRepeat(indent, options.format.indent.base); | |
} | |
} else { | |
options = defaultOptions; | |
indent = options.format.indent.style; | |
base = stringRepeat(indent, options.format.indent.base); | |
} | |
json = options.format.json; | |
renumber = options.format.renumber; | |
hexadecimal = json ? false : options.format.hexadecimal; | |
quotes = json ? 'double' : options.format.quotes; | |
escapeless = options.format.escapeless; | |
newline = options.format.newline; | |
space = options.format.space; | |
if (options.format.compact) { | |
newline = space = indent = base = ''; | |
} | |
parentheses = options.format.parentheses; | |
semicolons = options.format.semicolons; | |
safeConcatenation = options.format.safeConcatenation; | |
directive = options.directive; | |
parse = json ? null : options.parse; | |
sourceMap = options.sourceMap; | |
sourceCode = options.sourceCode; | |
preserveBlankLines = options.format.preserveBlankLines && sourceCode !== null; | |
extra = options; | |
if (sourceMap) { | |
if (!exports$9T.browser) { | |
// We assume environment is node.js | |
// And prevent from including source-map by browserify | |
SourceNode = dew$9V().SourceNode; | |
} else { | |
SourceNode = _global$I.sourceMap.SourceNode; | |
} | |
} | |
result = generateInternal(node); | |
if (!sourceMap) { | |
pair = { | |
code: result.toString(), | |
map: null | |
}; | |
return options.sourceMapWithCode ? pair : pair.code; | |
} | |
pair = result.toStringWithSourceMap({ | |
file: options.file, | |
sourceRoot: options.sourceMapRoot | |
}); | |
if (options.sourceContent) { | |
pair.map.setSourceContent(options.sourceMap, options.sourceContent); | |
} | |
if (options.sourceMapWithCode) { | |
return pair; | |
} | |
return pair.map.toString(); | |
} | |
FORMAT_MINIFY = { | |
indent: { | |
style: '', | |
base: 0 | |
}, | |
renumber: true, | |
hexadecimal: true, | |
quotes: 'auto', | |
escapeless: true, | |
compact: true, | |
parentheses: false, | |
semicolons: false | |
}; | |
FORMAT_DEFAULTS = getDefaultOptions().format; | |
exports$9T.version = dew$9U().version; | |
exports$9T.generate = generate; | |
exports$9T.attachComments = estraverse.attachComments; | |
exports$9T.Precedence = updateDeeply({}, Precedence); | |
exports$9T.browser = false; | |
exports$9T.FORMAT_MINIFY = FORMAT_MINIFY; | |
exports$9T.FORMAT_DEFAULTS = FORMAT_DEFAULTS; | |
})(); | |
/* vim: set sw=4 ts=4 et tw=80 : */ | |
return exports$9T; | |
} | |
function dew$9S () { return exports$9S } | |
var exports$9S = { | |
"Object": { | |
"writable": true, | |
"enumerable": false, | |
"configurable": true | |
}, | |
"Function": { | |
"writable": true, | |
"enumerable": false, | |
"configurable": true | |
}, | |
"Array": { | |
"writable": true, | |
"enumerable": false, | |
"configurable": true | |
}, | |
"Number": { | |
"writable": true, | |
"enumerable": false, | |
"configurable": true | |
}, | |
"parseFloat": { | |
"writable": true, | |
"enumerable": false, | |
"configurable": true | |
}, | |
"parseInt": { | |
"writable": true, | |
"enumerable": false, | |
"configurable": true | |
}, | |
"Infinity": { | |
"writable": false, | |
"enumerable": false, | |
"configurable": false | |
}, | |
"NaN": { | |
"writable": false, | |
"enumerable": false, | |
"configurable": false | |
}, | |
"undefined": { | |
"writable": false, | |
"enumerable": false, | |
"configurable": false | |
}, | |
"Boolean": { | |
"writable": true, | |
"enumerable": false, | |
"configurable": true | |
}, | |
"String": { | |
"writable": true, | |
"enumerable": false, | |
"configurable": true | |
}, | |
"Symbol": { | |
"writable": true, | |
"enumerable": false, | |
"configurable": true | |
}, | |
"Date": { | |
"writable": true, | |
"enumerable": false, | |
"configurable": true | |
}, | |
"Promise": { | |
"writable": true, | |
"enumerable": false, | |
"configurable": true | |
}, | |
"RegExp": { | |
"writable": true, | |
"enumerable": false, | |
"configurable": true | |
}, | |
"Error": { | |
"writable": true, | |
"enumerable": false, | |
"configurable": true | |
}, | |
"AggregateError": { | |
"writable": true, | |
"enumerable": false, | |
"configurable": true | |
}, | |
"EvalError": { | |
"writable": true, | |
"enumerable": false, | |
"configurable": true | |
}, | |
"RangeError": { | |
"writable": true, | |
"enumerable": false, | |
"configurable": true | |
}, | |
"ReferenceError": { | |
"writable": true, | |
"enumerable": false, | |
"configurable": true | |
}, | |
"SyntaxError": { | |
"writable": true, | |
"enumerable": false, | |
"configurable": true | |
}, | |
"TypeError": { | |
"writable": true, | |
"enumerable": false, | |
"configurable": true | |
}, | |
"URIError": { | |
"writable": true, | |
"enumerable": false, | |
"configurable": true | |
}, | |
"globalThis": { | |
"writable": true, | |
"enumerable": false, | |
"configurable": true | |
}, | |
"JSON": { | |
"writable": true, | |
"enumerable": false, | |
"configurable": true | |
}, | |
"Math": { | |
"writable": true, | |
"enumerable": false, | |
"configurable": true | |
}, | |
"Intl": { | |
"writable": true, | |
"enumerable": false, | |
"configurable": true | |
}, | |
"ArrayBuffer": { | |
"writable": true, | |
"enumerable": false, | |
"configurable": true | |
}, | |
"Uint8Array": { | |
"writable": true, | |
"enumerable": false, | |
"configurable": true | |
}, | |
"Int8Array": { | |
"writable": true, | |
"enumerable": false, | |
"configurable": true | |
}, | |
"Uint16Array": { | |
"writable": true, | |
"enumerable": false, | |
"configurable": true | |
}, | |
"Int16Array": { | |
"writable": true, | |
"enumerable": false, | |
"configurable": true | |
}, | |
"Uint32Array": { | |
"writable": true, | |
"enumerable": false, | |
"configurable": true | |
}, | |
"Int32Array": { | |
"writable": true, | |
"enumerable": false, | |
"configurable": true | |
}, | |
"Float32Array": { | |
"writable": true, | |
"enumerable": false, | |
"configurable": true | |
}, | |
"Float64Array": { | |
"writable": true, | |
"enumerable": false, | |
"configurable": true | |
}, | |
"Uint8ClampedArray": { | |
"writable": true, | |
"enumerable": false, | |
"configurable": true | |
}, | |
"BigUint64Array": { | |
"writable": true, | |
"enumerable": false, | |
"configurable": true | |
}, | |
"BigInt64Array": { | |
"writable": true, | |
"enumerable": false, | |
"configurable": true | |
}, | |
"DataView": { | |
"writable": true, | |
"enumerable": false, | |
"configurable": true | |
}, | |
"Map": { | |
"writable": true, | |
"enumerable": false, | |
"configurable": true | |
}, | |
"BigInt": { | |
"writable": true, | |
"enumerable": false, | |
"configurable": true | |
}, | |
"Set": { | |
"writable": true, | |
"enumerable": false, | |
"configurable": true | |
}, | |
"WeakMap": { | |
"writable": true, | |
"enumerable": false, | |
"configurable": true | |
}, | |
"WeakSet": { | |
"writable": true, | |
"enumerable": false, | |
"configurable": true | |
}, | |
"Proxy": { | |
"writable": true, | |
"enumerable": false, | |
"configurable": true | |
}, | |
"Reflect": { | |
"writable": true, | |
"enumerable": false, | |
"configurable": true | |
}, | |
"FinalizationRegistry": { | |
"writable": true, | |
"enumerable": false, | |
"configurable": true | |
}, | |
"WeakRef": { | |
"writable": true, | |
"enumerable": false, | |
"configurable": true | |
}, | |
"decodeURI": { | |
"writable": true, | |
"enumerable": false, | |
"configurable": true | |
}, | |
"decodeURIComponent": { | |
"writable": true, | |
"enumerable": false, | |
"configurable": true | |
}, | |
"encodeURI": { | |
"writable": true, | |
"enumerable": false, | |
"configurable": true | |
}, | |
"encodeURIComponent": { | |
"writable": true, | |
"enumerable": false, | |
"configurable": true | |
}, | |
"escape": { | |
"writable": true, | |
"enumerable": false, | |
"configurable": true | |
}, | |
"unescape": { | |
"writable": true, | |
"enumerable": false, | |
"configurable": true | |
}, | |
"eval": { | |
"writable": true, | |
"enumerable": false, | |
"configurable": true | |
}, | |
"isFinite": { | |
"writable": true, | |
"enumerable": false, | |
"configurable": true | |
}, | |
"isNaN": { | |
"writable": true, | |
"enumerable": false, | |
"configurable": true | |
}, | |
"SharedArrayBuffer": { | |
"writable": true, | |
"enumerable": false, | |
"configurable": true | |
}, | |
"Atomics": { | |
"writable": true, | |
"enumerable": false, | |
"configurable": true | |
}, | |
"WebAssembly": { | |
"writable": true, | |
"enumerable": false, | |
"configurable": true | |
} | |
} | |
; | |
var exports$9R = {}, | |
_dewExec$9C = false; | |
var _global$H = typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : global; | |
function dew$9R() { | |
if (_dewExec$9C) return exports$9R; | |
_dewExec$9C = true; | |
/* eslint-disable no-new-func */ | |
const acorn = dew$ac(); | |
const findGlobals = dew$a9(); | |
const escodegen = dew$9T(); | |
const jsGlobals = dew$9S(); // We can't use the default browserify vm shim because it doesn't work in a web worker. | |
// "eval" is skipped because it's set to a function that calls `runInContext`: | |
const jsGlobalEntriesToInstall = Object.entries(jsGlobals).filter(([name]) => name !== "eval" && name in _global$H); | |
exports$9R.createContext = function (sandbox) { | |
// TODO: This should probably use a symbol | |
Object.defineProperty(sandbox, "__isVMShimContext", { | |
value: true, | |
writable: true, | |
configurable: true, | |
enumerable: false | |
}); | |
for (const [globalName, globalPropDesc] of jsGlobalEntriesToInstall) { | |
const propDesc = { ...globalPropDesc, | |
value: _global$H[globalName] | |
}; | |
Object.defineProperty(sandbox, globalName, propDesc); | |
} | |
Object.defineProperty(sandbox, "eval", { | |
value(code) { | |
return exports$9R.runInContext(code, sandbox); | |
}, | |
writable: true, | |
configurable: true, | |
enumerable: false | |
}); | |
}; | |
exports$9R.isContext = function (sandbox) { | |
return sandbox.__isVMShimContext; | |
}; | |
exports$9R.runInContext = function (code, contextifiedSandbox, options) { | |
if (code === "this") { | |
// Special case for during window creation. | |
return contextifiedSandbox; | |
} | |
if (options === undefined) { | |
options = {}; | |
} | |
const comments = []; | |
const tokens = []; | |
const ast = acorn.parse(code, { | |
allowReturnOutsideFunction: true, | |
ranges: true, | |
// collect comments in Esprima's format | |
onComment: comments, | |
// collect token ranges | |
onToken: tokens | |
}); // make sure we keep comments | |
escodegen.attachComments(ast, comments, tokens); | |
const globals = findGlobals(ast); | |
for (let i = 0; i < globals.length; ++i) { | |
if (globals[i].name === "window" || globals[i].name === "this") { | |
continue; | |
} | |
const { | |
nodes | |
} = globals[i]; | |
for (let j = 0; j < nodes.length; ++j) { | |
const { | |
type, | |
name | |
} = nodes[j]; | |
nodes[j].type = "MemberExpression"; | |
nodes[j].property = { | |
name, | |
type | |
}; | |
nodes[j].computed = false; | |
nodes[j].object = { | |
name: "window", | |
type: "Identifier" | |
}; | |
} | |
} | |
const lastNode = ast.body[ast.body.length - 1]; | |
if (lastNode.type === "ExpressionStatement") { | |
lastNode.type = "ReturnStatement"; | |
lastNode.argument = lastNode.expression; | |
delete lastNode.expression; | |
} | |
const rewrittenCode = escodegen.generate(ast, { | |
comment: true | |
}); | |
const suffix = options.filename !== undefined ? "\n//# sourceURL=" + options.filename : ""; | |
return Function("window", rewrittenCode + suffix).bind(contextifiedSandbox)(contextifiedSandbox); | |
}; | |
exports$9R.Script = class VMShimScript { | |
constructor(code, options) { | |
this._code = code; | |
this._options = options; | |
} | |
runInContext(sandbox, options) { | |
return exports$9R.runInContext(this._code, sandbox, { ...this._options, | |
...options | |
}); | |
} | |
}; | |
return exports$9R; | |
} | |
var exports$9Q = {}, | |
_dewExec$9B = false; | |
function dew$9Q() { | |
if (_dewExec$9B) return exports$9Q; | |
_dewExec$9B = true; | |
/** Highest positive signed 32-bit float value */ | |
const maxInt = 2147483647; // aka. 0x7FFFFFFF or 2^31-1 | |
/** Bootstring parameters */ | |
const base = 36; | |
const tMin = 1; | |
const tMax = 26; | |
const skew = 38; | |
const damp = 700; | |
const initialBias = 72; | |
const initialN = 128; // 0x80 | |
const delimiter = '-'; // '\x2D' | |
/** Regular expressions */ | |
const regexPunycode = /^xn--/; | |
const regexNonASCII = /[^\0-\x7E]/; // non-ASCII chars | |
const regexSeparators = /[\x2E\u3002\uFF0E\uFF61]/g; // RFC 3490 separators | |
/** Error messages */ | |
const errors = { | |
'overflow': 'Overflow: input needs wider integers to process', | |
'not-basic': 'Illegal input >= 0x80 (not a basic code point)', | |
'invalid-input': 'Invalid input' | |
}; | |
/** Convenience shortcuts */ | |
const baseMinusTMin = base - tMin; | |
const floor = Math.floor; | |
const stringFromCharCode = String.fromCharCode; | |
/*--------------------------------------------------------------------------*/ | |
/** | |
* A generic error utility function. | |
* @private | |
* @param {String} type The error type. | |
* @returns {Error} Throws a `RangeError` with the applicable error message. | |
*/ | |
function error(type) { | |
throw new RangeError(errors[type]); | |
} | |
/** | |
* A generic `Array#map` utility function. | |
* @private | |
* @param {Array} array The array to iterate over. | |
* @param {Function} callback The function that gets called for every array | |
* item. | |
* @returns {Array} A new array of values returned by the callback function. | |
*/ | |
function map(array, fn) { | |
const result = []; | |
let length = array.length; | |
while (length--) { | |
result[length] = fn(array[length]); | |
} | |
return result; | |
} | |
/** | |
* A simple `Array#map`-like wrapper to work with domain name strings or email | |
* addresses. | |
* @private | |
* @param {String} domain The domain name or email address. | |
* @param {Function} callback The function that gets called for every | |
* character. | |
* @returns {Array} A new string of characters returned by the callback | |
* function. | |
*/ | |
function mapDomain(string, fn) { | |
const parts = string.split('@'); | |
let result = ''; | |
if (parts.length > 1) { | |
// In email addresses, only the domain name should be punycoded. Leave | |
// the local part (i.e. everything up to `@`) intact. | |
result = parts[0] + '@'; | |
string = parts[1]; | |
} // Avoid `split(regex)` for IE8 compatibility. See #17. | |
string = string.replace(regexSeparators, '\x2E'); | |
const labels = string.split('.'); | |
const encoded = map(labels, fn).join('.'); | |
return result + encoded; | |
} | |
/** | |
* Creates an array containing the numeric code points of each Unicode | |
* character in the string. While JavaScript uses UCS-2 internally, | |
* this function will convert a pair of surrogate halves (each of which | |
* UCS-2 exposes as separate characters) into a single code point, | |
* matching UTF-16. | |
* @see `punycode.ucs2.encode` | |
* @see <https://mathiasbynens.be/notes/javascript-encoding> | |
* @memberOf punycode.ucs2 | |
* @name decode | |
* @param {String} string The Unicode input string (UCS-2). | |
* @returns {Array} The new array of code points. | |
*/ | |
function ucs2decode(string) { | |
const output = []; | |
let counter = 0; | |
const length = string.length; | |
while (counter < length) { | |
const value = string.charCodeAt(counter++); | |
if (value >= 0xD800 && value <= 0xDBFF && counter < length) { | |
// It's a high surrogate, and there is a next character. | |
const extra = string.charCodeAt(counter++); | |
if ((extra & 0xFC00) == 0xDC00) { | |
// Low surrogate. | |
output.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000); | |
} else { | |
// It's an unmatched surrogate; only append this code unit, in case the | |
// next code unit is the high surrogate of a surrogate pair. | |
output.push(value); | |
counter--; | |
} | |
} else { | |
output.push(value); | |
} | |
} | |
return output; | |
} | |
/** | |
* Creates a string based on an array of numeric code points. | |
* @see `punycode.ucs2.decode` | |
* @memberOf punycode.ucs2 | |
* @name encode | |
* @param {Array} codePoints The array of numeric code points. | |
* @returns {String} The new Unicode string (UCS-2). | |
*/ | |
const ucs2encode = array => String.fromCodePoint(...array); | |
/** | |
* Converts a basic code point into a digit/integer. | |
* @see `digitToBasic()` | |
* @private | |
* @param {Number} codePoint The basic numeric code point value. | |
* @returns {Number} The numeric value of a basic code point (for use in | |
* representing integers) in the range `0` to `base - 1`, or `base` if | |
* the code point does not represent a value. | |
*/ | |
const basicToDigit = function (codePoint) { | |
if (codePoint - 0x30 < 0x0A) { | |
return codePoint - 0x16; | |
} | |
if (codePoint - 0x41 < 0x1A) { | |
return codePoint - 0x41; | |
} | |
if (codePoint - 0x61 < 0x1A) { | |
return codePoint - 0x61; | |
} | |
return base; | |
}; | |
/** | |
* Converts a digit/integer into a basic code point. | |
* @see `basicToDigit()` | |
* @private | |
* @param {Number} digit The numeric value of a basic code point. | |
* @returns {Number} The basic code point whose value (when used for | |
* representing integers) is `digit`, which needs to be in the range | |
* `0` to `base - 1`. If `flag` is non-zero, the uppercase form is | |
* used; else, the lowercase form is used. The behavior is undefined | |
* if `flag` is non-zero and `digit` has no uppercase form. | |
*/ | |
const digitToBasic = function (digit, flag) { | |
// 0..25 map to ASCII a..z or A..Z | |
// 26..35 map to ASCII 0..9 | |
return digit + 22 + 75 * (digit < 26) - ((flag != 0) << 5); | |
}; | |
/** | |
* Bias adaptation function as per section 3.4 of RFC 3492. | |
* https://tools.ietf.org/html/rfc3492#section-3.4 | |
* @private | |
*/ | |
const adapt = function (delta, numPoints, firstTime) { | |
let k = 0; | |
delta = firstTime ? floor(delta / damp) : delta >> 1; | |
delta += floor(delta / numPoints); | |
for (; | |
/* no initialization */ | |
delta > baseMinusTMin * tMax >> 1; k += base) { | |
delta = floor(delta / baseMinusTMin); | |
} | |
return floor(k + (baseMinusTMin + 1) * delta / (delta + skew)); | |
}; | |
/** | |
* Converts a Punycode string of ASCII-only symbols to a string of Unicode | |
* symbols. | |
* @memberOf punycode | |
* @param {String} input The Punycode string of ASCII-only symbols. | |
* @returns {String} The resulting string of Unicode symbols. | |
*/ | |
const decode = function (input) { | |
// Don't use UCS-2. | |
const output = []; | |
const inputLength = input.length; | |
let i = 0; | |
let n = initialN; | |
let bias = initialBias; // Handle the basic code points: let `basic` be the number of input code | |
// points before the last delimiter, or `0` if there is none, then copy | |
// the first basic code points to the output. | |
let basic = input.lastIndexOf(delimiter); | |
if (basic < 0) { | |
basic = 0; | |
} | |
for (let j = 0; j < basic; ++j) { | |
// if it's not a basic code point | |
if (input.charCodeAt(j) >= 0x80) { | |
error('not-basic'); | |
} | |
output.push(input.charCodeAt(j)); | |
} // Main decoding loop: start just after the last delimiter if any basic code | |
// points were copied; start at the beginning otherwise. | |
for (let index = basic > 0 ? basic + 1 : 0; index < inputLength;) | |
/* no final expression */ | |
{ | |
// `index` is the index of the next character to be consumed. | |
// Decode a generalized variable-length integer into `delta`, | |
// which gets added to `i`. The overflow checking is easier | |
// if we increase `i` as we go, then subtract off its starting | |
// value at the end to obtain `delta`. | |
let oldi = i; | |
for (let w = 1, k = base;; | |
/* no condition */ | |
k += base) { | |
if (index >= inputLength) { | |
error('invalid-input'); | |
} | |
const digit = basicToDigit(input.charCodeAt(index++)); | |
if (digit >= base || digit > floor((maxInt - i) / w)) { | |
error('overflow'); | |
} | |
i += digit * w; | |
const t = k <= bias ? tMin : k >= bias + tMax ? tMax : k - bias; | |
if (digit < t) { | |
break; | |
} | |
const baseMinusT = base - t; | |
if (w > floor(maxInt / baseMinusT)) { | |
error('overflow'); | |
} | |
w *= baseMinusT; | |
} | |
const out = output.length + 1; | |
bias = adapt(i - oldi, out, oldi == 0); // `i` was supposed to wrap around from `out` to `0`, | |
// incrementing `n` each time, so we'll fix that now: | |
if (floor(i / out) > maxInt - n) { | |
error('overflow'); | |
} | |
n += floor(i / out); | |
i %= out; // Insert `n` at position `i` of the output. | |
output.splice(i++, 0, n); | |
} | |
return String.fromCodePoint(...output); | |
}; | |
/** | |
* Converts a string of Unicode symbols (e.g. a domain name label) to a | |
* Punycode string of ASCII-only symbols. | |
* @memberOf punycode | |
* @param {String} input The string of Unicode symbols. | |
* @returns {String} The resulting Punycode string of ASCII-only symbols. | |
*/ | |
const encode = function (input) { | |
const output = []; // Convert the input in UCS-2 to an array of Unicode code points. | |
input = ucs2decode(input); // Cache the length. | |
let inputLength = input.length; // Initialize the state. | |
let n = initialN; | |
let delta = 0; | |
let bias = initialBias; // Handle the basic code points. | |
for (const currentValue of input) { | |
if (currentValue < 0x80) { | |
output.push(stringFromCharCode(currentValue)); | |
} | |
} | |
let basicLength = output.length; | |
let handledCPCount = basicLength; // `handledCPCount` is the number of code points that have been handled; | |
// `basicLength` is the number of basic code points. | |
// Finish the basic string with a delimiter unless it's empty. | |
if (basicLength) { | |
output.push(delimiter); | |
} // Main encoding loop: | |
while (handledCPCount < inputLength) { | |
// All non-basic code points < n have been handled already. Find the next | |
// larger one: | |
let m = maxInt; | |
for (const currentValue of input) { | |
if (currentValue >= n && currentValue < m) { | |
m = currentValue; | |
} | |
} // Increase `delta` enough to advance the decoder's <n,i> state to <m,0>, | |
// but guard against overflow. | |
const handledCPCountPlusOne = handledCPCount + 1; | |
if (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) { | |
error('overflow'); | |
} | |
delta += (m - n) * handledCPCountPlusOne; | |
n = m; | |
for (const currentValue of input) { | |
if (currentValue < n && ++delta > maxInt) { | |
error('overflow'); | |
} | |
if (currentValue == n) { | |
// Represent delta as a generalized variable-length integer. | |
let q = delta; | |
for (let k = base;; | |
/* no condition */ | |
k += base) { | |
const t = k <= bias ? tMin : k >= bias + tMax ? tMax : k - bias; | |
if (q < t) { | |
break; | |
} | |
const qMinusT = q - t; | |
const baseMinusT = base - t; | |
output.push(stringFromCharCode(digitToBasic(t + qMinusT % baseMinusT, 0))); | |
q = floor(qMinusT / baseMinusT); | |
} | |
output.push(stringFromCharCode(digitToBasic(q, 0))); | |
bias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength); | |
delta = 0; | |
++handledCPCount; | |
} | |
} | |
++delta; | |
++n; | |
} | |
return output.join(''); | |
}; | |
/** | |
* Converts a Punycode string representing a domain name or an email address | |
* to Unicode. Only the Punycoded parts of the input will be converted, i.e. | |
* it doesn't matter if you call it on a string that has already been | |
* converted to Unicode. | |
* @memberOf punycode | |
* @param {String} input The Punycoded domain name or email address to | |
* convert to Unicode. | |
* @returns {String} The Unicode representation of the given Punycode | |
* string. | |
*/ | |
const toUnicode = function (input) { | |
return mapDomain(input, function (string) { | |
return regexPunycode.test(string) ? decode(string.slice(4).toLowerCase()) : string; | |
}); | |
}; | |
/** | |
* Converts a Unicode string representing a domain name or an email address to | |
* Punycode. Only the non-ASCII parts of the domain name will be converted, | |
* i.e. it doesn't matter if you call it with a domain that's already in | |
* ASCII. | |
* @memberOf punycode | |
* @param {String} input The domain name or email address to convert, as a | |
* Unicode string. | |
* @returns {String} The Punycode representation of the given domain name or | |
* email address. | |
*/ | |
const toASCII = function (input) { | |
return mapDomain(input, function (string) { | |
return regexNonASCII.test(string) ? 'xn--' + encode(string) : string; | |
}); | |
}; | |
/*--------------------------------------------------------------------------*/ | |
/** Define the public API */ | |
const punycode = { | |
/** | |
* A string representing the current Punycode.js version number. | |
* @memberOf punycode | |
* @type String | |
*/ | |
'version': '2.1.0', | |
/** | |
* An object of methods to convert from JavaScript's internal character | |
* representation (UCS-2) to Unicode code points, and back. | |
* @see <https://mathiasbynens.be/notes/javascript-encoding> | |
* @memberOf punycode | |
* @type Object | |
*/ | |
'ucs2': { | |
'decode': ucs2decode, | |
'encode': ucs2encode | |
}, | |
'decode': decode, | |
'encode': encode, | |
'toASCII': toASCII, | |
'toUnicode': toUnicode | |
}; | |
exports$9Q = punycode; | |
return exports$9Q; | |
} | |
const t$d=2147483647,o$e=/^xn--/,n$g=/[^\0-\x7E]/,e$f=/[\x2E\u3002\uFF0E\uFF61]/g,r$f={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},c$c=Math.floor,s$a=String.fromCharCode;function i$c(t){throw new RangeError(r$f[t])}function f$g(t,o){const n=t.split("@");let r="";n.length>1&&(r=n[0]+"@",t=n[1]);const c=function(t,o){const n=[];let e=t.length;for(;e--;)n[e]=o(t[e]);return n}((t=t.replace(e$f,".")).split("."),o).join(".");return r+c}function l$g(t){const o=[];let n=0;const e=t.length;for(;n<e;){const r=t.charCodeAt(n++);if(r>=55296&&r<=56319&&n<e){const e=t.charCodeAt(n++);56320==(64512&e)?o.push(((1023&r)<<10)+(1023&e)+65536):(o.push(r),n--);}else o.push(r);}return o}const u$d=function(t,o){return t+22+75*(t<26)-((0!=o)<<5)},a$e=function(t,o,n){let e=0;for(t=n?c$c(t/700):t>>1,t+=c$c(t/o);t>455;e+=36)t=c$c(t/35);return c$c(e+36*t/(t+38))},d$8=function(o){const n=[],e=o.length;let r=0,s=128,f=72,l=o.lastIndexOf("-");l<0&&(l=0);for(let t=0;t<l;++t)o.charCodeAt(t)>=128&&i$c("not-basic"),n.push(o.charCodeAt(t));for(let d=l>0?l+1:0;d<e;){let l=r;for(let n=1,s=36;;s+=36){d>=e&&i$c("invalid-input");const l=(u=o.charCodeAt(d++))-48<10?u-22:u-65<26?u-65:u-97<26?u-97:36;(l>=36||l>c$c((t$d-r)/n))&&i$c("overflow"),r+=l*n;const a=s<=f?1:s>=f+26?26:s-f;if(l<a)break;const h=36-a;n>c$c(t$d/h)&&i$c("overflow"),n*=h;}const h=n.length+1;f=a$e(r-l,h,0==l),c$c(r/h)>t$d-s&&i$c("overflow"),s+=c$c(r/h),r%=h,n.splice(r++,0,s);}var u;return String.fromCodePoint(...n)},h$a=function(o){const n=[];let e=(o=l$g(o)).length,r=128,f=0,d=72;for(const t of o)t<128&&n.push(s$a(t));let h=n.length,p=h;for(h&&n.push("-");p<e;){let e=t$d;for(const t of o)t>=r&&t<e&&(e=t);const l=p+1;e-r>c$c((t$d-f)/l)&&i$c("overflow"),f+=(e-r)*l,r=e;for(const e of o)if(e<r&&++f>t$d&&i$c("overflow"),e==r){let t=f;for(let o=36;;o+=36){const e=o<=d?1:o>=d+26?26:o-d;if(t<e)break;const r=t-e,i=36-e;n.push(s$a(u$d(e+r%i,0))),t=c$c(r/i);}n.push(s$a(u$d(t,0))),d=a$e(f,l,p==h),f=0,++p;}++f,++r;}return n.join("")};var p$c={version:"2.1.0",ucs2:{decode:l$g,encode:t=>String.fromCodePoint(...t)},decode:d$8,encode:h$a,toASCII:function(t){return f$g(t,(function(t){return n$g.test(t)?"xn--"+h$a(t):t}))},toUnicode:function(t){return f$g(t,(function(t){return o$e.test(t)?d$8(t.slice(4).toLowerCase()):t}))}}; | |
function e$e(e,n){return Object.prototype.hasOwnProperty.call(e,n)}var n$f=function(n,r,t,o){r=r||"&",t=t||"=";var a={};if("string"!=typeof n||0===n.length)return a;var u=/\+/g;n=n.split(r);var c=1e3;o&&"number"==typeof o.maxKeys&&(c=o.maxKeys);var i=n.length;c>0&&i>c&&(i=c);for(var s=0;s<i;++s){var p,f,d,y,m=n[s].replace(u,"%20"),l=m.indexOf(t);l>=0?(p=m.substr(0,l),f=m.substr(l+1)):(p=m,f=""),d=decodeURIComponent(p),y=decodeURIComponent(f),e$e(a,d)?Array.isArray(a[d])?a[d].push(y):a[d]=[a[d],y]:a[d]=y;}return a},r$e=function(e){switch(typeof e){case"string":return e;case"boolean":return e?"true":"false";case"number":return isFinite(e)?e:"";default:return ""}},t$c=function(e,n,t,o){return n=n||"&",t=t||"=",null===e&&(e=void 0),"object"==typeof e?Object.keys(e).map((function(o){var a=encodeURIComponent(r$e(o))+t;return Array.isArray(e[o])?e[o].map((function(e){return a+encodeURIComponent(r$e(e))})).join(n):a+encodeURIComponent(r$e(e[o]))})).join(n):o?encodeURIComponent(r$e(o))+t+encodeURIComponent(r$e(e)):""},o$d={};o$d.decode=o$d.parse=n$f,o$d.encode=o$d.stringify=t$c;o$d.decode;o$d.encode;o$d.parse;o$d.stringify; | |
var h$9 = {}, | |
e$d = p$c, | |
a$d = { | |
isString: function (t) { | |
return "string" == typeof t; | |
}, | |
isObject: function (t) { | |
return "object" == typeof t && null !== t; | |
}, | |
isNull: function (t) { | |
return null === t; | |
}, | |
isNullOrUndefined: function (t) { | |
return null == t; | |
} | |
}; | |
function r$d() { | |
this.protocol = null, this.slashes = null, this.auth = null, this.host = null, this.port = null, this.hostname = null, this.hash = null, this.search = null, this.query = null, this.pathname = null, this.path = null, this.href = null; | |
} | |
h$9.parse = O$7, h$9.resolve = function (t, s) { | |
return O$7(t, !1, !0).resolve(s); | |
}, h$9.resolveObject = function (t, s) { | |
return t ? O$7(t, !1, !0).resolveObject(s) : s; | |
}, h$9.format = function (t) { | |
a$d.isString(t) && (t = O$7(t)); | |
return t instanceof r$d ? t.format() : r$d.prototype.format.call(t); | |
}, h$9.Url = r$d; | |
var o$c = /^([a-z0-9.+-]+:)/i, | |
n$e = /:[0-9]*$/, | |
i$b = /^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/, | |
l$f = ["{", "}", "|", "\\", "^", "`"].concat(["<", ">", '"', "`", " ", "\r", "\n", "\t"]), | |
p$b = ["'"].concat(l$f), | |
c$b = ["%", "/", "?", ";", "#"].concat(p$b), | |
u$c = ["/", "?", "#"], | |
f$f = /^[+a-z0-9A-Z_-]{0,63}$/, | |
m$8 = /^([+a-z0-9A-Z_-]{0,63})(.*)$/, | |
v$9 = { | |
javascript: !0, | |
"javascript:": !0 | |
}, | |
g$8 = { | |
javascript: !0, | |
"javascript:": !0 | |
}, | |
y$9 = { | |
http: !0, | |
https: !0, | |
ftp: !0, | |
gopher: !0, | |
file: !0, | |
"http:": !0, | |
"https:": !0, | |
"ftp:": !0, | |
"gopher:": !0, | |
"file:": !0 | |
}, | |
b$9 = o$d; | |
function O$7(t, s, h) { | |
if (t && a$d.isObject(t) && t instanceof r$d) return t; | |
var e = new r$d(); | |
return e.parse(t, s, h), e; | |
} | |
r$d.prototype.parse = function (t, s, h) { | |
if (!a$d.isString(t)) throw new TypeError("Parameter 'url' must be a string, not " + typeof t); | |
var r = t.indexOf("?"), | |
n = -1 !== r && r < t.indexOf("#") ? "?" : "#", | |
l = t.split(n); | |
l[0] = l[0].replace(/\\/g, "/"); | |
var O = t = l.join(n); | |
if (O = O.trim(), !h && 1 === t.split("#").length) { | |
var d = i$b.exec(O); | |
if (d) return this.path = O, this.href = O, this.pathname = d[1], d[2] ? (this.search = d[2], this.query = s ? b$9.parse(this.search.substr(1)) : this.search.substr(1)) : s && (this.search = "", this.query = {}), this; | |
} | |
var j = o$c.exec(O); | |
if (j) { | |
var q = (j = j[0]).toLowerCase(); | |
this.protocol = q, O = O.substr(j.length); | |
} | |
if (h || j || O.match(/^\/\/[^@\/]+@[^@\/]+/)) { | |
var x = "//" === O.substr(0, 2); | |
!x || j && g$8[j] || (O = O.substr(2), this.slashes = !0); | |
} | |
if (!g$8[j] && (x || j && !y$9[j])) { | |
for (var A, C, I = -1, w = 0; w < u$c.length; w++) { | |
-1 !== (N = O.indexOf(u$c[w])) && (-1 === I || N < I) && (I = N); | |
} | |
-1 !== (C = -1 === I ? O.lastIndexOf("@") : O.lastIndexOf("@", I)) && (A = O.slice(0, C), O = O.slice(C + 1), this.auth = decodeURIComponent(A)), I = -1; | |
for (w = 0; w < c$b.length; w++) { | |
var N; | |
-1 !== (N = O.indexOf(c$b[w])) && (-1 === I || N < I) && (I = N); | |
} | |
-1 === I && (I = O.length), this.host = O.slice(0, I), O = O.slice(I), this.parseHost(), this.hostname = this.hostname || ""; | |
var U = "[" === this.hostname[0] && "]" === this.hostname[this.hostname.length - 1]; | |
if (!U) for (var k = this.hostname.split(/\./), S = (w = 0, k.length); w < S; w++) { | |
var R = k[w]; | |
if (R && !R.match(f$f)) { | |
for (var $ = "", z = 0, H = R.length; z < H; z++) R.charCodeAt(z) > 127 ? $ += "x" : $ += R[z]; | |
if (!$.match(f$f)) { | |
var L = k.slice(0, w), | |
Z = k.slice(w + 1), | |
_ = R.match(m$8); | |
_ && (L.push(_[1]), Z.unshift(_[2])), Z.length && (O = "/" + Z.join(".") + O), this.hostname = L.join("."); | |
break; | |
} | |
} | |
} | |
this.hostname.length > 255 ? this.hostname = "" : this.hostname = this.hostname.toLowerCase(), U || (this.hostname = e$d.toASCII(this.hostname)); | |
var E = this.port ? ":" + this.port : "", | |
P = this.hostname || ""; | |
this.host = P + E, this.href += this.host, U && (this.hostname = this.hostname.substr(1, this.hostname.length - 2), "/" !== O[0] && (O = "/" + O)); | |
} | |
if (!v$9[q]) for (w = 0, S = p$b.length; w < S; w++) { | |
var T = p$b[w]; | |
if (-1 !== O.indexOf(T)) { | |
var B = encodeURIComponent(T); | |
B === T && (B = escape(T)), O = O.split(T).join(B); | |
} | |
} | |
var D = O.indexOf("#"); | |
-1 !== D && (this.hash = O.substr(D), O = O.slice(0, D)); | |
var F = O.indexOf("?"); | |
if (-1 !== F ? (this.search = O.substr(F), this.query = O.substr(F + 1), s && (this.query = b$9.parse(this.query)), O = O.slice(0, F)) : s && (this.search = "", this.query = {}), O && (this.pathname = O), y$9[q] && this.hostname && !this.pathname && (this.pathname = "/"), this.pathname || this.search) { | |
E = this.pathname || ""; | |
var G = this.search || ""; | |
this.path = E + G; | |
} | |
return this.href = this.format(), this; | |
}, r$d.prototype.format = function () { | |
var t = this.auth || ""; | |
t && (t = (t = encodeURIComponent(t)).replace(/%3A/i, ":"), t += "@"); | |
var s = this.protocol || "", | |
h = this.pathname || "", | |
e = this.hash || "", | |
r = !1, | |
o = ""; | |
this.host ? r = t + this.host : this.hostname && (r = t + (-1 === this.hostname.indexOf(":") ? this.hostname : "[" + this.hostname + "]"), this.port && (r += ":" + this.port)), this.query && a$d.isObject(this.query) && Object.keys(this.query).length && (o = b$9.stringify(this.query)); | |
var n = this.search || o && "?" + o || ""; | |
return s && ":" !== s.substr(-1) && (s += ":"), this.slashes || (!s || y$9[s]) && !1 !== r ? (r = "//" + (r || ""), h && "/" !== h.charAt(0) && (h = "/" + h)) : r || (r = ""), e && "#" !== e.charAt(0) && (e = "#" + e), n && "?" !== n.charAt(0) && (n = "?" + n), s + r + (h = h.replace(/[?#]/g, function (t) { | |
return encodeURIComponent(t); | |
})) + (n = n.replace("#", "%23")) + e; | |
}, r$d.prototype.resolve = function (t) { | |
return this.resolveObject(O$7(t, !1, !0)).format(); | |
}, r$d.prototype.resolveObject = function (t) { | |
if (a$d.isString(t)) { | |
var s = new r$d(); | |
s.parse(t, !1, !0), t = s; | |
} | |
for (var h = new r$d(), e = Object.keys(this), o = 0; o < e.length; o++) { | |
var n = e[o]; | |
h[n] = this[n]; | |
} | |
if (h.hash = t.hash, "" === t.href) return h.href = h.format(), h; | |
if (t.slashes && !t.protocol) { | |
for (var i = Object.keys(t), l = 0; l < i.length; l++) { | |
var p = i[l]; | |
"protocol" !== p && (h[p] = t[p]); | |
} | |
return y$9[h.protocol] && h.hostname && !h.pathname && (h.path = h.pathname = "/"), h.href = h.format(), h; | |
} | |
if (t.protocol && t.protocol !== h.protocol) { | |
if (!y$9[t.protocol]) { | |
for (var c = Object.keys(t), u = 0; u < c.length; u++) { | |
var f = c[u]; | |
h[f] = t[f]; | |
} | |
return h.href = h.format(), h; | |
} | |
if (h.protocol = t.protocol, t.host || g$8[t.protocol]) h.pathname = t.pathname;else { | |
for (var m = (t.pathname || "").split("/"); m.length && !(t.host = m.shift());); | |
t.host || (t.host = ""), t.hostname || (t.hostname = ""), "" !== m[0] && m.unshift(""), m.length < 2 && m.unshift(""), h.pathname = m.join("/"); | |
} | |
if (h.search = t.search, h.query = t.query, h.host = t.host || "", h.auth = t.auth, h.hostname = t.hostname || t.host, h.port = t.port, h.pathname || h.search) { | |
var v = h.pathname || "", | |
b = h.search || ""; | |
h.path = v + b; | |
} | |
return h.slashes = h.slashes || t.slashes, h.href = h.format(), h; | |
} | |
var O = h.pathname && "/" === h.pathname.charAt(0), | |
d = t.host || t.pathname && "/" === t.pathname.charAt(0), | |
j = d || O || h.host && t.pathname, | |
q = j, | |
x = h.pathname && h.pathname.split("/") || [], | |
A = (m = t.pathname && t.pathname.split("/") || [], h.protocol && !y$9[h.protocol]); | |
if (A && (h.hostname = "", h.port = null, h.host && ("" === x[0] ? x[0] = h.host : x.unshift(h.host)), h.host = "", t.protocol && (t.hostname = null, t.port = null, t.host && ("" === m[0] ? m[0] = t.host : m.unshift(t.host)), t.host = null), j = j && ("" === m[0] || "" === x[0])), d) h.host = t.host || "" === t.host ? t.host : h.host, h.hostname = t.hostname || "" === t.hostname ? t.hostname : h.hostname, h.search = t.search, h.query = t.query, x = m;else if (m.length) x || (x = []), x.pop(), x = x.concat(m), h.search = t.search, h.query = t.query;else if (!a$d.isNullOrUndefined(t.search)) { | |
if (A) h.hostname = h.host = x.shift(), (U = !!(h.host && h.host.indexOf("@") > 0) && h.host.split("@")) && (h.auth = U.shift(), h.host = h.hostname = U.shift()); | |
return h.search = t.search, h.query = t.query, a$d.isNull(h.pathname) && a$d.isNull(h.search) || (h.path = (h.pathname ? h.pathname : "") + (h.search ? h.search : "")), h.href = h.format(), h; | |
} | |
if (!x.length) return h.pathname = null, h.search ? h.path = "/" + h.search : h.path = null, h.href = h.format(), h; | |
for (var C = x.slice(-1)[0], I = (h.host || t.host || x.length > 1) && ("." === C || ".." === C) || "" === C, w = 0, N = x.length; N >= 0; N--) "." === (C = x[N]) ? x.splice(N, 1) : ".." === C ? (x.splice(N, 1), w++) : w && (x.splice(N, 1), w--); | |
if (!j && !q) for (; w--; w) x.unshift(".."); | |
!j || "" === x[0] || x[0] && "/" === x[0].charAt(0) || x.unshift(""), I && "/" !== x.join("/").substr(-1) && x.push(""); | |
var U, | |
k = "" === x[0] || x[0] && "/" === x[0].charAt(0); | |
A && (h.hostname = h.host = k ? "" : x.length ? x.shift() : "", (U = !!(h.host && h.host.indexOf("@") > 0) && h.host.split("@")) && (h.auth = U.shift(), h.host = h.hostname = U.shift())); | |
return (j = j || h.host && x.length) && !k && x.unshift(""), x.length ? h.pathname = x.join("/") : (h.pathname = null, h.path = null), a$d.isNull(h.pathname) && a$d.isNull(h.search) || (h.path = (h.pathname ? h.pathname : "") + (h.search ? h.search : "")), h.auth = t.auth || h.auth, h.slashes = h.slashes || t.slashes, h.href = h.format(), h; | |
}, r$d.prototype.parseHost = function () { | |
var t = this.host, | |
s = n$e.exec(t); | |
s && (":" !== (s = s[0]) && (this.port = s.substr(1)), t = t.substr(0, t.length - s.length)), t && (this.hostname = t); | |
}; | |
h$9.Url; | |
h$9.format; | |
h$9.resolve; | |
h$9.resolveObject; | |
var t$b = "function" == typeof Symbol && "symbol" == typeof Symbol.toStringTag, | |
e$c = Object.prototype.toString, | |
o$b = function (o) { | |
return !(t$b && o && "object" == typeof o && Symbol.toStringTag in o) && "[object Arguments]" === e$c.call(o); | |
}, | |
n$d = function (t) { | |
return !!o$b(t) || null !== t && "object" == typeof t && "number" == typeof t.length && t.length >= 0 && "[object Array]" !== e$c.call(t) && "[object Function]" === e$c.call(t.callee); | |
}, | |
r$c = function () { | |
return o$b(arguments); | |
}(); | |
o$b.isLegacyArguments = n$d; | |
var l$e = r$c ? o$b : n$d; | |
var t$1$4 = Object.prototype.toString, | |
o$1$5 = Function.prototype.toString, | |
n$1$5 = /^\s*(?:function)?\*/, | |
e$1$6 = "function" == typeof Symbol && "symbol" == typeof Symbol.toStringTag, | |
r$1$4 = Object.getPrototypeOf, | |
c$a = function () { | |
if (!e$1$6) return !1; | |
try { | |
return Function("return function*() {}")(); | |
} catch (t) {} | |
}(), | |
u$b = c$a ? r$1$4(c$a) : {}, | |
i$a = function (c) { | |
return "function" == typeof c && (!!n$1$5.test(o$1$5.call(c)) || (e$1$6 ? r$1$4(c) === u$b : "[object GeneratorFunction]" === t$1$4.call(c))); | |
}; | |
var t$2$3 = "function" == typeof Object.create ? function (t, e) { | |
e && (t.super_ = e, t.prototype = Object.create(e.prototype, { | |
constructor: { | |
value: t, | |
enumerable: !1, | |
writable: !0, | |
configurable: !0 | |
} | |
})); | |
} : function (t, e) { | |
if (e) { | |
t.super_ = e; | |
var o = function () {}; | |
o.prototype = e.prototype, t.prototype = new o(), t.prototype.constructor = t; | |
} | |
}; | |
var i$1$3 = function (e) { | |
return e && "object" == typeof e && "function" == typeof e.copy && "function" == typeof e.fill && "function" == typeof e.readUInt8; | |
}, | |
o$2$3 = {}, | |
u$1$5 = i$1$3, | |
f$e = l$e, | |
a$c = i$a; | |
function c$1$4(e) { | |
return e.call.bind(e); | |
} | |
var s$9 = "undefined" != typeof BigInt, | |
p$a = "undefined" != typeof Symbol, | |
y$8 = p$a && void 0 !== Symbol.toStringTag, | |
l$1$2 = "undefined" != typeof Uint8Array, | |
d$7 = "undefined" != typeof ArrayBuffer; | |
if (l$1$2 && y$8) var g$7 = Object.getPrototypeOf(Uint8Array.prototype), | |
b$8 = c$1$4(Object.getOwnPropertyDescriptor(g$7, Symbol.toStringTag).get); | |
var m$7 = c$1$4(Object.prototype.toString), | |
h$8 = c$1$4(Number.prototype.valueOf), | |
j$4 = c$1$4(String.prototype.valueOf), | |
A$6 = c$1$4(Boolean.prototype.valueOf); | |
if (s$9) var w$7 = c$1$4(BigInt.prototype.valueOf); | |
if (p$a) var v$8 = c$1$4(Symbol.prototype.valueOf); | |
function O$6(e, t) { | |
if ("object" != typeof e) return !1; | |
try { | |
return t(e), !0; | |
} catch (e) { | |
return !1; | |
} | |
} | |
function S$6(e) { | |
return l$1$2 && y$8 ? void 0 !== b$8(e) : B$5(e) || k$7(e) || E$6(e) || D$6(e) || U$5(e) || P$6(e) || x$7(e) || I$5(e) || M$6(e) || z$6(e) || F$5(e); | |
} | |
function B$5(e) { | |
return l$1$2 && y$8 ? "Uint8Array" === b$8(e) : "[object Uint8Array]" === m$7(e) || u$1$5(e) && void 0 !== e.buffer; | |
} | |
function k$7(e) { | |
return l$1$2 && y$8 ? "Uint8ClampedArray" === b$8(e) : "[object Uint8ClampedArray]" === m$7(e); | |
} | |
function E$6(e) { | |
return l$1$2 && y$8 ? "Uint16Array" === b$8(e) : "[object Uint16Array]" === m$7(e); | |
} | |
function D$6(e) { | |
return l$1$2 && y$8 ? "Uint32Array" === b$8(e) : "[object Uint32Array]" === m$7(e); | |
} | |
function U$5(e) { | |
return l$1$2 && y$8 ? "Int8Array" === b$8(e) : "[object Int8Array]" === m$7(e); | |
} | |
function P$6(e) { | |
return l$1$2 && y$8 ? "Int16Array" === b$8(e) : "[object Int16Array]" === m$7(e); | |
} | |
function x$7(e) { | |
return l$1$2 && y$8 ? "Int32Array" === b$8(e) : "[object Int32Array]" === m$7(e); | |
} | |
function I$5(e) { | |
return l$1$2 && y$8 ? "Float32Array" === b$8(e) : "[object Float32Array]" === m$7(e); | |
} | |
function M$6(e) { | |
return l$1$2 && y$8 ? "Float64Array" === b$8(e) : "[object Float64Array]" === m$7(e); | |
} | |
function z$6(e) { | |
return l$1$2 && y$8 ? "BigInt64Array" === b$8(e) : "[object BigInt64Array]" === m$7(e); | |
} | |
function F$5(e) { | |
return l$1$2 && y$8 ? "BigUint64Array" === b$8(e) : "[object BigUint64Array]" === m$7(e); | |
} | |
function T$6(e) { | |
return "[object Map]" === m$7(e); | |
} | |
function N$6(e) { | |
return "[object Set]" === m$7(e); | |
} | |
function W$4(e) { | |
return "[object WeakMap]" === m$7(e); | |
} | |
function $$3(e) { | |
return "[object WeakSet]" === m$7(e); | |
} | |
function C$6(e) { | |
return "[object ArrayBuffer]" === m$7(e); | |
} | |
function V$4(e) { | |
return "undefined" != typeof ArrayBuffer && (C$6.working ? C$6(e) : e instanceof ArrayBuffer); | |
} | |
function G$4(e) { | |
return "[object DataView]" === m$7(e); | |
} | |
function R$6(e) { | |
return "undefined" != typeof DataView && (G$4.working ? G$4(e) : e instanceof DataView); | |
} | |
function J$3(e) { | |
return "[object SharedArrayBuffer]" === m$7(e); | |
} | |
function _$8(e) { | |
return "undefined" != typeof SharedArrayBuffer && (J$3.working ? J$3(e) : e instanceof SharedArrayBuffer); | |
} | |
function H$5(e) { | |
return O$6(e, h$8); | |
} | |
function Z$4(e) { | |
return O$6(e, j$4); | |
} | |
function q$3(e) { | |
return O$6(e, A$6); | |
} | |
function K$4(e) { | |
return s$9 && O$6(e, w$7); | |
} | |
function L$6(e) { | |
return p$a && O$6(e, v$8); | |
} | |
o$2$3.isArgumentsObject = f$e, o$2$3.isGeneratorFunction = a$c, o$2$3.isPromise = function (e) { | |
return "undefined" != typeof Promise && e instanceof Promise || null !== e && "object" == typeof e && "function" == typeof e.then && "function" == typeof e.catch; | |
}, o$2$3.isArrayBufferView = function (e) { | |
return d$7 && ArrayBuffer.isView ? ArrayBuffer.isView(e) : S$6(e) || R$6(e); | |
}, o$2$3.isTypedArray = S$6, o$2$3.isUint8Array = B$5, o$2$3.isUint8ClampedArray = k$7, o$2$3.isUint16Array = E$6, o$2$3.isUint32Array = D$6, o$2$3.isInt8Array = U$5, o$2$3.isInt16Array = P$6, o$2$3.isInt32Array = x$7, o$2$3.isFloat32Array = I$5, o$2$3.isFloat64Array = M$6, o$2$3.isBigInt64Array = z$6, o$2$3.isBigUint64Array = F$5, T$6.working = "undefined" != typeof Map && T$6(new Map()), o$2$3.isMap = function (e) { | |
return "undefined" != typeof Map && (T$6.working ? T$6(e) : e instanceof Map); | |
}, N$6.working = "undefined" != typeof Set && N$6(new Set()), o$2$3.isSet = function (e) { | |
return "undefined" != typeof Set && (N$6.working ? N$6(e) : e instanceof Set); | |
}, W$4.working = "undefined" != typeof WeakMap && W$4(new WeakMap()), o$2$3.isWeakMap = function (e) { | |
return "undefined" != typeof WeakMap && (W$4.working ? W$4(e) : e instanceof WeakMap); | |
}, $$3.working = "undefined" != typeof WeakSet && $$3(new WeakSet()), o$2$3.isWeakSet = function (e) { | |
return $$3(e); | |
}, C$6.working = "undefined" != typeof ArrayBuffer && C$6(new ArrayBuffer()), o$2$3.isArrayBuffer = V$4, G$4.working = "undefined" != typeof ArrayBuffer && "undefined" != typeof DataView && G$4(new DataView(new ArrayBuffer(1), 0, 1)), o$2$3.isDataView = R$6, J$3.working = "undefined" != typeof SharedArrayBuffer && J$3(new SharedArrayBuffer()), o$2$3.isSharedArrayBuffer = _$8, o$2$3.isAsyncFunction = function (e) { | |
return "[object AsyncFunction]" === m$7(e); | |
}, o$2$3.isMapIterator = function (e) { | |
return "[object Map Iterator]" === m$7(e); | |
}, o$2$3.isSetIterator = function (e) { | |
return "[object Set Iterator]" === m$7(e); | |
}, o$2$3.isGeneratorObject = function (e) { | |
return "[object Generator]" === m$7(e); | |
}, o$2$3.isWebAssemblyCompiledModule = function (e) { | |
return "[object WebAssembly.Module]" === m$7(e); | |
}, o$2$3.isNumberObject = H$5, o$2$3.isStringObject = Z$4, o$2$3.isBooleanObject = q$3, o$2$3.isBigIntObject = K$4, o$2$3.isSymbolObject = L$6, o$2$3.isBoxedPrimitive = function (e) { | |
return H$5(e) || Z$4(e) || q$3(e) || K$4(e) || L$6(e); | |
}, o$2$3.isAnyArrayBuffer = function (e) { | |
return l$1$2 && (V$4(e) || _$8(e)); | |
}, ["isProxy", "isExternal", "isModuleNamespaceObject"].forEach(function (e) { | |
Object.defineProperty(o$2$3, e, { | |
enumerable: !1, | |
value: function () { | |
throw new Error(e + " is not supported in userland"); | |
} | |
}); | |
}); | |
var Q$3 = "undefined" != typeof globalThis ? globalThis : "undefined" != typeof self ? self : global, | |
X$4 = {}, | |
Y$4 = T$7, | |
ee$1 = Object.getOwnPropertyDescriptors || function (e) { | |
for (var t = Object.keys(e), r = {}, n = 0; n < t.length; n++) r[t[n]] = Object.getOwnPropertyDescriptor(e, t[n]); | |
return r; | |
}, | |
te = /%[sdj%]/g; | |
X$4.format = function (e) { | |
if (!ge(e)) { | |
for (var t = [], r = 0; r < arguments.length; r++) t.push(oe(arguments[r])); | |
return t.join(" "); | |
} | |
r = 1; | |
for (var n = arguments, i = n.length, o = String(e).replace(te, function (e) { | |
if ("%%" === e) return "%"; | |
if (r >= i) return e; | |
switch (e) { | |
case "%s": | |
return String(n[r++]); | |
case "%d": | |
return Number(n[r++]); | |
case "%j": | |
try { | |
return JSON.stringify(n[r++]); | |
} catch (e) { | |
return "[Circular]"; | |
} | |
default: | |
return e; | |
} | |
}), u = n[r]; r < i; u = n[++r]) le(u) || !he(u) ? o += " " + u : o += " " + oe(u); | |
return o; | |
}, X$4.deprecate = function (e, t) { | |
if (void 0 !== Y$4 && !0 === Y$4.noDeprecation) return e; | |
if (void 0 === Y$4) return function () { | |
return X$4.deprecate(e, t).apply(this || Q$3, arguments); | |
}; | |
var r = !1; | |
return function () { | |
if (!r) { | |
if (Y$4.throwDeprecation) throw new Error(t); | |
Y$4.traceDeprecation ? console.trace(t) : console.error(t), r = !0; | |
} | |
return e.apply(this || Q$3, arguments); | |
}; | |
}; | |
var re = {}, | |
ne = /^$/; | |
if (Y$4.env.NODE_DEBUG) { | |
var ie = Y$4.env.NODE_DEBUG; | |
ie = ie.replace(/[|\\{}()[\]^$+?.]/g, "\\$&").replace(/\*/g, ".*").replace(/,/g, "$|^").toUpperCase(), ne = new RegExp("^" + ie + "$", "i"); | |
} | |
function oe(e, t) { | |
var r = { | |
seen: [], | |
stylize: fe | |
}; | |
return arguments.length >= 3 && (r.depth = arguments[2]), arguments.length >= 4 && (r.colors = arguments[3]), ye(t) ? r.showHidden = t : t && X$4._extend(r, t), be(r.showHidden) && (r.showHidden = !1), be(r.depth) && (r.depth = 2), be(r.colors) && (r.colors = !1), be(r.customInspect) && (r.customInspect = !0), r.colors && (r.stylize = ue), ae(r, e, r.depth); | |
} | |
function ue(e, t) { | |
var r = oe.styles[t]; | |
return r ? "[" + oe.colors[r][0] + "m" + e + "[" + oe.colors[r][1] + "m" : e; | |
} | |
function fe(e, t) { | |
return e; | |
} | |
function ae(e, t, r) { | |
if (e.customInspect && t && we(t.inspect) && t.inspect !== X$4.inspect && (!t.constructor || t.constructor.prototype !== t)) { | |
var n = t.inspect(r, e); | |
return ge(n) || (n = ae(e, n, r)), n; | |
} | |
var i = function (e, t) { | |
if (be(t)) return e.stylize("undefined", "undefined"); | |
if (ge(t)) { | |
var r = "'" + JSON.stringify(t).replace(/^"|"$/g, "").replace(/'/g, "\\'").replace(/\\"/g, '"') + "'"; | |
return e.stylize(r, "string"); | |
} | |
if (de(t)) return e.stylize("" + t, "number"); | |
if (ye(t)) return e.stylize("" + t, "boolean"); | |
if (le(t)) return e.stylize("null", "null"); | |
}(e, t); | |
if (i) return i; | |
var o = Object.keys(t), | |
u = function (e) { | |
var t = {}; | |
return e.forEach(function (e, r) { | |
t[e] = !0; | |
}), t; | |
}(o); | |
if (e.showHidden && (o = Object.getOwnPropertyNames(t)), Ae(t) && (o.indexOf("message") >= 0 || o.indexOf("description") >= 0)) return ce(t); | |
if (0 === o.length) { | |
if (we(t)) { | |
var f = t.name ? ": " + t.name : ""; | |
return e.stylize("[Function" + f + "]", "special"); | |
} | |
if (me(t)) return e.stylize(RegExp.prototype.toString.call(t), "regexp"); | |
if (je(t)) return e.stylize(Date.prototype.toString.call(t), "date"); | |
if (Ae(t)) return ce(t); | |
} | |
var a, | |
c = "", | |
s = !1, | |
p = ["{", "}"]; | |
(pe(t) && (s = !0, p = ["[", "]"]), we(t)) && (c = " [Function" + (t.name ? ": " + t.name : "") + "]"); | |
return me(t) && (c = " " + RegExp.prototype.toString.call(t)), je(t) && (c = " " + Date.prototype.toUTCString.call(t)), Ae(t) && (c = " " + ce(t)), 0 !== o.length || s && 0 != t.length ? r < 0 ? me(t) ? e.stylize(RegExp.prototype.toString.call(t), "regexp") : e.stylize("[Object]", "special") : (e.seen.push(t), a = s ? function (e, t, r, n, i) { | |
for (var o = [], u = 0, f = t.length; u < f; ++u) ke(t, String(u)) ? o.push(se(e, t, r, n, String(u), !0)) : o.push(""); | |
return i.forEach(function (i) { | |
i.match(/^\d+$/) || o.push(se(e, t, r, n, i, !0)); | |
}), o; | |
}(e, t, r, u, o) : o.map(function (n) { | |
return se(e, t, r, u, n, s); | |
}), e.seen.pop(), function (e, t, r) { | |
var n = 0; | |
if (e.reduce(function (e, t) { | |
return n++, t.indexOf("\n") >= 0 && n++, e + t.replace(/\u001b\[\d\d?m/g, "").length + 1; | |
}, 0) > 60) return r[0] + ("" === t ? "" : t + "\n ") + " " + e.join(",\n ") + " " + r[1]; | |
return r[0] + t + " " + e.join(", ") + " " + r[1]; | |
}(a, c, p)) : p[0] + c + p[1]; | |
} | |
function ce(e) { | |
return "[" + Error.prototype.toString.call(e) + "]"; | |
} | |
function se(e, t, r, n, i, o) { | |
var u, f, a; | |
if ((a = Object.getOwnPropertyDescriptor(t, i) || { | |
value: t[i] | |
}).get ? f = a.set ? e.stylize("[Getter/Setter]", "special") : e.stylize("[Getter]", "special") : a.set && (f = e.stylize("[Setter]", "special")), ke(n, i) || (u = "[" + i + "]"), f || (e.seen.indexOf(a.value) < 0 ? (f = le(r) ? ae(e, a.value, null) : ae(e, a.value, r - 1)).indexOf("\n") > -1 && (f = o ? f.split("\n").map(function (e) { | |
return " " + e; | |
}).join("\n").substr(2) : "\n" + f.split("\n").map(function (e) { | |
return " " + e; | |
}).join("\n")) : f = e.stylize("[Circular]", "special")), be(u)) { | |
if (o && i.match(/^\d+$/)) return f; | |
(u = JSON.stringify("" + i)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/) ? (u = u.substr(1, u.length - 2), u = e.stylize(u, "name")) : (u = u.replace(/'/g, "\\'").replace(/\\"/g, '"').replace(/(^"|"$)/g, "'"), u = e.stylize(u, "string")); | |
} | |
return u + ": " + f; | |
} | |
function pe(e) { | |
return Array.isArray(e); | |
} | |
function ye(e) { | |
return "boolean" == typeof e; | |
} | |
function le(e) { | |
return null === e; | |
} | |
function de(e) { | |
return "number" == typeof e; | |
} | |
function ge(e) { | |
return "string" == typeof e; | |
} | |
function be(e) { | |
return void 0 === e; | |
} | |
function me(e) { | |
return he(e) && "[object RegExp]" === ve(e); | |
} | |
function he(e) { | |
return "object" == typeof e && null !== e; | |
} | |
function je(e) { | |
return he(e) && "[object Date]" === ve(e); | |
} | |
function Ae(e) { | |
return he(e) && ("[object Error]" === ve(e) || e instanceof Error); | |
} | |
function we(e) { | |
return "function" == typeof e; | |
} | |
function ve(e) { | |
return Object.prototype.toString.call(e); | |
} | |
function Oe(e) { | |
return e < 10 ? "0" + e.toString(10) : e.toString(10); | |
} | |
X$4.debuglog = function (e) { | |
if (e = e.toUpperCase(), !re[e]) if (ne.test(e)) { | |
var t = Y$4.pid; | |
re[e] = function () { | |
var r = X$4.format.apply(X$4, arguments); | |
console.error("%s %d: %s", e, t, r); | |
}; | |
} else re[e] = function () {}; | |
return re[e]; | |
}, X$4.inspect = oe, oe.colors = { | |
bold: [1, 22], | |
italic: [3, 23], | |
underline: [4, 24], | |
inverse: [7, 27], | |
white: [37, 39], | |
grey: [90, 39], | |
black: [30, 39], | |
blue: [34, 39], | |
cyan: [36, 39], | |
green: [32, 39], | |
magenta: [35, 39], | |
red: [31, 39], | |
yellow: [33, 39] | |
}, oe.styles = { | |
special: "cyan", | |
number: "yellow", | |
boolean: "yellow", | |
undefined: "grey", | |
null: "bold", | |
string: "green", | |
date: "magenta", | |
regexp: "red" | |
}, X$4.types = o$2$3, X$4.isArray = pe, X$4.isBoolean = ye, X$4.isNull = le, X$4.isNullOrUndefined = function (e) { | |
return null == e; | |
}, X$4.isNumber = de, X$4.isString = ge, X$4.isSymbol = function (e) { | |
return "symbol" == typeof e; | |
}, X$4.isUndefined = be, X$4.isRegExp = me, X$4.types.isRegExp = me, X$4.isObject = he, X$4.isDate = je, X$4.types.isDate = je, X$4.isError = Ae, X$4.types.isNativeError = Ae, X$4.isFunction = we, X$4.isPrimitive = function (e) { | |
return null === e || "boolean" == typeof e || "number" == typeof e || "string" == typeof e || "symbol" == typeof e || void 0 === e; | |
}, X$4.isBuffer = i$1$3; | |
var Se = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]; | |
function Be() { | |
var e = new Date(), | |
t = [Oe(e.getHours()), Oe(e.getMinutes()), Oe(e.getSeconds())].join(":"); | |
return [e.getDate(), Se[e.getMonth()], t].join(" "); | |
} | |
function ke(e, t) { | |
return Object.prototype.hasOwnProperty.call(e, t); | |
} | |
X$4.log = function () { | |
console.log("%s - %s", Be(), X$4.format.apply(X$4, arguments)); | |
}, X$4.inherits = t$2$3, X$4._extend = function (e, t) { | |
if (!t || !he(t)) return e; | |
for (var r = Object.keys(t), n = r.length; n--;) e[r[n]] = t[r[n]]; | |
return e; | |
}; | |
var Ee = "undefined" != typeof Symbol ? Symbol("util.promisify.custom") : void 0; | |
function De(e, t) { | |
if (!e) { | |
var r = new Error("Promise was rejected with a falsy value"); | |
r.reason = e, e = r; | |
} | |
return t(e); | |
} | |
X$4.promisify = function (e) { | |
if ("function" != typeof e) throw new TypeError('The "original" argument must be of type Function'); | |
if (Ee && e[Ee]) { | |
var t; | |
if ("function" != typeof (t = e[Ee])) throw new TypeError('The "util.promisify.custom" argument must be of type Function'); | |
return Object.defineProperty(t, Ee, { | |
value: t, | |
enumerable: !1, | |
writable: !1, | |
configurable: !0 | |
}), t; | |
} | |
function t() { | |
for (var t, r, n = new Promise(function (e, n) { | |
t = e, r = n; | |
}), i = [], o = 0; o < arguments.length; o++) i.push(arguments[o]); | |
i.push(function (e, n) { | |
e ? r(e) : t(n); | |
}); | |
try { | |
e.apply(this || Q$3, i); | |
} catch (e) { | |
r(e); | |
} | |
return n; | |
} | |
return Object.setPrototypeOf(t, Object.getPrototypeOf(e)), Ee && Object.defineProperty(t, Ee, { | |
value: t, | |
enumerable: !1, | |
writable: !1, | |
configurable: !0 | |
}), Object.defineProperties(t, ee$1(e)); | |
}, X$4.promisify.custom = Ee, X$4.callbackify = function (e) { | |
if ("function" != typeof e) throw new TypeError('The "original" argument must be of type Function'); | |
function t() { | |
for (var t = [], r = 0; r < arguments.length; r++) t.push(arguments[r]); | |
var n = t.pop(); | |
if ("function" != typeof n) throw new TypeError("The last argument must be of type Function"); | |
var i = this || Q$3, | |
o = function () { | |
return n.apply(i, arguments); | |
}; | |
e.apply(this || Q$3, t).then(function (e) { | |
Y$4.nextTick(o.bind(null, null, e)); | |
}, function (e) { | |
Y$4.nextTick(De.bind(null, e, o)); | |
}); | |
} | |
return Object.setPrototypeOf(t, Object.getPrototypeOf(e)), Object.defineProperties(t, ee$1(e)), t; | |
}; | |
X$4._extend; | |
X$4.callbackify; | |
X$4.debuglog; | |
X$4.deprecate; | |
X$4.format; | |
X$4.inherits; | |
X$4.inspect; | |
X$4.isArray; | |
X$4.isBoolean; | |
X$4.isBuffer; | |
X$4.isDate; | |
X$4.isError; | |
X$4.isFunction; | |
X$4.isNull; | |
X$4.isNullOrUndefined; | |
X$4.isNumber; | |
X$4.isObject; | |
X$4.isPrimitive; | |
X$4.isRegExp; | |
X$4.isString; | |
X$4.isSymbol; | |
X$4.isUndefined; | |
X$4.log; | |
X$4.promisify; | |
function dew$9P () { return exports$9P } | |
var exports$9P = [ | |
"ac", | |
"com.ac", | |
"edu.ac", | |
"gov.ac", | |
"net.ac", | |
"mil.ac", | |
"org.ac", | |
"ad", | |
"nom.ad", | |
"ae", | |
"co.ae", | |
"net.ae", | |
"org.ae", | |
"sch.ae", | |
"ac.ae", | |
"gov.ae", | |
"mil.ae", | |
"aero", | |
"accident-investigation.aero", | |
"accident-prevention.aero", | |
"aerobatic.aero", | |
"aeroclub.aero", | |
"aerodrome.aero", | |
"agents.aero", | |
"aircraft.aero", | |
"airline.aero", | |
"airport.aero", | |
"air-surveillance.aero", | |
"airtraffic.aero", | |
"air-traffic-control.aero", | |
"ambulance.aero", | |
"amusement.aero", | |
"association.aero", | |
"author.aero", | |
"ballooning.aero", | |
"broker.aero", | |
"caa.aero", | |
"cargo.aero", | |
"catering.aero", | |
"certification.aero", | |
"championship.aero", | |
"charter.aero", | |
"civilaviation.aero", | |
"club.aero", | |
"conference.aero", | |
"consultant.aero", | |
"consulting.aero", | |
"control.aero", | |
"council.aero", | |
"crew.aero", | |
"design.aero", | |
"dgca.aero", | |
"educator.aero", | |
"emergency.aero", | |
"engine.aero", | |
"engineer.aero", | |
"entertainment.aero", | |
"equipment.aero", | |
"exchange.aero", | |
"express.aero", | |
"federation.aero", | |
"flight.aero", | |
"freight.aero", | |
"fuel.aero", | |
"gliding.aero", | |
"government.aero", | |
"groundhandling.aero", | |
"group.aero", | |
"hanggliding.aero", | |
"homebuilt.aero", | |
"insurance.aero", | |
"journal.aero", | |
"journalist.aero", | |
"leasing.aero", | |
"logistics.aero", | |
"magazine.aero", | |
"maintenance.aero", | |
"media.aero", | |
"microlight.aero", | |
"modelling.aero", | |
"navigation.aero", | |
"parachuting.aero", | |
"paragliding.aero", | |
"passenger-association.aero", | |
"pilot.aero", | |
"press.aero", | |
"production.aero", | |
"recreation.aero", | |
"repbody.aero", | |
"res.aero", | |
"research.aero", | |
"rotorcraft.aero", | |
"safety.aero", | |
"scientist.aero", | |
"services.aero", | |
"show.aero", | |
"skydiving.aero", | |
"software.aero", | |
"student.aero", | |
"trader.aero", | |
"trading.aero", | |
"trainer.aero", | |
"union.aero", | |
"workinggroup.aero", | |
"works.aero", | |
"af", | |
"gov.af", | |
"com.af", | |
"org.af", | |
"net.af", | |
"edu.af", | |
"ag", | |
"com.ag", | |
"org.ag", | |
"net.ag", | |
"co.ag", | |
"nom.ag", | |
"ai", | |
"off.ai", | |
"com.ai", | |
"net.ai", | |
"org.ai", | |
"al", | |
"com.al", | |
"edu.al", | |
"gov.al", | |
"mil.al", | |
"net.al", | |
"org.al", | |
"am", | |
"co.am", | |
"com.am", | |
"commune.am", | |
"net.am", | |
"org.am", | |
"ao", | |
"ed.ao", | |
"gv.ao", | |
"og.ao", | |
"co.ao", | |
"pb.ao", | |
"it.ao", | |
"aq", | |
"ar", | |
"com.ar", | |
"edu.ar", | |
"gob.ar", | |
"gov.ar", | |
"int.ar", | |
"mil.ar", | |
"musica.ar", | |
"net.ar", | |
"org.ar", | |
"tur.ar", | |
"arpa", | |
"e164.arpa", | |
"in-addr.arpa", | |
"ip6.arpa", | |
"iris.arpa", | |
"uri.arpa", | |
"urn.arpa", | |
"as", | |
"gov.as", | |
"asia", | |
"at", | |
"ac.at", | |
"co.at", | |
"gv.at", | |
"or.at", | |
"au", | |
"com.au", | |
"net.au", | |
"org.au", | |
"edu.au", | |
"gov.au", | |
"asn.au", | |
"id.au", | |
"info.au", | |
"conf.au", | |
"oz.au", | |
"act.au", | |
"nsw.au", | |
"nt.au", | |
"qld.au", | |
"sa.au", | |
"tas.au", | |
"vic.au", | |
"wa.au", | |
"act.edu.au", | |
"catholic.edu.au", | |
"nsw.edu.au", | |
"nt.edu.au", | |
"qld.edu.au", | |
"sa.edu.au", | |
"tas.edu.au", | |
"vic.edu.au", | |
"wa.edu.au", | |
"qld.gov.au", | |
"sa.gov.au", | |
"tas.gov.au", | |
"vic.gov.au", | |
"wa.gov.au", | |
"education.tas.edu.au", | |
"schools.nsw.edu.au", | |
"aw", | |
"com.aw", | |
"ax", | |
"az", | |
"com.az", | |
"net.az", | |
"int.az", | |
"gov.az", | |
"org.az", | |
"edu.az", | |
"info.az", | |
"pp.az", | |
"mil.az", | |
"name.az", | |
"pro.az", | |
"biz.az", | |
"ba", | |
"com.ba", | |
"edu.ba", | |
"gov.ba", | |
"mil.ba", | |
"net.ba", | |
"org.ba", | |
"bb", | |
"biz.bb", | |
"co.bb", | |
"com.bb", | |
"edu.bb", | |
"gov.bb", | |
"info.bb", | |
"net.bb", | |
"org.bb", | |
"store.bb", | |
"tv.bb", | |
"*.bd", | |
"be", | |
"ac.be", | |
"bf", | |
"gov.bf", | |
"bg", | |
"a.bg", | |
"b.bg", | |
"c.bg", | |
"d.bg", | |
"e.bg", | |
"f.bg", | |
"g.bg", | |
"h.bg", | |
"i.bg", | |
"j.bg", | |
"k.bg", | |
"l.bg", | |
"m.bg", | |
"n.bg", | |
"o.bg", | |
"p.bg", | |
"q.bg", | |
"r.bg", | |
"s.bg", | |
"t.bg", | |
"u.bg", | |
"v.bg", | |
"w.bg", | |
"x.bg", | |
"y.bg", | |
"z.bg", | |
"0.bg", | |
"1.bg", | |
"2.bg", | |
"3.bg", | |
"4.bg", | |
"5.bg", | |
"6.bg", | |
"7.bg", | |
"8.bg", | |
"9.bg", | |
"bh", | |
"com.bh", | |
"edu.bh", | |
"net.bh", | |
"org.bh", | |
"gov.bh", | |
"bi", | |
"co.bi", | |
"com.bi", | |
"edu.bi", | |
"or.bi", | |
"org.bi", | |
"biz", | |
"bj", | |
"asso.bj", | |
"barreau.bj", | |
"gouv.bj", | |
"bm", | |
"com.bm", | |
"edu.bm", | |
"gov.bm", | |
"net.bm", | |
"org.bm", | |
"bn", | |
"com.bn", | |
"edu.bn", | |
"gov.bn", | |
"net.bn", | |
"org.bn", | |
"bo", | |
"com.bo", | |
"edu.bo", | |
"gob.bo", | |
"int.bo", | |
"org.bo", | |
"net.bo", | |
"mil.bo", | |
"tv.bo", | |
"web.bo", | |
"academia.bo", | |
"agro.bo", | |
"arte.bo", | |
"blog.bo", | |
"bolivia.bo", | |
"ciencia.bo", | |
"cooperativa.bo", | |
"democracia.bo", | |
"deporte.bo", | |
"ecologia.bo", | |
"economia.bo", | |
"empresa.bo", | |
"indigena.bo", | |
"industria.bo", | |
"info.bo", | |
"medicina.bo", | |
"movimiento.bo", | |
"musica.bo", | |
"natural.bo", | |
"nombre.bo", | |
"noticias.bo", | |
"patria.bo", | |
"politica.bo", | |
"profesional.bo", | |
"plurinacional.bo", | |
"pueblo.bo", | |
"revista.bo", | |
"salud.bo", | |
"tecnologia.bo", | |
"tksat.bo", | |
"transporte.bo", | |
"wiki.bo", | |
"br", | |
"9guacu.br", | |
"abc.br", | |
"adm.br", | |
"adv.br", | |
"agr.br", | |
"aju.br", | |
"am.br", | |
"anani.br", | |
"aparecida.br", | |
"arq.br", | |
"art.br", | |
"ato.br", | |
"b.br", | |
"barueri.br", | |
"belem.br", | |
"bhz.br", | |
"bio.br", | |
"blog.br", | |
"bmd.br", | |
"boavista.br", | |
"bsb.br", | |
"campinagrande.br", | |
"campinas.br", | |
"caxias.br", | |
"cim.br", | |
"cng.br", | |
"cnt.br", | |
"com.br", | |
"contagem.br", | |
"coop.br", | |
"cri.br", | |
"cuiaba.br", | |
"curitiba.br", | |
"def.br", | |
"ecn.br", | |
"eco.br", | |
"edu.br", | |
"emp.br", | |
"eng.br", | |
"esp.br", | |
"etc.br", | |
"eti.br", | |
"far.br", | |
"feira.br", | |
"flog.br", | |
"floripa.br", | |
"fm.br", | |
"fnd.br", | |
"fortal.br", | |
"fot.br", | |
"foz.br", | |
"fst.br", | |
"g12.br", | |
"ggf.br", | |
"goiania.br", | |
"gov.br", | |
"ac.gov.br", | |
"al.gov.br", | |
"am.gov.br", | |
"ap.gov.br", | |
"ba.gov.br", | |
"ce.gov.br", | |
"df.gov.br", | |
"es.gov.br", | |
"go.gov.br", | |
"ma.gov.br", | |
"mg.gov.br", | |
"ms.gov.br", | |
"mt.gov.br", | |
"pa.gov.br", | |
"pb.gov.br", | |
"pe.gov.br", | |
"pi.gov.br", | |
"pr.gov.br", | |
"rj.gov.br", | |
"rn.gov.br", | |
"ro.gov.br", | |
"rr.gov.br", | |
"rs.gov.br", | |
"sc.gov.br", | |
"se.gov.br", | |
"sp.gov.br", | |
"to.gov.br", | |
"gru.br", | |
"imb.br", | |
"ind.br", | |
"inf.br", | |
"jab.br", | |
"jampa.br", | |
"jdf.br", | |
"joinville.br", | |
"jor.br", | |
"jus.br", | |
"leg.br", | |
"lel.br", | |
"londrina.br", | |
"macapa.br", | |
"maceio.br", | |
"manaus.br", | |
"maringa.br", | |
"mat.br", | |
"med.br", | |
"mil.br", | |
"morena.br", | |
"mp.br", | |
"mus.br", | |
"natal.br", | |
"net.br", | |
"niteroi.br", | |
"*.nom.br", | |
"not.br", | |
"ntr.br", | |
"odo.br", | |
"ong.br", | |
"org.br", | |
"osasco.br", | |
"palmas.br", | |
"poa.br", | |
"ppg.br", | |
"pro.br", | |
"psc.br", | |
"psi.br", | |
"pvh.br", | |
"qsl.br", | |
"radio.br", | |
"rec.br", | |
"recife.br", | |
"ribeirao.br", | |
"rio.br", | |
"riobranco.br", | |
"riopreto.br", | |
"salvador.br", | |
"sampa.br", | |
"santamaria.br", | |
"santoandre.br", | |
"saobernardo.br", | |
"saogonca.br", | |
"sjc.br", | |
"slg.br", | |
"slz.br", | |
"sorocaba.br", | |
"srv.br", | |
"taxi.br", | |
"tc.br", | |
"teo.br", | |
"the.br", | |
"tmp.br", | |
"trd.br", | |
"tur.br", | |
"tv.br", | |
"udi.br", | |
"vet.br", | |
"vix.br", | |
"vlog.br", | |
"wiki.br", | |
"zlg.br", | |
"bs", | |
"com.bs", | |
"net.bs", | |
"org.bs", | |
"edu.bs", | |
"gov.bs", | |
"bt", | |
"com.bt", | |
"edu.bt", | |
"gov.bt", | |
"net.bt", | |
"org.bt", | |
"bv", | |
"bw", | |
"co.bw", | |
"org.bw", | |
"by", | |
"gov.by", | |
"mil.by", | |
"com.by", | |
"of.by", | |
"bz", | |
"com.bz", | |
"net.bz", | |
"org.bz", | |
"edu.bz", | |
"gov.bz", | |
"ca", | |
"ab.ca", | |
"bc.ca", | |
"mb.ca", | |
"nb.ca", | |
"nf.ca", | |
"nl.ca", | |
"ns.ca", | |
"nt.ca", | |
"nu.ca", | |
"on.ca", | |
"pe.ca", | |
"qc.ca", | |
"sk.ca", | |
"yk.ca", | |
"gc.ca", | |
"cat", | |
"cc", | |
"cd", | |
"gov.cd", | |
"cf", | |
"cg", | |
"ch", | |
"ci", | |
"org.ci", | |
"or.ci", | |
"com.ci", | |
"co.ci", | |
"edu.ci", | |
"ed.ci", | |
"ac.ci", | |
"net.ci", | |
"go.ci", | |
"asso.ci", | |
"aéroport.ci", | |
"int.ci", | |
"presse.ci", | |
"md.ci", | |
"gouv.ci", | |
"*.ck", | |
"!www.ck", | |
"cl", | |
"aprendemas.cl", | |
"co.cl", | |
"gob.cl", | |
"gov.cl", | |
"mil.cl", | |
"cm", | |
"co.cm", | |
"com.cm", | |
"gov.cm", | |
"net.cm", | |
"cn", | |
"ac.cn", | |
"com.cn", | |
"edu.cn", | |
"gov.cn", | |
"net.cn", | |
"org.cn", | |
"mil.cn", | |
"公司.cn", | |
"网络.cn", | |
"網絡.cn", | |
"ah.cn", | |
"bj.cn", | |
"cq.cn", | |
"fj.cn", | |
"gd.cn", | |
"gs.cn", | |
"gz.cn", | |
"gx.cn", | |
"ha.cn", | |
"hb.cn", | |
"he.cn", | |
"hi.cn", | |
"hl.cn", | |
"hn.cn", | |
"jl.cn", | |
"js.cn", | |
"jx.cn", | |
"ln.cn", | |
"nm.cn", | |
"nx.cn", | |
"qh.cn", | |
"sc.cn", | |
"sd.cn", | |
"sh.cn", | |
"sn.cn", | |
"sx.cn", | |
"tj.cn", | |
"xj.cn", | |
"xz.cn", | |
"yn.cn", | |
"zj.cn", | |
"hk.cn", | |
"mo.cn", | |
"tw.cn", | |
"co", | |
"arts.co", | |
"com.co", | |
"edu.co", | |
"firm.co", | |
"gov.co", | |
"info.co", | |
"int.co", | |
"mil.co", | |
"net.co", | |
"nom.co", | |
"org.co", | |
"rec.co", | |
"web.co", | |
"com", | |
"coop", | |
"cr", | |
"ac.cr", | |
"co.cr", | |
"ed.cr", | |
"fi.cr", | |
"go.cr", | |
"or.cr", | |
"sa.cr", | |
"cu", | |
"com.cu", | |
"edu.cu", | |
"org.cu", | |
"net.cu", | |
"gov.cu", | |
"inf.cu", | |
"cv", | |
"cw", | |
"com.cw", | |
"edu.cw", | |
"net.cw", | |
"org.cw", | |
"cx", | |
"gov.cx", | |
"cy", | |
"ac.cy", | |
"biz.cy", | |
"com.cy", | |
"ekloges.cy", | |
"gov.cy", | |
"ltd.cy", | |
"name.cy", | |
"net.cy", | |
"org.cy", | |
"parliament.cy", | |
"press.cy", | |
"pro.cy", | |
"tm.cy", | |
"cz", | |
"de", | |
"dj", | |
"dk", | |
"dm", | |
"com.dm", | |
"net.dm", | |
"org.dm", | |
"edu.dm", | |
"gov.dm", | |
"do", | |
"art.do", | |
"com.do", | |
"edu.do", | |
"gob.do", | |
"gov.do", | |
"mil.do", | |
"net.do", | |
"org.do", | |
"sld.do", | |
"web.do", | |
"dz", | |
"com.dz", | |
"org.dz", | |
"net.dz", | |
"gov.dz", | |
"edu.dz", | |
"asso.dz", | |
"pol.dz", | |
"art.dz", | |
"ec", | |
"com.ec", | |
"info.ec", | |
"net.ec", | |
"fin.ec", | |
"k12.ec", | |
"med.ec", | |
"pro.ec", | |
"org.ec", | |
"edu.ec", | |
"gov.ec", | |
"gob.ec", | |
"mil.ec", | |
"edu", | |
"ee", | |
"edu.ee", | |
"gov.ee", | |
"riik.ee", | |
"lib.ee", | |
"med.ee", | |
"com.ee", | |
"pri.ee", | |
"aip.ee", | |
"org.ee", | |
"fie.ee", | |
"eg", | |
"com.eg", | |
"edu.eg", | |
"eun.eg", | |
"gov.eg", | |
"mil.eg", | |
"name.eg", | |
"net.eg", | |
"org.eg", | |
"sci.eg", | |
"*.er", | |
"es", | |
"com.es", | |
"nom.es", | |
"org.es", | |
"gob.es", | |
"edu.es", | |
"et", | |
"com.et", | |
"gov.et", | |
"org.et", | |
"edu.et", | |
"biz.et", | |
"name.et", | |
"info.et", | |
"net.et", | |
"eu", | |
"fi", | |
"aland.fi", | |
"fj", | |
"ac.fj", | |
"biz.fj", | |
"com.fj", | |
"gov.fj", | |
"info.fj", | |
"mil.fj", | |
"name.fj", | |
"net.fj", | |
"org.fj", | |
"pro.fj", | |
"*.fk", | |
"fm", | |
"fo", | |
"fr", | |
"asso.fr", | |
"com.fr", | |
"gouv.fr", | |
"nom.fr", | |
"prd.fr", | |
"tm.fr", | |
"aeroport.fr", | |
"avocat.fr", | |
"avoues.fr", | |
"cci.fr", | |
"chambagri.fr", | |
"chirurgiens-dentistes.fr", | |
"experts-comptables.fr", | |
"geometre-expert.fr", | |
"greta.fr", | |
"huissier-justice.fr", | |
"medecin.fr", | |
"notaires.fr", | |
"pharmacien.fr", | |
"port.fr", | |
"veterinaire.fr", | |
"ga", | |
"gb", | |
"gd", | |
"ge", | |
"com.ge", | |
"edu.ge", | |
"gov.ge", | |
"org.ge", | |
"mil.ge", | |
"net.ge", | |
"pvt.ge", | |
"gf", | |
"gg", | |
"co.gg", | |
"net.gg", | |
"org.gg", | |
"gh", | |
"com.gh", | |
"edu.gh", | |
"gov.gh", | |
"org.gh", | |
"mil.gh", | |
"gi", | |
"com.gi", | |
"ltd.gi", | |
"gov.gi", | |
"mod.gi", | |
"edu.gi", | |
"org.gi", | |
"gl", | |
"co.gl", | |
"com.gl", | |
"edu.gl", | |
"net.gl", | |
"org.gl", | |
"gm", | |
"gn", | |
"ac.gn", | |
"com.gn", | |
"edu.gn", | |
"gov.gn", | |
"org.gn", | |
"net.gn", | |
"gov", | |
"gp", | |
"com.gp", | |
"net.gp", | |
"mobi.gp", | |
"edu.gp", | |
"org.gp", | |
"asso.gp", | |
"gq", | |
"gr", | |
"com.gr", | |
"edu.gr", | |
"net.gr", | |
"org.gr", | |
"gov.gr", | |
"gs", | |
"gt", | |
"com.gt", | |
"edu.gt", | |
"gob.gt", | |
"ind.gt", | |
"mil.gt", | |
"net.gt", | |
"org.gt", | |
"gu", | |
"com.gu", | |
"edu.gu", | |
"gov.gu", | |
"guam.gu", | |
"info.gu", | |
"net.gu", | |
"org.gu", | |
"web.gu", | |
"gw", | |
"gy", | |
"co.gy", | |
"com.gy", | |
"edu.gy", | |
"gov.gy", | |
"net.gy", | |
"org.gy", | |
"hk", | |
"com.hk", | |
"edu.hk", | |
"gov.hk", | |
"idv.hk", | |
"net.hk", | |
"org.hk", | |
"公司.hk", | |
"教育.hk", | |
"敎育.hk", | |
"政府.hk", | |
"個人.hk", | |
"个人.hk", | |
"箇人.hk", | |
"網络.hk", | |
"网络.hk", | |
"组織.hk", | |
"網絡.hk", | |
"网絡.hk", | |
"组织.hk", | |
"組織.hk", | |
"組织.hk", | |
"hm", | |
"hn", | |
"com.hn", | |
"edu.hn", | |
"org.hn", | |
"net.hn", | |
"mil.hn", | |
"gob.hn", | |
"hr", | |
"iz.hr", | |
"from.hr", | |
"name.hr", | |
"com.hr", | |
"ht", | |
"com.ht", | |
"shop.ht", | |
"firm.ht", | |
"info.ht", | |
"adult.ht", | |
"net.ht", | |
"pro.ht", | |
"org.ht", | |
"med.ht", | |
"art.ht", | |
"coop.ht", | |
"pol.ht", | |
"asso.ht", | |
"edu.ht", | |
"rel.ht", | |
"gouv.ht", | |
"perso.ht", | |
"hu", | |
"co.hu", | |
"info.hu", | |
"org.hu", | |
"priv.hu", | |
"sport.hu", | |
"tm.hu", | |
"2000.hu", | |
"agrar.hu", | |
"bolt.hu", | |
"casino.hu", | |
"city.hu", | |
"erotica.hu", | |
"erotika.hu", | |
"film.hu", | |
"forum.hu", | |
"games.hu", | |
"hotel.hu", | |
"ingatlan.hu", | |
"jogasz.hu", | |
"konyvelo.hu", | |
"lakas.hu", | |
"media.hu", | |
"news.hu", | |
"reklam.hu", | |
"sex.hu", | |
"shop.hu", | |
"suli.hu", | |
"szex.hu", | |
"tozsde.hu", | |
"utazas.hu", | |
"video.hu", | |
"id", | |
"ac.id", | |
"biz.id", | |
"co.id", | |
"desa.id", | |
"go.id", | |
"mil.id", | |
"my.id", | |
"net.id", | |
"or.id", | |
"ponpes.id", | |
"sch.id", | |
"web.id", | |
"ie", | |
"gov.ie", | |
"il", | |
"ac.il", | |
"co.il", | |
"gov.il", | |
"idf.il", | |
"k12.il", | |
"muni.il", | |
"net.il", | |
"org.il", | |
"im", | |
"ac.im", | |
"co.im", | |
"com.im", | |
"ltd.co.im", | |
"net.im", | |
"org.im", | |
"plc.co.im", | |
"tt.im", | |
"tv.im", | |
"in", | |
"co.in", | |
"firm.in", | |
"net.in", | |
"org.in", | |
"gen.in", | |
"ind.in", | |
"nic.in", | |
"ac.in", | |
"edu.in", | |
"res.in", | |
"gov.in", | |
"mil.in", | |
"info", | |
"int", | |
"eu.int", | |
"io", | |
"com.io", | |
"iq", | |
"gov.iq", | |
"edu.iq", | |
"mil.iq", | |
"com.iq", | |
"org.iq", | |
"net.iq", | |
"ir", | |
"ac.ir", | |
"co.ir", | |
"gov.ir", | |
"id.ir", | |
"net.ir", | |
"org.ir", | |
"sch.ir", | |
"ایران.ir", | |
"ايران.ir", | |
"is", | |
"net.is", | |
"com.is", | |
"edu.is", | |
"gov.is", | |
"org.is", | |
"int.is", | |
"it", | |
"gov.it", | |
"edu.it", | |
"abr.it", | |
"abruzzo.it", | |
"aosta-valley.it", | |
"aostavalley.it", | |
"bas.it", | |
"basilicata.it", | |
"cal.it", | |
"calabria.it", | |
"cam.it", | |
"campania.it", | |
"emilia-romagna.it", | |
"emiliaromagna.it", | |
"emr.it", | |
"friuli-v-giulia.it", | |
"friuli-ve-giulia.it", | |
"friuli-vegiulia.it", | |
"friuli-venezia-giulia.it", | |
"friuli-veneziagiulia.it", | |
"friuli-vgiulia.it", | |
"friuliv-giulia.it", | |
"friulive-giulia.it", | |
"friulivegiulia.it", | |
"friulivenezia-giulia.it", | |
"friuliveneziagiulia.it", | |
"friulivgiulia.it", | |
"fvg.it", | |
"laz.it", | |
"lazio.it", | |
"lig.it", | |
"liguria.it", | |
"lom.it", | |
"lombardia.it", | |
"lombardy.it", | |
"lucania.it", | |
"mar.it", | |
"marche.it", | |
"mol.it", | |
"molise.it", | |
"piedmont.it", | |
"piemonte.it", | |
"pmn.it", | |
"pug.it", | |
"puglia.it", | |
"sar.it", | |
"sardegna.it", | |
"sardinia.it", | |
"sic.it", | |
"sicilia.it", | |
"sicily.it", | |
"taa.it", | |
"tos.it", | |
"toscana.it", | |
"trentin-sud-tirol.it", | |
"trentin-süd-tirol.it", | |
"trentin-sudtirol.it", | |
"trentin-südtirol.it", | |
"trentin-sued-tirol.it", | |
"trentin-suedtirol.it", | |
"trentino-a-adige.it", | |
"trentino-aadige.it", | |
"trentino-alto-adige.it", | |
"trentino-altoadige.it", | |
"trentino-s-tirol.it", | |
"trentino-stirol.it", | |
"trentino-sud-tirol.it", | |
"trentino-süd-tirol.it", | |
"trentino-sudtirol.it", | |
"trentino-südtirol.it", | |
"trentino-sued-tirol.it", | |
"trentino-suedtirol.it", | |
"trentino.it", | |
"trentinoa-adige.it", | |
"trentinoaadige.it", | |
"trentinoalto-adige.it", | |
"trentinoaltoadige.it", | |
"trentinos-tirol.it", | |
"trentinostirol.it", | |
"trentinosud-tirol.it", | |
"trentinosüd-tirol.it", | |
"trentinosudtirol.it", | |
"trentinosüdtirol.it", | |
"trentinosued-tirol.it", | |
"trentinosuedtirol.it", | |
"trentinsud-tirol.it", | |
"trentinsüd-tirol.it", | |
"trentinsudtirol.it", | |
"trentinsüdtirol.it", | |
"trentinsued-tirol.it", | |
"trentinsuedtirol.it", | |
"tuscany.it", | |
"umb.it", | |
"umbria.it", | |
"val-d-aosta.it", | |
"val-daosta.it", | |
"vald-aosta.it", | |
"valdaosta.it", | |
"valle-aosta.it", | |
"valle-d-aosta.it", | |
"valle-daosta.it", | |
"valleaosta.it", | |
"valled-aosta.it", | |
"valledaosta.it", | |
"vallee-aoste.it", | |
"vallée-aoste.it", | |
"vallee-d-aoste.it", | |
"vallée-d-aoste.it", | |
"valleeaoste.it", | |
"valléeaoste.it", | |
"valleedaoste.it", | |
"valléedaoste.it", | |
"vao.it", | |
"vda.it", | |
"ven.it", | |
"veneto.it", | |
"ag.it", | |
"agrigento.it", | |
"al.it", | |
"alessandria.it", | |
"alto-adige.it", | |
"altoadige.it", | |
"an.it", | |
"ancona.it", | |
"andria-barletta-trani.it", | |
"andria-trani-barletta.it", | |
"andriabarlettatrani.it", | |
"andriatranibarletta.it", | |
"ao.it", | |
"aosta.it", | |
"aoste.it", | |
"ap.it", | |
"aq.it", | |
"aquila.it", | |
"ar.it", | |
"arezzo.it", | |
"ascoli-piceno.it", | |
"ascolipiceno.it", | |
"asti.it", | |
"at.it", | |
"av.it", | |
"avellino.it", | |
"ba.it", | |
"balsan-sudtirol.it", | |
"balsan-südtirol.it", | |
"balsan-suedtirol.it", | |
"balsan.it", | |
"bari.it", | |
"barletta-trani-andria.it", | |
"barlettatraniandria.it", | |
"belluno.it", | |
"benevento.it", | |
"bergamo.it", | |
"bg.it", | |
"bi.it", | |
"biella.it", | |
"bl.it", | |
"bn.it", | |
"bo.it", | |
"bologna.it", | |
"bolzano-altoadige.it", | |
"bolzano.it", | |
"bozen-sudtirol.it", | |
"bozen-südtirol.it", | |
"bozen-suedtirol.it", | |
"bozen.it", | |
"br.it", | |
"brescia.it", | |
"brindisi.it", | |
"bs.it", | |
"bt.it", | |
"bulsan-sudtirol.it", | |
"bulsan-südtirol.it", | |
"bulsan-suedtirol.it", | |
"bulsan.it", | |
"bz.it", | |
"ca.it", | |
"cagliari.it", | |
"caltanissetta.it", | |
"campidano-medio.it", | |
"campidanomedio.it", | |
"campobasso.it", | |
"carbonia-iglesias.it", | |
"carboniaiglesias.it", | |
"carrara-massa.it", | |
"carraramassa.it", | |
"caserta.it", | |
"catania.it", | |
"catanzaro.it", | |
"cb.it", | |
"ce.it", | |
"cesena-forli.it", | |
"cesena-forlì.it", | |
"cesenaforli.it", | |
"cesenaforlì.it", | |
"ch.it", | |
"chieti.it", | |
"ci.it", | |
"cl.it", | |
"cn.it", | |
"co.it", | |
"como.it", | |
"cosenza.it", | |
"cr.it", | |
"cremona.it", | |
"crotone.it", | |
"cs.it", | |
"ct.it", | |
"cuneo.it", | |
"cz.it", | |
"dell-ogliastra.it", | |
"dellogliastra.it", | |
"en.it", | |
"enna.it", | |
"fc.it", | |
"fe.it", | |
"fermo.it", | |
"ferrara.it", | |
"fg.it", | |
"fi.it", | |
"firenze.it", | |
"florence.it", | |
"fm.it", | |
"foggia.it", | |
"forli-cesena.it", | |
"forlì-cesena.it", | |
"forlicesena.it", | |
"forlìcesena.it", | |
"fr.it", | |
"frosinone.it", | |
"ge.it", | |
"genoa.it", | |
"genova.it", | |
"go.it", | |
"gorizia.it", | |
"gr.it", | |
"grosseto.it", | |
"iglesias-carbonia.it", | |
"iglesiascarbonia.it", | |
"im.it", | |
"imperia.it", | |
"is.it", | |
"isernia.it", | |
"kr.it", | |
"la-spezia.it", | |
"laquila.it", | |
"laspezia.it", | |
"latina.it", | |
"lc.it", | |
"le.it", | |
"lecce.it", | |
"lecco.it", | |
"li.it", | |
"livorno.it", | |
"lo.it", | |
"lodi.it", | |
"lt.it", | |
"lu.it", | |
"lucca.it", | |
"macerata.it", | |
"mantova.it", | |
"massa-carrara.it", | |
"massacarrara.it", | |
"matera.it", | |
"mb.it", | |
"mc.it", | |
"me.it", | |
"medio-campidano.it", | |
"mediocampidano.it", | |
"messina.it", | |
"mi.it", | |
"milan.it", | |
"milano.it", | |
"mn.it", | |
"mo.it", | |
"modena.it", | |
"monza-brianza.it", | |
"monza-e-della-brianza.it", | |
"monza.it", | |
"monzabrianza.it", | |
"monzaebrianza.it", | |
"monzaedellabrianza.it", | |
"ms.it", | |
"mt.it", | |
"na.it", | |
"naples.it", | |
"napoli.it", | |
"no.it", | |
"novara.it", | |
"nu.it", | |
"nuoro.it", | |
"og.it", | |
"ogliastra.it", | |
"olbia-tempio.it", | |
"olbiatempio.it", | |
"or.it", | |
"oristano.it", | |
"ot.it", | |
"pa.it", | |
"padova.it", | |
"padua.it", | |
"palermo.it", | |
"parma.it", | |
"pavia.it", | |
"pc.it", | |
"pd.it", | |
"pe.it", | |
"perugia.it", | |
"pesaro-urbino.it", | |
"pesarourbino.it", | |
"pescara.it", | |
"pg.it", | |
"pi.it", | |
"piacenza.it", | |
"pisa.it", | |
"pistoia.it", | |
"pn.it", | |
"po.it", | |
"pordenone.it", | |
"potenza.it", | |
"pr.it", | |
"prato.it", | |
"pt.it", | |
"pu.it", | |
"pv.it", | |
"pz.it", | |
"ra.it", | |
"ragusa.it", | |
"ravenna.it", | |
"rc.it", | |
"re.it", | |
"reggio-calabria.it", | |
"reggio-emilia.it", | |
"reggiocalabria.it", | |
"reggioemilia.it", | |
"rg.it", | |
"ri.it", | |
"rieti.it", | |
"rimini.it", | |
"rm.it", | |
"rn.it", | |
"ro.it", | |
"roma.it", | |
"rome.it", | |
"rovigo.it", | |
"sa.it", | |
"salerno.it", | |
"sassari.it", | |
"savona.it", | |
"si.it", | |
"siena.it", | |
"siracusa.it", | |
"so.it", | |
"sondrio.it", | |
"sp.it", | |
"sr.it", | |
"ss.it", | |
"suedtirol.it", | |
"südtirol.it", | |
"sv.it", | |
"ta.it", | |
"taranto.it", | |
"te.it", | |
"tempio-olbia.it", | |
"tempioolbia.it", | |
"teramo.it", | |
"terni.it", | |
"tn.it", | |
"to.it", | |
"torino.it", | |
"tp.it", | |
"tr.it", | |
"trani-andria-barletta.it", | |
"trani-barletta-andria.it", | |
"traniandriabarletta.it", | |
"tranibarlettaandria.it", | |
"trapani.it", | |
"trento.it", | |
"treviso.it", | |
"trieste.it", | |
"ts.it", | |
"turin.it", | |
"tv.it", | |
"ud.it", | |
"udine.it", | |
"urbino-pesaro.it", | |
"urbinopesaro.it", | |
"va.it", | |
"varese.it", | |
"vb.it", | |
"vc.it", | |
"ve.it", | |
"venezia.it", | |
"venice.it", | |
"verbania.it", | |
"vercelli.it", | |
"verona.it", | |
"vi.it", | |
"vibo-valentia.it", | |
"vibovalentia.it", | |
"vicenza.it", | |
"viterbo.it", | |
"vr.it", | |
"vs.it", | |
"vt.it", | |
"vv.it", | |
"je", | |
"co.je", | |
"net.je", | |
"org.je", | |
"*.jm", | |
"jo", | |
"com.jo", | |
"org.jo", | |
"net.jo", | |
"edu.jo", | |
"sch.jo", | |
"gov.jo", | |
"mil.jo", | |
"name.jo", | |
"jobs", | |
"jp", | |
"ac.jp", | |
"ad.jp", | |
"co.jp", | |
"ed.jp", | |
"go.jp", | |
"gr.jp", | |
"lg.jp", | |
"ne.jp", | |
"or.jp", | |
"aichi.jp", | |
"akita.jp", | |
"aomori.jp", | |
"chiba.jp", | |
"ehime.jp", | |
"fukui.jp", | |
"fukuoka.jp", | |
"fukushima.jp", | |
"gifu.jp", | |
"gunma.jp", | |
"hiroshima.jp", | |
"hokkaido.jp", | |
"hyogo.jp", | |
"ibaraki.jp", | |
"ishikawa.jp", | |
"iwate.jp", | |
"kagawa.jp", | |
"kagoshima.jp", | |
"kanagawa.jp", | |
"kochi.jp", | |
"kumamoto.jp", | |
"kyoto.jp", | |
"mie.jp", | |
"miyagi.jp", | |
"miyazaki.jp", | |
"nagano.jp", | |
"nagasaki.jp", | |
"nara.jp", | |
"niigata.jp", | |
"oita.jp", | |
"okayama.jp", | |
"okinawa.jp", | |
"osaka.jp", | |
"saga.jp", | |
"saitama.jp", | |
"shiga.jp", | |
"shimane.jp", | |
"shizuoka.jp", | |
"tochigi.jp", | |
"tokushima.jp", | |
"tokyo.jp", | |
"tottori.jp", | |
"toyama.jp", | |
"wakayama.jp", | |
"yamagata.jp", | |
"yamaguchi.jp", | |
"yamanashi.jp", | |
"栃木.jp", | |
"愛知.jp", | |
"愛媛.jp", | |
"兵庫.jp", | |
"熊本.jp", | |
"茨城.jp", | |
"北海道.jp", | |
"千葉.jp", | |
"和歌山.jp", | |
"長崎.jp", | |
"長野.jp", | |
"新潟.jp", | |
"青森.jp", | |
"静岡.jp", | |
"東京.jp", | |
"石川.jp", | |
"埼玉.jp", | |
"三重.jp", | |
"京都.jp", | |
"佐賀.jp", | |
"大分.jp", | |
"大阪.jp", | |
"奈良.jp", | |
"宮城.jp", | |
"宮崎.jp", | |
"富山.jp", | |
"山口.jp", | |
"山形.jp", | |
"山梨.jp", | |
"岩手.jp", | |
"岐阜.jp", | |
"岡山.jp", | |
"島根.jp", | |
"広島.jp", | |
"徳島.jp", | |
"沖縄.jp", | |
"滋賀.jp", | |
"神奈川.jp", | |
"福井.jp", | |
"福岡.jp", | |
"福島.jp", | |
"秋田.jp", | |
"群馬.jp", | |
"香川.jp", | |
"高知.jp", | |
"鳥取.jp", | |
"鹿児島.jp", | |
"*.kawasaki.jp", | |
"*.kitakyushu.jp", | |
"*.kobe.jp", | |
"*.nagoya.jp", | |
"*.sapporo.jp", | |
"*.sendai.jp", | |
"*.yokohama.jp", | |
"!city.kawasaki.jp", | |
"!city.kitakyushu.jp", | |
"!city.kobe.jp", | |
"!city.nagoya.jp", | |
"!city.sapporo.jp", | |
"!city.sendai.jp", | |
"!city.yokohama.jp", | |
"aisai.aichi.jp", | |
"ama.aichi.jp", | |
"anjo.aichi.jp", | |
"asuke.aichi.jp", | |
"chiryu.aichi.jp", | |
"chita.aichi.jp", | |
"fuso.aichi.jp", | |
"gamagori.aichi.jp", | |
"handa.aichi.jp", | |
"hazu.aichi.jp", | |
"hekinan.aichi.jp", | |
"higashiura.aichi.jp", | |
"ichinomiya.aichi.jp", | |
"inazawa.aichi.jp", | |
"inuyama.aichi.jp", | |
"isshiki.aichi.jp", | |
"iwakura.aichi.jp", | |
"kanie.aichi.jp", | |
"kariya.aichi.jp", | |
"kasugai.aichi.jp", | |
"kira.aichi.jp", | |
"kiyosu.aichi.jp", | |
"komaki.aichi.jp", | |
"konan.aichi.jp", | |
"kota.aichi.jp", | |
"mihama.aichi.jp", | |
"miyoshi.aichi.jp", | |
"nishio.aichi.jp", | |
"nisshin.aichi.jp", | |
"obu.aichi.jp", | |
"oguchi.aichi.jp", | |
"oharu.aichi.jp", | |
"okazaki.aichi.jp", | |
"owariasahi.aichi.jp", | |
"seto.aichi.jp", | |
"shikatsu.aichi.jp", | |
"shinshiro.aichi.jp", | |
"shitara.aichi.jp", | |
"tahara.aichi.jp", | |
"takahama.aichi.jp", | |
"tobishima.aichi.jp", | |
"toei.aichi.jp", | |
"togo.aichi.jp", | |
"tokai.aichi.jp", | |
"tokoname.aichi.jp", | |
"toyoake.aichi.jp", | |
"toyohashi.aichi.jp", | |
"toyokawa.aichi.jp", | |
"toyone.aichi.jp", | |
"toyota.aichi.jp", | |
"tsushima.aichi.jp", | |
"yatomi.aichi.jp", | |
"akita.akita.jp", | |
"daisen.akita.jp", | |
"fujisato.akita.jp", | |
"gojome.akita.jp", | |
"hachirogata.akita.jp", | |
"happou.akita.jp", | |
"higashinaruse.akita.jp", | |
"honjo.akita.jp", | |
"honjyo.akita.jp", | |
"ikawa.akita.jp", | |
"kamikoani.akita.jp", | |
"kamioka.akita.jp", | |
"katagami.akita.jp", | |
"kazuno.akita.jp", | |
"kitaakita.akita.jp", | |
"kosaka.akita.jp", | |
"kyowa.akita.jp", | |
"misato.akita.jp", | |
"mitane.akita.jp", | |
"moriyoshi.akita.jp", | |
"nikaho.akita.jp", | |
"noshiro.akita.jp", | |
"odate.akita.jp", | |
"oga.akita.jp", | |
"ogata.akita.jp", | |
"semboku.akita.jp", | |
"yokote.akita.jp", | |
"yurihonjo.akita.jp", | |
"aomori.aomori.jp", | |
"gonohe.aomori.jp", | |
"hachinohe.aomori.jp", | |
"hashikami.aomori.jp", | |
"hiranai.aomori.jp", | |
"hirosaki.aomori.jp", | |
"itayanagi.aomori.jp", | |
"kuroishi.aomori.jp", | |
"misawa.aomori.jp", | |
"mutsu.aomori.jp", | |
"nakadomari.aomori.jp", | |
"noheji.aomori.jp", | |
"oirase.aomori.jp", | |
"owani.aomori.jp", | |
"rokunohe.aomori.jp", | |
"sannohe.aomori.jp", | |
"shichinohe.aomori.jp", | |
"shingo.aomori.jp", | |
"takko.aomori.jp", | |
"towada.aomori.jp", | |
"tsugaru.aomori.jp", | |
"tsuruta.aomori.jp", | |
"abiko.chiba.jp", | |
"asahi.chiba.jp", | |
"chonan.chiba.jp", | |
"chosei.chiba.jp", | |
"choshi.chiba.jp", | |
"chuo.chiba.jp", | |
"funabashi.chiba.jp", | |
"futtsu.chiba.jp", | |
"hanamigawa.chiba.jp", | |
"ichihara.chiba.jp", | |
"ichikawa.chiba.jp", | |
"ichinomiya.chiba.jp", | |
"inzai.chiba.jp", | |
"isumi.chiba.jp", | |
"kamagaya.chiba.jp", | |
"kamogawa.chiba.jp", | |
"kashiwa.chiba.jp", | |
"katori.chiba.jp", | |
"katsuura.chiba.jp", | |
"kimitsu.chiba.jp", | |
"kisarazu.chiba.jp", | |
"kozaki.chiba.jp", | |
"kujukuri.chiba.jp", | |
"kyonan.chiba.jp", | |
"matsudo.chiba.jp", | |
"midori.chiba.jp", | |
"mihama.chiba.jp", | |
"minamiboso.chiba.jp", | |
"mobara.chiba.jp", | |
"mutsuzawa.chiba.jp", | |
"nagara.chiba.jp", | |
"nagareyama.chiba.jp", | |
"narashino.chiba.jp", | |
"narita.chiba.jp", | |
"noda.chiba.jp", | |
"oamishirasato.chiba.jp", | |
"omigawa.chiba.jp", | |
"onjuku.chiba.jp", | |
"otaki.chiba.jp", | |
"sakae.chiba.jp", | |
"sakura.chiba.jp", | |
"shimofusa.chiba.jp", | |
"shirako.chiba.jp", | |
"shiroi.chiba.jp", | |
"shisui.chiba.jp", | |
"sodegaura.chiba.jp", | |
"sosa.chiba.jp", | |
"tako.chiba.jp", | |
"tateyama.chiba.jp", | |
"togane.chiba.jp", | |
"tohnosho.chiba.jp", | |
"tomisato.chiba.jp", | |
"urayasu.chiba.jp", | |
"yachimata.chiba.jp", | |
"yachiyo.chiba.jp", | |
"yokaichiba.chiba.jp", | |
"yokoshibahikari.chiba.jp", | |
"yotsukaido.chiba.jp", | |
"ainan.ehime.jp", | |
"honai.ehime.jp", | |
"ikata.ehime.jp", | |
"imabari.ehime.jp", | |
"iyo.ehime.jp", | |
"kamijima.ehime.jp", | |
"kihoku.ehime.jp", | |
"kumakogen.ehime.jp", | |
"masaki.ehime.jp", | |
"matsuno.ehime.jp", | |
"matsuyama.ehime.jp", | |
"namikata.ehime.jp", | |
"niihama.ehime.jp", | |
"ozu.ehime.jp", | |
"saijo.ehime.jp", | |
"seiyo.ehime.jp", | |
"shikokuchuo.ehime.jp", | |
"tobe.ehime.jp", | |
"toon.ehime.jp", | |
"uchiko.ehime.jp", | |
"uwajima.ehime.jp", | |
"yawatahama.ehime.jp", | |
"echizen.fukui.jp", | |
"eiheiji.fukui.jp", | |
"fukui.fukui.jp", | |
"ikeda.fukui.jp", | |
"katsuyama.fukui.jp", | |
"mihama.fukui.jp", | |
"minamiechizen.fukui.jp", | |
"obama.fukui.jp", | |
"ohi.fukui.jp", | |
"ono.fukui.jp", | |
"sabae.fukui.jp", | |
"sakai.fukui.jp", | |
"takahama.fukui.jp", | |
"tsuruga.fukui.jp", | |
"wakasa.fukui.jp", | |
"ashiya.fukuoka.jp", | |
"buzen.fukuoka.jp", | |
"chikugo.fukuoka.jp", | |
"chikuho.fukuoka.jp", | |
"chikujo.fukuoka.jp", | |
"chikushino.fukuoka.jp", | |
"chikuzen.fukuoka.jp", | |
"chuo.fukuoka.jp", | |
"dazaifu.fukuoka.jp", | |
"fukuchi.fukuoka.jp", | |
"hakata.fukuoka.jp", | |
"higashi.fukuoka.jp", | |
"hirokawa.fukuoka.jp", | |
"hisayama.fukuoka.jp", | |
"iizuka.fukuoka.jp", | |
"inatsuki.fukuoka.jp", | |
"kaho.fukuoka.jp", | |
"kasuga.fukuoka.jp", | |
"kasuya.fukuoka.jp", | |
"kawara.fukuoka.jp", | |
"keisen.fukuoka.jp", | |
"koga.fukuoka.jp", | |
"kurate.fukuoka.jp", | |
"kurogi.fukuoka.jp", | |
"kurume.fukuoka.jp", | |
"minami.fukuoka.jp", | |
"miyako.fukuoka.jp", | |
"miyama.fukuoka.jp", | |
"miyawaka.fukuoka.jp", | |
"mizumaki.fukuoka.jp", | |
"munakata.fukuoka.jp", | |
"nakagawa.fukuoka.jp", | |
"nakama.fukuoka.jp", | |
"nishi.fukuoka.jp", | |
"nogata.fukuoka.jp", | |
"ogori.fukuoka.jp", | |
"okagaki.fukuoka.jp", | |
"okawa.fukuoka.jp", | |
"oki.fukuoka.jp", | |
"omuta.fukuoka.jp", | |
"onga.fukuoka.jp", | |
"onojo.fukuoka.jp", | |
"oto.fukuoka.jp", | |
"saigawa.fukuoka.jp", | |
"sasaguri.fukuoka.jp", | |
"shingu.fukuoka.jp", | |
"shinyoshitomi.fukuoka.jp", | |
"shonai.fukuoka.jp", | |
"soeda.fukuoka.jp", | |
"sue.fukuoka.jp", | |
"tachiarai.fukuoka.jp", | |
"tagawa.fukuoka.jp", | |
"takata.fukuoka.jp", | |
"toho.fukuoka.jp", | |
"toyotsu.fukuoka.jp", | |
"tsuiki.fukuoka.jp", | |
"ukiha.fukuoka.jp", | |
"umi.fukuoka.jp", | |
"usui.fukuoka.jp", | |
"yamada.fukuoka.jp", | |
"yame.fukuoka.jp", | |
"yanagawa.fukuoka.jp", | |
"yukuhashi.fukuoka.jp", | |
"aizubange.fukushima.jp", | |
"aizumisato.fukushima.jp", | |
"aizuwakamatsu.fukushima.jp", | |
"asakawa.fukushima.jp", | |
"bandai.fukushima.jp", | |
"date.fukushima.jp", | |
"fukushima.fukushima.jp", | |
"furudono.fukushima.jp", | |
"futaba.fukushima.jp", | |
"hanawa.fukushima.jp", | |
"higashi.fukushima.jp", | |
"hirata.fukushima.jp", | |
"hirono.fukushima.jp", | |
"iitate.fukushima.jp", | |
"inawashiro.fukushima.jp", | |
"ishikawa.fukushima.jp", | |
"iwaki.fukushima.jp", | |
"izumizaki.fukushima.jp", | |
"kagamiishi.fukushima.jp", | |
"kaneyama.fukushima.jp", | |
"kawamata.fukushima.jp", | |
"kitakata.fukushima.jp", | |
"kitashiobara.fukushima.jp", | |
"koori.fukushima.jp", | |
"koriyama.fukushima.jp", | |
"kunimi.fukushima.jp", | |
"miharu.fukushima.jp", | |
"mishima.fukushima.jp", | |
"namie.fukushima.jp", | |
"nango.fukushima.jp", | |
"nishiaizu.fukushima.jp", | |
"nishigo.fukushima.jp", | |
"okuma.fukushima.jp", | |
"omotego.fukushima.jp", | |
"ono.fukushima.jp", | |
"otama.fukushima.jp", | |
"samegawa.fukushima.jp", | |
"shimogo.fukushima.jp", | |
"shirakawa.fukushima.jp", | |
"showa.fukushima.jp", | |
"soma.fukushima.jp", | |
"sukagawa.fukushima.jp", | |
"taishin.fukushima.jp", | |
"tamakawa.fukushima.jp", | |
"tanagura.fukushima.jp", | |
"tenei.fukushima.jp", | |
"yabuki.fukushima.jp", | |
"yamato.fukushima.jp", | |
"yamatsuri.fukushima.jp", | |
"yanaizu.fukushima.jp", | |
"yugawa.fukushima.jp", | |
"anpachi.gifu.jp", | |
"ena.gifu.jp", | |
"gifu.gifu.jp", | |
"ginan.gifu.jp", | |
"godo.gifu.jp", | |
"gujo.gifu.jp", | |
"hashima.gifu.jp", | |
"hichiso.gifu.jp", | |
"hida.gifu.jp", | |
"higashishirakawa.gifu.jp", | |
"ibigawa.gifu.jp", | |
"ikeda.gifu.jp", | |
"kakamigahara.gifu.jp", | |
"kani.gifu.jp", | |
"kasahara.gifu.jp", | |
"kasamatsu.gifu.jp", | |
"kawaue.gifu.jp", | |
"kitagata.gifu.jp", | |
"mino.gifu.jp", | |
"minokamo.gifu.jp", | |
"mitake.gifu.jp", | |
"mizunami.gifu.jp", | |
"motosu.gifu.jp", | |
"nakatsugawa.gifu.jp", | |
"ogaki.gifu.jp", | |
"sakahogi.gifu.jp", | |
"seki.gifu.jp", | |
"sekigahara.gifu.jp", | |
"shirakawa.gifu.jp", | |
"tajimi.gifu.jp", | |
"takayama.gifu.jp", | |
"tarui.gifu.jp", | |
"toki.gifu.jp", | |
"tomika.gifu.jp", | |
"wanouchi.gifu.jp", | |
"yamagata.gifu.jp", | |
"yaotsu.gifu.jp", | |
"yoro.gifu.jp", | |
"annaka.gunma.jp", | |
"chiyoda.gunma.jp", | |
"fujioka.gunma.jp", | |
"higashiagatsuma.gunma.jp", | |
"isesaki.gunma.jp", | |
"itakura.gunma.jp", | |
"kanna.gunma.jp", | |
"kanra.gunma.jp", | |
"katashina.gunma.jp", | |
"kawaba.gunma.jp", | |
"kiryu.gunma.jp", | |
"kusatsu.gunma.jp", | |
"maebashi.gunma.jp", | |
"meiwa.gunma.jp", | |
"midori.gunma.jp", | |
"minakami.gunma.jp", | |
"naganohara.gunma.jp", | |
"nakanojo.gunma.jp", | |
"nanmoku.gunma.jp", | |
"numata.gunma.jp", | |
"oizumi.gunma.jp", | |
"ora.gunma.jp", | |
"ota.gunma.jp", | |
"shibukawa.gunma.jp", | |
"shimonita.gunma.jp", | |
"shinto.gunma.jp", | |
"showa.gunma.jp", | |
"takasaki.gunma.jp", | |
"takayama.gunma.jp", | |
"tamamura.gunma.jp", | |
"tatebayashi.gunma.jp", | |
"tomioka.gunma.jp", | |
"tsukiyono.gunma.jp", | |
"tsumagoi.gunma.jp", | |
"ueno.gunma.jp", | |
"yoshioka.gunma.jp", | |
"asaminami.hiroshima.jp", | |
"daiwa.hiroshima.jp", | |
"etajima.hiroshima.jp", | |
"fuchu.hiroshima.jp", | |
"fukuyama.hiroshima.jp", | |
"hatsukaichi.hiroshima.jp", | |
"higashihiroshima.hiroshima.jp", | |
"hongo.hiroshima.jp", | |
"jinsekikogen.hiroshima.jp", | |
"kaita.hiroshima.jp", | |
"kui.hiroshima.jp", | |
"kumano.hiroshima.jp", | |
"kure.hiroshima.jp", | |
"mihara.hiroshima.jp", | |
"miyoshi.hiroshima.jp", | |
"naka.hiroshima.jp", | |
"onomichi.hiroshima.jp", | |
"osakikamijima.hiroshima.jp", | |
"otake.hiroshima.jp", | |
"saka.hiroshima.jp", | |
"sera.hiroshima.jp", | |
"seranishi.hiroshima.jp", | |
"shinichi.hiroshima.jp", | |
"shobara.hiroshima.jp", | |
"takehara.hiroshima.jp", | |
"abashiri.hokkaido.jp", | |
"abira.hokkaido.jp", | |
"aibetsu.hokkaido.jp", | |
"akabira.hokkaido.jp", | |
"akkeshi.hokkaido.jp", | |
"asahikawa.hokkaido.jp", | |
"ashibetsu.hokkaido.jp", | |
"ashoro.hokkaido.jp", | |
"assabu.hokkaido.jp", | |
"atsuma.hokkaido.jp", | |
"bibai.hokkaido.jp", | |
"biei.hokkaido.jp", | |
"bifuka.hokkaido.jp", | |
"bihoro.hokkaido.jp", | |
"biratori.hokkaido.jp", | |
"chippubetsu.hokkaido.jp", | |
"chitose.hokkaido.jp", | |
"date.hokkaido.jp", | |
"ebetsu.hokkaido.jp", | |
"embetsu.hokkaido.jp", | |
"eniwa.hokkaido.jp", | |
"erimo.hokkaido.jp", | |
"esan.hokkaido.jp", | |
"esashi.hokkaido.jp", | |
"fukagawa.hokkaido.jp", | |
"fukushima.hokkaido.jp", | |
"furano.hokkaido.jp", | |
"furubira.hokkaido.jp", | |
"haboro.hokkaido.jp", | |
"hakodate.hokkaido.jp", | |
"hamatonbetsu.hokkaido.jp", | |
"hidaka.hokkaido.jp", | |
"higashikagura.hokkaido.jp", | |
"higashikawa.hokkaido.jp", | |
"hiroo.hokkaido.jp", | |
"hokuryu.hokkaido.jp", | |
"hokuto.hokkaido.jp", | |
"honbetsu.hokkaido.jp", | |
"horokanai.hokkaido.jp", | |
"horonobe.hokkaido.jp", | |
"ikeda.hokkaido.jp", | |
"imakane.hokkaido.jp", | |
"ishikari.hokkaido.jp", | |
"iwamizawa.hokkaido.jp", | |
"iwanai.hokkaido.jp", | |
"kamifurano.hokkaido.jp", | |
"kamikawa.hokkaido.jp", | |
"kamishihoro.hokkaido.jp", | |
"kamisunagawa.hokkaido.jp", | |
"kamoenai.hokkaido.jp", | |
"kayabe.hokkaido.jp", | |
"kembuchi.hokkaido.jp", | |
"kikonai.hokkaido.jp", | |
"kimobetsu.hokkaido.jp", | |
"kitahiroshima.hokkaido.jp", | |
"kitami.hokkaido.jp", | |
"kiyosato.hokkaido.jp", | |
"koshimizu.hokkaido.jp", | |
"kunneppu.hokkaido.jp", | |
"kuriyama.hokkaido.jp", | |
"kuromatsunai.hokkaido.jp", | |
"kushiro.hokkaido.jp", | |
"kutchan.hokkaido.jp", | |
"kyowa.hokkaido.jp", | |
"mashike.hokkaido.jp", | |
"matsumae.hokkaido.jp", | |
"mikasa.hokkaido.jp", | |
"minamifurano.hokkaido.jp", | |
"mombetsu.hokkaido.jp", | |
"moseushi.hokkaido.jp", | |
"mukawa.hokkaido.jp", | |
"muroran.hokkaido.jp", | |
"naie.hokkaido.jp", | |
"nakagawa.hokkaido.jp", | |
"nakasatsunai.hokkaido.jp", | |
"nakatombetsu.hokkaido.jp", | |
"nanae.hokkaido.jp", | |
"nanporo.hokkaido.jp", | |
"nayoro.hokkaido.jp", | |
"nemuro.hokkaido.jp", | |
"niikappu.hokkaido.jp", | |
"niki.hokkaido.jp", | |
"nishiokoppe.hokkaido.jp", | |
"noboribetsu.hokkaido.jp", | |
"numata.hokkaido.jp", | |
"obihiro.hokkaido.jp", | |
"obira.hokkaido.jp", | |
"oketo.hokkaido.jp", | |
"okoppe.hokkaido.jp", | |
"otaru.hokkaido.jp", | |
"otobe.hokkaido.jp", | |
"otofuke.hokkaido.jp", | |
"otoineppu.hokkaido.jp", | |
"oumu.hokkaido.jp", | |
"ozora.hokkaido.jp", | |
"pippu.hokkaido.jp", | |
"rankoshi.hokkaido.jp", | |
"rebun.hokkaido.jp", | |
"rikubetsu.hokkaido.jp", | |
"rishiri.hokkaido.jp", | |
"rishirifuji.hokkaido.jp", | |
"saroma.hokkaido.jp", | |
"sarufutsu.hokkaido.jp", | |
"shakotan.hokkaido.jp", | |
"shari.hokkaido.jp", | |
"shibecha.hokkaido.jp", | |
"shibetsu.hokkaido.jp", | |
"shikabe.hokkaido.jp", | |
"shikaoi.hokkaido.jp", | |
"shimamaki.hokkaido.jp", | |
"shimizu.hokkaido.jp", | |
"shimokawa.hokkaido.jp", | |
"shinshinotsu.hokkaido.jp", | |
"shintoku.hokkaido.jp", | |
"shiranuka.hokkaido.jp", | |
"shiraoi.hokkaido.jp", | |
"shiriuchi.hokkaido.jp", | |
"sobetsu.hokkaido.jp", | |
"sunagawa.hokkaido.jp", | |
"taiki.hokkaido.jp", | |
"takasu.hokkaido.jp", | |
"takikawa.hokkaido.jp", | |
"takinoue.hokkaido.jp", | |
"teshikaga.hokkaido.jp", | |
"tobetsu.hokkaido.jp", | |
"tohma.hokkaido.jp", | |
"tomakomai.hokkaido.jp", | |
"tomari.hokkaido.jp", | |
"toya.hokkaido.jp", | |
"toyako.hokkaido.jp", | |
"toyotomi.hokkaido.jp", | |
"toyoura.hokkaido.jp", | |
"tsubetsu.hokkaido.jp", | |
"tsukigata.hokkaido.jp", | |
"urakawa.hokkaido.jp", | |
"urausu.hokkaido.jp", | |
"uryu.hokkaido.jp", | |
"utashinai.hokkaido.jp", | |
"wakkanai.hokkaido.jp", | |
"wassamu.hokkaido.jp", | |
"yakumo.hokkaido.jp", | |
"yoichi.hokkaido.jp", | |
"aioi.hyogo.jp", | |
"akashi.hyogo.jp", | |
"ako.hyogo.jp", | |
"amagasaki.hyogo.jp", | |
"aogaki.hyogo.jp", | |
"asago.hyogo.jp", | |
"ashiya.hyogo.jp", | |
"awaji.hyogo.jp", | |
"fukusaki.hyogo.jp", | |
"goshiki.hyogo.jp", | |
"harima.hyogo.jp", | |
"himeji.hyogo.jp", | |
"ichikawa.hyogo.jp", | |
"inagawa.hyogo.jp", | |
"itami.hyogo.jp", | |
"kakogawa.hyogo.jp", | |
"kamigori.hyogo.jp", | |
"kamikawa.hyogo.jp", | |
"kasai.hyogo.jp", | |
"kasuga.hyogo.jp", | |
"kawanishi.hyogo.jp", | |
"miki.hyogo.jp", | |
"minamiawaji.hyogo.jp", | |
"nishinomiya.hyogo.jp", | |
"nishiwaki.hyogo.jp", | |
"ono.hyogo.jp", | |
"sanda.hyogo.jp", | |
"sannan.hyogo.jp", | |
"sasayama.hyogo.jp", | |
"sayo.hyogo.jp", | |
"shingu.hyogo.jp", | |
"shinonsen.hyogo.jp", | |
"shiso.hyogo.jp", | |
"sumoto.hyogo.jp", | |
"taishi.hyogo.jp", | |
"taka.hyogo.jp", | |
"takarazuka.hyogo.jp", | |
"takasago.hyogo.jp", | |
"takino.hyogo.jp", | |
"tamba.hyogo.jp", | |
"tatsuno.hyogo.jp", | |
"toyooka.hyogo.jp", | |
"yabu.hyogo.jp", | |
"yashiro.hyogo.jp", | |
"yoka.hyogo.jp", | |
"yokawa.hyogo.jp", | |
"ami.ibaraki.jp", | |
"asahi.ibaraki.jp", | |
"bando.ibaraki.jp", | |
"chikusei.ibaraki.jp", | |
"daigo.ibaraki.jp", | |
"fujishiro.ibaraki.jp", | |
"hitachi.ibaraki.jp", | |
"hitachinaka.ibaraki.jp", | |
"hitachiomiya.ibaraki.jp", | |
"hitachiota.ibaraki.jp", | |
"ibaraki.ibaraki.jp", | |
"ina.ibaraki.jp", | |
"inashiki.ibaraki.jp", | |
"itako.ibaraki.jp", | |
"iwama.ibaraki.jp", | |
"joso.ibaraki.jp", | |
"kamisu.ibaraki.jp", | |
"kasama.ibaraki.jp", | |
"kashima.ibaraki.jp", | |
"kasumigaura.ibaraki.jp", | |
"koga.ibaraki.jp", | |
"miho.ibaraki.jp", | |
"mito.ibaraki.jp", | |
"moriya.ibaraki.jp", | |
"naka.ibaraki.jp", | |
"namegata.ibaraki.jp", | |
"oarai.ibaraki.jp", | |
"ogawa.ibaraki.jp", | |
"omitama.ibaraki.jp", | |
"ryugasaki.ibaraki.jp", | |
"sakai.ibaraki.jp", | |
"sakuragawa.ibaraki.jp", | |
"shimodate.ibaraki.jp", | |
"shimotsuma.ibaraki.jp", | |
"shirosato.ibaraki.jp", | |
"sowa.ibaraki.jp", | |
"suifu.ibaraki.jp", | |
"takahagi.ibaraki.jp", | |
"tamatsukuri.ibaraki.jp", | |
"tokai.ibaraki.jp", | |
"tomobe.ibaraki.jp", | |
"tone.ibaraki.jp", | |
"toride.ibaraki.jp", | |
"tsuchiura.ibaraki.jp", | |
"tsukuba.ibaraki.jp", | |
"uchihara.ibaraki.jp", | |
"ushiku.ibaraki.jp", | |
"yachiyo.ibaraki.jp", | |
"yamagata.ibaraki.jp", | |
"yawara.ibaraki.jp", | |
"yuki.ibaraki.jp", | |
"anamizu.ishikawa.jp", | |
"hakui.ishikawa.jp", | |
"hakusan.ishikawa.jp", | |
"kaga.ishikawa.jp", | |
"kahoku.ishikawa.jp", | |
"kanazawa.ishikawa.jp", | |
"kawakita.ishikawa.jp", | |
"komatsu.ishikawa.jp", | |
"nakanoto.ishikawa.jp", | |
"nanao.ishikawa.jp", | |
"nomi.ishikawa.jp", | |
"nonoichi.ishikawa.jp", | |
"noto.ishikawa.jp", | |
"shika.ishikawa.jp", | |
"suzu.ishikawa.jp", | |
"tsubata.ishikawa.jp", | |
"tsurugi.ishikawa.jp", | |
"uchinada.ishikawa.jp", | |
"wajima.ishikawa.jp", | |
"fudai.iwate.jp", | |
"fujisawa.iwate.jp", | |
"hanamaki.iwate.jp", | |
"hiraizumi.iwate.jp", | |
"hirono.iwate.jp", | |
"ichinohe.iwate.jp", | |
"ichinoseki.iwate.jp", | |
"iwaizumi.iwate.jp", | |
"iwate.iwate.jp", | |
"joboji.iwate.jp", | |
"kamaishi.iwate.jp", | |
"kanegasaki.iwate.jp", | |
"karumai.iwate.jp", | |
"kawai.iwate.jp", | |
"kitakami.iwate.jp", | |
"kuji.iwate.jp", | |
"kunohe.iwate.jp", | |
"kuzumaki.iwate.jp", | |
"miyako.iwate.jp", | |
"mizusawa.iwate.jp", | |
"morioka.iwate.jp", | |
"ninohe.iwate.jp", | |
"noda.iwate.jp", | |
"ofunato.iwate.jp", | |
"oshu.iwate.jp", | |
"otsuchi.iwate.jp", | |
"rikuzentakata.iwate.jp", | |
"shiwa.iwate.jp", | |
"shizukuishi.iwate.jp", | |
"sumita.iwate.jp", | |
"tanohata.iwate.jp", | |
"tono.iwate.jp", | |
"yahaba.iwate.jp", | |
"yamada.iwate.jp", | |
"ayagawa.kagawa.jp", | |
"higashikagawa.kagawa.jp", | |
"kanonji.kagawa.jp", | |
"kotohira.kagawa.jp", | |
"manno.kagawa.jp", | |
"marugame.kagawa.jp", | |
"mitoyo.kagawa.jp", | |
"naoshima.kagawa.jp", | |
"sanuki.kagawa.jp", | |
"tadotsu.kagawa.jp", | |
"takamatsu.kagawa.jp", | |
"tonosho.kagawa.jp", | |
"uchinomi.kagawa.jp", | |
"utazu.kagawa.jp", | |
"zentsuji.kagawa.jp", | |
"akune.kagoshima.jp", | |
"amami.kagoshima.jp", | |
"hioki.kagoshima.jp", | |
"isa.kagoshima.jp", | |
"isen.kagoshima.jp", | |
"izumi.kagoshima.jp", | |
"kagoshima.kagoshima.jp", | |
"kanoya.kagoshima.jp", | |
"kawanabe.kagoshima.jp", | |
"kinko.kagoshima.jp", | |
"kouyama.kagoshima.jp", | |
"makurazaki.kagoshima.jp", | |
"matsumoto.kagoshima.jp", | |
"minamitane.kagoshima.jp", | |
"nakatane.kagoshima.jp", | |
"nishinoomote.kagoshima.jp", | |
"satsumasendai.kagoshima.jp", | |
"soo.kagoshima.jp", | |
"tarumizu.kagoshima.jp", | |
"yusui.kagoshima.jp", | |
"aikawa.kanagawa.jp", | |
"atsugi.kanagawa.jp", | |
"ayase.kanagawa.jp", | |
"chigasaki.kanagawa.jp", | |
"ebina.kanagawa.jp", | |
"fujisawa.kanagawa.jp", | |
"hadano.kanagawa.jp", | |
"hakone.kanagawa.jp", | |
"hiratsuka.kanagawa.jp", | |
"isehara.kanagawa.jp", | |
"kaisei.kanagawa.jp", | |
"kamakura.kanagawa.jp", | |
"kiyokawa.kanagawa.jp", | |
"matsuda.kanagawa.jp", | |
"minamiashigara.kanagawa.jp", | |
"miura.kanagawa.jp", | |
"nakai.kanagawa.jp", | |
"ninomiya.kanagawa.jp", | |
"odawara.kanagawa.jp", | |
"oi.kanagawa.jp", | |
"oiso.kanagawa.jp", | |
"sagamihara.kanagawa.jp", | |
"samukawa.kanagawa.jp", | |
"tsukui.kanagawa.jp", | |
"yamakita.kanagawa.jp", | |
"yamato.kanagawa.jp", | |
"yokosuka.kanagawa.jp", | |
"yugawara.kanagawa.jp", | |
"zama.kanagawa.jp", | |
"zushi.kanagawa.jp", | |
"aki.kochi.jp", | |
"geisei.kochi.jp", | |
"hidaka.kochi.jp", | |
"higashitsuno.kochi.jp", | |
"ino.kochi.jp", | |
"kagami.kochi.jp", | |
"kami.kochi.jp", | |
"kitagawa.kochi.jp", | |
"kochi.kochi.jp", | |
"mihara.kochi.jp", | |
"motoyama.kochi.jp", | |
"muroto.kochi.jp", | |
"nahari.kochi.jp", | |
"nakamura.kochi.jp", | |
"nankoku.kochi.jp", | |
"nishitosa.kochi.jp", | |
"niyodogawa.kochi.jp", | |
"ochi.kochi.jp", | |
"okawa.kochi.jp", | |
"otoyo.kochi.jp", | |
"otsuki.kochi.jp", | |
"sakawa.kochi.jp", | |
"sukumo.kochi.jp", | |
"susaki.kochi.jp", | |
"tosa.kochi.jp", | |
"tosashimizu.kochi.jp", | |
"toyo.kochi.jp", | |
"tsuno.kochi.jp", | |
"umaji.kochi.jp", | |
"yasuda.kochi.jp", | |
"yusuhara.kochi.jp", | |
"amakusa.kumamoto.jp", | |
"arao.kumamoto.jp", | |
"aso.kumamoto.jp", | |
"choyo.kumamoto.jp", | |
"gyokuto.kumamoto.jp", | |
"kamiamakusa.kumamoto.jp", | |
"kikuchi.kumamoto.jp", | |
"kumamoto.kumamoto.jp", | |
"mashiki.kumamoto.jp", | |
"mifune.kumamoto.jp", | |
"minamata.kumamoto.jp", | |
"minamioguni.kumamoto.jp", | |
"nagasu.kumamoto.jp", | |
"nishihara.kumamoto.jp", | |
"oguni.kumamoto.jp", | |
"ozu.kumamoto.jp", | |
"sumoto.kumamoto.jp", | |
"takamori.kumamoto.jp", | |
"uki.kumamoto.jp", | |
"uto.kumamoto.jp", | |
"yamaga.kumamoto.jp", | |
"yamato.kumamoto.jp", | |
"yatsushiro.kumamoto.jp", | |
"ayabe.kyoto.jp", | |
"fukuchiyama.kyoto.jp", | |
"higashiyama.kyoto.jp", | |
"ide.kyoto.jp", | |
"ine.kyoto.jp", | |
"joyo.kyoto.jp", | |
"kameoka.kyoto.jp", | |
"kamo.kyoto.jp", | |
"kita.kyoto.jp", | |
"kizu.kyoto.jp", | |
"kumiyama.kyoto.jp", | |
"kyotamba.kyoto.jp", | |
"kyotanabe.kyoto.jp", | |
"kyotango.kyoto.jp", | |
"maizuru.kyoto.jp", | |
"minami.kyoto.jp", | |
"minamiyamashiro.kyoto.jp", | |
"miyazu.kyoto.jp", | |
"muko.kyoto.jp", | |
"nagaokakyo.kyoto.jp", | |
"nakagyo.kyoto.jp", | |
"nantan.kyoto.jp", | |
"oyamazaki.kyoto.jp", | |
"sakyo.kyoto.jp", | |
"seika.kyoto.jp", | |
"tanabe.kyoto.jp", | |
"uji.kyoto.jp", | |
"ujitawara.kyoto.jp", | |
"wazuka.kyoto.jp", | |
"yamashina.kyoto.jp", | |
"yawata.kyoto.jp", | |
"asahi.mie.jp", | |
"inabe.mie.jp", | |
"ise.mie.jp", | |
"kameyama.mie.jp", | |
"kawagoe.mie.jp", | |
"kiho.mie.jp", | |
"kisosaki.mie.jp", | |
"kiwa.mie.jp", | |
"komono.mie.jp", | |
"kumano.mie.jp", | |
"kuwana.mie.jp", | |
"matsusaka.mie.jp", | |
"meiwa.mie.jp", | |
"mihama.mie.jp", | |
"minamiise.mie.jp", | |
"misugi.mie.jp", | |
"miyama.mie.jp", | |
"nabari.mie.jp", | |
"shima.mie.jp", | |
"suzuka.mie.jp", | |
"tado.mie.jp", | |
"taiki.mie.jp", | |
"taki.mie.jp", | |
"tamaki.mie.jp", | |
"toba.mie.jp", | |
"tsu.mie.jp", | |
"udono.mie.jp", | |
"ureshino.mie.jp", | |
"watarai.mie.jp", | |
"yokkaichi.mie.jp", | |
"furukawa.miyagi.jp", | |
"higashimatsushima.miyagi.jp", | |
"ishinomaki.miyagi.jp", | |
"iwanuma.miyagi.jp", | |
"kakuda.miyagi.jp", | |
"kami.miyagi.jp", | |
"kawasaki.miyagi.jp", | |
"marumori.miyagi.jp", | |
"matsushima.miyagi.jp", | |
"minamisanriku.miyagi.jp", | |
"misato.miyagi.jp", | |
"murata.miyagi.jp", | |
"natori.miyagi.jp", | |
"ogawara.miyagi.jp", | |
"ohira.miyagi.jp", | |
"onagawa.miyagi.jp", | |
"osaki.miyagi.jp", | |
"rifu.miyagi.jp", | |
"semine.miyagi.jp", | |
"shibata.miyagi.jp", | |
"shichikashuku.miyagi.jp", | |
"shikama.miyagi.jp", | |
"shiogama.miyagi.jp", | |
"shiroishi.miyagi.jp", | |
"tagajo.miyagi.jp", | |
"taiwa.miyagi.jp", | |
"tome.miyagi.jp", | |
"tomiya.miyagi.jp", | |
"wakuya.miyagi.jp", | |
"watari.miyagi.jp", | |
"yamamoto.miyagi.jp", | |
"zao.miyagi.jp", | |
"aya.miyazaki.jp", | |
"ebino.miyazaki.jp", | |
"gokase.miyazaki.jp", | |
"hyuga.miyazaki.jp", | |
"kadogawa.miyazaki.jp", | |
"kawaminami.miyazaki.jp", | |
"kijo.miyazaki.jp", | |
"kitagawa.miyazaki.jp", | |
"kitakata.miyazaki.jp", | |
"kitaura.miyazaki.jp", | |
"kobayashi.miyazaki.jp", | |
"kunitomi.miyazaki.jp", | |
"kushima.miyazaki.jp", | |
"mimata.miyazaki.jp", | |
"miyakonojo.miyazaki.jp", | |
"miyazaki.miyazaki.jp", | |
"morotsuka.miyazaki.jp", | |
"nichinan.miyazaki.jp", | |
"nishimera.miyazaki.jp", | |
"nobeoka.miyazaki.jp", | |
"saito.miyazaki.jp", | |
"shiiba.miyazaki.jp", | |
"shintomi.miyazaki.jp", | |
"takaharu.miyazaki.jp", | |
"takanabe.miyazaki.jp", | |
"takazaki.miyazaki.jp", | |
"tsuno.miyazaki.jp", | |
"achi.nagano.jp", | |
"agematsu.nagano.jp", | |
"anan.nagano.jp", | |
"aoki.nagano.jp", | |
"asahi.nagano.jp", | |
"azumino.nagano.jp", | |
"chikuhoku.nagano.jp", | |
"chikuma.nagano.jp", | |
"chino.nagano.jp", | |
"fujimi.nagano.jp", | |
"hakuba.nagano.jp", | |
"hara.nagano.jp", | |
"hiraya.nagano.jp", | |
"iida.nagano.jp", | |
"iijima.nagano.jp", | |
"iiyama.nagano.jp", | |
"iizuna.nagano.jp", | |
"ikeda.nagano.jp", | |
"ikusaka.nagano.jp", | |
"ina.nagano.jp", | |
"karuizawa.nagano.jp", | |
"kawakami.nagano.jp", | |
"kiso.nagano.jp", | |
"kisofukushima.nagano.jp", | |
"kitaaiki.nagano.jp", | |
"komagane.nagano.jp", | |
"komoro.nagano.jp", | |
"matsukawa.nagano.jp", | |
"matsumoto.nagano.jp", | |
"miasa.nagano.jp", | |
"minamiaiki.nagano.jp", | |
"minamimaki.nagano.jp", | |
"minamiminowa.nagano.jp", | |
"minowa.nagano.jp", | |
"miyada.nagano.jp", | |
"miyota.nagano.jp", | |
"mochizuki.nagano.jp", | |
"nagano.nagano.jp", | |
"nagawa.nagano.jp", | |
"nagiso.nagano.jp", | |
"nakagawa.nagano.jp", | |
"nakano.nagano.jp", | |
"nozawaonsen.nagano.jp", | |
"obuse.nagano.jp", | |
"ogawa.nagano.jp", | |
"okaya.nagano.jp", | |
"omachi.nagano.jp", | |
"omi.nagano.jp", | |
"ookuwa.nagano.jp", | |
"ooshika.nagano.jp", | |
"otaki.nagano.jp", | |
"otari.nagano.jp", | |
"sakae.nagano.jp", | |
"sakaki.nagano.jp", | |
"saku.nagano.jp", | |
"sakuho.nagano.jp", | |
"shimosuwa.nagano.jp", | |
"shinanomachi.nagano.jp", | |
"shiojiri.nagano.jp", | |
"suwa.nagano.jp", | |
"suzaka.nagano.jp", | |
"takagi.nagano.jp", | |
"takamori.nagano.jp", | |
"takayama.nagano.jp", | |
"tateshina.nagano.jp", | |
"tatsuno.nagano.jp", | |
"togakushi.nagano.jp", | |
"togura.nagano.jp", | |
"tomi.nagano.jp", | |
"ueda.nagano.jp", | |
"wada.nagano.jp", | |
"yamagata.nagano.jp", | |
"yamanouchi.nagano.jp", | |
"yasaka.nagano.jp", | |
"yasuoka.nagano.jp", | |
"chijiwa.nagasaki.jp", | |
"futsu.nagasaki.jp", | |
"goto.nagasaki.jp", | |
"hasami.nagasaki.jp", | |
"hirado.nagasaki.jp", | |
"iki.nagasaki.jp", | |
"isahaya.nagasaki.jp", | |
"kawatana.nagasaki.jp", | |
"kuchinotsu.nagasaki.jp", | |
"matsuura.nagasaki.jp", | |
"nagasaki.nagasaki.jp", | |
"obama.nagasaki.jp", | |
"omura.nagasaki.jp", | |
"oseto.nagasaki.jp", | |
"saikai.nagasaki.jp", | |
"sasebo.nagasaki.jp", | |
"seihi.nagasaki.jp", | |
"shimabara.nagasaki.jp", | |
"shinkamigoto.nagasaki.jp", | |
"togitsu.nagasaki.jp", | |
"tsushima.nagasaki.jp", | |
"unzen.nagasaki.jp", | |
"ando.nara.jp", | |
"gose.nara.jp", | |
"heguri.nara.jp", | |
"higashiyoshino.nara.jp", | |
"ikaruga.nara.jp", | |
"ikoma.nara.jp", | |
"kamikitayama.nara.jp", | |
"kanmaki.nara.jp", | |
"kashiba.nara.jp", | |
"kashihara.nara.jp", | |
"katsuragi.nara.jp", | |
"kawai.nara.jp", | |
"kawakami.nara.jp", | |
"kawanishi.nara.jp", | |
"koryo.nara.jp", | |
"kurotaki.nara.jp", | |
"mitsue.nara.jp", | |
"miyake.nara.jp", | |
"nara.nara.jp", | |
"nosegawa.nara.jp", | |
"oji.nara.jp", | |
"ouda.nara.jp", | |
"oyodo.nara.jp", | |
"sakurai.nara.jp", | |
"sango.nara.jp", | |
"shimoichi.nara.jp", | |
"shimokitayama.nara.jp", | |
"shinjo.nara.jp", | |
"soni.nara.jp", | |
"takatori.nara.jp", | |
"tawaramoto.nara.jp", | |
"tenkawa.nara.jp", | |
"tenri.nara.jp", | |
"uda.nara.jp", | |
"yamatokoriyama.nara.jp", | |
"yamatotakada.nara.jp", | |
"yamazoe.nara.jp", | |
"yoshino.nara.jp", | |
"aga.niigata.jp", | |
"agano.niigata.jp", | |
"gosen.niigata.jp", | |
"itoigawa.niigata.jp", | |
"izumozaki.niigata.jp", | |
"joetsu.niigata.jp", | |
"kamo.niigata.jp", | |
"kariwa.niigata.jp", | |
"kashiwazaki.niigata.jp", | |
"minamiuonuma.niigata.jp", | |
"mitsuke.niigata.jp", | |
"muika.niigata.jp", | |
"murakami.niigata.jp", | |
"myoko.niigata.jp", | |
"nagaoka.niigata.jp", | |
"niigata.niigata.jp", | |
"ojiya.niigata.jp", | |
"omi.niigata.jp", | |
"sado.niigata.jp", | |
"sanjo.niigata.jp", | |
"seiro.niigata.jp", | |
"seirou.niigata.jp", | |
"sekikawa.niigata.jp", | |
"shibata.niigata.jp", | |
"tagami.niigata.jp", | |
"tainai.niigata.jp", | |
"tochio.niigata.jp", | |
"tokamachi.niigata.jp", | |
"tsubame.niigata.jp", | |
"tsunan.niigata.jp", | |
"uonuma.niigata.jp", | |
"yahiko.niigata.jp", | |
"yoita.niigata.jp", | |
"yuzawa.niigata.jp", | |
"beppu.oita.jp", | |
"bungoono.oita.jp", | |
"bungotakada.oita.jp", | |
"hasama.oita.jp", | |
"hiji.oita.jp", | |
"himeshima.oita.jp", | |
"hita.oita.jp", | |
"kamitsue.oita.jp", | |
"kokonoe.oita.jp", | |
"kuju.oita.jp", | |
"kunisaki.oita.jp", | |
"kusu.oita.jp", | |
"oita.oita.jp", | |
"saiki.oita.jp", | |
"taketa.oita.jp", | |
"tsukumi.oita.jp", | |
"usa.oita.jp", | |
"usuki.oita.jp", | |
"yufu.oita.jp", | |
"akaiwa.okayama.jp", | |
"asakuchi.okayama.jp", | |
"bizen.okayama.jp", | |
"hayashima.okayama.jp", | |
"ibara.okayama.jp", | |
"kagamino.okayama.jp", | |
"kasaoka.okayama.jp", | |
"kibichuo.okayama.jp", | |
"kumenan.okayama.jp", | |
"kurashiki.okayama.jp", | |
"maniwa.okayama.jp", | |
"misaki.okayama.jp", | |
"nagi.okayama.jp", | |
"niimi.okayama.jp", | |
"nishiawakura.okayama.jp", | |
"okayama.okayama.jp", | |
"satosho.okayama.jp", | |
"setouchi.okayama.jp", | |
"shinjo.okayama.jp", | |
"shoo.okayama.jp", | |
"soja.okayama.jp", | |
"takahashi.okayama.jp", | |
"tamano.okayama.jp", | |
"tsuyama.okayama.jp", | |
"wake.okayama.jp", | |
"yakage.okayama.jp", | |
"aguni.okinawa.jp", | |
"ginowan.okinawa.jp", | |
"ginoza.okinawa.jp", | |
"gushikami.okinawa.jp", | |
"haebaru.okinawa.jp", | |
"higashi.okinawa.jp", | |
"hirara.okinawa.jp", | |
"iheya.okinawa.jp", | |
"ishigaki.okinawa.jp", | |
"ishikawa.okinawa.jp", | |
"itoman.okinawa.jp", | |
"izena.okinawa.jp", | |
"kadena.okinawa.jp", | |
"kin.okinawa.jp", | |
"kitadaito.okinawa.jp", | |
"kitanakagusuku.okinawa.jp", | |
"kumejima.okinawa.jp", | |
"kunigami.okinawa.jp", | |
"minamidaito.okinawa.jp", | |
"motobu.okinawa.jp", | |
"nago.okinawa.jp", | |
"naha.okinawa.jp", | |
"nakagusuku.okinawa.jp", | |
"nakijin.okinawa.jp", | |
"nanjo.okinawa.jp", | |
"nishihara.okinawa.jp", | |
"ogimi.okinawa.jp", | |
"okinawa.okinawa.jp", | |
"onna.okinawa.jp", | |
"shimoji.okinawa.jp", | |
"taketomi.okinawa.jp", | |
"tarama.okinawa.jp", | |
"tokashiki.okinawa.jp", | |
"tomigusuku.okinawa.jp", | |
"tonaki.okinawa.jp", | |
"urasoe.okinawa.jp", | |
"uruma.okinawa.jp", | |
"yaese.okinawa.jp", | |
"yomitan.okinawa.jp", | |
"yonabaru.okinawa.jp", | |
"yonaguni.okinawa.jp", | |
"zamami.okinawa.jp", | |
"abeno.osaka.jp", | |
"chihayaakasaka.osaka.jp", | |
"chuo.osaka.jp", | |
"daito.osaka.jp", | |
"fujiidera.osaka.jp", | |
"habikino.osaka.jp", | |
"hannan.osaka.jp", | |
"higashiosaka.osaka.jp", | |
"higashisumiyoshi.osaka.jp", | |
"higashiyodogawa.osaka.jp", | |
"hirakata.osaka.jp", | |
"ibaraki.osaka.jp", | |
"ikeda.osaka.jp", | |
"izumi.osaka.jp", | |
"izumiotsu.osaka.jp", | |
"izumisano.osaka.jp", | |
"kadoma.osaka.jp", | |
"kaizuka.osaka.jp", | |
"kanan.osaka.jp", | |
"kashiwara.osaka.jp", | |
"katano.osaka.jp", | |
"kawachinagano.osaka.jp", | |
"kishiwada.osaka.jp", | |
"kita.osaka.jp", | |
"kumatori.osaka.jp", | |
"matsubara.osaka.jp", | |
"minato.osaka.jp", | |
"minoh.osaka.jp", | |
"misaki.osaka.jp", | |
"moriguchi.osaka.jp", | |
"neyagawa.osaka.jp", | |
"nishi.osaka.jp", | |
"nose.osaka.jp", | |
"osakasayama.osaka.jp", | |
"sakai.osaka.jp", | |
"sayama.osaka.jp", | |
"sennan.osaka.jp", | |
"settsu.osaka.jp", | |
"shijonawate.osaka.jp", | |
"shimamoto.osaka.jp", | |
"suita.osaka.jp", | |
"tadaoka.osaka.jp", | |
"taishi.osaka.jp", | |
"tajiri.osaka.jp", | |
"takaishi.osaka.jp", | |
"takatsuki.osaka.jp", | |
"tondabayashi.osaka.jp", | |
"toyonaka.osaka.jp", | |
"toyono.osaka.jp", | |
"yao.osaka.jp", | |
"ariake.saga.jp", | |
"arita.saga.jp", | |
"fukudomi.saga.jp", | |
"genkai.saga.jp", | |
"hamatama.saga.jp", | |
"hizen.saga.jp", | |
"imari.saga.jp", | |
"kamimine.saga.jp", | |
"kanzaki.saga.jp", | |
"karatsu.saga.jp", | |
"kashima.saga.jp", | |
"kitagata.saga.jp", | |
"kitahata.saga.jp", | |
"kiyama.saga.jp", | |
"kouhoku.saga.jp", | |
"kyuragi.saga.jp", | |
"nishiarita.saga.jp", | |
"ogi.saga.jp", | |
"omachi.saga.jp", | |
"ouchi.saga.jp", | |
"saga.saga.jp", | |
"shiroishi.saga.jp", | |
"taku.saga.jp", | |
"tara.saga.jp", | |
"tosu.saga.jp", | |
"yoshinogari.saga.jp", | |
"arakawa.saitama.jp", | |
"asaka.saitama.jp", | |
"chichibu.saitama.jp", | |
"fujimi.saitama.jp", | |
"fujimino.saitama.jp", | |
"fukaya.saitama.jp", | |
"hanno.saitama.jp", | |
"hanyu.saitama.jp", | |
"hasuda.saitama.jp", | |
"hatogaya.saitama.jp", | |
"hatoyama.saitama.jp", | |
"hidaka.saitama.jp", | |
"higashichichibu.saitama.jp", | |
"higashimatsuyama.saitama.jp", | |
"honjo.saitama.jp", | |
"ina.saitama.jp", | |
"iruma.saitama.jp", | |
"iwatsuki.saitama.jp", | |
"kamiizumi.saitama.jp", | |
"kamikawa.saitama.jp", | |
"kamisato.saitama.jp", | |
"kasukabe.saitama.jp", | |
"kawagoe.saitama.jp", | |
"kawaguchi.saitama.jp", | |
"kawajima.saitama.jp", | |
"kazo.saitama.jp", | |
"kitamoto.saitama.jp", | |
"koshigaya.saitama.jp", | |
"kounosu.saitama.jp", | |
"kuki.saitama.jp", | |
"kumagaya.saitama.jp", | |
"matsubushi.saitama.jp", | |
"minano.saitama.jp", | |
"misato.saitama.jp", | |
"miyashiro.saitama.jp", | |
"miyoshi.saitama.jp", | |
"moroyama.saitama.jp", | |
"nagatoro.saitama.jp", | |
"namegawa.saitama.jp", | |
"niiza.saitama.jp", | |
"ogano.saitama.jp", | |
"ogawa.saitama.jp", | |
"ogose.saitama.jp", | |
"okegawa.saitama.jp", | |
"omiya.saitama.jp", | |
"otaki.saitama.jp", | |
"ranzan.saitama.jp", | |
"ryokami.saitama.jp", | |
"saitama.saitama.jp", | |
"sakado.saitama.jp", | |
"satte.saitama.jp", | |
"sayama.saitama.jp", | |
"shiki.saitama.jp", | |
"shiraoka.saitama.jp", | |
"soka.saitama.jp", | |
"sugito.saitama.jp", | |
"toda.saitama.jp", | |
"tokigawa.saitama.jp", | |
"tokorozawa.saitama.jp", | |
"tsurugashima.saitama.jp", | |
"urawa.saitama.jp", | |
"warabi.saitama.jp", | |
"yashio.saitama.jp", | |
"yokoze.saitama.jp", | |
"yono.saitama.jp", | |
"yorii.saitama.jp", | |
"yoshida.saitama.jp", | |
"yoshikawa.saitama.jp", | |
"yoshimi.saitama.jp", | |
"aisho.shiga.jp", | |
"gamo.shiga.jp", | |
"higashiomi.shiga.jp", | |
"hikone.shiga.jp", | |
"koka.shiga.jp", | |
"konan.shiga.jp", | |
"kosei.shiga.jp", | |
"koto.shiga.jp", | |
"kusatsu.shiga.jp", | |
"maibara.shiga.jp", | |
"moriyama.shiga.jp", | |
"nagahama.shiga.jp", | |
"nishiazai.shiga.jp", | |
"notogawa.shiga.jp", | |
"omihachiman.shiga.jp", | |
"otsu.shiga.jp", | |
"ritto.shiga.jp", | |
"ryuoh.shiga.jp", | |
"takashima.shiga.jp", | |
"takatsuki.shiga.jp", | |
"torahime.shiga.jp", | |
"toyosato.shiga.jp", | |
"yasu.shiga.jp", | |
"akagi.shimane.jp", | |
"ama.shimane.jp", | |
"gotsu.shimane.jp", | |
"hamada.shimane.jp", | |
"higashiizumo.shimane.jp", | |
"hikawa.shimane.jp", | |
"hikimi.shimane.jp", | |
"izumo.shimane.jp", | |
"kakinoki.shimane.jp", | |
"masuda.shimane.jp", | |
"matsue.shimane.jp", | |
"misato.shimane.jp", | |
"nishinoshima.shimane.jp", | |
"ohda.shimane.jp", | |
"okinoshima.shimane.jp", | |
"okuizumo.shimane.jp", | |
"shimane.shimane.jp", | |
"tamayu.shimane.jp", | |
"tsuwano.shimane.jp", | |
"unnan.shimane.jp", | |
"yakumo.shimane.jp", | |
"yasugi.shimane.jp", | |
"yatsuka.shimane.jp", | |
"arai.shizuoka.jp", | |
"atami.shizuoka.jp", | |
"fuji.shizuoka.jp", | |
"fujieda.shizuoka.jp", | |
"fujikawa.shizuoka.jp", | |
"fujinomiya.shizuoka.jp", | |
"fukuroi.shizuoka.jp", | |
"gotemba.shizuoka.jp", | |
"haibara.shizuoka.jp", | |
"hamamatsu.shizuoka.jp", | |
"higashiizu.shizuoka.jp", | |
"ito.shizuoka.jp", | |
"iwata.shizuoka.jp", | |
"izu.shizuoka.jp", | |
"izunokuni.shizuoka.jp", | |
"kakegawa.shizuoka.jp", | |
"kannami.shizuoka.jp", | |
"kawanehon.shizuoka.jp", | |
"kawazu.shizuoka.jp", | |
"kikugawa.shizuoka.jp", | |
"kosai.shizuoka.jp", | |
"makinohara.shizuoka.jp", | |
"matsuzaki.shizuoka.jp", | |
"minamiizu.shizuoka.jp", | |
"mishima.shizuoka.jp", | |
"morimachi.shizuoka.jp", | |
"nishiizu.shizuoka.jp", | |
"numazu.shizuoka.jp", | |
"omaezaki.shizuoka.jp", | |
"shimada.shizuoka.jp", | |
"shimizu.shizuoka.jp", | |
"shimoda.shizuoka.jp", | |
"shizuoka.shizuoka.jp", | |
"susono.shizuoka.jp", | |
"yaizu.shizuoka.jp", | |
"yoshida.shizuoka.jp", | |
"ashikaga.tochigi.jp", | |
"bato.tochigi.jp", | |
"haga.tochigi.jp", | |
"ichikai.tochigi.jp", | |
"iwafune.tochigi.jp", | |
"kaminokawa.tochigi.jp", | |
"kanuma.tochigi.jp", | |
"karasuyama.tochigi.jp", | |
"kuroiso.tochigi.jp", | |
"mashiko.tochigi.jp", | |
"mibu.tochigi.jp", | |
"moka.tochigi.jp", | |
"motegi.tochigi.jp", | |
"nasu.tochigi.jp", | |
"nasushiobara.tochigi.jp", | |
"nikko.tochigi.jp", | |
"nishikata.tochigi.jp", | |
"nogi.tochigi.jp", | |
"ohira.tochigi.jp", | |
"ohtawara.tochigi.jp", | |
"oyama.tochigi.jp", | |
"sakura.tochigi.jp", | |
"sano.tochigi.jp", | |
"shimotsuke.tochigi.jp", | |
"shioya.tochigi.jp", | |
"takanezawa.tochigi.jp", | |
"tochigi.tochigi.jp", | |
"tsuga.tochigi.jp", | |
"ujiie.tochigi.jp", | |
"utsunomiya.tochigi.jp", | |
"yaita.tochigi.jp", | |
"aizumi.tokushima.jp", | |
"anan.tokushima.jp", | |
"ichiba.tokushima.jp", | |
"itano.tokushima.jp", | |
"kainan.tokushima.jp", | |
"komatsushima.tokushima.jp", | |
"matsushige.tokushima.jp", | |
"mima.tokushima.jp", | |
"minami.tokushima.jp", | |
"miyoshi.tokushima.jp", | |
"mugi.tokushima.jp", | |
"nakagawa.tokushima.jp", | |
"naruto.tokushima.jp", | |
"sanagochi.tokushima.jp", | |
"shishikui.tokushima.jp", | |
"tokushima.tokushima.jp", | |
"wajiki.tokushima.jp", | |
"adachi.tokyo.jp", | |
"akiruno.tokyo.jp", | |
"akishima.tokyo.jp", | |
"aogashima.tokyo.jp", | |
"arakawa.tokyo.jp", | |
"bunkyo.tokyo.jp", | |
"chiyoda.tokyo.jp", | |
"chofu.tokyo.jp", | |
"chuo.tokyo.jp", | |
"edogawa.tokyo.jp", | |
"fuchu.tokyo.jp", | |
"fussa.tokyo.jp", | |
"hachijo.tokyo.jp", | |
"hachioji.tokyo.jp", | |
"hamura.tokyo.jp", | |
"higashikurume.tokyo.jp", | |
"higashimurayama.tokyo.jp", | |
"higashiyamato.tokyo.jp", | |
"hino.tokyo.jp", | |
"hinode.tokyo.jp", | |
"hinohara.tokyo.jp", | |
"inagi.tokyo.jp", | |
"itabashi.tokyo.jp", | |
"katsushika.tokyo.jp", | |
"kita.tokyo.jp", | |
"kiyose.tokyo.jp", | |
"kodaira.tokyo.jp", | |
"koganei.tokyo.jp", | |
"kokubunji.tokyo.jp", | |
"komae.tokyo.jp", | |
"koto.tokyo.jp", | |
"kouzushima.tokyo.jp", | |
"kunitachi.tokyo.jp", | |
"machida.tokyo.jp", | |
"meguro.tokyo.jp", | |
"minato.tokyo.jp", | |
"mitaka.tokyo.jp", | |
"mizuho.tokyo.jp", | |
"musashimurayama.tokyo.jp", | |
"musashino.tokyo.jp", | |
"nakano.tokyo.jp", | |
"nerima.tokyo.jp", | |
"ogasawara.tokyo.jp", | |
"okutama.tokyo.jp", | |
"ome.tokyo.jp", | |
"oshima.tokyo.jp", | |
"ota.tokyo.jp", | |
"setagaya.tokyo.jp", | |
"shibuya.tokyo.jp", | |
"shinagawa.tokyo.jp", | |
"shinjuku.tokyo.jp", | |
"suginami.tokyo.jp", | |
"sumida.tokyo.jp", | |
"tachikawa.tokyo.jp", | |
"taito.tokyo.jp", | |
"tama.tokyo.jp", | |
"toshima.tokyo.jp", | |
"chizu.tottori.jp", | |
"hino.tottori.jp", | |
"kawahara.tottori.jp", | |
"koge.tottori.jp", | |
"kotoura.tottori.jp", | |
"misasa.tottori.jp", | |
"nanbu.tottori.jp", | |
"nichinan.tottori.jp", | |
"sakaiminato.tottori.jp", | |
"tottori.tottori.jp", | |
"wakasa.tottori.jp", | |
"yazu.tottori.jp", | |
"yonago.tottori.jp", | |
"asahi.toyama.jp", | |
"fuchu.toyama.jp", | |
"fukumitsu.toyama.jp", | |
"funahashi.toyama.jp", | |
"himi.toyama.jp", | |
"imizu.toyama.jp", | |
"inami.toyama.jp", | |
"johana.toyama.jp", | |
"kamiichi.toyama.jp", | |
"kurobe.toyama.jp", | |
"nakaniikawa.toyama.jp", | |
"namerikawa.toyama.jp", | |
"nanto.toyama.jp", | |
"nyuzen.toyama.jp", | |
"oyabe.toyama.jp", | |
"taira.toyama.jp", | |
"takaoka.toyama.jp", | |
"tateyama.toyama.jp", | |
"toga.toyama.jp", | |
"tonami.toyama.jp", | |
"toyama.toyama.jp", | |
"unazuki.toyama.jp", | |
"uozu.toyama.jp", | |
"yamada.toyama.jp", | |
"arida.wakayama.jp", | |
"aridagawa.wakayama.jp", | |
"gobo.wakayama.jp", | |
"hashimoto.wakayama.jp", | |
"hidaka.wakayama.jp", | |
"hirogawa.wakayama.jp", | |
"inami.wakayama.jp", | |
"iwade.wakayama.jp", | |
"kainan.wakayama.jp", | |
"kamitonda.wakayama.jp", | |
"katsuragi.wakayama.jp", | |
"kimino.wakayama.jp", | |
"kinokawa.wakayama.jp", | |
"kitayama.wakayama.jp", | |
"koya.wakayama.jp", | |
"koza.wakayama.jp", | |
"kozagawa.wakayama.jp", | |
"kudoyama.wakayama.jp", | |
"kushimoto.wakayama.jp", | |
"mihama.wakayama.jp", | |
"misato.wakayama.jp", | |
"nachikatsuura.wakayama.jp", | |
"shingu.wakayama.jp", | |
"shirahama.wakayama.jp", | |
"taiji.wakayama.jp", | |
"tanabe.wakayama.jp", | |
"wakayama.wakayama.jp", | |
"yuasa.wakayama.jp", | |
"yura.wakayama.jp", | |
"asahi.yamagata.jp", | |
"funagata.yamagata.jp", | |
"higashine.yamagata.jp", | |
"iide.yamagata.jp", | |
"kahoku.yamagata.jp", | |
"kaminoyama.yamagata.jp", | |
"kaneyama.yamagata.jp", | |
"kawanishi.yamagata.jp", | |
"mamurogawa.yamagata.jp", | |
"mikawa.yamagata.jp", | |
"murayama.yamagata.jp", | |
"nagai.yamagata.jp", | |
"nakayama.yamagata.jp", | |
"nanyo.yamagata.jp", | |
"nishikawa.yamagata.jp", | |
"obanazawa.yamagata.jp", | |
"oe.yamagata.jp", | |
"oguni.yamagata.jp", | |
"ohkura.yamagata.jp", | |
"oishida.yamagata.jp", | |
"sagae.yamagata.jp", | |
"sakata.yamagata.jp", | |
"sakegawa.yamagata.jp", | |
"shinjo.yamagata.jp", | |
"shirataka.yamagata.jp", | |
"shonai.yamagata.jp", | |
"takahata.yamagata.jp", | |
"tendo.yamagata.jp", | |
"tozawa.yamagata.jp", | |
"tsuruoka.yamagata.jp", | |
"yamagata.yamagata.jp", | |
"yamanobe.yamagata.jp", | |
"yonezawa.yamagata.jp", | |
"yuza.yamagata.jp", | |
"abu.yamaguchi.jp", | |
"hagi.yamaguchi.jp", | |
"hikari.yamaguchi.jp", | |
"hofu.yamaguchi.jp", | |
"iwakuni.yamaguchi.jp", | |
"kudamatsu.yamaguchi.jp", | |
"mitou.yamaguchi.jp", | |
"nagato.yamaguchi.jp", | |
"oshima.yamaguchi.jp", | |
"shimonoseki.yamaguchi.jp", | |
"shunan.yamaguchi.jp", | |
"tabuse.yamaguchi.jp", | |
"tokuyama.yamaguchi.jp", | |
"toyota.yamaguchi.jp", | |
"ube.yamaguchi.jp", | |
"yuu.yamaguchi.jp", | |
"chuo.yamanashi.jp", | |
"doshi.yamanashi.jp", | |
"fuefuki.yamanashi.jp", | |
"fujikawa.yamanashi.jp", | |
"fujikawaguchiko.yamanashi.jp", | |
"fujiyoshida.yamanashi.jp", | |
"hayakawa.yamanashi.jp", | |
"hokuto.yamanashi.jp", | |
"ichikawamisato.yamanashi.jp", | |
"kai.yamanashi.jp", | |
"kofu.yamanashi.jp", | |
"koshu.yamanashi.jp", | |
"kosuge.yamanashi.jp", | |
"minami-alps.yamanashi.jp", | |
"minobu.yamanashi.jp", | |
"nakamichi.yamanashi.jp", | |
"nanbu.yamanashi.jp", | |
"narusawa.yamanashi.jp", | |
"nirasaki.yamanashi.jp", | |
"nishikatsura.yamanashi.jp", | |
"oshino.yamanashi.jp", | |
"otsuki.yamanashi.jp", | |
"showa.yamanashi.jp", | |
"tabayama.yamanashi.jp", | |
"tsuru.yamanashi.jp", | |
"uenohara.yamanashi.jp", | |
"yamanakako.yamanashi.jp", | |
"yamanashi.yamanashi.jp", | |
"ke", | |
"ac.ke", | |
"co.ke", | |
"go.ke", | |
"info.ke", | |
"me.ke", | |
"mobi.ke", | |
"ne.ke", | |
"or.ke", | |
"sc.ke", | |
"kg", | |
"org.kg", | |
"net.kg", | |
"com.kg", | |
"edu.kg", | |
"gov.kg", | |
"mil.kg", | |
"*.kh", | |
"ki", | |
"edu.ki", | |
"biz.ki", | |
"net.ki", | |
"org.ki", | |
"gov.ki", | |
"info.ki", | |
"com.ki", | |
"km", | |
"org.km", | |
"nom.km", | |
"gov.km", | |
"prd.km", | |
"tm.km", | |
"edu.km", | |
"mil.km", | |
"ass.km", | |
"com.km", | |
"coop.km", | |
"asso.km", | |
"presse.km", | |
"medecin.km", | |
"notaires.km", | |
"pharmaciens.km", | |
"veterinaire.km", | |
"gouv.km", | |
"kn", | |
"net.kn", | |
"org.kn", | |
"edu.kn", | |
"gov.kn", | |
"kp", | |
"com.kp", | |
"edu.kp", | |
"gov.kp", | |
"org.kp", | |
"rep.kp", | |
"tra.kp", | |
"kr", | |
"ac.kr", | |
"co.kr", | |
"es.kr", | |
"go.kr", | |
"hs.kr", | |
"kg.kr", | |
"mil.kr", | |
"ms.kr", | |
"ne.kr", | |
"or.kr", | |
"pe.kr", | |
"re.kr", | |
"sc.kr", | |
"busan.kr", | |
"chungbuk.kr", | |
"chungnam.kr", | |
"daegu.kr", | |
"daejeon.kr", | |
"gangwon.kr", | |
"gwangju.kr", | |
"gyeongbuk.kr", | |
"gyeonggi.kr", | |
"gyeongnam.kr", | |
"incheon.kr", | |
"jeju.kr", | |
"jeonbuk.kr", | |
"jeonnam.kr", | |
"seoul.kr", | |
"ulsan.kr", | |
"kw", | |
"com.kw", | |
"edu.kw", | |
"emb.kw", | |
"gov.kw", | |
"ind.kw", | |
"net.kw", | |
"org.kw", | |
"ky", | |
"edu.ky", | |
"gov.ky", | |
"com.ky", | |
"org.ky", | |
"net.ky", | |
"kz", | |
"org.kz", | |
"edu.kz", | |
"net.kz", | |
"gov.kz", | |
"mil.kz", | |
"com.kz", | |
"la", | |
"int.la", | |
"net.la", | |
"info.la", | |
"edu.la", | |
"gov.la", | |
"per.la", | |
"com.la", | |
"org.la", | |
"lb", | |
"com.lb", | |
"edu.lb", | |
"gov.lb", | |
"net.lb", | |
"org.lb", | |
"lc", | |
"com.lc", | |
"net.lc", | |
"co.lc", | |
"org.lc", | |
"edu.lc", | |
"gov.lc", | |
"li", | |
"lk", | |
"gov.lk", | |
"sch.lk", | |
"net.lk", | |
"int.lk", | |
"com.lk", | |
"org.lk", | |
"edu.lk", | |
"ngo.lk", | |
"soc.lk", | |
"web.lk", | |
"ltd.lk", | |
"assn.lk", | |
"grp.lk", | |
"hotel.lk", | |
"ac.lk", | |
"lr", | |
"com.lr", | |
"edu.lr", | |
"gov.lr", | |
"org.lr", | |
"net.lr", | |
"ls", | |
"ac.ls", | |
"biz.ls", | |
"co.ls", | |
"edu.ls", | |
"gov.ls", | |
"info.ls", | |
"net.ls", | |
"org.ls", | |
"sc.ls", | |
"lt", | |
"gov.lt", | |
"lu", | |
"lv", | |
"com.lv", | |
"edu.lv", | |
"gov.lv", | |
"org.lv", | |
"mil.lv", | |
"id.lv", | |
"net.lv", | |
"asn.lv", | |
"conf.lv", | |
"ly", | |
"com.ly", | |
"net.ly", | |
"gov.ly", | |
"plc.ly", | |
"edu.ly", | |
"sch.ly", | |
"med.ly", | |
"org.ly", | |
"id.ly", | |
"ma", | |
"co.ma", | |
"net.ma", | |
"gov.ma", | |
"org.ma", | |
"ac.ma", | |
"press.ma", | |
"mc", | |
"tm.mc", | |
"asso.mc", | |
"md", | |
"me", | |
"co.me", | |
"net.me", | |
"org.me", | |
"edu.me", | |
"ac.me", | |
"gov.me", | |
"its.me", | |
"priv.me", | |
"mg", | |
"org.mg", | |
"nom.mg", | |
"gov.mg", | |
"prd.mg", | |
"tm.mg", | |
"edu.mg", | |
"mil.mg", | |
"com.mg", | |
"co.mg", | |
"mh", | |
"mil", | |
"mk", | |
"com.mk", | |
"org.mk", | |
"net.mk", | |
"edu.mk", | |
"gov.mk", | |
"inf.mk", | |
"name.mk", | |
"ml", | |
"com.ml", | |
"edu.ml", | |
"gouv.ml", | |
"gov.ml", | |
"net.ml", | |
"org.ml", | |
"presse.ml", | |
"*.mm", | |
"mn", | |
"gov.mn", | |
"edu.mn", | |
"org.mn", | |
"mo", | |
"com.mo", | |
"net.mo", | |
"org.mo", | |
"edu.mo", | |
"gov.mo", | |
"mobi", | |
"mp", | |
"mq", | |
"mr", | |
"gov.mr", | |
"ms", | |
"com.ms", | |
"edu.ms", | |
"gov.ms", | |
"net.ms", | |
"org.ms", | |
"mt", | |
"com.mt", | |
"edu.mt", | |
"net.mt", | |
"org.mt", | |
"mu", | |
"com.mu", | |
"net.mu", | |
"org.mu", | |
"gov.mu", | |
"ac.mu", | |
"co.mu", | |
"or.mu", | |
"museum", | |
"academy.museum", | |
"agriculture.museum", | |
"air.museum", | |
"airguard.museum", | |
"alabama.museum", | |
"alaska.museum", | |
"amber.museum", | |
"ambulance.museum", | |
"american.museum", | |
"americana.museum", | |
"americanantiques.museum", | |
"americanart.museum", | |
"amsterdam.museum", | |
"and.museum", | |
"annefrank.museum", | |
"anthro.museum", | |
"anthropology.museum", | |
"antiques.museum", | |
"aquarium.museum", | |
"arboretum.museum", | |
"archaeological.museum", | |
"archaeology.museum", | |
"architecture.museum", | |
"art.museum", | |
"artanddesign.museum", | |
"artcenter.museum", | |
"artdeco.museum", | |
"arteducation.museum", | |
"artgallery.museum", | |
"arts.museum", | |
"artsandcrafts.museum", | |
"asmatart.museum", | |
"assassination.museum", | |
"assisi.museum", | |
"association.museum", | |
"astronomy.museum", | |
"atlanta.museum", | |
"austin.museum", | |
"australia.museum", | |
"automotive.museum", | |
"aviation.museum", | |
"axis.museum", | |
"badajoz.museum", | |
"baghdad.museum", | |
"bahn.museum", | |
"bale.museum", | |
"baltimore.museum", | |
"barcelona.museum", | |
"baseball.museum", | |
"basel.museum", | |
"baths.museum", | |
"bauern.museum", | |
"beauxarts.museum", | |
"beeldengeluid.museum", | |
"bellevue.museum", | |
"bergbau.museum", | |
"berkeley.museum", | |
"berlin.museum", | |
"bern.museum", | |
"bible.museum", | |
"bilbao.museum", | |
"bill.museum", | |
"birdart.museum", | |
"birthplace.museum", | |
"bonn.museum", | |
"boston.museum", | |
"botanical.museum", | |
"botanicalgarden.museum", | |
"botanicgarden.museum", | |
"botany.museum", | |
"brandywinevalley.museum", | |
"brasil.museum", | |
"bristol.museum", | |
"british.museum", | |
"britishcolumbia.museum", | |
"broadcast.museum", | |
"brunel.museum", | |
"brussel.museum", | |
"brussels.museum", | |
"bruxelles.museum", | |
"building.museum", | |
"burghof.museum", | |
"bus.museum", | |
"bushey.museum", | |
"cadaques.museum", | |
"california.museum", | |
"cambridge.museum", | |
"can.museum", | |
"canada.museum", | |
"capebreton.museum", | |
"carrier.museum", | |
"cartoonart.museum", | |
"casadelamoneda.museum", | |
"castle.museum", | |
"castres.museum", | |
"celtic.museum", | |
"center.museum", | |
"chattanooga.museum", | |
"cheltenham.museum", | |
"chesapeakebay.museum", | |
"chicago.museum", | |
"children.museum", | |
"childrens.museum", | |
"childrensgarden.museum", | |
"chiropractic.museum", | |
"chocolate.museum", | |
"christiansburg.museum", | |
"cincinnati.museum", | |
"cinema.museum", | |
"circus.museum", | |
"civilisation.museum", | |
"civilization.museum", | |
"civilwar.museum", | |
"clinton.museum", | |
"clock.museum", | |
"coal.museum", | |
"coastaldefence.museum", | |
"cody.museum", | |
"coldwar.museum", | |
"collection.museum", | |
"colonialwilliamsburg.museum", | |
"coloradoplateau.museum", | |
"columbia.museum", | |
"columbus.museum", | |
"communication.museum", | |
"communications.museum", | |
"community.museum", | |
"computer.museum", | |
"computerhistory.museum", | |
"comunicações.museum", | |
"contemporary.museum", | |
"contemporaryart.museum", | |
"convent.museum", | |
"copenhagen.museum", | |
"corporation.museum", | |
"correios-e-telecomunicações.museum", | |
"corvette.museum", | |
"costume.museum", | |
"countryestate.museum", | |
"county.museum", | |
"crafts.museum", | |
"cranbrook.museum", | |
"creation.museum", | |
"cultural.museum", | |
"culturalcenter.museum", | |
"culture.museum", | |
"cyber.museum", | |
"cymru.museum", | |
"dali.museum", | |
"dallas.museum", | |
"database.museum", | |
"ddr.museum", | |
"decorativearts.museum", | |
"delaware.museum", | |
"delmenhorst.museum", | |
"denmark.museum", | |
"depot.museum", | |
"design.museum", | |
"detroit.museum", | |
"dinosaur.museum", | |
"discovery.museum", | |
"dolls.museum", | |
"donostia.museum", | |
"durham.museum", | |
"eastafrica.museum", | |
"eastcoast.museum", | |
"education.museum", | |
"educational.museum", | |
"egyptian.museum", | |
"eisenbahn.museum", | |
"elburg.museum", | |
"elvendrell.museum", | |
"embroidery.museum", | |
"encyclopedic.museum", | |
"england.museum", | |
"entomology.museum", | |
"environment.museum", | |
"environmentalconservation.museum", | |
"epilepsy.museum", | |
"essex.museum", | |
"estate.museum", | |
"ethnology.museum", | |
"exeter.museum", | |
"exhibition.museum", | |
"family.museum", | |
"farm.museum", | |
"farmequipment.museum", | |
"farmers.museum", | |
"farmstead.museum", | |
"field.museum", | |
"figueres.museum", | |
"filatelia.museum", | |
"film.museum", | |
"fineart.museum", | |
"finearts.museum", | |
"finland.museum", | |
"flanders.museum", | |
"florida.museum", | |
"force.museum", | |
"fortmissoula.museum", | |
"fortworth.museum", | |
"foundation.museum", | |
"francaise.museum", | |
"frankfurt.museum", | |
"franziskaner.museum", | |
"freemasonry.museum", | |
"freiburg.museum", | |
"fribourg.museum", | |
"frog.museum", | |
"fundacio.museum", | |
"furniture.museum", | |
"gallery.museum", | |
"garden.museum", | |
"gateway.museum", | |
"geelvinck.museum", | |
"gemological.museum", | |
"geology.museum", | |
"georgia.museum", | |
"giessen.museum", | |
"glas.museum", | |
"glass.museum", | |
"gorge.museum", | |
"grandrapids.museum", | |
"graz.museum", | |
"guernsey.museum", | |
"halloffame.museum", | |
"hamburg.museum", | |
"handson.museum", | |
"harvestcelebration.museum", | |
"hawaii.museum", | |
"health.museum", | |
"heimatunduhren.museum", | |
"hellas.museum", | |
"helsinki.museum", | |
"hembygdsforbund.museum", | |
"heritage.museum", | |
"histoire.museum", | |
"historical.museum", | |
"historicalsociety.museum", | |
"historichouses.museum", | |
"historisch.museum", | |
"historisches.museum", | |
"history.museum", | |
"historyofscience.museum", | |
"horology.museum", | |
"house.museum", | |
"humanities.museum", | |
"illustration.museum", | |
"imageandsound.museum", | |
"indian.museum", | |
"indiana.museum", | |
"indianapolis.museum", | |
"indianmarket.museum", | |
"intelligence.museum", | |
"interactive.museum", | |
"iraq.museum", | |
"iron.museum", | |
"isleofman.museum", | |
"jamison.museum", | |
"jefferson.museum", | |
"jerusalem.museum", | |
"jewelry.museum", | |
"jewish.museum", | |
"jewishart.museum", | |
"jfk.museum", | |
"journalism.museum", | |
"judaica.museum", | |
"judygarland.museum", | |
"juedisches.museum", | |
"juif.museum", | |
"karate.museum", | |
"karikatur.museum", | |
"kids.museum", | |
"koebenhavn.museum", | |
"koeln.museum", | |
"kunst.museum", | |
"kunstsammlung.museum", | |
"kunstunddesign.museum", | |
"labor.museum", | |
"labour.museum", | |
"lajolla.museum", | |
"lancashire.museum", | |
"landes.museum", | |
"lans.museum", | |
"läns.museum", | |
"larsson.museum", | |
"lewismiller.museum", | |
"lincoln.museum", | |
"linz.museum", | |
"living.museum", | |
"livinghistory.museum", | |
"localhistory.museum", | |
"london.museum", | |
"losangeles.museum", | |
"louvre.museum", | |
"loyalist.museum", | |
"lucerne.museum", | |
"luxembourg.museum", | |
"luzern.museum", | |
"mad.museum", | |
"madrid.museum", | |
"mallorca.museum", | |
"manchester.museum", | |
"mansion.museum", | |
"mansions.museum", | |
"manx.museum", | |
"marburg.museum", | |
"maritime.museum", | |
"maritimo.museum", | |
"maryland.museum", | |
"marylhurst.museum", | |
"media.museum", | |
"medical.museum", | |
"medizinhistorisches.museum", | |
"meeres.museum", | |
"memorial.museum", | |
"mesaverde.museum", | |
"michigan.museum", | |
"midatlantic.museum", | |
"military.museum", | |
"mill.museum", | |
"miners.museum", | |
"mining.museum", | |
"minnesota.museum", | |
"missile.museum", | |
"missoula.museum", | |
"modern.museum", | |
"moma.museum", | |
"money.museum", | |
"monmouth.museum", | |
"monticello.museum", | |
"montreal.museum", | |
"moscow.museum", | |
"motorcycle.museum", | |
"muenchen.museum", | |
"muenster.museum", | |
"mulhouse.museum", | |
"muncie.museum", | |
"museet.museum", | |
"museumcenter.museum", | |
"museumvereniging.museum", | |
"music.museum", | |
"national.museum", | |
"nationalfirearms.museum", | |
"nationalheritage.museum", | |
"nativeamerican.museum", | |
"naturalhistory.museum", | |
"naturalhistorymuseum.museum", | |
"naturalsciences.museum", | |
"nature.museum", | |
"naturhistorisches.museum", | |
"natuurwetenschappen.museum", | |
"naumburg.museum", | |
"naval.museum", | |
"nebraska.museum", | |
"neues.museum", | |
"newhampshire.museum", | |
"newjersey.museum", | |
"newmexico.museum", | |
"newport.museum", | |
"newspaper.museum", | |
"newyork.museum", | |
"niepce.museum", | |
"norfolk.museum", | |
"north.museum", | |
"nrw.museum", | |
"nyc.museum", | |
"nyny.museum", | |
"oceanographic.museum", | |
"oceanographique.museum", | |
"omaha.museum", | |
"online.museum", | |
"ontario.museum", | |
"openair.museum", | |
"oregon.museum", | |
"oregontrail.museum", | |
"otago.museum", | |
"oxford.museum", | |
"pacific.museum", | |
"paderborn.museum", | |
"palace.museum", | |
"paleo.museum", | |
"palmsprings.museum", | |
"panama.museum", | |
"paris.museum", | |
"pasadena.museum", | |
"pharmacy.museum", | |
"philadelphia.museum", | |
"philadelphiaarea.museum", | |
"philately.museum", | |
"phoenix.museum", | |
"photography.museum", | |
"pilots.museum", | |
"pittsburgh.museum", | |
"planetarium.museum", | |
"plantation.museum", | |
"plants.museum", | |
"plaza.museum", | |
"portal.museum", | |
"portland.museum", | |
"portlligat.museum", | |
"posts-and-telecommunications.museum", | |
"preservation.museum", | |
"presidio.museum", | |
"press.museum", | |
"project.museum", | |
"public.museum", | |
"pubol.museum", | |
"quebec.museum", | |
"railroad.museum", | |
"railway.museum", | |
"research.museum", | |
"resistance.museum", | |
"riodejaneiro.museum", | |
"rochester.museum", | |
"rockart.museum", | |
"roma.museum", | |
"russia.museum", | |
"saintlouis.museum", | |
"salem.museum", | |
"salvadordali.museum", | |
"salzburg.museum", | |
"sandiego.museum", | |
"sanfrancisco.museum", | |
"santabarbara.museum", | |
"santacruz.museum", | |
"santafe.museum", | |
"saskatchewan.museum", | |
"satx.museum", | |
"savannahga.museum", | |
"schlesisches.museum", | |
"schoenbrunn.museum", | |
"schokoladen.museum", | |
"school.museum", | |
"schweiz.museum", | |
"science.museum", | |
"scienceandhistory.museum", | |
"scienceandindustry.museum", | |
"sciencecenter.museum", | |
"sciencecenters.museum", | |
"science-fiction.museum", | |
"sciencehistory.museum", | |
"sciences.museum", | |
"sciencesnaturelles.museum", | |
"scotland.museum", | |
"seaport.museum", | |
"settlement.museum", | |
"settlers.museum", | |
"shell.museum", | |
"sherbrooke.museum", | |
"sibenik.museum", | |
"silk.museum", | |
"ski.museum", | |
"skole.museum", | |
"society.museum", | |
"sologne.museum", | |
"soundandvision.museum", | |
"southcarolina.museum", | |
"southwest.museum", | |
"space.museum", | |
"spy.museum", | |
"square.museum", | |
"stadt.museum", | |
"stalbans.museum", | |
"starnberg.museum", | |
"state.museum", | |
"stateofdelaware.museum", | |
"station.museum", | |
"steam.museum", | |
"steiermark.museum", | |
"stjohn.museum", | |
"stockholm.museum", | |
"stpetersburg.museum", | |
"stuttgart.museum", | |
"suisse.museum", | |
"surgeonshall.museum", | |
"surrey.museum", | |
"svizzera.museum", | |
"sweden.museum", | |
"sydney.museum", | |
"tank.museum", | |
"tcm.museum", | |
"technology.museum", | |
"telekommunikation.museum", | |
"television.museum", | |
"texas.museum", | |
"textile.museum", | |
"theater.museum", | |
"time.museum", | |
"timekeeping.museum", | |
"topology.museum", | |
"torino.museum", | |
"touch.museum", | |
"town.museum", | |
"transport.museum", | |
"tree.museum", | |
"trolley.museum", | |
"trust.museum", | |
"trustee.museum", | |
"uhren.museum", | |
"ulm.museum", | |
"undersea.museum", | |
"university.museum", | |
"usa.museum", | |
"usantiques.museum", | |
"usarts.museum", | |
"uscountryestate.museum", | |
"usculture.museum", | |
"usdecorativearts.museum", | |
"usgarden.museum", | |
"ushistory.museum", | |
"ushuaia.museum", | |
"uslivinghistory.museum", | |
"utah.museum", | |
"uvic.museum", | |
"valley.museum", | |
"vantaa.museum", | |
"versailles.museum", | |
"viking.museum", | |
"village.museum", | |
"virginia.museum", | |
"virtual.museum", | |
"virtuel.museum", | |
"vlaanderen.museum", | |
"volkenkunde.museum", | |
"wales.museum", | |
"wallonie.museum", | |
"war.museum", | |
"washingtondc.museum", | |
"watchandclock.museum", | |
"watch-and-clock.museum", | |
"western.museum", | |
"westfalen.museum", | |
"whaling.museum", | |
"wildlife.museum", | |
"williamsburg.museum", | |
"windmill.museum", | |
"workshop.museum", | |
"york.museum", | |
"yorkshire.museum", | |
"yosemite.museum", | |
"youth.museum", | |
"zoological.museum", | |
"zoology.museum", | |
"ירושלים.museum", | |
"иком.museum", | |
"mv", | |
"aero.mv", | |
"biz.mv", | |
"com.mv", | |
"coop.mv", | |
"edu.mv", | |
"gov.mv", | |
"info.mv", | |
"int.mv", | |
"mil.mv", | |
"museum.mv", | |
"name.mv", | |
"net.mv", | |
"org.mv", | |
"pro.mv", | |
"mw", | |
"ac.mw", | |
"biz.mw", | |
"co.mw", | |
"com.mw", | |
"coop.mw", | |
"edu.mw", | |
"gov.mw", | |
"int.mw", | |
"museum.mw", | |
"net.mw", | |
"org.mw", | |
"mx", | |
"com.mx", | |
"org.mx", | |
"gob.mx", | |
"edu.mx", | |
"net.mx", | |
"my", | |
"com.my", | |
"net.my", | |
"org.my", | |
"gov.my", | |
"edu.my", | |
"mil.my", | |
"name.my", | |
"mz", | |
"ac.mz", | |
"adv.mz", | |
"co.mz", | |
"edu.mz", | |
"gov.mz", | |
"mil.mz", | |
"net.mz", | |
"org.mz", | |
"na", | |
"info.na", | |
"pro.na", | |
"name.na", | |
"school.na", | |
"or.na", | |
"dr.na", | |
"us.na", | |
"mx.na", | |
"ca.na", | |
"in.na", | |
"cc.na", | |
"tv.na", | |
"ws.na", | |
"mobi.na", | |
"co.na", | |
"com.na", | |
"org.na", | |
"name", | |
"nc", | |
"asso.nc", | |
"nom.nc", | |
"ne", | |
"net", | |
"nf", | |
"com.nf", | |
"net.nf", | |
"per.nf", | |
"rec.nf", | |
"web.nf", | |
"arts.nf", | |
"firm.nf", | |
"info.nf", | |
"other.nf", | |
"store.nf", | |
"ng", | |
"com.ng", | |
"edu.ng", | |
"gov.ng", | |
"i.ng", | |
"mil.ng", | |
"mobi.ng", | |
"name.ng", | |
"net.ng", | |
"org.ng", | |
"sch.ng", | |
"ni", | |
"ac.ni", | |
"biz.ni", | |
"co.ni", | |
"com.ni", | |
"edu.ni", | |
"gob.ni", | |
"in.ni", | |
"info.ni", | |
"int.ni", | |
"mil.ni", | |
"net.ni", | |
"nom.ni", | |
"org.ni", | |
"web.ni", | |
"nl", | |
"no", | |
"fhs.no", | |
"vgs.no", | |
"fylkesbibl.no", | |
"folkebibl.no", | |
"museum.no", | |
"idrett.no", | |
"priv.no", | |
"mil.no", | |
"stat.no", | |
"dep.no", | |
"kommune.no", | |
"herad.no", | |
"aa.no", | |
"ah.no", | |
"bu.no", | |
"fm.no", | |
"hl.no", | |
"hm.no", | |
"jan-mayen.no", | |
"mr.no", | |
"nl.no", | |
"nt.no", | |
"of.no", | |
"ol.no", | |
"oslo.no", | |
"rl.no", | |
"sf.no", | |
"st.no", | |
"svalbard.no", | |
"tm.no", | |
"tr.no", | |
"va.no", | |
"vf.no", | |
"gs.aa.no", | |
"gs.ah.no", | |
"gs.bu.no", | |
"gs.fm.no", | |
"gs.hl.no", | |
"gs.hm.no", | |
"gs.jan-mayen.no", | |
"gs.mr.no", | |
"gs.nl.no", | |
"gs.nt.no", | |
"gs.of.no", | |
"gs.ol.no", | |
"gs.oslo.no", | |
"gs.rl.no", | |
"gs.sf.no", | |
"gs.st.no", | |
"gs.svalbard.no", | |
"gs.tm.no", | |
"gs.tr.no", | |
"gs.va.no", | |
"gs.vf.no", | |
"akrehamn.no", | |
"åkrehamn.no", | |
"algard.no", | |
"ålgård.no", | |
"arna.no", | |
"brumunddal.no", | |
"bryne.no", | |
"bronnoysund.no", | |
"brønnøysund.no", | |
"drobak.no", | |
"drøbak.no", | |
"egersund.no", | |
"fetsund.no", | |
"floro.no", | |
"florø.no", | |
"fredrikstad.no", | |
"hokksund.no", | |
"honefoss.no", | |
"hønefoss.no", | |
"jessheim.no", | |
"jorpeland.no", | |
"jørpeland.no", | |
"kirkenes.no", | |
"kopervik.no", | |
"krokstadelva.no", | |
"langevag.no", | |
"langevåg.no", | |
"leirvik.no", | |
"mjondalen.no", | |
"mjøndalen.no", | |
"mo-i-rana.no", | |
"mosjoen.no", | |
"mosjøen.no", | |
"nesoddtangen.no", | |
"orkanger.no", | |
"osoyro.no", | |
"osøyro.no", | |
"raholt.no", | |
"råholt.no", | |
"sandnessjoen.no", | |
"sandnessjøen.no", | |
"skedsmokorset.no", | |
"slattum.no", | |
"spjelkavik.no", | |
"stathelle.no", | |
"stavern.no", | |
"stjordalshalsen.no", | |
"stjørdalshalsen.no", | |
"tananger.no", | |
"tranby.no", | |
"vossevangen.no", | |
"afjord.no", | |
"åfjord.no", | |
"agdenes.no", | |
"al.no", | |
"ål.no", | |
"alesund.no", | |
"ålesund.no", | |
"alstahaug.no", | |
"alta.no", | |
"áltá.no", | |
"alaheadju.no", | |
"álaheadju.no", | |
"alvdal.no", | |
"amli.no", | |
"åmli.no", | |
"amot.no", | |
"åmot.no", | |
"andebu.no", | |
"andoy.no", | |
"andøy.no", | |
"andasuolo.no", | |
"ardal.no", | |
"årdal.no", | |
"aremark.no", | |
"arendal.no", | |
"ås.no", | |
"aseral.no", | |
"åseral.no", | |
"asker.no", | |
"askim.no", | |
"askvoll.no", | |
"askoy.no", | |
"askøy.no", | |
"asnes.no", | |
"åsnes.no", | |
"audnedaln.no", | |
"aukra.no", | |
"aure.no", | |
"aurland.no", | |
"aurskog-holand.no", | |
"aurskog-høland.no", | |
"austevoll.no", | |
"austrheim.no", | |
"averoy.no", | |
"averøy.no", | |
"balestrand.no", | |
"ballangen.no", | |
"balat.no", | |
"bálát.no", | |
"balsfjord.no", | |
"bahccavuotna.no", | |
"báhccavuotna.no", | |
"bamble.no", | |
"bardu.no", | |
"beardu.no", | |
"beiarn.no", | |
"bajddar.no", | |
"bájddar.no", | |
"baidar.no", | |
"báidár.no", | |
"berg.no", | |
"bergen.no", | |
"berlevag.no", | |
"berlevåg.no", | |
"bearalvahki.no", | |
"bearalváhki.no", | |
"bindal.no", | |
"birkenes.no", | |
"bjarkoy.no", | |
"bjarkøy.no", | |
"bjerkreim.no", | |
"bjugn.no", | |
"bodo.no", | |
"bodø.no", | |
"badaddja.no", | |
"bådåddjå.no", | |
"budejju.no", | |
"bokn.no", | |
"bremanger.no", | |
"bronnoy.no", | |
"brønnøy.no", | |
"bygland.no", | |
"bykle.no", | |
"barum.no", | |
"bærum.no", | |
"bo.telemark.no", | |
"bø.telemark.no", | |
"bo.nordland.no", | |
"bø.nordland.no", | |
"bievat.no", | |
"bievát.no", | |
"bomlo.no", | |
"bømlo.no", | |
"batsfjord.no", | |
"båtsfjord.no", | |
"bahcavuotna.no", | |
"báhcavuotna.no", | |
"dovre.no", | |
"drammen.no", | |
"drangedal.no", | |
"dyroy.no", | |
"dyrøy.no", | |
"donna.no", | |
"dønna.no", | |
"eid.no", | |
"eidfjord.no", | |
"eidsberg.no", | |
"eidskog.no", | |
"eidsvoll.no", | |
"eigersund.no", | |
"elverum.no", | |
"enebakk.no", | |
"engerdal.no", | |
"etne.no", | |
"etnedal.no", | |
"evenes.no", | |
"evenassi.no", | |
"evenášši.no", | |
"evje-og-hornnes.no", | |
"farsund.no", | |
"fauske.no", | |
"fuossko.no", | |
"fuoisku.no", | |
"fedje.no", | |
"fet.no", | |
"finnoy.no", | |
"finnøy.no", | |
"fitjar.no", | |
"fjaler.no", | |
"fjell.no", | |
"flakstad.no", | |
"flatanger.no", | |
"flekkefjord.no", | |
"flesberg.no", | |
"flora.no", | |
"fla.no", | |
"flå.no", | |
"folldal.no", | |
"forsand.no", | |
"fosnes.no", | |
"frei.no", | |
"frogn.no", | |
"froland.no", | |
"frosta.no", | |
"frana.no", | |
"fræna.no", | |
"froya.no", | |
"frøya.no", | |
"fusa.no", | |
"fyresdal.no", | |
"forde.no", | |
"førde.no", | |
"gamvik.no", | |
"gangaviika.no", | |
"gáŋgaviika.no", | |
"gaular.no", | |
"gausdal.no", | |
"gildeskal.no", | |
"gildeskål.no", | |
"giske.no", | |
"gjemnes.no", | |
"gjerdrum.no", | |
"gjerstad.no", | |
"gjesdal.no", | |
"gjovik.no", | |
"gjøvik.no", | |
"gloppen.no", | |
"gol.no", | |
"gran.no", | |
"grane.no", | |
"granvin.no", | |
"gratangen.no", | |
"grimstad.no", | |
"grong.no", | |
"kraanghke.no", | |
"kråanghke.no", | |
"grue.no", | |
"gulen.no", | |
"hadsel.no", | |
"halden.no", | |
"halsa.no", | |
"hamar.no", | |
"hamaroy.no", | |
"habmer.no", | |
"hábmer.no", | |
"hapmir.no", | |
"hápmir.no", | |
"hammerfest.no", | |
"hammarfeasta.no", | |
"hámmárfeasta.no", | |
"haram.no", | |
"hareid.no", | |
"harstad.no", | |
"hasvik.no", | |
"aknoluokta.no", | |
"ákŋoluokta.no", | |
"hattfjelldal.no", | |
"aarborte.no", | |
"haugesund.no", | |
"hemne.no", | |
"hemnes.no", | |
"hemsedal.no", | |
"heroy.more-og-romsdal.no", | |
"herøy.møre-og-romsdal.no", | |
"heroy.nordland.no", | |
"herøy.nordland.no", | |
"hitra.no", | |
"hjartdal.no", | |
"hjelmeland.no", | |
"hobol.no", | |
"hobøl.no", | |
"hof.no", | |
"hol.no", | |
"hole.no", | |
"holmestrand.no", | |
"holtalen.no", | |
"holtålen.no", | |
"hornindal.no", | |
"horten.no", | |
"hurdal.no", | |
"hurum.no", | |
"hvaler.no", | |
"hyllestad.no", | |
"hagebostad.no", | |
"hægebostad.no", | |
"hoyanger.no", | |
"høyanger.no", | |
"hoylandet.no", | |
"høylandet.no", | |
"ha.no", | |
"hå.no", | |
"ibestad.no", | |
"inderoy.no", | |
"inderøy.no", | |
"iveland.no", | |
"jevnaker.no", | |
"jondal.no", | |
"jolster.no", | |
"jølster.no", | |
"karasjok.no", | |
"karasjohka.no", | |
"kárášjohka.no", | |
"karlsoy.no", | |
"galsa.no", | |
"gálsá.no", | |
"karmoy.no", | |
"karmøy.no", | |
"kautokeino.no", | |
"guovdageaidnu.no", | |
"klepp.no", | |
"klabu.no", | |
"klæbu.no", | |
"kongsberg.no", | |
"kongsvinger.no", | |
"kragero.no", | |
"kragerø.no", | |
"kristiansand.no", | |
"kristiansund.no", | |
"krodsherad.no", | |
"krødsherad.no", | |
"kvalsund.no", | |
"rahkkeravju.no", | |
"ráhkkerávju.no", | |
"kvam.no", | |
"kvinesdal.no", | |
"kvinnherad.no", | |
"kviteseid.no", | |
"kvitsoy.no", | |
"kvitsøy.no", | |
"kvafjord.no", | |
"kvæfjord.no", | |
"giehtavuoatna.no", | |
"kvanangen.no", | |
"kvænangen.no", | |
"navuotna.no", | |
"návuotna.no", | |
"kafjord.no", | |
"kåfjord.no", | |
"gaivuotna.no", | |
"gáivuotna.no", | |
"larvik.no", | |
"lavangen.no", | |
"lavagis.no", | |
"loabat.no", | |
"loabát.no", | |
"lebesby.no", | |
"davvesiida.no", | |
"leikanger.no", | |
"leirfjord.no", | |
"leka.no", | |
"leksvik.no", | |
"lenvik.no", | |
"leangaviika.no", | |
"leaŋgaviika.no", | |
"lesja.no", | |
"levanger.no", | |
"lier.no", | |
"lierne.no", | |
"lillehammer.no", | |
"lillesand.no", | |
"lindesnes.no", | |
"lindas.no", | |
"lindås.no", | |
"lom.no", | |
"loppa.no", | |
"lahppi.no", | |
"láhppi.no", | |
"lund.no", | |
"lunner.no", | |
"luroy.no", | |
"lurøy.no", | |
"luster.no", | |
"lyngdal.no", | |
"lyngen.no", | |
"ivgu.no", | |
"lardal.no", | |
"lerdal.no", | |
"lærdal.no", | |
"lodingen.no", | |
"lødingen.no", | |
"lorenskog.no", | |
"lørenskog.no", | |
"loten.no", | |
"løten.no", | |
"malvik.no", | |
"masoy.no", | |
"måsøy.no", | |
"muosat.no", | |
"muosát.no", | |
"mandal.no", | |
"marker.no", | |
"marnardal.no", | |
"masfjorden.no", | |
"meland.no", | |
"meldal.no", | |
"melhus.no", | |
"meloy.no", | |
"meløy.no", | |
"meraker.no", | |
"meråker.no", | |
"moareke.no", | |
"moåreke.no", | |
"midsund.no", | |
"midtre-gauldal.no", | |
"modalen.no", | |
"modum.no", | |
"molde.no", | |
"moskenes.no", | |
"moss.no", | |
"mosvik.no", | |
"malselv.no", | |
"målselv.no", | |
"malatvuopmi.no", | |
"málatvuopmi.no", | |
"namdalseid.no", | |
"aejrie.no", | |
"namsos.no", | |
"namsskogan.no", | |
"naamesjevuemie.no", | |
"nååmesjevuemie.no", | |
"laakesvuemie.no", | |
"nannestad.no", | |
"narvik.no", | |
"narviika.no", | |
"naustdal.no", | |
"nedre-eiker.no", | |
"nes.akershus.no", | |
"nes.buskerud.no", | |
"nesna.no", | |
"nesodden.no", | |
"nesseby.no", | |
"unjarga.no", | |
"unjárga.no", | |
"nesset.no", | |
"nissedal.no", | |
"nittedal.no", | |
"nord-aurdal.no", | |
"nord-fron.no", | |
"nord-odal.no", | |
"norddal.no", | |
"nordkapp.no", | |
"davvenjarga.no", | |
"davvenjárga.no", | |
"nordre-land.no", | |
"nordreisa.no", | |
"raisa.no", | |
"ráisa.no", | |
"nore-og-uvdal.no", | |
"notodden.no", | |
"naroy.no", | |
"nærøy.no", | |
"notteroy.no", | |
"nøtterøy.no", | |
"odda.no", | |
"oksnes.no", | |
"øksnes.no", | |
"oppdal.no", | |
"oppegard.no", | |
"oppegård.no", | |
"orkdal.no", | |
"orland.no", | |
"ørland.no", | |
"orskog.no", | |
"ørskog.no", | |
"orsta.no", | |
"ørsta.no", | |
"os.hedmark.no", | |
"os.hordaland.no", | |
"osen.no", | |
"osteroy.no", | |
"osterøy.no", | |
"ostre-toten.no", | |
"østre-toten.no", | |
"overhalla.no", | |
"ovre-eiker.no", | |
"øvre-eiker.no", | |
"oyer.no", | |
"øyer.no", | |
"oygarden.no", | |
"øygarden.no", | |
"oystre-slidre.no", | |
"øystre-slidre.no", | |
"porsanger.no", | |
"porsangu.no", | |
"porsáŋgu.no", | |
"porsgrunn.no", | |
"radoy.no", | |
"radøy.no", | |
"rakkestad.no", | |
"rana.no", | |
"ruovat.no", | |
"randaberg.no", | |
"rauma.no", | |
"rendalen.no", | |
"rennebu.no", | |
"rennesoy.no", | |
"rennesøy.no", | |
"rindal.no", | |
"ringebu.no", | |
"ringerike.no", | |
"ringsaker.no", | |
"rissa.no", | |
"risor.no", | |
"risør.no", | |
"roan.no", | |
"rollag.no", | |
"rygge.no", | |
"ralingen.no", | |
"rælingen.no", | |
"rodoy.no", | |
"rødøy.no", | |
"romskog.no", | |
"rømskog.no", | |
"roros.no", | |
"røros.no", | |
"rost.no", | |
"røst.no", | |
"royken.no", | |
"røyken.no", | |
"royrvik.no", | |
"røyrvik.no", | |
"rade.no", | |
"råde.no", | |
"salangen.no", | |
"siellak.no", | |
"saltdal.no", | |
"salat.no", | |
"sálát.no", | |
"sálat.no", | |
"samnanger.no", | |
"sande.more-og-romsdal.no", | |
"sande.møre-og-romsdal.no", | |
"sande.vestfold.no", | |
"sandefjord.no", | |
"sandnes.no", | |
"sandoy.no", | |
"sandøy.no", | |
"sarpsborg.no", | |
"sauda.no", | |
"sauherad.no", | |
"sel.no", | |
"selbu.no", | |
"selje.no", | |
"seljord.no", | |
"sigdal.no", | |
"siljan.no", | |
"sirdal.no", | |
"skaun.no", | |
"skedsmo.no", | |
"ski.no", | |
"skien.no", | |
"skiptvet.no", | |
"skjervoy.no", | |
"skjervøy.no", | |
"skierva.no", | |
"skiervá.no", | |
"skjak.no", | |
"skjåk.no", | |
"skodje.no", | |
"skanland.no", | |
"skånland.no", | |
"skanit.no", | |
"skánit.no", | |
"smola.no", | |
"smøla.no", | |
"snillfjord.no", | |
"snasa.no", | |
"snåsa.no", | |
"snoasa.no", | |
"snaase.no", | |
"snåase.no", | |
"sogndal.no", | |
"sokndal.no", | |
"sola.no", | |
"solund.no", | |
"songdalen.no", | |
"sortland.no", | |
"spydeberg.no", | |
"stange.no", | |
"stavanger.no", | |
"steigen.no", | |
"steinkjer.no", | |
"stjordal.no", | |
"stjørdal.no", | |
"stokke.no", | |
"stor-elvdal.no", | |
"stord.no", | |
"stordal.no", | |
"storfjord.no", | |
"omasvuotna.no", | |
"strand.no", | |
"stranda.no", | |
"stryn.no", | |
"sula.no", | |
"suldal.no", | |
"sund.no", | |
"sunndal.no", | |
"surnadal.no", | |
"sveio.no", | |
"svelvik.no", | |
"sykkylven.no", | |
"sogne.no", | |
"søgne.no", | |
"somna.no", | |
"sømna.no", | |
"sondre-land.no", | |
"søndre-land.no", | |
"sor-aurdal.no", | |
"sør-aurdal.no", | |
"sor-fron.no", | |
"sør-fron.no", | |
"sor-odal.no", | |
"sør-odal.no", | |
"sor-varanger.no", | |
"sør-varanger.no", | |
"matta-varjjat.no", | |
"mátta-várjjat.no", | |
"sorfold.no", | |
"sørfold.no", | |
"sorreisa.no", | |
"sørreisa.no", | |
"sorum.no", | |
"sørum.no", | |
"tana.no", | |
"deatnu.no", | |
"time.no", | |
"tingvoll.no", | |
"tinn.no", | |
"tjeldsund.no", | |
"dielddanuorri.no", | |
"tjome.no", | |
"tjøme.no", | |
"tokke.no", | |
"tolga.no", | |
"torsken.no", | |
"tranoy.no", | |
"tranøy.no", | |
"tromso.no", | |
"tromsø.no", | |
"tromsa.no", | |
"romsa.no", | |
"trondheim.no", | |
"troandin.no", | |
"trysil.no", | |
"trana.no", | |
"træna.no", | |
"trogstad.no", | |
"trøgstad.no", | |
"tvedestrand.no", | |
"tydal.no", | |
"tynset.no", | |
"tysfjord.no", | |
"divtasvuodna.no", | |
"divttasvuotna.no", | |
"tysnes.no", | |
"tysvar.no", | |
"tysvær.no", | |
"tonsberg.no", | |
"tønsberg.no", | |
"ullensaker.no", | |
"ullensvang.no", | |
"ulvik.no", | |
"utsira.no", | |
"vadso.no", | |
"vadsø.no", | |
"cahcesuolo.no", | |
"čáhcesuolo.no", | |
"vaksdal.no", | |
"valle.no", | |
"vang.no", | |
"vanylven.no", | |
"vardo.no", | |
"vardø.no", | |
"varggat.no", | |
"várggát.no", | |
"vefsn.no", | |
"vaapste.no", | |
"vega.no", | |
"vegarshei.no", | |
"vegårshei.no", | |
"vennesla.no", | |
"verdal.no", | |
"verran.no", | |
"vestby.no", | |
"vestnes.no", | |
"vestre-slidre.no", | |
"vestre-toten.no", | |
"vestvagoy.no", | |
"vestvågøy.no", | |
"vevelstad.no", | |
"vik.no", | |
"vikna.no", | |
"vindafjord.no", | |
"volda.no", | |
"voss.no", | |
"varoy.no", | |
"værøy.no", | |
"vagan.no", | |
"vågan.no", | |
"voagat.no", | |
"vagsoy.no", | |
"vågsøy.no", | |
"vaga.no", | |
"vågå.no", | |
"valer.os |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment