govuk_publishing_components 17.11.0 → 17.12.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/govuk_publishing_components/components/cookie-banner.js +2 -2
- data/app/assets/javascripts/govuk_publishing_components/lib/cookie-functions.js +4 -6
- data/app/assets/stylesheets/govuk_publishing_components/components/_cookie-banner.scss +1 -9
- data/app/assets/stylesheets/govuk_publishing_components/components/_title.scss +0 -18
- data/app/views/govuk_publishing_components/components/_title.html.erb +9 -6
- data/app/views/govuk_publishing_components/components/docs/heading.yml +1 -1
- data/app/views/govuk_publishing_components/components/docs/hint.yml +1 -1
- data/app/views/govuk_publishing_components/components/docs/subscription-links.yml +1 -1
- data/app/views/govuk_publishing_components/components/docs/textarea.yml +1 -1
- data/app/views/govuk_publishing_components/components/docs/title.yml +4 -4
- data/config/initializers/assets.rb +5 -0
- data/lib/govuk_publishing_components/version.rb +1 -1
- data/node_modules/accessible-autocomplete/package.json +1 -1
- data/node_modules/standard/node_modules/acorn/CHANGELOG.md +16 -0
- data/node_modules/standard/node_modules/acorn/README.md +1 -4
- data/node_modules/standard/node_modules/acorn/dist/acorn.js +4666 -4720
- data/node_modules/standard/node_modules/acorn/dist/acorn.mjs +382 -436
- data/node_modules/standard/node_modules/acorn/dist/bin.js +4 -8
- data/node_modules/standard/node_modules/acorn/package.json +11 -11
- metadata +16 -16
@@ -27,8 +27,8 @@ var keywordRelationalOperator = /^in(stanceof)?$/;
|
|
27
27
|
// code point above 128.
|
28
28
|
// Generated by `bin/generate-identifier-regex.js`.
|
29
29
|
|
30
|
-
var nonASCIIidentifierStartChars = "
|
31
|
-
var nonASCIIidentifierChars = "\u200c\
|
30
|
+
var nonASCIIidentifierStartChars = "aab5bac0-d6d8-f6f8-\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-\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\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\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\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-\u31ba\u31f0-\u31ff\u3400-\u4db5\u4e00-\u9fef\ua000-\ua48c\ua4d0-\ua4fd\ua500-\ua60c\ua610-\ua61f\ua62a\ua62b\ua640-\ua66e\ua67f-\ua69d\ua6a0-\ua6ef\ua717-\ua71f\ua722-\ua788\ua78b-\ua7bf\ua7c2-\ua7c6\ua7f7-\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-\uab67\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";
|
31
|
+
var nonASCIIidentifierChars = "\u200c\u200db7\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\u0b56\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\u0d82\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\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\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";
|
32
32
|
|
33
33
|
var nonASCIIidentifierStart = new RegExp("[" + nonASCIIidentifierStartChars + "]");
|
34
34
|
var nonASCIIidentifier = new RegExp("[" + nonASCIIidentifierStartChars + nonASCIIidentifierChars + "]");
|
@@ -42,10 +42,10 @@ nonASCIIidentifierStartChars = nonASCIIidentifierChars = null;
|
|
42
42
|
// generated by bin/generate-identifier-regex.js
|
43
43
|
|
44
44
|
// eslint-disable-next-line comma-spacing
|
45
|
-
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,477,28,11,0,9,21,
|
45
|
+
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,477,28,11,0,9,21,155,22,13,52,76,44,33,24,27,35,30,0,12,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,0,33,47,21,1,2,0,185,46,42,3,37,47,21,0,60,42,14,0,72,26,230,43,117,63,32,0,161,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,270,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,754,9486,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,42710,42,4148,12,221,3,5761,15,7472,3104,541];
|
46
46
|
|
47
47
|
// eslint-disable-next-line comma-spacing
|
48
|
-
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,525,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,4,9,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,
|
48
|
+
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,525,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,4,9,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,232,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,19723,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,792487,239];
|
49
49
|
|
50
50
|
// This has a complexity linear to the value of the code. The
|
51
51
|
// assumption is that looking up astral identifier characters is
|
@@ -127,8 +127,7 @@ var TokenType = function TokenType(label, conf) {
|
|
127
127
|
function binop(name, prec) {
|
128
128
|
return new TokenType(name, {beforeExpr: true, binop: prec})
|
129
129
|
}
|
130
|
-
var beforeExpr = {beforeExpr: true};
|
131
|
-
var startsExpr = {startsExpr: true};
|
130
|
+
var beforeExpr = {beforeExpr: true}, startsExpr = {startsExpr: true};
|
132
131
|
|
133
132
|
// Map keyword names to token types.
|
134
133
|
|
@@ -227,7 +226,7 @@ var types = {
|
|
227
226
|
_class: kw("class", startsExpr),
|
228
227
|
_extends: kw("extends", beforeExpr),
|
229
228
|
_export: kw("export"),
|
230
|
-
_import: kw("import"),
|
229
|
+
_import: kw("import", startsExpr),
|
231
230
|
_null: kw("null", startsExpr),
|
232
231
|
_true: kw("true", startsExpr),
|
233
232
|
_false: kw("false", startsExpr),
|
@@ -436,27 +435,29 @@ function pushComment(options, array) {
|
|
436
435
|
}
|
437
436
|
|
438
437
|
// Each scope gets a bitset that may contain these flags
|
439
|
-
var
|
440
|
-
|
441
|
-
|
442
|
-
|
443
|
-
|
444
|
-
|
445
|
-
|
446
|
-
|
447
|
-
|
438
|
+
var
|
439
|
+
SCOPE_TOP = 1,
|
440
|
+
SCOPE_FUNCTION = 2,
|
441
|
+
SCOPE_VAR = SCOPE_TOP | SCOPE_FUNCTION,
|
442
|
+
SCOPE_ASYNC = 4,
|
443
|
+
SCOPE_GENERATOR = 8,
|
444
|
+
SCOPE_ARROW = 16,
|
445
|
+
SCOPE_SIMPLE_CATCH = 32,
|
446
|
+
SCOPE_SUPER = 64,
|
447
|
+
SCOPE_DIRECT_SUPER = 128;
|
448
448
|
|
449
449
|
function functionFlags(async, generator) {
|
450
450
|
return SCOPE_FUNCTION | (async ? SCOPE_ASYNC : 0) | (generator ? SCOPE_GENERATOR : 0)
|
451
451
|
}
|
452
452
|
|
453
453
|
// Used in checkLVal and declareName to determine the type of a binding
|
454
|
-
var
|
455
|
-
|
456
|
-
|
457
|
-
|
458
|
-
|
459
|
-
|
454
|
+
var
|
455
|
+
BIND_NONE = 0, // Not a binding
|
456
|
+
BIND_VAR = 1, // Var-style binding
|
457
|
+
BIND_LEXICAL = 2, // Let- or const-style binding
|
458
|
+
BIND_FUNCTION = 3, // Function declaration
|
459
|
+
BIND_SIMPLE_CATCH = 4, // Simple (identifier pattern) catch binding
|
460
|
+
BIND_OUTSIDE = 5; // Special case for function names as bound inside the function
|
460
461
|
|
461
462
|
var Parser = function Parser(options, input, startPos) {
|
462
463
|
this.options = options = getOptions(options);
|
@@ -587,21 +588,19 @@ var pp = Parser.prototype;
|
|
587
588
|
|
588
589
|
var literal = /^(?:'((?:\\.|[^'])*?)'|"((?:\\.|[^"])*?)")/;
|
589
590
|
pp.strictDirective = function(start) {
|
590
|
-
var this$1 = this;
|
591
|
-
|
592
591
|
for (;;) {
|
593
592
|
// Try to find string literal.
|
594
593
|
skipWhiteSpace.lastIndex = start;
|
595
|
-
start += skipWhiteSpace.exec(this
|
596
|
-
var match = literal.exec(this
|
594
|
+
start += skipWhiteSpace.exec(this.input)[0].length;
|
595
|
+
var match = literal.exec(this.input.slice(start));
|
597
596
|
if (!match) { return false }
|
598
597
|
if ((match[1] || match[2]) === "use strict") { return true }
|
599
598
|
start += match[0].length;
|
600
599
|
|
601
600
|
// Skip semicolon, if any.
|
602
601
|
skipWhiteSpace.lastIndex = start;
|
603
|
-
start += skipWhiteSpace.exec(this
|
604
|
-
if (this
|
602
|
+
start += skipWhiteSpace.exec(this.input)[0].length;
|
603
|
+
if (this.input[start] === ";")
|
605
604
|
{ start++; }
|
606
605
|
}
|
607
606
|
};
|
@@ -735,20 +734,18 @@ var pp$1 = Parser.prototype;
|
|
735
734
|
// to its body instead of creating a new node.
|
736
735
|
|
737
736
|
pp$1.parseTopLevel = function(node) {
|
738
|
-
var this$1 = this;
|
739
|
-
|
740
737
|
var exports = {};
|
741
738
|
if (!node.body) { node.body = []; }
|
742
739
|
while (this.type !== types.eof) {
|
743
|
-
var stmt = this
|
740
|
+
var stmt = this.parseStatement(null, true, exports);
|
744
741
|
node.body.push(stmt);
|
745
742
|
}
|
746
743
|
if (this.inModule)
|
747
|
-
{ for (var i = 0, list = Object.keys(this
|
744
|
+
{ for (var i = 0, list = Object.keys(this.undefinedExports); i < list.length; i += 1)
|
748
745
|
{
|
749
746
|
var name = list[i];
|
750
747
|
|
751
|
-
this
|
748
|
+
this.raiseRecoverable(this.undefinedExports[name].start, ("Export '" + name + "' is not defined"));
|
752
749
|
} }
|
753
750
|
this.adaptDirectivePrologue(node.body);
|
754
751
|
this.next();
|
@@ -758,8 +755,7 @@ pp$1.parseTopLevel = function(node) {
|
|
758
755
|
return this.finishNode(node, "Program")
|
759
756
|
};
|
760
757
|
|
761
|
-
var loopLabel = {kind: "loop"};
|
762
|
-
var switchLabel = {kind: "switch"};
|
758
|
+
var loopLabel = {kind: "loop"}, switchLabel = {kind: "switch"};
|
763
759
|
|
764
760
|
pp$1.isLet = function(context) {
|
765
761
|
if (this.options.ecmaVersion < 6 || !this.isContextual("let")) { return false }
|
@@ -846,6 +842,14 @@ pp$1.parseStatement = function(context, topLevel, exports) {
|
|
846
842
|
case types.semi: return this.parseEmptyStatement(node)
|
847
843
|
case types._export:
|
848
844
|
case types._import:
|
845
|
+
if (this.options.ecmaVersion > 10 && starttype === types._import) {
|
846
|
+
skipWhiteSpace.lastIndex = this.pos;
|
847
|
+
var skip = skipWhiteSpace.exec(this.input);
|
848
|
+
var next = this.pos + skip[0].length, nextCh = this.input.charCodeAt(next);
|
849
|
+
if (nextCh === 40) // '('
|
850
|
+
{ return this.parseExpressionStatement(node, this.parseExpression()) }
|
851
|
+
}
|
852
|
+
|
849
853
|
if (!this.options.allowImportExportEverywhere) {
|
850
854
|
if (!topLevel)
|
851
855
|
{ this.raise(this.start, "'import' and 'export' may only appear at the top level"); }
|
@@ -874,8 +878,6 @@ pp$1.parseStatement = function(context, topLevel, exports) {
|
|
874
878
|
};
|
875
879
|
|
876
880
|
pp$1.parseBreakContinueStatement = function(node, keyword) {
|
877
|
-
var this$1 = this;
|
878
|
-
|
879
881
|
var isBreak = keyword === "break";
|
880
882
|
this.next();
|
881
883
|
if (this.eat(types.semi) || this.insertSemicolon()) { node.label = null; }
|
@@ -889,7 +891,7 @@ pp$1.parseBreakContinueStatement = function(node, keyword) {
|
|
889
891
|
// continue to.
|
890
892
|
var i = 0;
|
891
893
|
for (; i < this.labels.length; ++i) {
|
892
|
-
var lab = this
|
894
|
+
var lab = this.labels[i];
|
893
895
|
if (node.label == null || lab.name === node.label.name) {
|
894
896
|
if (lab.kind != null && (isBreak || lab.kind === "loop")) { break }
|
895
897
|
if (node.label && isBreak) { break }
|
@@ -943,8 +945,7 @@ pp$1.parseForStatement = function(node) {
|
|
943
945
|
this.next();
|
944
946
|
this.parseVar(init$1, true, kind);
|
945
947
|
this.finishNode(init$1, "VariableDeclaration");
|
946
|
-
if ((this.type === types._in || (this.options.ecmaVersion >= 6 && this.isContextual("of"))) && init$1.declarations.length === 1
|
947
|
-
!(kind !== "var" && init$1.declarations[0].init)) {
|
948
|
+
if ((this.type === types._in || (this.options.ecmaVersion >= 6 && this.isContextual("of"))) && init$1.declarations.length === 1) {
|
948
949
|
if (this.options.ecmaVersion >= 9) {
|
949
950
|
if (this.type === types._in) {
|
950
951
|
if (awaitAt > -1) { this.unexpected(awaitAt); }
|
@@ -1002,8 +1003,6 @@ pp$1.parseReturnStatement = function(node) {
|
|
1002
1003
|
};
|
1003
1004
|
|
1004
1005
|
pp$1.parseSwitchStatement = function(node) {
|
1005
|
-
var this$1 = this;
|
1006
|
-
|
1007
1006
|
this.next();
|
1008
1007
|
node.discriminant = this.parseParenExpression();
|
1009
1008
|
node.cases = [];
|
@@ -1017,23 +1016,23 @@ pp$1.parseSwitchStatement = function(node) {
|
|
1017
1016
|
|
1018
1017
|
var cur;
|
1019
1018
|
for (var sawDefault = false; this.type !== types.braceR;) {
|
1020
|
-
if (this
|
1021
|
-
var isCase = this
|
1022
|
-
if (cur) { this
|
1023
|
-
node.cases.push(cur = this
|
1019
|
+
if (this.type === types._case || this.type === types._default) {
|
1020
|
+
var isCase = this.type === types._case;
|
1021
|
+
if (cur) { this.finishNode(cur, "SwitchCase"); }
|
1022
|
+
node.cases.push(cur = this.startNode());
|
1024
1023
|
cur.consequent = [];
|
1025
|
-
this
|
1024
|
+
this.next();
|
1026
1025
|
if (isCase) {
|
1027
|
-
cur.test = this
|
1026
|
+
cur.test = this.parseExpression();
|
1028
1027
|
} else {
|
1029
|
-
if (sawDefault) { this
|
1028
|
+
if (sawDefault) { this.raiseRecoverable(this.lastTokStart, "Multiple default clauses"); }
|
1030
1029
|
sawDefault = true;
|
1031
1030
|
cur.test = null;
|
1032
1031
|
}
|
1033
|
-
this
|
1032
|
+
this.expect(types.colon);
|
1034
1033
|
} else {
|
1035
|
-
if (!cur) { this
|
1036
|
-
cur.consequent.push(this
|
1034
|
+
if (!cur) { this.unexpected(); }
|
1035
|
+
cur.consequent.push(this.parseStatement(null));
|
1037
1036
|
}
|
1038
1037
|
}
|
1039
1038
|
this.exitScope();
|
@@ -1114,21 +1113,19 @@ pp$1.parseEmptyStatement = function(node) {
|
|
1114
1113
|
};
|
1115
1114
|
|
1116
1115
|
pp$1.parseLabeledStatement = function(node, maybeName, expr, context) {
|
1117
|
-
var
|
1118
|
-
|
1119
|
-
for (var i$1 = 0, list = this$1.labels; i$1 < list.length; i$1 += 1)
|
1116
|
+
for (var i$1 = 0, list = this.labels; i$1 < list.length; i$1 += 1)
|
1120
1117
|
{
|
1121
1118
|
var label = list[i$1];
|
1122
1119
|
|
1123
1120
|
if (label.name === maybeName)
|
1124
|
-
{ this
|
1121
|
+
{ this.raise(expr.start, "Label '" + maybeName + "' is already declared");
|
1125
1122
|
} }
|
1126
1123
|
var kind = this.type.isLoop ? "loop" : this.type === types._switch ? "switch" : null;
|
1127
1124
|
for (var i = this.labels.length - 1; i >= 0; i--) {
|
1128
|
-
var label$1 = this
|
1125
|
+
var label$1 = this.labels[i];
|
1129
1126
|
if (label$1.statementStart === node.start) {
|
1130
1127
|
// Update information about previous labels on this node
|
1131
|
-
label$1.statementStart = this
|
1128
|
+
label$1.statementStart = this.start;
|
1132
1129
|
label$1.kind = kind;
|
1133
1130
|
} else { break }
|
1134
1131
|
}
|
@@ -1150,7 +1147,6 @@ pp$1.parseExpressionStatement = function(node, expr) {
|
|
1150
1147
|
// function bodies).
|
1151
1148
|
|
1152
1149
|
pp$1.parseBlock = function(createNewLexicalScope, node) {
|
1153
|
-
var this$1 = this;
|
1154
1150
|
if ( createNewLexicalScope === void 0 ) createNewLexicalScope = true;
|
1155
1151
|
if ( node === void 0 ) node = this.startNode();
|
1156
1152
|
|
@@ -1158,7 +1154,7 @@ pp$1.parseBlock = function(createNewLexicalScope, node) {
|
|
1158
1154
|
this.expect(types.braceL);
|
1159
1155
|
if (createNewLexicalScope) { this.enterScope(0); }
|
1160
1156
|
while (!this.eat(types.braceR)) {
|
1161
|
-
var stmt = this
|
1157
|
+
var stmt = this.parseStatement(null);
|
1162
1158
|
node.body.push(stmt);
|
1163
1159
|
}
|
1164
1160
|
if (createNewLexicalScope) { this.exitScope(); }
|
@@ -1186,59 +1182,65 @@ pp$1.parseFor = function(node, init) {
|
|
1186
1182
|
// same from parser's perspective.
|
1187
1183
|
|
1188
1184
|
pp$1.parseForIn = function(node, init) {
|
1189
|
-
var
|
1185
|
+
var isForIn = this.type === types._in;
|
1190
1186
|
this.next();
|
1191
|
-
|
1192
|
-
|
1193
|
-
|
1194
|
-
|
1195
|
-
|
1187
|
+
|
1188
|
+
if (
|
1189
|
+
init.type === "VariableDeclaration" &&
|
1190
|
+
init.declarations[0].init != null &&
|
1191
|
+
(
|
1192
|
+
!isForIn ||
|
1193
|
+
this.options.ecmaVersion < 8 ||
|
1194
|
+
this.strict ||
|
1195
|
+
init.kind !== "var" ||
|
1196
|
+
init.declarations[0].id.type !== "Identifier"
|
1197
|
+
)
|
1198
|
+
) {
|
1199
|
+
this.raise(
|
1200
|
+
init.start,
|
1201
|
+
((isForIn ? "for-in" : "for-of") + " loop variable declaration may not have an initializer")
|
1202
|
+
);
|
1203
|
+
} else if (init.type === "AssignmentPattern") {
|
1204
|
+
this.raise(init.start, "Invalid left-hand side in for-loop");
|
1196
1205
|
}
|
1197
1206
|
node.left = init;
|
1198
|
-
node.right =
|
1207
|
+
node.right = isForIn ? this.parseExpression() : this.parseMaybeAssign();
|
1199
1208
|
this.expect(types.parenR);
|
1200
1209
|
node.body = this.parseStatement("for");
|
1201
1210
|
this.exitScope();
|
1202
1211
|
this.labels.pop();
|
1203
|
-
return this.finishNode(node,
|
1212
|
+
return this.finishNode(node, isForIn ? "ForInStatement" : "ForOfStatement")
|
1204
1213
|
};
|
1205
1214
|
|
1206
1215
|
// Parse a list of variable declarations.
|
1207
1216
|
|
1208
1217
|
pp$1.parseVar = function(node, isFor, kind) {
|
1209
|
-
var this$1 = this;
|
1210
|
-
|
1211
1218
|
node.declarations = [];
|
1212
1219
|
node.kind = kind;
|
1213
1220
|
for (;;) {
|
1214
|
-
var decl = this
|
1215
|
-
this
|
1216
|
-
if (this
|
1217
|
-
decl.init = this
|
1218
|
-
} else if (kind === "const" && !(this
|
1219
|
-
this
|
1220
|
-
} else if (decl.id.type !== "Identifier" && !(isFor && (this
|
1221
|
-
this
|
1221
|
+
var decl = this.startNode();
|
1222
|
+
this.parseVarId(decl, kind);
|
1223
|
+
if (this.eat(types.eq)) {
|
1224
|
+
decl.init = this.parseMaybeAssign(isFor);
|
1225
|
+
} else if (kind === "const" && !(this.type === types._in || (this.options.ecmaVersion >= 6 && this.isContextual("of")))) {
|
1226
|
+
this.unexpected();
|
1227
|
+
} else if (decl.id.type !== "Identifier" && !(isFor && (this.type === types._in || this.isContextual("of")))) {
|
1228
|
+
this.raise(this.lastTokEnd, "Complex binding patterns require an initialization value");
|
1222
1229
|
} else {
|
1223
1230
|
decl.init = null;
|
1224
1231
|
}
|
1225
|
-
node.declarations.push(this
|
1226
|
-
if (!this
|
1232
|
+
node.declarations.push(this.finishNode(decl, "VariableDeclarator"));
|
1233
|
+
if (!this.eat(types.comma)) { break }
|
1227
1234
|
}
|
1228
1235
|
return node
|
1229
1236
|
};
|
1230
1237
|
|
1231
1238
|
pp$1.parseVarId = function(decl, kind) {
|
1232
|
-
if ((kind === "const" || kind === "let") && this.isContextual("let")) {
|
1233
|
-
this.raiseRecoverable(this.start, "let is disallowed as a lexically bound name");
|
1234
|
-
}
|
1235
1239
|
decl.id = this.parseBindingAtom();
|
1236
1240
|
this.checkLVal(decl.id, kind === "var" ? BIND_VAR : BIND_LEXICAL, false);
|
1237
1241
|
};
|
1238
1242
|
|
1239
|
-
var FUNC_STATEMENT = 1;
|
1240
|
-
var FUNC_HANGING_STATEMENT = 2;
|
1241
|
-
var FUNC_NULLABLE_ID = 4;
|
1243
|
+
var FUNC_STATEMENT = 1, FUNC_HANGING_STATEMENT = 2, FUNC_NULLABLE_ID = 4;
|
1242
1244
|
|
1243
1245
|
// Parse a function declaration or literal (depending on the
|
1244
1246
|
// `statement & FUNC_STATEMENT`).
|
@@ -1292,8 +1294,6 @@ pp$1.parseFunctionParams = function(node) {
|
|
1292
1294
|
// `isStatement` parameter).
|
1293
1295
|
|
1294
1296
|
pp$1.parseClass = function(node, isStatement) {
|
1295
|
-
var this$1 = this;
|
1296
|
-
|
1297
1297
|
this.next();
|
1298
1298
|
|
1299
1299
|
// ecma-262 14.6 Class Definitions
|
@@ -1308,11 +1308,11 @@ pp$1.parseClass = function(node, isStatement) {
|
|
1308
1308
|
classBody.body = [];
|
1309
1309
|
this.expect(types.braceL);
|
1310
1310
|
while (!this.eat(types.braceR)) {
|
1311
|
-
var element = this
|
1311
|
+
var element = this.parseClassElement(node.superClass !== null);
|
1312
1312
|
if (element) {
|
1313
1313
|
classBody.body.push(element);
|
1314
1314
|
if (element.type === "MethodDefinition" && element.kind === "constructor") {
|
1315
|
-
if (hadConstructor) { this
|
1315
|
+
if (hadConstructor) { this.raise(element.start, "Duplicate constructor in the same class"); }
|
1316
1316
|
hadConstructor = true;
|
1317
1317
|
}
|
1318
1318
|
}
|
@@ -1403,8 +1403,6 @@ pp$1.parseClassSuper = function(node) {
|
|
1403
1403
|
// Parses module export declaration.
|
1404
1404
|
|
1405
1405
|
pp$1.parseExport = function(node, exports) {
|
1406
|
-
var this$1 = this;
|
1407
|
-
|
1408
1406
|
this.next();
|
1409
1407
|
// export * from '...'
|
1410
1408
|
if (this.eat(types.star)) {
|
@@ -1451,9 +1449,9 @@ pp$1.parseExport = function(node, exports) {
|
|
1451
1449
|
// check for keywords used as local names
|
1452
1450
|
var spec = list[i];
|
1453
1451
|
|
1454
|
-
this
|
1452
|
+
this.checkUnreserved(spec.local);
|
1455
1453
|
// check if export is defined
|
1456
|
-
this
|
1454
|
+
this.checkLocalExport(spec.local);
|
1457
1455
|
}
|
1458
1456
|
|
1459
1457
|
node.source = null;
|
@@ -1471,8 +1469,6 @@ pp$1.checkExport = function(exports, name, pos) {
|
|
1471
1469
|
};
|
1472
1470
|
|
1473
1471
|
pp$1.checkPatternExport = function(exports, pat) {
|
1474
|
-
var this$1 = this;
|
1475
|
-
|
1476
1472
|
var type = pat.type;
|
1477
1473
|
if (type === "Identifier")
|
1478
1474
|
{ this.checkExport(exports, pat.name, pat.start); }
|
@@ -1481,13 +1477,13 @@ pp$1.checkPatternExport = function(exports, pat) {
|
|
1481
1477
|
{
|
1482
1478
|
var prop = list[i];
|
1483
1479
|
|
1484
|
-
this
|
1480
|
+
this.checkPatternExport(exports, prop);
|
1485
1481
|
} }
|
1486
1482
|
else if (type === "ArrayPattern")
|
1487
1483
|
{ for (var i$1 = 0, list$1 = pat.elements; i$1 < list$1.length; i$1 += 1) {
|
1488
1484
|
var elt = list$1[i$1];
|
1489
1485
|
|
1490
|
-
if (elt) { this
|
1486
|
+
if (elt) { this.checkPatternExport(exports, elt); }
|
1491
1487
|
} }
|
1492
1488
|
else if (type === "Property")
|
1493
1489
|
{ this.checkPatternExport(exports, pat.value); }
|
@@ -1500,14 +1496,12 @@ pp$1.checkPatternExport = function(exports, pat) {
|
|
1500
1496
|
};
|
1501
1497
|
|
1502
1498
|
pp$1.checkVariableExport = function(exports, decls) {
|
1503
|
-
var this$1 = this;
|
1504
|
-
|
1505
1499
|
if (!exports) { return }
|
1506
1500
|
for (var i = 0, list = decls; i < list.length; i += 1)
|
1507
1501
|
{
|
1508
1502
|
var decl = list[i];
|
1509
1503
|
|
1510
|
-
this
|
1504
|
+
this.checkPatternExport(exports, decl.id);
|
1511
1505
|
}
|
1512
1506
|
};
|
1513
1507
|
|
@@ -1523,22 +1517,20 @@ pp$1.shouldParseExportStatement = function() {
|
|
1523
1517
|
// Parses a comma-separated list of module exports.
|
1524
1518
|
|
1525
1519
|
pp$1.parseExportSpecifiers = function(exports) {
|
1526
|
-
var this$1 = this;
|
1527
|
-
|
1528
1520
|
var nodes = [], first = true;
|
1529
1521
|
// export { x, y as z } [from '...']
|
1530
1522
|
this.expect(types.braceL);
|
1531
1523
|
while (!this.eat(types.braceR)) {
|
1532
1524
|
if (!first) {
|
1533
|
-
this
|
1534
|
-
if (this
|
1525
|
+
this.expect(types.comma);
|
1526
|
+
if (this.afterTrailingComma(types.braceR)) { break }
|
1535
1527
|
} else { first = false; }
|
1536
1528
|
|
1537
|
-
var node = this
|
1538
|
-
node.local = this
|
1539
|
-
node.exported = this
|
1540
|
-
this
|
1541
|
-
nodes.push(this
|
1529
|
+
var node = this.startNode();
|
1530
|
+
node.local = this.parseIdent(true);
|
1531
|
+
node.exported = this.eatContextual("as") ? this.parseIdent(true) : node.local;
|
1532
|
+
this.checkExport(exports, node.exported.name, node.exported.start);
|
1533
|
+
nodes.push(this.finishNode(node, "ExportSpecifier"));
|
1542
1534
|
}
|
1543
1535
|
return nodes
|
1544
1536
|
};
|
@@ -1563,8 +1555,6 @@ pp$1.parseImport = function(node) {
|
|
1563
1555
|
// Parses a comma-separated list of module imports.
|
1564
1556
|
|
1565
1557
|
pp$1.parseImportSpecifiers = function() {
|
1566
|
-
var this$1 = this;
|
1567
|
-
|
1568
1558
|
var nodes = [], first = true;
|
1569
1559
|
if (this.type === types.name) {
|
1570
1560
|
// import defaultObj, { x, y as z } from '...'
|
@@ -1586,20 +1576,20 @@ pp$1.parseImportSpecifiers = function() {
|
|
1586
1576
|
this.expect(types.braceL);
|
1587
1577
|
while (!this.eat(types.braceR)) {
|
1588
1578
|
if (!first) {
|
1589
|
-
this
|
1590
|
-
if (this
|
1579
|
+
this.expect(types.comma);
|
1580
|
+
if (this.afterTrailingComma(types.braceR)) { break }
|
1591
1581
|
} else { first = false; }
|
1592
1582
|
|
1593
|
-
var node$2 = this
|
1594
|
-
node$2.imported = this
|
1595
|
-
if (this
|
1596
|
-
node$2.local = this
|
1583
|
+
var node$2 = this.startNode();
|
1584
|
+
node$2.imported = this.parseIdent(true);
|
1585
|
+
if (this.eatContextual("as")) {
|
1586
|
+
node$2.local = this.parseIdent();
|
1597
1587
|
} else {
|
1598
|
-
this
|
1588
|
+
this.checkUnreserved(node$2.imported);
|
1599
1589
|
node$2.local = node$2.imported;
|
1600
1590
|
}
|
1601
|
-
this
|
1602
|
-
nodes.push(this
|
1591
|
+
this.checkLVal(node$2.local, BIND_LEXICAL);
|
1592
|
+
nodes.push(this.finishNode(node$2, "ImportSpecifier"));
|
1603
1593
|
}
|
1604
1594
|
return nodes
|
1605
1595
|
};
|
@@ -1626,8 +1616,6 @@ var pp$2 = Parser.prototype;
|
|
1626
1616
|
// if possible.
|
1627
1617
|
|
1628
1618
|
pp$2.toAssignable = function(node, isBinding, refDestructuringErrors) {
|
1629
|
-
var this$1 = this;
|
1630
|
-
|
1631
1619
|
if (this.options.ecmaVersion >= 6 && node) {
|
1632
1620
|
switch (node.type) {
|
1633
1621
|
case "Identifier":
|
@@ -1646,7 +1634,7 @@ pp$2.toAssignable = function(node, isBinding, refDestructuringErrors) {
|
|
1646
1634
|
for (var i = 0, list = node.properties; i < list.length; i += 1) {
|
1647
1635
|
var prop = list[i];
|
1648
1636
|
|
1649
|
-
this
|
1637
|
+
this.toAssignable(prop, isBinding);
|
1650
1638
|
// Early error:
|
1651
1639
|
// AssignmentRestProperty[Yield, Await] :
|
1652
1640
|
// `...` DestructuringAssignmentTarget[Yield, Await]
|
@@ -1656,7 +1644,7 @@ pp$2.toAssignable = function(node, isBinding, refDestructuringErrors) {
|
|
1656
1644
|
prop.type === "RestElement" &&
|
1657
1645
|
(prop.argument.type === "ArrayPattern" || prop.argument.type === "ObjectPattern")
|
1658
1646
|
) {
|
1659
|
-
this
|
1647
|
+
this.raise(prop.argument.start, "Unexpected token");
|
1660
1648
|
}
|
1661
1649
|
}
|
1662
1650
|
break
|
@@ -1707,12 +1695,10 @@ pp$2.toAssignable = function(node, isBinding, refDestructuringErrors) {
|
|
1707
1695
|
// Convert list of expression atoms to binding list.
|
1708
1696
|
|
1709
1697
|
pp$2.toAssignableList = function(exprList, isBinding) {
|
1710
|
-
var this$1 = this;
|
1711
|
-
|
1712
1698
|
var end = exprList.length;
|
1713
1699
|
for (var i = 0; i < end; i++) {
|
1714
1700
|
var elt = exprList[i];
|
1715
|
-
if (elt) { this
|
1701
|
+
if (elt) { this.toAssignable(elt, isBinding); }
|
1716
1702
|
}
|
1717
1703
|
if (end) {
|
1718
1704
|
var last = exprList[end - 1];
|
@@ -1763,26 +1749,24 @@ pp$2.parseBindingAtom = function() {
|
|
1763
1749
|
};
|
1764
1750
|
|
1765
1751
|
pp$2.parseBindingList = function(close, allowEmpty, allowTrailingComma) {
|
1766
|
-
var this$1 = this;
|
1767
|
-
|
1768
1752
|
var elts = [], first = true;
|
1769
1753
|
while (!this.eat(close)) {
|
1770
1754
|
if (first) { first = false; }
|
1771
|
-
else { this
|
1772
|
-
if (allowEmpty && this
|
1755
|
+
else { this.expect(types.comma); }
|
1756
|
+
if (allowEmpty && this.type === types.comma) {
|
1773
1757
|
elts.push(null);
|
1774
|
-
} else if (allowTrailingComma && this
|
1758
|
+
} else if (allowTrailingComma && this.afterTrailingComma(close)) {
|
1775
1759
|
break
|
1776
|
-
} else if (this
|
1777
|
-
var rest = this
|
1778
|
-
this
|
1760
|
+
} else if (this.type === types.ellipsis) {
|
1761
|
+
var rest = this.parseRestBinding();
|
1762
|
+
this.parseBindingListItem(rest);
|
1779
1763
|
elts.push(rest);
|
1780
|
-
if (this
|
1781
|
-
this
|
1764
|
+
if (this.type === types.comma) { this.raise(this.start, "Comma is not permitted after the rest element"); }
|
1765
|
+
this.expect(close);
|
1782
1766
|
break
|
1783
1767
|
} else {
|
1784
|
-
var elem = this
|
1785
|
-
this
|
1768
|
+
var elem = this.parseMaybeDefault(this.start, this.startLoc);
|
1769
|
+
this.parseBindingListItem(elem);
|
1786
1770
|
elts.push(elem);
|
1787
1771
|
}
|
1788
1772
|
}
|
@@ -1812,11 +1796,12 @@ pp$2.parseMaybeDefault = function(startPos, startLoc, left) {
|
|
1812
1796
|
// 'none' indicating that the binding should be checked for illegal identifiers, but not for duplicate references
|
1813
1797
|
|
1814
1798
|
pp$2.checkLVal = function(expr, bindingType, checkClashes) {
|
1815
|
-
var this$1 = this;
|
1816
1799
|
if ( bindingType === void 0 ) bindingType = BIND_NONE;
|
1817
1800
|
|
1818
1801
|
switch (expr.type) {
|
1819
1802
|
case "Identifier":
|
1803
|
+
if (bindingType === BIND_LEXICAL && expr.name === "let")
|
1804
|
+
{ this.raiseRecoverable(expr.start, "let is disallowed as a lexically bound name"); }
|
1820
1805
|
if (this.strict && this.reservedWordsStrictBind.test(expr.name))
|
1821
1806
|
{ this.raiseRecoverable(expr.start, (bindingType ? "Binding " : "Assigning to ") + expr.name + " in strict mode"); }
|
1822
1807
|
if (checkClashes) {
|
@@ -1836,7 +1821,7 @@ pp$2.checkLVal = function(expr, bindingType, checkClashes) {
|
|
1836
1821
|
{
|
1837
1822
|
var prop = list[i];
|
1838
1823
|
|
1839
|
-
this
|
1824
|
+
this.checkLVal(prop, bindingType, checkClashes);
|
1840
1825
|
}
|
1841
1826
|
break
|
1842
1827
|
|
@@ -1849,7 +1834,7 @@ pp$2.checkLVal = function(expr, bindingType, checkClashes) {
|
|
1849
1834
|
for (var i$1 = 0, list$1 = expr.elements; i$1 < list$1.length; i$1 += 1) {
|
1850
1835
|
var elem = list$1[i$1];
|
1851
1836
|
|
1852
|
-
if (elem) { this
|
1837
|
+
if (elem) { this.checkLVal(elem, bindingType, checkClashes); }
|
1853
1838
|
}
|
1854
1839
|
break
|
1855
1840
|
|
@@ -1871,22 +1856,6 @@ pp$2.checkLVal = function(expr, bindingType, checkClashes) {
|
|
1871
1856
|
};
|
1872
1857
|
|
1873
1858
|
// A recursive descent parser operates by defining functions for all
|
1874
|
-
// syntactic elements, and recursively calling those, each function
|
1875
|
-
// advancing the input stream and returning an AST node. Precedence
|
1876
|
-
// of constructs (for example, the fact that `!x[1]` means `!(x[1])`
|
1877
|
-
// instead of `(!x)[1]` is handled by the fact that the parser
|
1878
|
-
// function that parses unary prefix operators is called first, and
|
1879
|
-
// in turn calls the function that parses `[]` subscripts — that
|
1880
|
-
// way, it'll receive the node for `x[1]` already parsed, and wraps
|
1881
|
-
// *that* in the unary operator node.
|
1882
|
-
//
|
1883
|
-
// Acorn uses an [operator precedence parser][opp] to handle binary
|
1884
|
-
// operator precedence, because it is much more compact than using
|
1885
|
-
// the technique outlined above, which uses different, nesting
|
1886
|
-
// functions to specify precedence, for all of the ten binary
|
1887
|
-
// precedence levels that JavaScript defines.
|
1888
|
-
//
|
1889
|
-
// [opp]: http://en.wikipedia.org/wiki/Operator-precedence_parser
|
1890
1859
|
|
1891
1860
|
var pp$3 = Parser.prototype;
|
1892
1861
|
|
@@ -1956,14 +1925,12 @@ pp$3.checkPropClash = function(prop, propHash, refDestructuringErrors) {
|
|
1956
1925
|
// delayed syntax error at correct position).
|
1957
1926
|
|
1958
1927
|
pp$3.parseExpression = function(noIn, refDestructuringErrors) {
|
1959
|
-
var this$1 = this;
|
1960
|
-
|
1961
1928
|
var startPos = this.start, startLoc = this.startLoc;
|
1962
1929
|
var expr = this.parseMaybeAssign(noIn, refDestructuringErrors);
|
1963
1930
|
if (this.type === types.comma) {
|
1964
1931
|
var node = this.startNodeAt(startPos, startLoc);
|
1965
1932
|
node.expressions = [expr];
|
1966
|
-
while (this.eat(types.comma)) { node.expressions.push(this
|
1933
|
+
while (this.eat(types.comma)) { node.expressions.push(this.parseMaybeAssign(noIn, refDestructuringErrors)); }
|
1967
1934
|
return this.finishNode(node, "SequenceExpression")
|
1968
1935
|
}
|
1969
1936
|
return expr
|
@@ -2074,8 +2041,6 @@ pp$3.buildBinary = function(startPos, startLoc, left, right, op, logical) {
|
|
2074
2041
|
// Parse unary operators, both prefix and postfix.
|
2075
2042
|
|
2076
2043
|
pp$3.parseMaybeUnary = function(refDestructuringErrors, sawUnary) {
|
2077
|
-
var this$1 = this;
|
2078
|
-
|
2079
2044
|
var startPos = this.start, startLoc = this.startLoc, expr;
|
2080
2045
|
if (this.isContextual("await") && (this.inAsync || (!this.inFunction && this.options.allowAwaitOutsideFunction))) {
|
2081
2046
|
expr = this.parseAwait();
|
@@ -2097,13 +2062,13 @@ pp$3.parseMaybeUnary = function(refDestructuringErrors, sawUnary) {
|
|
2097
2062
|
expr = this.parseExprSubscripts(refDestructuringErrors);
|
2098
2063
|
if (this.checkExpressionErrors(refDestructuringErrors)) { return expr }
|
2099
2064
|
while (this.type.postfix && !this.canInsertSemicolon()) {
|
2100
|
-
var node$1 = this
|
2101
|
-
node$1.operator = this
|
2065
|
+
var node$1 = this.startNodeAt(startPos, startLoc);
|
2066
|
+
node$1.operator = this.value;
|
2102
2067
|
node$1.prefix = false;
|
2103
2068
|
node$1.argument = expr;
|
2104
|
-
this
|
2105
|
-
this
|
2106
|
-
expr = this
|
2069
|
+
this.checkLVal(expr);
|
2070
|
+
this.next();
|
2071
|
+
expr = this.finishNode(node$1, "UpdateExpression");
|
2107
2072
|
}
|
2108
2073
|
}
|
2109
2074
|
|
@@ -2129,12 +2094,10 @@ pp$3.parseExprSubscripts = function(refDestructuringErrors) {
|
|
2129
2094
|
};
|
2130
2095
|
|
2131
2096
|
pp$3.parseSubscripts = function(base, startPos, startLoc, noCalls) {
|
2132
|
-
var this$1 = this;
|
2133
|
-
|
2134
2097
|
var maybeAsyncArrow = this.options.ecmaVersion >= 8 && base.type === "Identifier" && base.name === "async" &&
|
2135
2098
|
this.lastTokEnd === base.end && !this.canInsertSemicolon() && this.input.slice(base.start, base.end) === "async";
|
2136
2099
|
while (true) {
|
2137
|
-
var element = this
|
2100
|
+
var element = this.parseSubscript(base, startPos, startLoc, noCalls, maybeAsyncArrow);
|
2138
2101
|
if (element === base || element.type === "ArrowFunctionExpression") { return element }
|
2139
2102
|
base = element;
|
2140
2103
|
}
|
@@ -2154,7 +2117,7 @@ pp$3.parseSubscript = function(base, startPos, startLoc, noCalls, maybeAsyncArro
|
|
2154
2117
|
this.yieldPos = 0;
|
2155
2118
|
this.awaitPos = 0;
|
2156
2119
|
this.awaitIdentPos = 0;
|
2157
|
-
var exprList = this.parseExprList(types.parenR, this.options.ecmaVersion >= 8, false, refDestructuringErrors);
|
2120
|
+
var exprList = this.parseExprList(types.parenR, this.options.ecmaVersion >= 8 && base.type !== "Import", false, refDestructuringErrors);
|
2158
2121
|
if (maybeAsyncArrow && !this.canInsertSemicolon() && this.eat(types.arrow)) {
|
2159
2122
|
this.checkPatternErrors(refDestructuringErrors, false);
|
2160
2123
|
this.checkYieldAwaitInDefaultParams();
|
@@ -2172,6 +2135,16 @@ pp$3.parseSubscript = function(base, startPos, startLoc, noCalls, maybeAsyncArro
|
|
2172
2135
|
var node$1 = this.startNodeAt(startPos, startLoc);
|
2173
2136
|
node$1.callee = base;
|
2174
2137
|
node$1.arguments = exprList;
|
2138
|
+
if (node$1.callee.type === "Import") {
|
2139
|
+
if (node$1.arguments.length !== 1) {
|
2140
|
+
this.raise(node$1.start, "import() requires exactly one argument");
|
2141
|
+
}
|
2142
|
+
|
2143
|
+
var importArg = node$1.arguments[0];
|
2144
|
+
if (importArg && importArg.type === "SpreadElement") {
|
2145
|
+
this.raise(importArg.start, "... is not allowed in import()");
|
2146
|
+
}
|
2147
|
+
}
|
2175
2148
|
base = this.finishNode(node$1, "CallExpression");
|
2176
2149
|
} else if (this.type === types.backQuote) {
|
2177
2150
|
var node$2 = this.startNodeAt(startPos, startLoc);
|
@@ -2282,15 +2255,32 @@ pp$3.parseExprAtom = function(refDestructuringErrors) {
|
|
2282
2255
|
case types.backQuote:
|
2283
2256
|
return this.parseTemplate()
|
2284
2257
|
|
2258
|
+
case types._import:
|
2259
|
+
if (this.options.ecmaVersion > 10) {
|
2260
|
+
return this.parseDynamicImport()
|
2261
|
+
} else {
|
2262
|
+
return this.unexpected()
|
2263
|
+
}
|
2264
|
+
|
2285
2265
|
default:
|
2286
2266
|
this.unexpected();
|
2287
2267
|
}
|
2288
2268
|
};
|
2289
2269
|
|
2270
|
+
pp$3.parseDynamicImport = function() {
|
2271
|
+
var node = this.startNode();
|
2272
|
+
this.next();
|
2273
|
+
if (this.type !== types.parenL) {
|
2274
|
+
this.unexpected();
|
2275
|
+
}
|
2276
|
+
return this.finishNode(node, "Import")
|
2277
|
+
};
|
2278
|
+
|
2290
2279
|
pp$3.parseLiteral = function(value) {
|
2291
2280
|
var node = this.startNode();
|
2292
2281
|
node.value = value;
|
2293
2282
|
node.raw = this.input.slice(this.start, this.end);
|
2283
|
+
if (node.raw.charCodeAt(node.raw.length - 1) === 110) { node.bigint = node.raw.slice(0, -1); }
|
2294
2284
|
this.next();
|
2295
2285
|
return this.finishNode(node, "Literal")
|
2296
2286
|
};
|
@@ -2303,8 +2293,6 @@ pp$3.parseParenExpression = function() {
|
|
2303
2293
|
};
|
2304
2294
|
|
2305
2295
|
pp$3.parseParenAndDistinguishExpression = function(canBeArrow) {
|
2306
|
-
var this$1 = this;
|
2307
|
-
|
2308
2296
|
var startPos = this.start, startLoc = this.startLoc, val, allowTrailingComma = this.options.ecmaVersion >= 8;
|
2309
2297
|
if (this.options.ecmaVersion >= 6) {
|
2310
2298
|
this.next();
|
@@ -2316,17 +2304,17 @@ pp$3.parseParenAndDistinguishExpression = function(canBeArrow) {
|
|
2316
2304
|
this.awaitPos = 0;
|
2317
2305
|
// Do not save awaitIdentPos to allow checking awaits nested in parameters
|
2318
2306
|
while (this.type !== types.parenR) {
|
2319
|
-
first ? first = false : this
|
2320
|
-
if (allowTrailingComma && this
|
2307
|
+
first ? first = false : this.expect(types.comma);
|
2308
|
+
if (allowTrailingComma && this.afterTrailingComma(types.parenR, true)) {
|
2321
2309
|
lastIsComma = true;
|
2322
2310
|
break
|
2323
|
-
} else if (this
|
2324
|
-
spreadStart = this
|
2325
|
-
exprList.push(this
|
2326
|
-
if (this
|
2311
|
+
} else if (this.type === types.ellipsis) {
|
2312
|
+
spreadStart = this.start;
|
2313
|
+
exprList.push(this.parseParenItem(this.parseRestBinding()));
|
2314
|
+
if (this.type === types.comma) { this.raise(this.start, "Comma is not permitted after the rest element"); }
|
2327
2315
|
break
|
2328
2316
|
} else {
|
2329
|
-
exprList.push(this
|
2317
|
+
exprList.push(this.parseMaybeAssign(false, refDestructuringErrors, this.parseParenItem));
|
2330
2318
|
}
|
2331
2319
|
}
|
2332
2320
|
var innerEndPos = this.start, innerEndLoc = this.startLoc;
|
@@ -2397,7 +2385,10 @@ pp$3.parseNew = function() {
|
|
2397
2385
|
}
|
2398
2386
|
var startPos = this.start, startLoc = this.startLoc;
|
2399
2387
|
node.callee = this.parseSubscripts(this.parseExprAtom(), startPos, startLoc, true);
|
2400
|
-
if (this.
|
2388
|
+
if (this.options.ecmaVersion > 10 && node.callee.type === "Import") {
|
2389
|
+
this.raise(node.callee.start, "Cannot use new with import(...)");
|
2390
|
+
}
|
2391
|
+
if (this.eat(types.parenL)) { node.arguments = this.parseExprList(types.parenR, this.options.ecmaVersion >= 8 && node.callee.type !== "Import", false); }
|
2401
2392
|
else { node.arguments = empty$1; }
|
2402
2393
|
return this.finishNode(node, "NewExpression")
|
2403
2394
|
};
|
@@ -2428,7 +2419,6 @@ pp$3.parseTemplateElement = function(ref) {
|
|
2428
2419
|
};
|
2429
2420
|
|
2430
2421
|
pp$3.parseTemplate = function(ref) {
|
2431
|
-
var this$1 = this;
|
2432
2422
|
if ( ref === void 0 ) ref = {};
|
2433
2423
|
var isTagged = ref.isTagged; if ( isTagged === void 0 ) isTagged = false;
|
2434
2424
|
|
@@ -2438,11 +2428,11 @@ pp$3.parseTemplate = function(ref) {
|
|
2438
2428
|
var curElt = this.parseTemplateElement({isTagged: isTagged});
|
2439
2429
|
node.quasis = [curElt];
|
2440
2430
|
while (!curElt.tail) {
|
2441
|
-
if (this
|
2442
|
-
this
|
2443
|
-
node.expressions.push(this
|
2444
|
-
this
|
2445
|
-
node.quasis.push(curElt = this
|
2431
|
+
if (this.type === types.eof) { this.raise(this.pos, "Unterminated template literal"); }
|
2432
|
+
this.expect(types.dollarBraceL);
|
2433
|
+
node.expressions.push(this.parseExpression());
|
2434
|
+
this.expect(types.braceR);
|
2435
|
+
node.quasis.push(curElt = this.parseTemplateElement({isTagged: isTagged}));
|
2446
2436
|
}
|
2447
2437
|
this.next();
|
2448
2438
|
return this.finishNode(node, "TemplateLiteral")
|
@@ -2457,19 +2447,17 @@ pp$3.isAsyncProp = function(prop) {
|
|
2457
2447
|
// Parse an object literal or binding pattern.
|
2458
2448
|
|
2459
2449
|
pp$3.parseObj = function(isPattern, refDestructuringErrors) {
|
2460
|
-
var this$1 = this;
|
2461
|
-
|
2462
2450
|
var node = this.startNode(), first = true, propHash = {};
|
2463
2451
|
node.properties = [];
|
2464
2452
|
this.next();
|
2465
2453
|
while (!this.eat(types.braceR)) {
|
2466
2454
|
if (!first) {
|
2467
|
-
this
|
2468
|
-
if (this
|
2455
|
+
this.expect(types.comma);
|
2456
|
+
if (this.afterTrailingComma(types.braceR)) { break }
|
2469
2457
|
} else { first = false; }
|
2470
2458
|
|
2471
|
-
var prop = this
|
2472
|
-
if (!isPattern) { this
|
2459
|
+
var prop = this.parseProperty(isPattern, refDestructuringErrors);
|
2460
|
+
if (!isPattern) { this.checkPropClash(prop, propHash, refDestructuringErrors); }
|
2473
2461
|
node.properties.push(prop);
|
2474
2462
|
}
|
2475
2463
|
return this.finishNode(node, isPattern ? "ObjectPattern" : "ObjectExpression")
|
@@ -2702,14 +2690,12 @@ pp$3.isSimpleParamList = function(params) {
|
|
2702
2690
|
// or "arguments" and duplicate parameters.
|
2703
2691
|
|
2704
2692
|
pp$3.checkParams = function(node, allowDuplicates) {
|
2705
|
-
var this$1 = this;
|
2706
|
-
|
2707
2693
|
var nameHash = {};
|
2708
2694
|
for (var i = 0, list = node.params; i < list.length; i += 1)
|
2709
2695
|
{
|
2710
2696
|
var param = list[i];
|
2711
2697
|
|
2712
|
-
this
|
2698
|
+
this.checkLVal(param, BIND_VAR, allowDuplicates ? null : nameHash);
|
2713
2699
|
}
|
2714
2700
|
};
|
2715
2701
|
|
@@ -2720,24 +2706,22 @@ pp$3.checkParams = function(node, allowDuplicates) {
|
|
2720
2706
|
// for array literals).
|
2721
2707
|
|
2722
2708
|
pp$3.parseExprList = function(close, allowTrailingComma, allowEmpty, refDestructuringErrors) {
|
2723
|
-
var this$1 = this;
|
2724
|
-
|
2725
2709
|
var elts = [], first = true;
|
2726
2710
|
while (!this.eat(close)) {
|
2727
2711
|
if (!first) {
|
2728
|
-
this
|
2729
|
-
if (allowTrailingComma && this
|
2712
|
+
this.expect(types.comma);
|
2713
|
+
if (allowTrailingComma && this.afterTrailingComma(close)) { break }
|
2730
2714
|
} else { first = false; }
|
2731
2715
|
|
2732
2716
|
var elt = (void 0);
|
2733
|
-
if (allowEmpty && this
|
2717
|
+
if (allowEmpty && this.type === types.comma)
|
2734
2718
|
{ elt = null; }
|
2735
|
-
else if (this
|
2736
|
-
elt = this
|
2737
|
-
if (refDestructuringErrors && this
|
2738
|
-
{ refDestructuringErrors.trailingComma = this
|
2719
|
+
else if (this.type === types.ellipsis) {
|
2720
|
+
elt = this.parseSpread(refDestructuringErrors);
|
2721
|
+
if (refDestructuringErrors && this.type === types.comma && refDestructuringErrors.trailingComma < 0)
|
2722
|
+
{ refDestructuringErrors.trailingComma = this.start; }
|
2739
2723
|
} else {
|
2740
|
-
elt = this
|
2724
|
+
elt = this.parseMaybeAssign(false, refDestructuringErrors);
|
2741
2725
|
}
|
2742
2726
|
elts.push(elt);
|
2743
2727
|
}
|
@@ -2878,8 +2862,6 @@ pp$5.treatFunctionsAsVarInScope = function(scope) {
|
|
2878
2862
|
};
|
2879
2863
|
|
2880
2864
|
pp$5.declareName = function(name, bindingType, pos) {
|
2881
|
-
var this$1 = this;
|
2882
|
-
|
2883
2865
|
var redeclared = false;
|
2884
2866
|
if (bindingType === BIND_LEXICAL) {
|
2885
2867
|
var scope = this.currentScope();
|
@@ -2899,15 +2881,15 @@ pp$5.declareName = function(name, bindingType, pos) {
|
|
2899
2881
|
scope$2.functions.push(name);
|
2900
2882
|
} else {
|
2901
2883
|
for (var i = this.scopeStack.length - 1; i >= 0; --i) {
|
2902
|
-
var scope$3 = this
|
2884
|
+
var scope$3 = this.scopeStack[i];
|
2903
2885
|
if (scope$3.lexical.indexOf(name) > -1 && !((scope$3.flags & SCOPE_SIMPLE_CATCH) && scope$3.lexical[0] === name) ||
|
2904
|
-
!this
|
2886
|
+
!this.treatFunctionsAsVarInScope(scope$3) && scope$3.functions.indexOf(name) > -1) {
|
2905
2887
|
redeclared = true;
|
2906
2888
|
break
|
2907
2889
|
}
|
2908
2890
|
scope$3.var.push(name);
|
2909
|
-
if (this
|
2910
|
-
{ delete this
|
2891
|
+
if (this.inModule && (scope$3.flags & SCOPE_TOP))
|
2892
|
+
{ delete this.undefinedExports[name]; }
|
2911
2893
|
if (scope$3.flags & SCOPE_VAR) { break }
|
2912
2894
|
}
|
2913
2895
|
}
|
@@ -2927,20 +2909,16 @@ pp$5.currentScope = function() {
|
|
2927
2909
|
};
|
2928
2910
|
|
2929
2911
|
pp$5.currentVarScope = function() {
|
2930
|
-
var this$1 = this;
|
2931
|
-
|
2932
2912
|
for (var i = this.scopeStack.length - 1;; i--) {
|
2933
|
-
var scope = this
|
2913
|
+
var scope = this.scopeStack[i];
|
2934
2914
|
if (scope.flags & SCOPE_VAR) { return scope }
|
2935
2915
|
}
|
2936
2916
|
};
|
2937
2917
|
|
2938
2918
|
// Could be useful for `this`, `new.target`, `super()`, `super.property`, and `super[property]`.
|
2939
2919
|
pp$5.currentThisScope = function() {
|
2940
|
-
var this$1 = this;
|
2941
|
-
|
2942
2920
|
for (var i = this.scopeStack.length - 1;; i--) {
|
2943
|
-
var scope = this
|
2921
|
+
var scope = this.scopeStack[i];
|
2944
2922
|
if (scope.flags & SCOPE_VAR && !(scope.flags & SCOPE_ARROW)) { return scope }
|
2945
2923
|
}
|
2946
2924
|
};
|
@@ -2992,8 +2970,6 @@ pp$6.finishNodeAt = function(node, type, pos, loc) {
|
|
2992
2970
|
};
|
2993
2971
|
|
2994
2972
|
// The algorithm used to determine whether a regexp can appear at a
|
2995
|
-
// given point in the program is loosely based on sweet.js' approach.
|
2996
|
-
// See https://github.com/mozilla/sweet.js/wiki/design
|
2997
2973
|
|
2998
2974
|
var TokContext = function TokContext(token, isExpr, preserveSpace, override, generator) {
|
2999
2975
|
this.token = token;
|
@@ -3044,10 +3020,8 @@ pp$7.braceIsBlock = function(prevType) {
|
|
3044
3020
|
};
|
3045
3021
|
|
3046
3022
|
pp$7.inGeneratorContext = function() {
|
3047
|
-
var this$1 = this;
|
3048
|
-
|
3049
3023
|
for (var i = this.context.length - 1; i >= 1; i--) {
|
3050
|
-
var context = this
|
3024
|
+
var context = this.context[i];
|
3051
3025
|
if (context.token === "function")
|
3052
3026
|
{ return context.generator }
|
3053
3027
|
}
|
@@ -3155,7 +3129,7 @@ var unicodeGeneralCategoryValues = "Cased_Letter LC Close_Punctuation Pe Connect
|
|
3155
3129
|
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";
|
3156
3130
|
var unicodeScriptValues = {
|
3157
3131
|
9: ecma9ScriptValues,
|
3158
|
-
10: ecma9ScriptValues + " Dogra Dogr Gunjala_Gondi Gong Hanifi_Rohingya Rohg Makasar Maka Medefaidrin Medf Old_Sogdian Sogo Sogdian Sogd"
|
3132
|
+
10: ecma9ScriptValues + " Dogra Dogr Elymaic Elym Gunjala_Gondi Gong Hanifi_Rohingya Rohg Makasar Maka Medefaidrin Medf Nandinagari Nand Nyiakeng_Puachue_Hmong Hmnp Old_Sogdian Sogo Sogdian Sogd Wancho Wcho"
|
3159
3133
|
};
|
3160
3134
|
|
3161
3135
|
var data = {};
|
@@ -3176,7 +3150,7 @@ function buildUnicodeData(ecmaVersion) {
|
|
3176
3150
|
buildUnicodeData(9);
|
3177
3151
|
buildUnicodeData(10);
|
3178
3152
|
|
3179
|
-
var pp$
|
3153
|
+
var pp$8 = Parser.prototype;
|
3180
3154
|
|
3181
3155
|
var RegExpValidationState = function RegExpValidationState(parser) {
|
3182
3156
|
this.parser = parser;
|
@@ -3258,7 +3232,7 @@ RegExpValidationState.prototype.eat = function eat (ch) {
|
|
3258
3232
|
return false
|
3259
3233
|
};
|
3260
3234
|
|
3261
|
-
function codePointToString
|
3235
|
+
function codePointToString(ch) {
|
3262
3236
|
if (ch <= 0xFFFF) { return String.fromCharCode(ch) }
|
3263
3237
|
ch -= 0x10000;
|
3264
3238
|
return String.fromCharCode((ch >> 10) + 0xD800, (ch & 0x03FF) + 0xDC00)
|
@@ -3270,19 +3244,17 @@ function codePointToString$1(ch) {
|
|
3270
3244
|
* @param {RegExpValidationState} state The state to validate RegExp.
|
3271
3245
|
* @returns {void}
|
3272
3246
|
*/
|
3273
|
-
pp$
|
3274
|
-
var this$1 = this;
|
3275
|
-
|
3247
|
+
pp$8.validateRegExpFlags = function(state) {
|
3276
3248
|
var validFlags = state.validFlags;
|
3277
3249
|
var flags = state.flags;
|
3278
3250
|
|
3279
3251
|
for (var i = 0; i < flags.length; i++) {
|
3280
3252
|
var flag = flags.charAt(i);
|
3281
3253
|
if (validFlags.indexOf(flag) === -1) {
|
3282
|
-
this
|
3254
|
+
this.raise(state.start, "Invalid regular expression flag");
|
3283
3255
|
}
|
3284
3256
|
if (flags.indexOf(flag, i + 1) > -1) {
|
3285
|
-
this
|
3257
|
+
this.raise(state.start, "Duplicate regular expression flag");
|
3286
3258
|
}
|
3287
3259
|
}
|
3288
3260
|
};
|
@@ -3293,7 +3265,7 @@ pp$9.validateRegExpFlags = function(state) {
|
|
3293
3265
|
* @param {RegExpValidationState} state The state to validate RegExp.
|
3294
3266
|
* @returns {void}
|
3295
3267
|
*/
|
3296
|
-
pp$
|
3268
|
+
pp$8.validateRegExpPattern = function(state) {
|
3297
3269
|
this.regexp_pattern(state);
|
3298
3270
|
|
3299
3271
|
// The goal symbol for the parse is |Pattern[~U, ~N]|. If the result of
|
@@ -3308,7 +3280,7 @@ pp$9.validateRegExpPattern = function(state) {
|
|
3308
3280
|
};
|
3309
3281
|
|
3310
3282
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-Pattern
|
3311
|
-
pp$
|
3283
|
+
pp$8.regexp_pattern = function(state) {
|
3312
3284
|
state.pos = 0;
|
3313
3285
|
state.lastIntValue = 0;
|
3314
3286
|
state.lastStringValue = "";
|
@@ -3342,12 +3314,10 @@ pp$9.regexp_pattern = function(state) {
|
|
3342
3314
|
};
|
3343
3315
|
|
3344
3316
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-Disjunction
|
3345
|
-
pp$
|
3346
|
-
var this$1 = this;
|
3347
|
-
|
3317
|
+
pp$8.regexp_disjunction = function(state) {
|
3348
3318
|
this.regexp_alternative(state);
|
3349
3319
|
while (state.eat(0x7C /* | */)) {
|
3350
|
-
this
|
3320
|
+
this.regexp_alternative(state);
|
3351
3321
|
}
|
3352
3322
|
|
3353
3323
|
// Make the same message as V8.
|
@@ -3360,13 +3330,13 @@ pp$9.regexp_disjunction = function(state) {
|
|
3360
3330
|
};
|
3361
3331
|
|
3362
3332
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-Alternative
|
3363
|
-
pp$
|
3333
|
+
pp$8.regexp_alternative = function(state) {
|
3364
3334
|
while (state.pos < state.source.length && this.regexp_eatTerm(state))
|
3365
|
-
{
|
3335
|
+
{ }
|
3366
3336
|
};
|
3367
3337
|
|
3368
3338
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-Term
|
3369
|
-
pp$
|
3339
|
+
pp$8.regexp_eatTerm = function(state) {
|
3370
3340
|
if (this.regexp_eatAssertion(state)) {
|
3371
3341
|
// Handle `QuantifiableAssertion Quantifier` alternative.
|
3372
3342
|
// `state.lastAssertionIsQuantifiable` is true if the last eaten Assertion
|
@@ -3389,7 +3359,7 @@ pp$9.regexp_eatTerm = function(state) {
|
|
3389
3359
|
};
|
3390
3360
|
|
3391
3361
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-Assertion
|
3392
|
-
pp$
|
3362
|
+
pp$8.regexp_eatAssertion = function(state) {
|
3393
3363
|
var start = state.pos;
|
3394
3364
|
state.lastAssertionIsQuantifiable = false;
|
3395
3365
|
|
@@ -3427,7 +3397,7 @@ pp$9.regexp_eatAssertion = function(state) {
|
|
3427
3397
|
};
|
3428
3398
|
|
3429
3399
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-Quantifier
|
3430
|
-
pp$
|
3400
|
+
pp$8.regexp_eatQuantifier = function(state, noError) {
|
3431
3401
|
if ( noError === void 0 ) noError = false;
|
3432
3402
|
|
3433
3403
|
if (this.regexp_eatQuantifierPrefix(state, noError)) {
|
@@ -3438,7 +3408,7 @@ pp$9.regexp_eatQuantifier = function(state, noError) {
|
|
3438
3408
|
};
|
3439
3409
|
|
3440
3410
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-QuantifierPrefix
|
3441
|
-
pp$
|
3411
|
+
pp$8.regexp_eatQuantifierPrefix = function(state, noError) {
|
3442
3412
|
return (
|
3443
3413
|
state.eat(0x2A /* * */) ||
|
3444
3414
|
state.eat(0x2B /* + */) ||
|
@@ -3446,7 +3416,7 @@ pp$9.regexp_eatQuantifierPrefix = function(state, noError) {
|
|
3446
3416
|
this.regexp_eatBracedQuantifier(state, noError)
|
3447
3417
|
)
|
3448
3418
|
};
|
3449
|
-
pp$
|
3419
|
+
pp$8.regexp_eatBracedQuantifier = function(state, noError) {
|
3450
3420
|
var start = state.pos;
|
3451
3421
|
if (state.eat(0x7B /* { */)) {
|
3452
3422
|
var min = 0, max = -1;
|
@@ -3472,7 +3442,7 @@ pp$9.regexp_eatBracedQuantifier = function(state, noError) {
|
|
3472
3442
|
};
|
3473
3443
|
|
3474
3444
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-Atom
|
3475
|
-
pp$
|
3445
|
+
pp$8.regexp_eatAtom = function(state) {
|
3476
3446
|
return (
|
3477
3447
|
this.regexp_eatPatternCharacters(state) ||
|
3478
3448
|
state.eat(0x2E /* . */) ||
|
@@ -3482,7 +3452,7 @@ pp$9.regexp_eatAtom = function(state) {
|
|
3482
3452
|
this.regexp_eatCapturingGroup(state)
|
3483
3453
|
)
|
3484
3454
|
};
|
3485
|
-
pp$
|
3455
|
+
pp$8.regexp_eatReverseSolidusAtomEscape = function(state) {
|
3486
3456
|
var start = state.pos;
|
3487
3457
|
if (state.eat(0x5C /* \ */)) {
|
3488
3458
|
if (this.regexp_eatAtomEscape(state)) {
|
@@ -3492,7 +3462,7 @@ pp$9.regexp_eatReverseSolidusAtomEscape = function(state) {
|
|
3492
3462
|
}
|
3493
3463
|
return false
|
3494
3464
|
};
|
3495
|
-
pp$
|
3465
|
+
pp$8.regexp_eatUncapturingGroup = function(state) {
|
3496
3466
|
var start = state.pos;
|
3497
3467
|
if (state.eat(0x28 /* ( */)) {
|
3498
3468
|
if (state.eat(0x3F /* ? */) && state.eat(0x3A /* : */)) {
|
@@ -3506,7 +3476,7 @@ pp$9.regexp_eatUncapturingGroup = function(state) {
|
|
3506
3476
|
}
|
3507
3477
|
return false
|
3508
3478
|
};
|
3509
|
-
pp$
|
3479
|
+
pp$8.regexp_eatCapturingGroup = function(state) {
|
3510
3480
|
if (state.eat(0x28 /* ( */)) {
|
3511
3481
|
if (this.options.ecmaVersion >= 9) {
|
3512
3482
|
this.regexp_groupSpecifier(state);
|
@@ -3524,7 +3494,7 @@ pp$9.regexp_eatCapturingGroup = function(state) {
|
|
3524
3494
|
};
|
3525
3495
|
|
3526
3496
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-ExtendedAtom
|
3527
|
-
pp$
|
3497
|
+
pp$8.regexp_eatExtendedAtom = function(state) {
|
3528
3498
|
return (
|
3529
3499
|
state.eat(0x2E /* . */) ||
|
3530
3500
|
this.regexp_eatReverseSolidusAtomEscape(state) ||
|
@@ -3537,7 +3507,7 @@ pp$9.regexp_eatExtendedAtom = function(state) {
|
|
3537
3507
|
};
|
3538
3508
|
|
3539
3509
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-InvalidBracedQuantifier
|
3540
|
-
pp$
|
3510
|
+
pp$8.regexp_eatInvalidBracedQuantifier = function(state) {
|
3541
3511
|
if (this.regexp_eatBracedQuantifier(state, true)) {
|
3542
3512
|
state.raise("Nothing to repeat");
|
3543
3513
|
}
|
@@ -3545,7 +3515,7 @@ pp$9.regexp_eatInvalidBracedQuantifier = function(state) {
|
|
3545
3515
|
};
|
3546
3516
|
|
3547
3517
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-SyntaxCharacter
|
3548
|
-
pp$
|
3518
|
+
pp$8.regexp_eatSyntaxCharacter = function(state) {
|
3549
3519
|
var ch = state.current();
|
3550
3520
|
if (isSyntaxCharacter(ch)) {
|
3551
3521
|
state.lastIntValue = ch;
|
@@ -3567,7 +3537,7 @@ function isSyntaxCharacter(ch) {
|
|
3567
3537
|
|
3568
3538
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-PatternCharacter
|
3569
3539
|
// But eat eager.
|
3570
|
-
pp$
|
3540
|
+
pp$8.regexp_eatPatternCharacters = function(state) {
|
3571
3541
|
var start = state.pos;
|
3572
3542
|
var ch = 0;
|
3573
3543
|
while ((ch = state.current()) !== -1 && !isSyntaxCharacter(ch)) {
|
@@ -3577,7 +3547,7 @@ pp$9.regexp_eatPatternCharacters = function(state) {
|
|
3577
3547
|
};
|
3578
3548
|
|
3579
3549
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-ExtendedPatternCharacter
|
3580
|
-
pp$
|
3550
|
+
pp$8.regexp_eatExtendedPatternCharacter = function(state) {
|
3581
3551
|
var ch = state.current();
|
3582
3552
|
if (
|
3583
3553
|
ch !== -1 &&
|
@@ -3598,7 +3568,7 @@ pp$9.regexp_eatExtendedPatternCharacter = function(state) {
|
|
3598
3568
|
// GroupSpecifier[U] ::
|
3599
3569
|
// [empty]
|
3600
3570
|
// `?` GroupName[?U]
|
3601
|
-
pp$
|
3571
|
+
pp$8.regexp_groupSpecifier = function(state) {
|
3602
3572
|
if (state.eat(0x3F /* ? */)) {
|
3603
3573
|
if (this.regexp_eatGroupName(state)) {
|
3604
3574
|
if (state.groupNames.indexOf(state.lastStringValue) !== -1) {
|
@@ -3614,7 +3584,7 @@ pp$9.regexp_groupSpecifier = function(state) {
|
|
3614
3584
|
// GroupName[U] ::
|
3615
3585
|
// `<` RegExpIdentifierName[?U] `>`
|
3616
3586
|
// Note: this updates `state.lastStringValue` property with the eaten name.
|
3617
|
-
pp$
|
3587
|
+
pp$8.regexp_eatGroupName = function(state) {
|
3618
3588
|
state.lastStringValue = "";
|
3619
3589
|
if (state.eat(0x3C /* < */)) {
|
3620
3590
|
if (this.regexp_eatRegExpIdentifierName(state) && state.eat(0x3E /* > */)) {
|
@@ -3629,12 +3599,12 @@ pp$9.regexp_eatGroupName = function(state) {
|
|
3629
3599
|
// RegExpIdentifierStart[?U]
|
3630
3600
|
// RegExpIdentifierName[?U] RegExpIdentifierPart[?U]
|
3631
3601
|
// Note: this updates `state.lastStringValue` property with the eaten name.
|
3632
|
-
pp$
|
3602
|
+
pp$8.regexp_eatRegExpIdentifierName = function(state) {
|
3633
3603
|
state.lastStringValue = "";
|
3634
3604
|
if (this.regexp_eatRegExpIdentifierStart(state)) {
|
3635
|
-
state.lastStringValue += codePointToString
|
3605
|
+
state.lastStringValue += codePointToString(state.lastIntValue);
|
3636
3606
|
while (this.regexp_eatRegExpIdentifierPart(state)) {
|
3637
|
-
state.lastStringValue += codePointToString
|
3607
|
+
state.lastStringValue += codePointToString(state.lastIntValue);
|
3638
3608
|
}
|
3639
3609
|
return true
|
3640
3610
|
}
|
@@ -3646,7 +3616,7 @@ pp$9.regexp_eatRegExpIdentifierName = function(state) {
|
|
3646
3616
|
// `$`
|
3647
3617
|
// `_`
|
3648
3618
|
// `\` RegExpUnicodeEscapeSequence[?U]
|
3649
|
-
pp$
|
3619
|
+
pp$8.regexp_eatRegExpIdentifierStart = function(state) {
|
3650
3620
|
var start = state.pos;
|
3651
3621
|
var ch = state.current();
|
3652
3622
|
state.advance();
|
@@ -3673,7 +3643,7 @@ function isRegExpIdentifierStart(ch) {
|
|
3673
3643
|
// `\` RegExpUnicodeEscapeSequence[?U]
|
3674
3644
|
// <ZWNJ>
|
3675
3645
|
// <ZWJ>
|
3676
|
-
pp$
|
3646
|
+
pp$8.regexp_eatRegExpIdentifierPart = function(state) {
|
3677
3647
|
var start = state.pos;
|
3678
3648
|
var ch = state.current();
|
3679
3649
|
state.advance();
|
@@ -3694,7 +3664,7 @@ function isRegExpIdentifierPart(ch) {
|
|
3694
3664
|
}
|
3695
3665
|
|
3696
3666
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-AtomEscape
|
3697
|
-
pp$
|
3667
|
+
pp$8.regexp_eatAtomEscape = function(state) {
|
3698
3668
|
if (
|
3699
3669
|
this.regexp_eatBackReference(state) ||
|
3700
3670
|
this.regexp_eatCharacterClassEscape(state) ||
|
@@ -3712,7 +3682,7 @@ pp$9.regexp_eatAtomEscape = function(state) {
|
|
3712
3682
|
}
|
3713
3683
|
return false
|
3714
3684
|
};
|
3715
|
-
pp$
|
3685
|
+
pp$8.regexp_eatBackReference = function(state) {
|
3716
3686
|
var start = state.pos;
|
3717
3687
|
if (this.regexp_eatDecimalEscape(state)) {
|
3718
3688
|
var n = state.lastIntValue;
|
@@ -3730,7 +3700,7 @@ pp$9.regexp_eatBackReference = function(state) {
|
|
3730
3700
|
}
|
3731
3701
|
return false
|
3732
3702
|
};
|
3733
|
-
pp$
|
3703
|
+
pp$8.regexp_eatKGroupName = function(state) {
|
3734
3704
|
if (state.eat(0x6B /* k */)) {
|
3735
3705
|
if (this.regexp_eatGroupName(state)) {
|
3736
3706
|
state.backReferenceNames.push(state.lastStringValue);
|
@@ -3742,7 +3712,7 @@ pp$9.regexp_eatKGroupName = function(state) {
|
|
3742
3712
|
};
|
3743
3713
|
|
3744
3714
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-CharacterEscape
|
3745
|
-
pp$
|
3715
|
+
pp$8.regexp_eatCharacterEscape = function(state) {
|
3746
3716
|
return (
|
3747
3717
|
this.regexp_eatControlEscape(state) ||
|
3748
3718
|
this.regexp_eatCControlLetter(state) ||
|
@@ -3753,7 +3723,7 @@ pp$9.regexp_eatCharacterEscape = function(state) {
|
|
3753
3723
|
this.regexp_eatIdentityEscape(state)
|
3754
3724
|
)
|
3755
3725
|
};
|
3756
|
-
pp$
|
3726
|
+
pp$8.regexp_eatCControlLetter = function(state) {
|
3757
3727
|
var start = state.pos;
|
3758
3728
|
if (state.eat(0x63 /* c */)) {
|
3759
3729
|
if (this.regexp_eatControlLetter(state)) {
|
@@ -3763,7 +3733,7 @@ pp$9.regexp_eatCControlLetter = function(state) {
|
|
3763
3733
|
}
|
3764
3734
|
return false
|
3765
3735
|
};
|
3766
|
-
pp$
|
3736
|
+
pp$8.regexp_eatZero = function(state) {
|
3767
3737
|
if (state.current() === 0x30 /* 0 */ && !isDecimalDigit(state.lookahead())) {
|
3768
3738
|
state.lastIntValue = 0;
|
3769
3739
|
state.advance();
|
@@ -3773,7 +3743,7 @@ pp$9.regexp_eatZero = function(state) {
|
|
3773
3743
|
};
|
3774
3744
|
|
3775
3745
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-ControlEscape
|
3776
|
-
pp$
|
3746
|
+
pp$8.regexp_eatControlEscape = function(state) {
|
3777
3747
|
var ch = state.current();
|
3778
3748
|
if (ch === 0x74 /* t */) {
|
3779
3749
|
state.lastIntValue = 0x09; /* \t */
|
@@ -3804,7 +3774,7 @@ pp$9.regexp_eatControlEscape = function(state) {
|
|
3804
3774
|
};
|
3805
3775
|
|
3806
3776
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-ControlLetter
|
3807
|
-
pp$
|
3777
|
+
pp$8.regexp_eatControlLetter = function(state) {
|
3808
3778
|
var ch = state.current();
|
3809
3779
|
if (isControlLetter(ch)) {
|
3810
3780
|
state.lastIntValue = ch % 0x20;
|
@@ -3821,7 +3791,7 @@ function isControlLetter(ch) {
|
|
3821
3791
|
}
|
3822
3792
|
|
3823
3793
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-RegExpUnicodeEscapeSequence
|
3824
|
-
pp$
|
3794
|
+
pp$8.regexp_eatRegExpUnicodeEscapeSequence = function(state) {
|
3825
3795
|
var start = state.pos;
|
3826
3796
|
|
3827
3797
|
if (state.eat(0x75 /* u */)) {
|
@@ -3863,7 +3833,7 @@ function isValidUnicode(ch) {
|
|
3863
3833
|
}
|
3864
3834
|
|
3865
3835
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-IdentityEscape
|
3866
|
-
pp$
|
3836
|
+
pp$8.regexp_eatIdentityEscape = function(state) {
|
3867
3837
|
if (state.switchU) {
|
3868
3838
|
if (this.regexp_eatSyntaxCharacter(state)) {
|
3869
3839
|
return true
|
@@ -3886,7 +3856,7 @@ pp$9.regexp_eatIdentityEscape = function(state) {
|
|
3886
3856
|
};
|
3887
3857
|
|
3888
3858
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-DecimalEscape
|
3889
|
-
pp$
|
3859
|
+
pp$8.regexp_eatDecimalEscape = function(state) {
|
3890
3860
|
state.lastIntValue = 0;
|
3891
3861
|
var ch = state.current();
|
3892
3862
|
if (ch >= 0x31 /* 1 */ && ch <= 0x39 /* 9 */) {
|
@@ -3900,7 +3870,7 @@ pp$9.regexp_eatDecimalEscape = function(state) {
|
|
3900
3870
|
};
|
3901
3871
|
|
3902
3872
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-CharacterClassEscape
|
3903
|
-
pp$
|
3873
|
+
pp$8.regexp_eatCharacterClassEscape = function(state) {
|
3904
3874
|
var ch = state.current();
|
3905
3875
|
|
3906
3876
|
if (isCharacterClassEscape(ch)) {
|
@@ -3942,7 +3912,7 @@ function isCharacterClassEscape(ch) {
|
|
3942
3912
|
// UnicodePropertyValueExpression ::
|
3943
3913
|
// UnicodePropertyName `=` UnicodePropertyValue
|
3944
3914
|
// LoneUnicodePropertyNameOrValue
|
3945
|
-
pp$
|
3915
|
+
pp$8.regexp_eatUnicodePropertyValueExpression = function(state) {
|
3946
3916
|
var start = state.pos;
|
3947
3917
|
|
3948
3918
|
// UnicodePropertyName `=` UnicodePropertyValue
|
@@ -3964,24 +3934,24 @@ pp$9.regexp_eatUnicodePropertyValueExpression = function(state) {
|
|
3964
3934
|
}
|
3965
3935
|
return false
|
3966
3936
|
};
|
3967
|
-
pp$
|
3937
|
+
pp$8.regexp_validateUnicodePropertyNameAndValue = function(state, name, value) {
|
3968
3938
|
if (!has(state.unicodeProperties.nonBinary, name))
|
3969
3939
|
{ state.raise("Invalid property name"); }
|
3970
3940
|
if (!state.unicodeProperties.nonBinary[name].test(value))
|
3971
3941
|
{ state.raise("Invalid property value"); }
|
3972
3942
|
};
|
3973
|
-
pp$
|
3943
|
+
pp$8.regexp_validateUnicodePropertyNameOrValue = function(state, nameOrValue) {
|
3974
3944
|
if (!state.unicodeProperties.binary.test(nameOrValue))
|
3975
3945
|
{ state.raise("Invalid property name"); }
|
3976
3946
|
};
|
3977
3947
|
|
3978
3948
|
// UnicodePropertyName ::
|
3979
3949
|
// UnicodePropertyNameCharacters
|
3980
|
-
pp$
|
3950
|
+
pp$8.regexp_eatUnicodePropertyName = function(state) {
|
3981
3951
|
var ch = 0;
|
3982
3952
|
state.lastStringValue = "";
|
3983
3953
|
while (isUnicodePropertyNameCharacter(ch = state.current())) {
|
3984
|
-
state.lastStringValue += codePointToString
|
3954
|
+
state.lastStringValue += codePointToString(ch);
|
3985
3955
|
state.advance();
|
3986
3956
|
}
|
3987
3957
|
return state.lastStringValue !== ""
|
@@ -3992,11 +3962,11 @@ function isUnicodePropertyNameCharacter(ch) {
|
|
3992
3962
|
|
3993
3963
|
// UnicodePropertyValue ::
|
3994
3964
|
// UnicodePropertyValueCharacters
|
3995
|
-
pp$
|
3965
|
+
pp$8.regexp_eatUnicodePropertyValue = function(state) {
|
3996
3966
|
var ch = 0;
|
3997
3967
|
state.lastStringValue = "";
|
3998
3968
|
while (isUnicodePropertyValueCharacter(ch = state.current())) {
|
3999
|
-
state.lastStringValue += codePointToString
|
3969
|
+
state.lastStringValue += codePointToString(ch);
|
4000
3970
|
state.advance();
|
4001
3971
|
}
|
4002
3972
|
return state.lastStringValue !== ""
|
@@ -4007,12 +3977,12 @@ function isUnicodePropertyValueCharacter(ch) {
|
|
4007
3977
|
|
4008
3978
|
// LoneUnicodePropertyNameOrValue ::
|
4009
3979
|
// UnicodePropertyValueCharacters
|
4010
|
-
pp$
|
3980
|
+
pp$8.regexp_eatLoneUnicodePropertyNameOrValue = function(state) {
|
4011
3981
|
return this.regexp_eatUnicodePropertyValue(state)
|
4012
3982
|
};
|
4013
3983
|
|
4014
3984
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-CharacterClass
|
4015
|
-
pp$
|
3985
|
+
pp$8.regexp_eatCharacterClass = function(state) {
|
4016
3986
|
if (state.eat(0x5B /* [ */)) {
|
4017
3987
|
state.eat(0x5E /* ^ */);
|
4018
3988
|
this.regexp_classRanges(state);
|
@@ -4028,12 +3998,10 @@ pp$9.regexp_eatCharacterClass = function(state) {
|
|
4028
3998
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-ClassRanges
|
4029
3999
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-NonemptyClassRanges
|
4030
4000
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-NonemptyClassRangesNoDash
|
4031
|
-
pp$
|
4032
|
-
var this$1 = this;
|
4033
|
-
|
4001
|
+
pp$8.regexp_classRanges = function(state) {
|
4034
4002
|
while (this.regexp_eatClassAtom(state)) {
|
4035
4003
|
var left = state.lastIntValue;
|
4036
|
-
if (state.eat(0x2D /* - */) && this
|
4004
|
+
if (state.eat(0x2D /* - */) && this.regexp_eatClassAtom(state)) {
|
4037
4005
|
var right = state.lastIntValue;
|
4038
4006
|
if (state.switchU && (left === -1 || right === -1)) {
|
4039
4007
|
state.raise("Invalid character class");
|
@@ -4047,7 +4015,7 @@ pp$9.regexp_classRanges = function(state) {
|
|
4047
4015
|
|
4048
4016
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-ClassAtom
|
4049
4017
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-ClassAtomNoDash
|
4050
|
-
pp$
|
4018
|
+
pp$8.regexp_eatClassAtom = function(state) {
|
4051
4019
|
var start = state.pos;
|
4052
4020
|
|
4053
4021
|
if (state.eat(0x5C /* \ */)) {
|
@@ -4076,7 +4044,7 @@ pp$9.regexp_eatClassAtom = function(state) {
|
|
4076
4044
|
};
|
4077
4045
|
|
4078
4046
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-ClassEscape
|
4079
|
-
pp$
|
4047
|
+
pp$8.regexp_eatClassEscape = function(state) {
|
4080
4048
|
var start = state.pos;
|
4081
4049
|
|
4082
4050
|
if (state.eat(0x62 /* b */)) {
|
@@ -4103,7 +4071,7 @@ pp$9.regexp_eatClassEscape = function(state) {
|
|
4103
4071
|
};
|
4104
4072
|
|
4105
4073
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-ClassControlLetter
|
4106
|
-
pp$
|
4074
|
+
pp$8.regexp_eatClassControlLetter = function(state) {
|
4107
4075
|
var ch = state.current();
|
4108
4076
|
if (isDecimalDigit(ch) || ch === 0x5F /* _ */) {
|
4109
4077
|
state.lastIntValue = ch % 0x20;
|
@@ -4114,7 +4082,7 @@ pp$9.regexp_eatClassControlLetter = function(state) {
|
|
4114
4082
|
};
|
4115
4083
|
|
4116
4084
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-HexEscapeSequence
|
4117
|
-
pp$
|
4085
|
+
pp$8.regexp_eatHexEscapeSequence = function(state) {
|
4118
4086
|
var start = state.pos;
|
4119
4087
|
if (state.eat(0x78 /* x */)) {
|
4120
4088
|
if (this.regexp_eatFixedHexDigits(state, 2)) {
|
@@ -4129,7 +4097,7 @@ pp$9.regexp_eatHexEscapeSequence = function(state) {
|
|
4129
4097
|
};
|
4130
4098
|
|
4131
4099
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-DecimalDigits
|
4132
|
-
pp$
|
4100
|
+
pp$8.regexp_eatDecimalDigits = function(state) {
|
4133
4101
|
var start = state.pos;
|
4134
4102
|
var ch = 0;
|
4135
4103
|
state.lastIntValue = 0;
|
@@ -4144,7 +4112,7 @@ function isDecimalDigit(ch) {
|
|
4144
4112
|
}
|
4145
4113
|
|
4146
4114
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-HexDigits
|
4147
|
-
pp$
|
4115
|
+
pp$8.regexp_eatHexDigits = function(state) {
|
4148
4116
|
var start = state.pos;
|
4149
4117
|
var ch = 0;
|
4150
4118
|
state.lastIntValue = 0;
|
@@ -4173,7 +4141,7 @@ function hexToInt(ch) {
|
|
4173
4141
|
|
4174
4142
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-LegacyOctalEscapeSequence
|
4175
4143
|
// Allows only 0-377(octal) i.e. 0-255(decimal).
|
4176
|
-
pp$
|
4144
|
+
pp$8.regexp_eatLegacyOctalEscapeSequence = function(state) {
|
4177
4145
|
if (this.regexp_eatOctalDigit(state)) {
|
4178
4146
|
var n1 = state.lastIntValue;
|
4179
4147
|
if (this.regexp_eatOctalDigit(state)) {
|
@@ -4192,7 +4160,7 @@ pp$9.regexp_eatLegacyOctalEscapeSequence = function(state) {
|
|
4192
4160
|
};
|
4193
4161
|
|
4194
4162
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-OctalDigit
|
4195
|
-
pp$
|
4163
|
+
pp$8.regexp_eatOctalDigit = function(state) {
|
4196
4164
|
var ch = state.current();
|
4197
4165
|
if (isOctalDigit(ch)) {
|
4198
4166
|
state.lastIntValue = ch - 0x30; /* 0 */
|
@@ -4209,7 +4177,7 @@ function isOctalDigit(ch) {
|
|
4209
4177
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-Hex4Digits
|
4210
4178
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-HexDigit
|
4211
4179
|
// And HexDigit HexDigit in https://www.ecma-international.org/ecma-262/8.0/#prod-HexEscapeSequence
|
4212
|
-
pp$
|
4180
|
+
pp$8.regexp_eatFixedHexDigits = function(state, length) {
|
4213
4181
|
var start = state.pos;
|
4214
4182
|
state.lastIntValue = 0;
|
4215
4183
|
for (var i = 0; i < length; ++i) {
|
@@ -4241,11 +4209,11 @@ var Token = function Token(p) {
|
|
4241
4209
|
|
4242
4210
|
// ## Tokenizer
|
4243
4211
|
|
4244
|
-
var pp$
|
4212
|
+
var pp$9 = Parser.prototype;
|
4245
4213
|
|
4246
4214
|
// Move to the next token
|
4247
4215
|
|
4248
|
-
pp$
|
4216
|
+
pp$9.next = function() {
|
4249
4217
|
if (this.options.onToken)
|
4250
4218
|
{ this.options.onToken(new Token(this)); }
|
4251
4219
|
|
@@ -4256,14 +4224,14 @@ pp$8.next = function() {
|
|
4256
4224
|
this.nextToken();
|
4257
4225
|
};
|
4258
4226
|
|
4259
|
-
pp$
|
4227
|
+
pp$9.getToken = function() {
|
4260
4228
|
this.next();
|
4261
4229
|
return new Token(this)
|
4262
4230
|
};
|
4263
4231
|
|
4264
4232
|
// If we're in an ES6 environment, make parsers iterable
|
4265
4233
|
if (typeof Symbol !== "undefined")
|
4266
|
-
{ pp$
|
4234
|
+
{ pp$9[Symbol.iterator] = function() {
|
4267
4235
|
var this$1 = this;
|
4268
4236
|
|
4269
4237
|
return {
|
@@ -4280,14 +4248,14 @@ if (typeof Symbol !== "undefined")
|
|
4280
4248
|
// Toggle strict mode. Re-reads the next number or string to please
|
4281
4249
|
// pedantic tests (`"use strict"; 010;` should fail).
|
4282
4250
|
|
4283
|
-
pp$
|
4251
|
+
pp$9.curContext = function() {
|
4284
4252
|
return this.context[this.context.length - 1]
|
4285
4253
|
};
|
4286
4254
|
|
4287
4255
|
// Read a single token, updating the parser object's token-related
|
4288
4256
|
// properties.
|
4289
4257
|
|
4290
|
-
pp$
|
4258
|
+
pp$9.nextToken = function() {
|
4291
4259
|
var curContext = this.curContext();
|
4292
4260
|
if (!curContext || !curContext.preserveSpace) { this.skipSpace(); }
|
4293
4261
|
|
@@ -4299,7 +4267,7 @@ pp$8.nextToken = function() {
|
|
4299
4267
|
else { this.readToken(this.fullCharCodeAtPos()); }
|
4300
4268
|
};
|
4301
4269
|
|
4302
|
-
pp$
|
4270
|
+
pp$9.readToken = function(code) {
|
4303
4271
|
// Identifier or keyword. '\uXXXX' sequences are allowed in
|
4304
4272
|
// identifiers, so '\' also dispatches to that.
|
4305
4273
|
if (isIdentifierStart(code, this.options.ecmaVersion >= 6) || code === 92 /* '\' */)
|
@@ -4308,16 +4276,14 @@ pp$8.readToken = function(code) {
|
|
4308
4276
|
return this.getTokenFromCode(code)
|
4309
4277
|
};
|
4310
4278
|
|
4311
|
-
pp$
|
4279
|
+
pp$9.fullCharCodeAtPos = function() {
|
4312
4280
|
var code = this.input.charCodeAt(this.pos);
|
4313
4281
|
if (code <= 0xd7ff || code >= 0xe000) { return code }
|
4314
4282
|
var next = this.input.charCodeAt(this.pos + 1);
|
4315
4283
|
return (code << 10) + next - 0x35fdc00
|
4316
4284
|
};
|
4317
4285
|
|
4318
|
-
pp$
|
4319
|
-
var this$1 = this;
|
4320
|
-
|
4286
|
+
pp$9.skipBlockComment = function() {
|
4321
4287
|
var startLoc = this.options.onComment && this.curPosition();
|
4322
4288
|
var start = this.pos, end = this.input.indexOf("*/", this.pos += 2);
|
4323
4289
|
if (end === -1) { this.raise(this.pos - 2, "Unterminated comment"); }
|
@@ -4326,8 +4292,8 @@ pp$8.skipBlockComment = function() {
|
|
4326
4292
|
lineBreakG.lastIndex = start;
|
4327
4293
|
var match;
|
4328
4294
|
while ((match = lineBreakG.exec(this.input)) && match.index < this.pos) {
|
4329
|
-
++this
|
4330
|
-
this
|
4295
|
+
++this.curLine;
|
4296
|
+
this.lineStart = match.index + match[0].length;
|
4331
4297
|
}
|
4332
4298
|
}
|
4333
4299
|
if (this.options.onComment)
|
@@ -4335,14 +4301,12 @@ pp$8.skipBlockComment = function() {
|
|
4335
4301
|
startLoc, this.curPosition()); }
|
4336
4302
|
};
|
4337
4303
|
|
4338
|
-
pp$
|
4339
|
-
var this$1 = this;
|
4340
|
-
|
4304
|
+
pp$9.skipLineComment = function(startSkip) {
|
4341
4305
|
var start = this.pos;
|
4342
4306
|
var startLoc = this.options.onComment && this.curPosition();
|
4343
4307
|
var ch = this.input.charCodeAt(this.pos += startSkip);
|
4344
4308
|
while (this.pos < this.input.length && !isNewLine(ch)) {
|
4345
|
-
ch = this
|
4309
|
+
ch = this.input.charCodeAt(++this.pos);
|
4346
4310
|
}
|
4347
4311
|
if (this.options.onComment)
|
4348
4312
|
{ this.options.onComment(false, this.input.slice(start + startSkip, this.pos), start, this.pos,
|
@@ -4352,33 +4316,31 @@ pp$8.skipLineComment = function(startSkip) {
|
|
4352
4316
|
// Called at the start of the parse and after every token. Skips
|
4353
4317
|
// whitespace and comments, and.
|
4354
4318
|
|
4355
|
-
pp$
|
4356
|
-
var this$1 = this;
|
4357
|
-
|
4319
|
+
pp$9.skipSpace = function() {
|
4358
4320
|
loop: while (this.pos < this.input.length) {
|
4359
|
-
var ch = this
|
4321
|
+
var ch = this.input.charCodeAt(this.pos);
|
4360
4322
|
switch (ch) {
|
4361
4323
|
case 32: case 160: // ' '
|
4362
|
-
++this
|
4324
|
+
++this.pos;
|
4363
4325
|
break
|
4364
4326
|
case 13:
|
4365
|
-
if (this
|
4366
|
-
++this
|
4327
|
+
if (this.input.charCodeAt(this.pos + 1) === 10) {
|
4328
|
+
++this.pos;
|
4367
4329
|
}
|
4368
4330
|
case 10: case 8232: case 8233:
|
4369
|
-
++this
|
4370
|
-
if (this
|
4371
|
-
++this
|
4372
|
-
this
|
4331
|
+
++this.pos;
|
4332
|
+
if (this.options.locations) {
|
4333
|
+
++this.curLine;
|
4334
|
+
this.lineStart = this.pos;
|
4373
4335
|
}
|
4374
4336
|
break
|
4375
4337
|
case 47: // '/'
|
4376
|
-
switch (this
|
4338
|
+
switch (this.input.charCodeAt(this.pos + 1)) {
|
4377
4339
|
case 42: // '*'
|
4378
|
-
this
|
4340
|
+
this.skipBlockComment();
|
4379
4341
|
break
|
4380
4342
|
case 47:
|
4381
|
-
this
|
4343
|
+
this.skipLineComment(2);
|
4382
4344
|
break
|
4383
4345
|
default:
|
4384
4346
|
break loop
|
@@ -4386,7 +4348,7 @@ pp$8.skipSpace = function() {
|
|
4386
4348
|
break
|
4387
4349
|
default:
|
4388
4350
|
if (ch > 8 && ch < 14 || ch >= 5760 && nonASCIIwhitespace.test(String.fromCharCode(ch))) {
|
4389
|
-
++this
|
4351
|
+
++this.pos;
|
4390
4352
|
} else {
|
4391
4353
|
break loop
|
4392
4354
|
}
|
@@ -4399,7 +4361,7 @@ pp$8.skipSpace = function() {
|
|
4399
4361
|
// the token, so that the next one's `start` will point at the
|
4400
4362
|
// right position.
|
4401
4363
|
|
4402
|
-
pp$
|
4364
|
+
pp$9.finishToken = function(type, val) {
|
4403
4365
|
this.end = this.pos;
|
4404
4366
|
if (this.options.locations) { this.endLoc = this.curPosition(); }
|
4405
4367
|
var prevType = this.type;
|
@@ -4418,7 +4380,7 @@ pp$8.finishToken = function(type, val) {
|
|
4418
4380
|
//
|
4419
4381
|
// All in the name of speed.
|
4420
4382
|
//
|
4421
|
-
pp$
|
4383
|
+
pp$9.readToken_dot = function() {
|
4422
4384
|
var next = this.input.charCodeAt(this.pos + 1);
|
4423
4385
|
if (next >= 48 && next <= 57) { return this.readNumber(true) }
|
4424
4386
|
var next2 = this.input.charCodeAt(this.pos + 2);
|
@@ -4431,14 +4393,14 @@ pp$8.readToken_dot = function() {
|
|
4431
4393
|
}
|
4432
4394
|
};
|
4433
4395
|
|
4434
|
-
pp$
|
4396
|
+
pp$9.readToken_slash = function() { // '/'
|
4435
4397
|
var next = this.input.charCodeAt(this.pos + 1);
|
4436
4398
|
if (this.exprAllowed) { ++this.pos; return this.readRegexp() }
|
4437
4399
|
if (next === 61) { return this.finishOp(types.assign, 2) }
|
4438
4400
|
return this.finishOp(types.slash, 1)
|
4439
4401
|
};
|
4440
4402
|
|
4441
|
-
pp$
|
4403
|
+
pp$9.readToken_mult_modulo_exp = function(code) { // '%*'
|
4442
4404
|
var next = this.input.charCodeAt(this.pos + 1);
|
4443
4405
|
var size = 1;
|
4444
4406
|
var tokentype = code === 42 ? types.star : types.modulo;
|
@@ -4454,20 +4416,20 @@ pp$8.readToken_mult_modulo_exp = function(code) { // '%*'
|
|
4454
4416
|
return this.finishOp(tokentype, size)
|
4455
4417
|
};
|
4456
4418
|
|
4457
|
-
pp$
|
4419
|
+
pp$9.readToken_pipe_amp = function(code) { // '|&'
|
4458
4420
|
var next = this.input.charCodeAt(this.pos + 1);
|
4459
4421
|
if (next === code) { return this.finishOp(code === 124 ? types.logicalOR : types.logicalAND, 2) }
|
4460
4422
|
if (next === 61) { return this.finishOp(types.assign, 2) }
|
4461
4423
|
return this.finishOp(code === 124 ? types.bitwiseOR : types.bitwiseAND, 1)
|
4462
4424
|
};
|
4463
4425
|
|
4464
|
-
pp$
|
4426
|
+
pp$9.readToken_caret = function() { // '^'
|
4465
4427
|
var next = this.input.charCodeAt(this.pos + 1);
|
4466
4428
|
if (next === 61) { return this.finishOp(types.assign, 2) }
|
4467
4429
|
return this.finishOp(types.bitwiseXOR, 1)
|
4468
4430
|
};
|
4469
4431
|
|
4470
|
-
pp$
|
4432
|
+
pp$9.readToken_plus_min = function(code) { // '+-'
|
4471
4433
|
var next = this.input.charCodeAt(this.pos + 1);
|
4472
4434
|
if (next === code) {
|
4473
4435
|
if (next === 45 && !this.inModule && this.input.charCodeAt(this.pos + 2) === 62 &&
|
@@ -4483,7 +4445,7 @@ pp$8.readToken_plus_min = function(code) { // '+-'
|
|
4483
4445
|
return this.finishOp(types.plusMin, 1)
|
4484
4446
|
};
|
4485
4447
|
|
4486
|
-
pp$
|
4448
|
+
pp$9.readToken_lt_gt = function(code) { // '<>'
|
4487
4449
|
var next = this.input.charCodeAt(this.pos + 1);
|
4488
4450
|
var size = 1;
|
4489
4451
|
if (next === code) {
|
@@ -4502,7 +4464,7 @@ pp$8.readToken_lt_gt = function(code) { // '<>'
|
|
4502
4464
|
return this.finishOp(types.relational, size)
|
4503
4465
|
};
|
4504
4466
|
|
4505
|
-
pp$
|
4467
|
+
pp$9.readToken_eq_excl = function(code) { // '=!'
|
4506
4468
|
var next = this.input.charCodeAt(this.pos + 1);
|
4507
4469
|
if (next === 61) { return this.finishOp(types.equality, this.input.charCodeAt(this.pos + 2) === 61 ? 3 : 2) }
|
4508
4470
|
if (code === 61 && next === 62 && this.options.ecmaVersion >= 6) { // '=>'
|
@@ -4512,7 +4474,7 @@ pp$8.readToken_eq_excl = function(code) { // '=!'
|
|
4512
4474
|
return this.finishOp(code === 61 ? types.eq : types.prefix, 1)
|
4513
4475
|
};
|
4514
4476
|
|
4515
|
-
pp$
|
4477
|
+
pp$9.getTokenFromCode = function(code) {
|
4516
4478
|
switch (code) {
|
4517
4479
|
// The interpretation of a dot depends on whether it is followed
|
4518
4480
|
// by a digit or another two dots.
|
@@ -4583,30 +4545,28 @@ pp$8.getTokenFromCode = function(code) {
|
|
4583
4545
|
return this.finishOp(types.prefix, 1)
|
4584
4546
|
}
|
4585
4547
|
|
4586
|
-
this.raise(this.pos, "Unexpected character '" + codePointToString(code) + "'");
|
4548
|
+
this.raise(this.pos, "Unexpected character '" + codePointToString$1(code) + "'");
|
4587
4549
|
};
|
4588
4550
|
|
4589
|
-
pp$
|
4551
|
+
pp$9.finishOp = function(type, size) {
|
4590
4552
|
var str = this.input.slice(this.pos, this.pos + size);
|
4591
4553
|
this.pos += size;
|
4592
4554
|
return this.finishToken(type, str)
|
4593
4555
|
};
|
4594
4556
|
|
4595
|
-
pp$
|
4596
|
-
var this$1 = this;
|
4597
|
-
|
4557
|
+
pp$9.readRegexp = function() {
|
4598
4558
|
var escaped, inClass, start = this.pos;
|
4599
4559
|
for (;;) {
|
4600
|
-
if (this
|
4601
|
-
var ch = this
|
4602
|
-
if (lineBreak.test(ch)) { this
|
4560
|
+
if (this.pos >= this.input.length) { this.raise(start, "Unterminated regular expression"); }
|
4561
|
+
var ch = this.input.charAt(this.pos);
|
4562
|
+
if (lineBreak.test(ch)) { this.raise(start, "Unterminated regular expression"); }
|
4603
4563
|
if (!escaped) {
|
4604
4564
|
if (ch === "[") { inClass = true; }
|
4605
4565
|
else if (ch === "]" && inClass) { inClass = false; }
|
4606
4566
|
else if (ch === "/" && !inClass) { break }
|
4607
4567
|
escaped = ch === "\\";
|
4608
4568
|
} else { escaped = false; }
|
4609
|
-
++this
|
4569
|
+
++this.pos;
|
4610
4570
|
}
|
4611
4571
|
var pattern = this.input.slice(start, this.pos);
|
4612
4572
|
++this.pos;
|
@@ -4636,18 +4596,16 @@ pp$8.readRegexp = function() {
|
|
4636
4596
|
// were read, the integer value otherwise. When `len` is given, this
|
4637
4597
|
// will return `null` unless the integer has exactly `len` digits.
|
4638
4598
|
|
4639
|
-
pp$
|
4640
|
-
var this$1 = this;
|
4641
|
-
|
4599
|
+
pp$9.readInt = function(radix, len) {
|
4642
4600
|
var start = this.pos, total = 0;
|
4643
4601
|
for (var i = 0, e = len == null ? Infinity : len; i < e; ++i) {
|
4644
|
-
var code = this
|
4602
|
+
var code = this.input.charCodeAt(this.pos), val = (void 0);
|
4645
4603
|
if (code >= 97) { val = code - 97 + 10; } // a
|
4646
4604
|
else if (code >= 65) { val = code - 65 + 10; } // A
|
4647
4605
|
else if (code >= 48 && code <= 57) { val = code - 48; } // 0-9
|
4648
4606
|
else { val = Infinity; }
|
4649
4607
|
if (val >= radix) { break }
|
4650
|
-
++this
|
4608
|
+
++this.pos;
|
4651
4609
|
total = total * radix + val;
|
4652
4610
|
}
|
4653
4611
|
if (this.pos === start || len != null && this.pos - start !== len) { return null }
|
@@ -4655,23 +4613,34 @@ pp$8.readInt = function(radix, len) {
|
|
4655
4613
|
return total
|
4656
4614
|
};
|
4657
4615
|
|
4658
|
-
pp$
|
4616
|
+
pp$9.readRadixNumber = function(radix) {
|
4617
|
+
var start = this.pos;
|
4659
4618
|
this.pos += 2; // 0x
|
4660
4619
|
var val = this.readInt(radix);
|
4661
4620
|
if (val == null) { this.raise(this.start + 2, "Expected number in radix " + radix); }
|
4662
|
-
if (
|
4621
|
+
if (this.options.ecmaVersion >= 11 && this.input.charCodeAt(this.pos) === 110) {
|
4622
|
+
val = typeof BigInt !== "undefined" ? BigInt(this.input.slice(start, this.pos)) : null;
|
4623
|
+
++this.pos;
|
4624
|
+
} else if (isIdentifierStart(this.fullCharCodeAtPos())) { this.raise(this.pos, "Identifier directly after number"); }
|
4663
4625
|
return this.finishToken(types.num, val)
|
4664
4626
|
};
|
4665
4627
|
|
4666
4628
|
// Read an integer, octal integer, or floating-point number.
|
4667
4629
|
|
4668
|
-
pp$
|
4630
|
+
pp$9.readNumber = function(startsWithDot) {
|
4669
4631
|
var start = this.pos;
|
4670
4632
|
if (!startsWithDot && this.readInt(10) === null) { this.raise(start, "Invalid number"); }
|
4671
4633
|
var octal = this.pos - start >= 2 && this.input.charCodeAt(start) === 48;
|
4672
4634
|
if (octal && this.strict) { this.raise(start, "Invalid number"); }
|
4673
4635
|
if (octal && /[89]/.test(this.input.slice(start, this.pos))) { octal = false; }
|
4674
4636
|
var next = this.input.charCodeAt(this.pos);
|
4637
|
+
if (!octal && !startsWithDot && this.options.ecmaVersion >= 11 && next === 110) {
|
4638
|
+
var str$1 = this.input.slice(start, this.pos);
|
4639
|
+
var val$1 = typeof BigInt !== "undefined" ? BigInt(str$1) : null;
|
4640
|
+
++this.pos;
|
4641
|
+
if (isIdentifierStart(this.fullCharCodeAtPos())) { this.raise(this.pos, "Identifier directly after number"); }
|
4642
|
+
return this.finishToken(types.num, val$1)
|
4643
|
+
}
|
4675
4644
|
if (next === 46 && !octal) { // '.'
|
4676
4645
|
++this.pos;
|
4677
4646
|
this.readInt(10);
|
@@ -4691,7 +4660,7 @@ pp$8.readNumber = function(startsWithDot) {
|
|
4691
4660
|
|
4692
4661
|
// Read a string value, interpreting backslash-escapes.
|
4693
4662
|
|
4694
|
-
pp$
|
4663
|
+
pp$9.readCodePoint = function() {
|
4695
4664
|
var ch = this.input.charCodeAt(this.pos), code;
|
4696
4665
|
|
4697
4666
|
if (ch === 123) { // '{'
|
@@ -4706,28 +4675,26 @@ pp$8.readCodePoint = function() {
|
|
4706
4675
|
return code
|
4707
4676
|
};
|
4708
4677
|
|
4709
|
-
function codePointToString(code) {
|
4678
|
+
function codePointToString$1(code) {
|
4710
4679
|
// UTF-16 Decoding
|
4711
4680
|
if (code <= 0xFFFF) { return String.fromCharCode(code) }
|
4712
4681
|
code -= 0x10000;
|
4713
4682
|
return String.fromCharCode((code >> 10) + 0xD800, (code & 1023) + 0xDC00)
|
4714
4683
|
}
|
4715
4684
|
|
4716
|
-
pp$
|
4717
|
-
var this$1 = this;
|
4718
|
-
|
4685
|
+
pp$9.readString = function(quote) {
|
4719
4686
|
var out = "", chunkStart = ++this.pos;
|
4720
4687
|
for (;;) {
|
4721
|
-
if (this
|
4722
|
-
var ch = this
|
4688
|
+
if (this.pos >= this.input.length) { this.raise(this.start, "Unterminated string constant"); }
|
4689
|
+
var ch = this.input.charCodeAt(this.pos);
|
4723
4690
|
if (ch === quote) { break }
|
4724
4691
|
if (ch === 92) { // '\'
|
4725
|
-
out += this
|
4726
|
-
out += this
|
4727
|
-
chunkStart = this
|
4692
|
+
out += this.input.slice(chunkStart, this.pos);
|
4693
|
+
out += this.readEscapedChar(false);
|
4694
|
+
chunkStart = this.pos;
|
4728
4695
|
} else {
|
4729
|
-
if (isNewLine(ch, this
|
4730
|
-
++this
|
4696
|
+
if (isNewLine(ch, this.options.ecmaVersion >= 10)) { this.raise(this.start, "Unterminated string constant"); }
|
4697
|
+
++this.pos;
|
4731
4698
|
}
|
4732
4699
|
}
|
4733
4700
|
out += this.input.slice(chunkStart, this.pos++);
|
@@ -4738,7 +4705,7 @@ pp$8.readString = function(quote) {
|
|
4738
4705
|
|
4739
4706
|
var INVALID_TEMPLATE_ESCAPE_ERROR = {};
|
4740
4707
|
|
4741
|
-
pp$
|
4708
|
+
pp$9.tryReadTemplateToken = function() {
|
4742
4709
|
this.inTemplateElement = true;
|
4743
4710
|
try {
|
4744
4711
|
this.readTmplToken();
|
@@ -4753,7 +4720,7 @@ pp$8.tryReadTemplateToken = function() {
|
|
4753
4720
|
this.inTemplateElement = false;
|
4754
4721
|
};
|
4755
4722
|
|
4756
|
-
pp$
|
4723
|
+
pp$9.invalidStringToken = function(position, message) {
|
4757
4724
|
if (this.inTemplateElement && this.options.ecmaVersion >= 9) {
|
4758
4725
|
throw INVALID_TEMPLATE_ESCAPE_ERROR
|
4759
4726
|
} else {
|
@@ -4761,36 +4728,34 @@ pp$8.invalidStringToken = function(position, message) {
|
|
4761
4728
|
}
|
4762
4729
|
};
|
4763
4730
|
|
4764
|
-
pp$
|
4765
|
-
var this$1 = this;
|
4766
|
-
|
4731
|
+
pp$9.readTmplToken = function() {
|
4767
4732
|
var out = "", chunkStart = this.pos;
|
4768
4733
|
for (;;) {
|
4769
|
-
if (this
|
4770
|
-
var ch = this
|
4771
|
-
if (ch === 96 || ch === 36 && this
|
4772
|
-
if (this
|
4734
|
+
if (this.pos >= this.input.length) { this.raise(this.start, "Unterminated template"); }
|
4735
|
+
var ch = this.input.charCodeAt(this.pos);
|
4736
|
+
if (ch === 96 || ch === 36 && this.input.charCodeAt(this.pos + 1) === 123) { // '`', '${'
|
4737
|
+
if (this.pos === this.start && (this.type === types.template || this.type === types.invalidTemplate)) {
|
4773
4738
|
if (ch === 36) {
|
4774
|
-
this
|
4775
|
-
return this
|
4739
|
+
this.pos += 2;
|
4740
|
+
return this.finishToken(types.dollarBraceL)
|
4776
4741
|
} else {
|
4777
|
-
++this
|
4778
|
-
return this
|
4742
|
+
++this.pos;
|
4743
|
+
return this.finishToken(types.backQuote)
|
4779
4744
|
}
|
4780
4745
|
}
|
4781
|
-
out += this
|
4782
|
-
return this
|
4746
|
+
out += this.input.slice(chunkStart, this.pos);
|
4747
|
+
return this.finishToken(types.template, out)
|
4783
4748
|
}
|
4784
4749
|
if (ch === 92) { // '\'
|
4785
|
-
out += this
|
4786
|
-
out += this
|
4787
|
-
chunkStart = this
|
4750
|
+
out += this.input.slice(chunkStart, this.pos);
|
4751
|
+
out += this.readEscapedChar(true);
|
4752
|
+
chunkStart = this.pos;
|
4788
4753
|
} else if (isNewLine(ch)) {
|
4789
|
-
out += this
|
4790
|
-
++this
|
4754
|
+
out += this.input.slice(chunkStart, this.pos);
|
4755
|
+
++this.pos;
|
4791
4756
|
switch (ch) {
|
4792
4757
|
case 13:
|
4793
|
-
if (this
|
4758
|
+
if (this.input.charCodeAt(this.pos) === 10) { ++this.pos; }
|
4794
4759
|
case 10:
|
4795
4760
|
out += "\n";
|
4796
4761
|
break
|
@@ -4798,35 +4763,33 @@ pp$8.readTmplToken = function() {
|
|
4798
4763
|
out += String.fromCharCode(ch);
|
4799
4764
|
break
|
4800
4765
|
}
|
4801
|
-
if (this
|
4802
|
-
++this
|
4803
|
-
this
|
4766
|
+
if (this.options.locations) {
|
4767
|
+
++this.curLine;
|
4768
|
+
this.lineStart = this.pos;
|
4804
4769
|
}
|
4805
|
-
chunkStart = this
|
4770
|
+
chunkStart = this.pos;
|
4806
4771
|
} else {
|
4807
|
-
++this
|
4772
|
+
++this.pos;
|
4808
4773
|
}
|
4809
4774
|
}
|
4810
4775
|
};
|
4811
4776
|
|
4812
4777
|
// Reads a template token to search for the end, without validating any escape sequences
|
4813
|
-
pp$
|
4814
|
-
var this$1 = this;
|
4815
|
-
|
4778
|
+
pp$9.readInvalidTemplateToken = function() {
|
4816
4779
|
for (; this.pos < this.input.length; this.pos++) {
|
4817
|
-
switch (this
|
4780
|
+
switch (this.input[this.pos]) {
|
4818
4781
|
case "\\":
|
4819
|
-
++this
|
4782
|
+
++this.pos;
|
4820
4783
|
break
|
4821
4784
|
|
4822
4785
|
case "$":
|
4823
|
-
if (this
|
4786
|
+
if (this.input[this.pos + 1] !== "{") {
|
4824
4787
|
break
|
4825
4788
|
}
|
4826
4789
|
// falls through
|
4827
4790
|
|
4828
4791
|
case "`":
|
4829
|
-
return this
|
4792
|
+
return this.finishToken(types.invalidTemplate, this.input.slice(this.start, this.pos))
|
4830
4793
|
|
4831
4794
|
// no default
|
4832
4795
|
}
|
@@ -4836,14 +4799,14 @@ pp$8.readInvalidTemplateToken = function() {
|
|
4836
4799
|
|
4837
4800
|
// Used to read escaped characters
|
4838
4801
|
|
4839
|
-
pp$
|
4802
|
+
pp$9.readEscapedChar = function(inTemplate) {
|
4840
4803
|
var ch = this.input.charCodeAt(++this.pos);
|
4841
4804
|
++this.pos;
|
4842
4805
|
switch (ch) {
|
4843
4806
|
case 110: return "\n" // 'n' -> '\n'
|
4844
4807
|
case 114: return "\r" // 'r' -> '\r'
|
4845
4808
|
case 120: return String.fromCharCode(this.readHexChar(2)) // 'x'
|
4846
|
-
case 117: return codePointToString(this.readCodePoint()) // 'u'
|
4809
|
+
case 117: return codePointToString$1(this.readCodePoint()) // 'u'
|
4847
4810
|
case 116: return "\t" // 't' -> '\t'
|
4848
4811
|
case 98: return "\b" // 'b' -> '\b'
|
4849
4812
|
case 118: return "\u000b" // 'v' -> '\u000b'
|
@@ -4883,7 +4846,7 @@ pp$8.readEscapedChar = function(inTemplate) {
|
|
4883
4846
|
|
4884
4847
|
// Used to read character escape sequences ('\x', '\u', '\U').
|
4885
4848
|
|
4886
|
-
pp$
|
4849
|
+
pp$9.readHexChar = function(len) {
|
4887
4850
|
var codePos = this.pos;
|
4888
4851
|
var n = this.readInt(16, len);
|
4889
4852
|
if (n === null) { this.invalidStringToken(codePos, "Bad character escape sequence"); }
|
@@ -4896,28 +4859,26 @@ pp$8.readHexChar = function(len) {
|
|
4896
4859
|
// Incrementally adds only escaped chars, adding other chunks as-is
|
4897
4860
|
// as a micro-optimization.
|
4898
4861
|
|
4899
|
-
pp$
|
4900
|
-
var this$1 = this;
|
4901
|
-
|
4862
|
+
pp$9.readWord1 = function() {
|
4902
4863
|
this.containsEsc = false;
|
4903
4864
|
var word = "", first = true, chunkStart = this.pos;
|
4904
4865
|
var astral = this.options.ecmaVersion >= 6;
|
4905
4866
|
while (this.pos < this.input.length) {
|
4906
|
-
var ch = this
|
4867
|
+
var ch = this.fullCharCodeAtPos();
|
4907
4868
|
if (isIdentifierChar(ch, astral)) {
|
4908
|
-
this
|
4869
|
+
this.pos += ch <= 0xffff ? 1 : 2;
|
4909
4870
|
} else if (ch === 92) { // "\"
|
4910
|
-
this
|
4911
|
-
word += this
|
4912
|
-
var escStart = this
|
4913
|
-
if (this
|
4914
|
-
{ this
|
4915
|
-
++this
|
4916
|
-
var esc = this
|
4871
|
+
this.containsEsc = true;
|
4872
|
+
word += this.input.slice(chunkStart, this.pos);
|
4873
|
+
var escStart = this.pos;
|
4874
|
+
if (this.input.charCodeAt(++this.pos) !== 117) // "u"
|
4875
|
+
{ this.invalidStringToken(this.pos, "Expecting Unicode escape sequence \\uXXXX"); }
|
4876
|
+
++this.pos;
|
4877
|
+
var esc = this.readCodePoint();
|
4917
4878
|
if (!(first ? isIdentifierStart : isIdentifierChar)(esc, astral))
|
4918
|
-
{ this
|
4919
|
-
word += codePointToString(esc);
|
4920
|
-
chunkStart = this
|
4879
|
+
{ this.invalidStringToken(escStart, "Invalid Unicode escape"); }
|
4880
|
+
word += codePointToString$1(esc);
|
4881
|
+
chunkStart = this.pos;
|
4921
4882
|
} else {
|
4922
4883
|
break
|
4923
4884
|
}
|
@@ -4929,7 +4890,7 @@ pp$8.readWord1 = function() {
|
|
4929
4890
|
// Read an identifier or keyword token. Will check for reserved
|
4930
4891
|
// words when necessary.
|
4931
4892
|
|
4932
|
-
pp$
|
4893
|
+
pp$9.readWord = function() {
|
4933
4894
|
var word = this.readWord1();
|
4934
4895
|
var type = types.name;
|
4935
4896
|
if (this.keywords.test(word)) {
|
@@ -4940,22 +4901,8 @@ pp$8.readWord = function() {
|
|
4940
4901
|
};
|
4941
4902
|
|
4942
4903
|
// Acorn is a tiny, fast JavaScript parser written in JavaScript.
|
4943
|
-
//
|
4944
|
-
// Acorn was written by Marijn Haverbeke, Ingvar Stepanyan, and
|
4945
|
-
// various contributors and released under an MIT license.
|
4946
|
-
//
|
4947
|
-
// Git repositories for Acorn are available at
|
4948
|
-
//
|
4949
|
-
// http://marijnhaverbeke.nl/git/acorn
|
4950
|
-
// https://github.com/acornjs/acorn.git
|
4951
|
-
//
|
4952
|
-
// Please use the [github bug tracker][ghbt] to report issues.
|
4953
|
-
//
|
4954
|
-
// [ghbt]: https://github.com/acornjs/acorn/issues
|
4955
|
-
//
|
4956
|
-
// [walk]: util/walk.js
|
4957
4904
|
|
4958
|
-
var version = "6.
|
4905
|
+
var version = "6.2.0";
|
4959
4906
|
|
4960
4907
|
// The main exported interface (under `self.acorn` when in the
|
4961
4908
|
// browser) is a `parse` function that takes a code string and
|
@@ -4983,5 +4930,4 @@ function tokenizer(input, options) {
|
|
4983
4930
|
return Parser.tokenizer(input, options)
|
4984
4931
|
}
|
4985
4932
|
|
4986
|
-
export {
|
4987
|
-
//# sourceMappingURL=acorn.mjs.map
|
4933
|
+
export { Node, Parser, Position, SourceLocation, TokContext, Token, TokenType, defaultOptions, getLineInfo, isIdentifierChar, isIdentifierStart, isNewLine, keywords$1 as keywordTypes, lineBreak, lineBreakG, nonASCIIwhitespace, parse, parseExpressionAt, types$1 as tokContexts, types as tokTypes, tokenizer, version };
|