{“version”:3,“file”:“svelte.js”,“sources”:,“sourcesContent”:[“function getLocator ( source, options ) {ntif ( options === void 0 ) options = {};nntvar offsetLine = options.offsetLine || 0;ntvar offsetColumn = options.offsetColumn || 0;nntvar originalLines = source.split( '\n' );nntvar start = 0;ntvar lineRanges = originalLines.map( function ( line, i ) {nttvar end = start + line.length + 1;nttvar range = { start: start, end: end, line: i };nnttstart = end;nttreturn range;nt});nntvar i = 0;nntfunction rangeContains ( range, index ) {nttreturn range.start <= index && index < range.end;nt}nntfunction getLocation ( range, index ) {nttreturn { line: offsetLine + range.line, column: offsetColumn + index - range.start, character: index };nt}nntreturn function locate ( search, startIndex ) {nttif ( typeof search === 'string' ) {ntttsearch = source.indexOf( search, startIndex || 0 );ntt}nnttvar range = lineRanges;nnttvar d = search >= range.end ? 1 : -1;nnttwhile ( range ) {ntttif ( rangeContains( range, search ) ) return getLocation( range, search );nnttti += d;ntttrange = lineRanges;ntt}nt};n}nnfunction locate ( source, search, options ) {ntif ( typeof options === 'number' ) {nttthrow new Error( 'locate takes a { startIndex, offsetLine, offsetColumn } object as the third argument' );nt}nntreturn getLocator( source, options )( search, options && options.startIndex );n}nnexport { getLocator, locate };”,“// Reserved word lists for various dialects of the languagennvar reservedWords = {n 3: "abstract boolean byte char class double enum export extends final float goto implements import int interface long native package private protected public short static super synchronized throws transient volatile",n 5: "class enum extends super const export import",n 6: "enum",n strict: "implements interface let package private protected public static yield",n strictBind: "eval arguments"n}nn// And the keywordsnnvar ecma5AndLessKeywords = "break case catch continue debugger default do else finally for function if return switch throw try var while with null true false instanceof typeof void delete new in this"nnvar keywords = {n 5: ecma5AndLessKeywords,n 6: ecma5AndLessKeywords + " const class extends export import super"n}nn// ## Character categoriesnn// Big ugly regular expressions that match characters in then// whitespace, identifier, and identifier-start categories. Thesen// are only applied when a character is found to actually have an// code point above 128.n// Generated by `bin/generate-identifier-regex.js`.nnvar nonASCIIidentifierStartChars = "\xaa\xb5\xba\xc0-\xd6\xd8-\xf6\xf8-\u02c1\u02c6-\u02d1\u02e0-\u02e4\u02ec\u02ee\u0370-\u0374\u0376\u0377\u037a-\u037d\u037f\u0386\u0388-\u038a\u038c\u038e-\u03a1\u03a3-\u03f5\u03f7-\u0481\u048a-\u052f\u0531-\u0556\u0559\u0561-\u0587\u05d0-\u05ea\u05f0-\u05f2\u0620-\u064a\u066e\u066f\u0671-\u06d3\u06d5\u06e5\u06e6\u06ee\u06ef\u06fa-\u06fc\u06ff\u0710\u0712-\u072f\u074d-\u07a5\u07b1\u07ca-\u07ea\u07f4\u07f5\u07fa\u0800-\u0815\u081a\u0824\u0828\u0840-\u0858\u08a0-\u08b4\u08b6-\u08bd\u0904-\u0939\u093d\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098c\u098f\u0990\u0993-\u09a8\u09aa-\u09b0\u09b2\u09b6-\u09b9\u09bd\u09ce\u09dc\u09dd\u09df-\u09e1\u09f0\u09f1\u0a05-\u0a0a\u0a0f\u0a10\u0a13-\u0a28\u0a2a-\u0a30\u0a32\u0a33\u0a35\u0a36\u0a38\u0a39\u0a59-\u0a5c\u0a5e\u0a72-\u0a74\u0a85-\u0a8d\u0a8f-\u0a91\u0a93-\u0aa8\u0aaa-\u0ab0\u0ab2\u0ab3\u0ab5-\u0ab9\u0abd\u0ad0\u0ae0\u0ae1\u0af9\u0b05-\u0b0c\u0b0f\u0b10\u0b13-\u0b28\u0b2a-\u0b30\u0b32\u0b33\u0b35-\u0b39\u0b3d\u0b5c\u0b5d\u0b5f-\u0b61\u0b71\u0b83\u0b85-\u0b8a\u0b8e-\u0b90\u0b92-\u0b95\u0b99\u0b9a\u0b9c\u0b9e\u0b9f\u0ba3\u0ba4\u0ba8-\u0baa\u0bae-\u0bb9\u0bd0\u0c05-\u0c0c\u0c0e-\u0c10\u0c12-\u0c28\u0c2a-\u0c39\u0c3d\u0c58-\u0c5a\u0c60\u0c61\u0c80\u0c85-\u0c8c\u0c8e-\u0c90\u0c92-\u0ca8\u0caa-\u0cb3\u0cb5-\u0cb9\u0cbd\u0cde\u0ce0\u0ce1\u0cf1\u0cf2\u0d05-\u0d0c\u0d0e-\u0d10\u0d12-\u0d3a\u0d3d\u0d4e\u0d54-\u0d56\u0d5f-\u0d61\u0d7a-\u0d7f\u0d85-\u0d96\u0d9a-\u0db1\u0db3-\u0dbb\u0dbd\u0dc0-\u0dc6\u0e01-\u0e30\u0e32\u0e33\u0e40-\u0e46\u0e81\u0e82\u0e84\u0e87\u0e88\u0e8a\u0e8d\u0e94-\u0e97\u0e99-\u0e9f\u0ea1-\u0ea3\u0ea5\u0ea7\u0eaa\u0eab\u0ead-\u0eb0\u0eb2\u0eb3\u0ebd\u0ec0-\u0ec4\u0ec6\u0edc-\u0edf\u0f00\u0f40-\u0f47\u0f49-\u0f6c\u0f88-\u0f8c\u1000-\u102a\u103f\u1050-\u1055\u105a-\u105d\u1061\u1065\u1066\u106e-\u1070\u1075-\u1081\u108e\u10a0-\u10c5\u10c7\u10cd\u10d0-\u10fa\u10fc-\u1248\u124a-\u124d\u1250-\u1256\u1258\u125a-\u125d\u1260-\u1288\u128a-\u128d\u1290-\u12b0\u12b2-\u12b5\u12b8-\u12be\u12c0\u12c2-\u12c5\u12c8-\u12d6\u12d8-\u1310\u1312-\u1315\u1318-\u135a\u1380-\u138f\u13a0-\u13f5\u13f8-\u13fd\u1401-\u166c\u166f-\u167f\u1681-\u169a\u16a0-\u16ea\u16ee-\u16f8\u1700-\u170c\u170e-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176c\u176e-\u1770\u1780-\u17b3\u17d7\u17dc\u1820-\u1877\u1880-\u18a8\u18aa\u18b0-\u18f5\u1900-\u191e\u1950-\u196d\u1970-\u1974\u1980-\u19ab\u19b0-\u19c9\u1a00-\u1a16\u1a20-\u1a54\u1aa7\u1b05-\u1b33\u1b45-\u1b4b\u1b83-\u1ba0\u1bae\u1baf\u1bba-\u1be5\u1c00-\u1c23\u1c4d-\u1c4f\u1c5a-\u1c7d\u1c80-\u1c88\u1ce9-\u1cec\u1cee-\u1cf1\u1cf5\u1cf6\u1d00-\u1dbf\u1e00-\u1f15\u1f18-\u1f1d\u1f20-\u1f45\u1f48-\u1f4d\u1f50-\u1f57\u1f59\u1f5b\u1f5d\u1f5f-\u1f7d\u1f80-\u1fb4\u1fb6-\u1fbc\u1fbe\u1fc2-\u1fc4\u1fc6-\u1fcc\u1fd0-\u1fd3\u1fd6-\u1fdb\u1fe0-\u1fec\u1ff2-\u1ff4\u1ff6-\u1ffc\u2071\u207f\u2090-\u209c\u2102\u2107\u210a-\u2113\u2115\u2118-\u211d\u2124\u2126\u2128\u212a-\u2139\u213c-\u213f\u2145-\u2149\u214e\u2160-\u2188\u2c00-\u2c2e\u2c30-\u2c5e\u2c60-\u2ce4\u2ceb-\u2cee\u2cf2\u2cf3\u2d00-\u2d25\u2d27\u2d2d\u2d30-\u2d67\u2d6f\u2d80-\u2d96\u2da0-\u2da6\u2da8-\u2dae\u2db0-\u2db6\u2db8-\u2dbe\u2dc0-\u2dc6\u2dc8-\u2dce\u2dd0-\u2dd6\u2dd8-\u2dde\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303c\u3041-\u3096\u309b-\u309f\u30a1-\u30fa\u30fc-\u30ff\u3105-\u312d\u3131-\u318e\u31a0-\u31ba\u31f0-\u31ff\u3400-\u4db5\u4e00-\u9fd5\ua000-\ua48c\ua4d0-\ua4fd\ua500-\ua60c\ua610-\ua61f\ua62a\ua62b\ua640-\ua66e\ua67f-\ua69d\ua6a0-\ua6ef\ua717-\ua71f\ua722-\ua788\ua78b-\ua7ae\ua7b0-\ua7b7\ua7f7-\ua801\ua803-\ua805\ua807-\ua80a\ua80c-\ua822\ua840-\ua873\ua882-\ua8b3\ua8f2-\ua8f7\ua8fb\ua8fd\ua90a-\ua925\ua930-\ua946\ua960-\ua97c\ua984-\ua9b2\ua9cf\ua9e0-\ua9e4\ua9e6-\ua9ef\ua9fa-\ua9fe\uaa00-\uaa28\uaa40-\uaa42\uaa44-\uaa4b\uaa60-\uaa76\uaa7a\uaa7e-\uaaaf\uaab1\uaab5\uaab6\uaab9-\uaabd\uaac0\uaac2\uaadb-\uaadd\uaae0-\uaaea\uaaf2-\uaaf4\uab01-\uab06\uab09-\uab0e\uab11-\uab16\uab20-\uab26\uab28-\uab2e\uab30-\uab5a\uab5c-\uab65\uab70-\uabe2\uac00-\ud7a3\ud7b0-\ud7c6\ud7cb-\ud7fb\uf900-\ufa6d\ufa70-\ufad9\ufb00-\ufb06\ufb13-\ufb17\ufb1d\ufb1f-\ufb28\ufb2a-\ufb36\ufb38-\ufb3c\ufb3e\ufb40\ufb41\ufb43\ufb44\ufb46-\ufbb1\ufbd3-\ufd3d\ufd50-\ufd8f\ufd92-\ufdc7\ufdf0-\ufdfb\ufe70-\ufe74\ufe76-\ufefc\uff21-\uff3a\uff41-\uff5a\uff66-\uffbe\uffc2-\uffc7\uffca-\uffcf\uffd2-\uffd7\uffda-\uffdc"nvar nonASCIIidentifierChars = "\u200c\u200d\xb7\u0300-\u036f\u0387\u0483-\u0487\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u0669\u0670\u06d6-\u06dc\u06df-\u06e4\u06e7\u06e8\u06ea-\u06ed\u06f0-\u06f9\u0711\u0730-\u074a\u07a6-\u07b0\u07c0-\u07c9\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0859-\u085b\u08d4-\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\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\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-\u0c03\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\u0d01-\u0d03\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-\u0eb9\u0ebb\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\u1cf2-\u1cf4\u1cf8\u1cf9\u1dc0-\u1df5\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\ua900-\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"nnvar nonASCIIidentifierStart = new RegExp("[" + nonASCIIidentifierStartChars + "]")nvar nonASCIIidentifier = new RegExp("[" + nonASCIIidentifierStartChars + nonASCIIidentifierChars + "]")nnnonASCIIidentifierStartChars = nonASCIIidentifierChars = nullnn// These are a run-length and offset encoded representation of then// >0xffff code points that are a valid part of identifiers. Then// offset starts at 0x10000, and each pair of numbers represents ann// offset to the next range, and then a size of the range. They weren// generated by bin/generate-identifier-regex.jsnvar astralIdentifierStartCodes = [0,11,2,25,2,18,2,1,2,14,3,13,35,122,70,52,268,28,4,48,48,31,17,26,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,26,45,28,4,28,36,7,2,27,28,53,11,21,11,18,14,17,111,72,56,50,14,50,785,52,76,44,33,24,27,35,42,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,54,47,21,1,2,0,185,46,42,3,37,47,21,0,60,42,86,25,391,63,32,0,449,56,264,8,2,36,18,0,50,29,881,921,103,110,18,195,2749,1070,4050,582,8634,568,8,30,114,29,19,47,17,3,32,20,6,18,881,68,12,0,67,12,65,0,32,6124,20,754,9486,1,3071,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,4149,196,60,67,1213,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,10591,541]nvar astralIdentifierCodes = [509,0,227,0,150,4,294,9,1368,2,2,1,6,3,41,2,5,0,166,1,1306,2,54,14,32,9,16,3,46,10,54,9,7,2,37,13,2,9,52,0,13,2,49,13,10,2,4,9,83,11,7,0,161,11,6,9,7,3,57,0,2,6,3,1,3,2,10,0,11,1,3,6,4,4,193,17,10,9,87,19,13,9,214,6,3,8,28,1,83,16,16,9,82,12,9,9,84,14,5,9,423,9,838,7,2,7,17,9,57,21,2,13,19882,9,135,4,60,6,26,9,1016,45,17,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,2214,6,110,6,6,9,792487,239]nn// This has a complexity linear to the value of the code. Then// assumption is that looking up astral identifier characters isn// rare.nfunction isInAstralSet(code, set) {n var pos = 0x10000n for (var i = 0; i < set.length; i += 2) {n pos += setn if (pos > code) return falsen pos += set[i + 1]n if (pos >= code) return truen }n}nn// Test whether a given character code starts an identifier.nnfunction isIdentifierStart(code, astral) {n if (code < 65) return code === 36n if (code < 91) return truen if (code < 97) return code === 95n if (code < 123) return truen if (code <= 0xffff) return code >= 0xaa && nonASCIIidentifierStart.test(String.fromCharCode(code))n if (astral === false) return falsen return isInAstralSet(code, astralIdentifierStartCodes)n}nn// Test whether a given character is part of an identifier.nnfunction isIdentifierChar(code, astral) {n if (code < 48) return code === 36n if (code < 58) return truen if (code < 65) return falsen if (code < 91) return truen if (code < 97) return code === 95n if (code < 123) return truen if (code <= 0xffff) return code >= 0xaa && nonASCIIidentifier.test(String.fromCharCode(code))n if (astral === false) return falsen return isInAstralSet(code, astralIdentifierStartCodes) || isInAstralSet(code, astralIdentifierCodes)n}nn// ## Token typesnn// The assignment of fine-grained, information-carrying type objectsn// allows the tokenizer to store the information it has about an// token in a way that is very cheap for the parser to look up.nn// All token type variables start with an underscore, to make themn// easy to recognize.nn// The `beforeExpr` property is used to disambiguate between regularn// expressions and divisions. It is set on all token types that cann// be followed by an expression (thus, a slash after them would be an// regular expression).n//n// The `startsExpr` property is used to check if the token ends an// `yield` expression. It is set on all token types that either cann// directly start an expression (like a quotation mark) or cann// continue an expression (like the body of a string).n//n// `isLoop` marks a keyword as starting a loop, which is importantn// to know when parsing a label, in order to allow or disallown// continue jumps to that label.nnvar TokenType = function TokenType(label, conf) {n if ( conf === void 0 ) conf = {};nn this.label = labeln this.keyword = conf.keywordn this.beforeExpr = !!conf.beforeExprn this.startsExpr = !!conf.startsExprn this.isLoop = !!conf.isLoopn this.isAssign = !!conf.isAssignn this.prefix = !!conf.prefixn this.postfix = !!conf.postfixn this.binop = conf.binop || nulln this.updateContext = nulln};nnfunction binop(name, prec) {n return new TokenType(name, {beforeExpr: true, binop: prec})n}nvar beforeExpr = {beforeExpr: true};nvar startsExpr = {startsExpr: true};n// Map keyword names to token types.nnvar keywordTypes = {}nn// Succinct definitions of keyword token typesnfunction kw(name, options) {n if ( options === void 0 ) options = {};nn options.keyword = namen return keywordTypes = new TokenType(name, options)n}nnvar tt = {n num: new TokenType("num", startsExpr),n regexp: new TokenType("regexp", startsExpr),n string: new TokenType("string", startsExpr),n name: new TokenType("name", startsExpr),n eof: new TokenType("eof"),nn // Punctuation token types.n bracketL: new TokenType("[", {beforeExpr: true, startsExpr: true}),n bracketR: new TokenType("]"),n braceL: new TokenType("{", {beforeExpr: true, startsExpr: true}),n braceR: new TokenType("}"),n parenL: new TokenType("(", {beforeExpr: true, startsExpr: true}),n parenR: new TokenType(")"),n comma: new TokenType(",", beforeExpr),n semi: new TokenType(";", beforeExpr),n colon: new TokenType(":", beforeExpr),n dot: new TokenType("."),n question: new TokenType("?", beforeExpr),n arrow: new TokenType("=>", beforeExpr),n template: new TokenType("template"),n ellipsis: new TokenType("…", beforeExpr),n backQuote: new TokenType("`", startsExpr),n dollarBraceL: new TokenType("${", {beforeExpr: true, startsExpr: true}),nn // Operators. These carry several kinds of properties to help then // parser use them properly (the presence of these properties isn // what categorizes them as operators).n //n // `binop`, when present, specifies that this operator is a binaryn // operator, and will refer to its precedence.n //n // `prefix` and `postfix` mark the operator as a prefix or postfixn // unary operator.n //n // `isAssign` marks all of `=`, `+=`, `-=` etcetera, which act asn // binary operators with a very low precedence, that should resultn // in AssignmentExpression nodes.nn eq: new TokenType("=", {beforeExpr: true, isAssign: true}),n assign: new TokenType("_=", {beforeExpr: true, isAssign: true}),n incDec: new TokenType("++/–", {prefix: true, postfix: true, startsExpr: true}),n prefix: new TokenType("prefix", {beforeExpr: true, prefix: true, startsExpr: true}),n logicalOR: binop("||", 1),n logicalAND: binop("&&", 2),n bitwiseOR: binop("|", 3),n bitwiseXOR: binop("^", 4),n bitwiseAND: binop("&", 5),n equality: binop("==/!=", 6),n relational: binop("</>", 7),n bitShift: binop("<</>>", 8),n plusMin: new TokenType("+/-", {beforeExpr: true, binop: 9, prefix: true, startsExpr: true}),n modulo: binop("%", 10),n star: binop("*", 10),n slash: binop("/", 10),n starstar: new TokenType("**", {beforeExpr: true}),nn // Keyword token types.n _break: kw("break"),n _case: kw("case", beforeExpr),n _catch: kw("catch"),n _continue: kw("continue"),n _debugger: kw("debugger"),n _default: kw("default", beforeExpr),n _do: kw("do", {isLoop: true, beforeExpr: true}),n _else: kw("else", beforeExpr),n _finally: kw("finally"),n _for: kw("for", {isLoop: true}),n _function: kw("function", startsExpr),n _if: kw("if"),n _return: kw("return", beforeExpr),n _switch: kw("switch"),n _throw: kw("throw", beforeExpr),n _try: kw("try"),n _var: kw("var"),n _const: kw("const"),n _while: kw("while", {isLoop: true}),n _with: kw("with"),n _new: kw("new", {beforeExpr: true, startsExpr: true}),n _this: kw("this", startsExpr),n _super: kw("super", startsExpr),n _class: kw("class"),n _extends: kw("extends", beforeExpr),n _export: kw("export"),n _import: kw("import"),n _null: kw("null", startsExpr),n _true: kw("true", startsExpr),n _false: kw("false", startsExpr),n _in: kw("in", {beforeExpr: true, binop: 7}),n _instanceof: kw("instanceof", {beforeExpr: true, binop: 7}),n _typeof: kw("typeof", {beforeExpr: true, prefix: true, startsExpr: true}),n _void: kw("void", {beforeExpr: true, prefix: true, startsExpr: true}),n _delete: kw("delete", {beforeExpr: true, prefix: true, startsExpr: true})n}nn// Matches a whole line break (where CRLF is considered a singlen// line break). Used to count lines.nnvar lineBreak = /\r\n?|\n|\u2028|\u2029/nvar lineBreakG = new RegExp(lineBreak.source, "g")nnfunction isNewLine(code) {n return code === 10 || code === 13 || code === 0x2028 || code === 0x2029n}nnvar nonASCIIwhitespace = /[\u1680\u180e\u2000-\u200a\u202f\u205f\u3000\ufeff]/nnvar skipWhiteSpace = /(?:\s|\/\/.*|\/**?*\/)*/gnnfunction isArray(obj) {n return Object.prototype.toString.call(obj) === "[object Array]"n}nn// Checks if an object has a property.nnfunction has(obj, propName) {n return Object.prototype.hasOwnProperty.call(obj, propName)n}nn// These are used when `options.locations` is on, for then// `startLoc` and `endLoc` properties.nnvar Position = function Position(line, col) {n this.line = linen this.column = coln};nnPosition.prototype.offset = function offset (n) {n return new Position(this.line, this.column + n)n};nnvar SourceLocation = function SourceLocation(p, start, end) {n this.start = startn this.end = endn if (p.sourceFile !== null) this.source = p.sourceFilen};nn// The `getLineInfo` function is mostly useful when then// `locations` option is off (for performance reasons) and youn// want to find the line/column position for a given charactern// offset. `input` should be the code string that the offset refersn// into.nnfunction getLineInfo(input, offset) {n for (var line = 1, cur = 0;;) {n lineBreakG.lastIndex = curn var match = lineBreakG.exec(input)n if (match && match.index < offset) {n ++linen cur = match.index + match.lengthn } else {n return new Position(line, offset - cur)n }n }n}nn// A second optional argument can be given to further configuren// the parser process. These options are recognized:nnvar defaultOptions = {n // `ecmaVersion` indicates the ECMAScript version to parse. Mustn // be either 3, 5, 6 (2015), 7 (2016), or 8 (2017). This influences supportn // for strict mode, the set of reserved words, and support forn // new syntax features. The default is 7.n ecmaVersion: 7,n // `sourceType` indicates the mode the code should be parsed in.n // Can be either `"script"` or `"module"`. This influences globaln // strict mode and parsing of `import` and `export` declarations.n sourceType: "script",n // `onInsertedSemicolon` can be a callback that will be calledn // when a semicolon is automatically inserted. It will be passedn // th position of the comma as an offset, and if `locations` isn // enabled, it is given the location as a `{line, column}` objectn // as second argument.n onInsertedSemicolon: null,n // `onTrailingComma` is similar to `onInsertedSemicolon`, but forn // trailing commas.n onTrailingComma: null,n // By default, reserved words are only enforced if ecmaVersion >= 5.n // Set `allowReserved` to a boolean value to explicitly turn this onn // an off. When this option has the value "never", reserved wordsn // and keywords can also not be used as property names.n allowReserved: null,n // When enabled, a return at the top level is not considered ann // error.n allowReturnOutsideFunction: false,n // When enabled, import/export statements are not constrained ton // appearing at the top of the program.n allowImportExportEverywhere: false,n // When enabled, hashbang directive in the beginning of filen // is allowed and treated as a line comment.n allowHashBang: false,n // When `locations` is on, `loc` properties holding objects withn // `start` and `end` properties in `{line, column}` form (withn // line being 1-based and column 0-based) will be attached to then // nodes.n locations: false,n // A function can be passed as `onToken` option, which willn // cause Acorn to call that function with object in the samen // format as tokens returned from `tokenizer().getToken()`. Noten // that you are not allowed to call the parser from then // callback—that will corrupt its internal state.n onToken: null,n // A function can be passed as `onComment` option, which willn // cause Acorn to call that function with `(block, text, start,n // end)` parameters whenever a comment is skipped. `block` is an // boolean indicating whether this is a block (`/* */`) comment,n // `text` is the content of the comment, and `start` and `end` aren // character offsets that denote the start and end of the comment.n // When the `locations` option is on, two more parameters aren // passed, the full `{line, column}` locations of the start andn // end of the comments. Note that you are not allowed to call then // parser from the callback—that will corrupt its internal state.n onComment: null,n // Nodes have their start and end characters offsets recorded inn // `start` and `end` properties (directly on the node, rather thann // the `loc` object, which holds line/column data. To also add an // [semi-standardized] `range` property holding a `[start,n // end]` array with the same numbers, set the `ranges` option ton // `true`.n //n // [range]: bugzilla.mozilla.org/show_bug.cgi?id=745678n ranges: false,n // It is possible to parse multiple files into a single AST byn // passing the tree produced by parsing the first file asn // `program` option in subsequent parses. This will add then // toplevel forms of the parsed file to the `Program` (top) noden // of an existing parse tree.n program: null,n // When `locations` is on, you can pass this to record the sourcen // file in every node's `loc` object.n sourceFile: null,n // This value, if given, is stored in every node, whethern // `locations` is on or off.n directSourceFile: null,n // When enabled, parenthesized expressions are represented byn // (non-standard) ParenthesizedExpression nodesn preserveParens: false,n plugins: {}n}nn// Interpret and default an options objectnnfunction getOptions(opts) {n var options = {}nn for (var opt in defaultOptions)n options = opts && has(opts, opt) ? opts : defaultOptionsnn if (options.ecmaVersion >= 2015)n options.ecmaVersion -= 2009nn if (options.allowReserved == null)n options.allowReserved = options.ecmaVersion < 5nn if (isArray(options.onToken)) {n var tokens = options.onTokenn options.onToken = function (token) { return tokens.push(token); }n }n if (isArray(options.onComment))n options.onComment = pushComment(options, options.onComment)nn return optionsn}nnfunction pushComment(options, array) {n return function (block, text, start, end, startLoc, endLoc) {n var comment = {n type: block ? 'Block' : 'Line',n value: text,n start: start,n end: endn }n if (options.locations)n comment.loc = new SourceLocation(this, startLoc, endLoc)n if (options.ranges)n comment.range = [start, end]n array.push(comment)n }n}nn// Registered pluginsnvar plugins = {}nnfunction keywordRegexp(words) {n return new RegExp("^(" + words.replace(/ /g, "|") + ")$")n}nnvar Parser = function Parser(options, input, startPos) {n this.options = options = getOptions(options)n this.sourceFile = options.sourceFilen this.keywords = keywordRegexp(keywords[options.ecmaVersion >= 6 ? 6 : 5])n var reserved = ""n if (!options.allowReserved) {n for (var v = options.ecmaVersion;; v–)n if (reserved = reservedWords) breakn if (options.sourceType == "module") reserved += " await"n }n this.reservedWords = keywordRegexp(reserved)n var reservedStrict = (reserved ? reserved + " " : "") + reservedWords.strictn this.reservedWordsStrict = keywordRegexp(reservedStrict)n this.reservedWordsStrictBind = keywordRegexp(reservedStrict + " " + reservedWords.strictBind)n this.input = String(input)nn // Used to signal to callers of `readWord1` whether the wordn // contained any escape sequences. This is needed because words withn // escape sequences must not be interpreted as keywords.n this.containsEsc = falsenn // Load pluginsn this.loadPlugins(options.plugins)nn // Set up token statenn // The current position of the tokenizer in the input.n if (startPos) {n this.pos = startPosn this.lineStart = this.input.lastIndexOf("\n", startPos - 1) + 1n this.curLine = this.input.slice(0, this.lineStart).split(lineBreak).lengthn } else {n this.pos = this.lineStart = 0n this.curLine = 1n }nn // Properties of the current token:n // Its typen this.type = tt.eofn // For tokens that include more information than their type, the valuen this.value = nulln // Its start and end offsetn this.start = this.end = this.posn // And, if locations are used, the {line, column} objectn // corresponding to those offsetsn this.startLoc = this.endLoc = this.curPosition()nn // Position information for the previous tokenn this.lastTokEndLoc = this.lastTokStartLoc = nulln this.lastTokStart = this.lastTokEnd = this.posnn // The context stack is used to superficially track syntacticn // context to predict whether a regular expression is allowed in an // given position.n this.context = this.initialContext()n this.exprAllowed = truenn // Figure out if it's a module code.n this.inModule = options.sourceType === "module"n this.strict = this.inModule || this.strictDirective(this.pos)nn // Used to signify the start of a potential arrow functionn this.potentialArrowAt = -1nn // Flags to track whether we are in a function, a generator, an async function.n this.inFunction = this.inGenerator = this.inAsync = falsen // Positions to delayed-check that yield/await does not exist in default parameters.n this.yieldPos = this.awaitPos = 0n // Labels in scope.n this.labels = []nn // If enabled, skip leading hashbang line.n if (this.pos === 0 && options.allowHashBang && this.input.slice(0, 2) === '#!')n this.skipLineComment(2)n};nn// DEPRECATED Kept for backwards compatibility until 3.0 in case a plugin uses themnParser.prototype.isKeyword = function isKeyword (word) { return this.keywords.test(word) };nParser.prototype.isReservedWord = function isReservedWord (word) { return this.reservedWords.test(word) };nnParser.prototype.extend = function extend (name, f) {n this = f(this)n};nnParser.prototype.loadPlugins = function loadPlugins (pluginConfigs) {n var this$1 = this;nn for (var name in pluginConfigs) {n var plugin = pluginsn if (!plugin) throw new Error("Plugin '" + name + "' not found")n plugin(this$1, pluginConfigs)n }n};nnParser.prototype.parse = function parse () {n var node = this.options.program || this.startNode()n this.nextToken()n return this.parseTopLevel(node)n};nnvar pp = Parser.prototypenn// ## Parser utilitiesnnvar literal = /^(?:'((?:[^\']|\.)*)'|"((?:[^\"]|\.)*)"|;)/npp.strictDirective = function(start) {n var this$1 = this;nn for (;;) {n skipWhiteSpace.lastIndex = startn start += skipWhiteSpace.exec(this$1.input).lengthn var match = literal.exec(this$1.input.slice(start))n if (!match) return falsen if ((match || match) == "use strict") return truen start += match.lengthn }n}nn// Predicate that tests whether the next token is of the givenn// type, and if yes, consumes it as a side effect.nnpp.eat = function(type) {n if (this.type === type) {n this.next()n return truen } else {n return falsen }n}nn// Tests whether parsed token is a contextual keyword.nnpp.isContextual = function(name) {n return this.type === tt.name && this.value === namen}nn// Consumes contextual keyword if possible.nnpp.eatContextual = function(name) {n return this.value === name && this.eat(tt.name)n}nn// Asserts that following token is given contextual keyword.nnpp.expectContextual = function(name) {n if (!this.eatContextual(name)) this.unexpected()n}nn// Test whether a semicolon can be inserted at the current position.nnpp.canInsertSemicolon = function() {n return this.type === tt.eof ||n this.type === tt.braceR ||n lineBreak.test(this.input.slice(this.lastTokEnd, this.start))n}nnpp.insertSemicolon = function() {n if (this.canInsertSemicolon()) {n if (this.options.onInsertedSemicolon)n this.options.onInsertedSemicolon(this.lastTokEnd, this.lastTokEndLoc)n return truen }n}nn// Consume a semicolon, or, failing that, see if we are allowed ton// pretend that there is a semicolon at this position.nnpp.semicolon = function() {n if (!this.eat(tt.semi) && !this.insertSemicolon()) this.unexpected()n}nnpp.afterTrailingComma = function(tokType, notNext) {n if (this.type == tokType) {n if (this.options.onTrailingComma)n this.options.onTrailingComma(this.lastTokStart, this.lastTokStartLoc)n if (!notNext)n this.next()n return truen }n}nn// Expect a token of a given type. If found, consume it, otherwise,n// raise an unexpected token error.nnpp.expect = function(type) {n this.eat(type) || this.unexpected()n}nn// Raise an unexpected token error.nnpp.unexpected = function(pos) {n this.raise(pos != null ? pos : this.start, "Unexpected token")n}nnvar DestructuringErrors = function DestructuringErrors() {n this.shorthandAssign = this.trailingComma = this.parenthesizedAssign = this.parenthesizedBind = -1n};nnpp.checkPatternErrors = function(refDestructuringErrors, isAssign) {n if (!refDestructuringErrors) returnn if (refDestructuringErrors.trailingComma > -1)n this.raiseRecoverable(refDestructuringErrors.trailingComma, "Comma is not permitted after the rest element")n var parens = isAssign ? refDestructuringErrors.parenthesizedAssign : refDestructuringErrors.parenthesizedBindn if (parens > -1) this.raiseRecoverable(parens, "Parenthesized pattern")n}nnpp.checkExpressionErrors = function(refDestructuringErrors, andThrow) {n var pos = refDestructuringErrors ? refDestructuringErrors.shorthandAssign : -1n if (!andThrow) return pos >= 0n if (pos > -1) this.raise(pos, "Shorthand property assignments are valid only in destructuring patterns")n}nnpp.checkYieldAwaitInDefaultParams = function() {n if (this.yieldPos && (!this.awaitPos || this.yieldPos < this.awaitPos))n this.raise(this.yieldPos, "Yield expression cannot be a default value")n if (this.awaitPos)n this.raise(this.awaitPos, "Await expression cannot be a default value")n}nnpp.isSimpleAssignTarget = function(expr) {n if (expr.type === "ParenthesizedExpression")n return this.isSimpleAssignTarget(expr.expression)n return expr.type === "Identifier" || expr.type === "MemberExpression"n}nnvar pp$1 = Parser.prototypenn// ### Statement parsingnn// Parse a program. Initializes the parser, reads any number ofn// statements, and wraps them in a Program node. Optionally takes an// `program` argument. If present, the statements will be appendedn// to its body instead of creating a new node.nnpp$1.parseTopLevel = function(node) {n var this$1 = this;nn var exports = {}n if (!node.body) node.body = []n while (this.type !== tt.eof) {n var stmt = this$1.parseStatement(true, true, exports)n node.body.push(stmt)n }n this.next()n if (this.options.ecmaVersion >= 6) {n node.sourceType = this.options.sourceTypen }n return this.finishNode(node, "Program")n}nnvar loopLabel = {kind: "loop"};nvar switchLabel = {kind: "switch"};npp$1.isLet = function() {n if (this.type !== tt.name || this.options.ecmaVersion < 6 || this.value != "let") return falsen skipWhiteSpace.lastIndex = this.posn var skip = skipWhiteSpace.exec(this.input)n var next = this.pos + skip.length, nextCh = this.input.charCodeAt(next)n if (nextCh === 91 || nextCh == 123) return true // '{' and '['n if (isIdentifierStart(nextCh, true)) {n for (var pos = next + 1; isIdentifierChar(this.input.charCodeAt(pos), true); ++pos) {}n var ident = this.input.slice(next, pos)n if (!this.isKeyword(ident)) return truen }n return falsen}nn// check 'async [no LineTerminator here] function'n// - 'async /foo/ function' is OK.n// - 'async /*\n*/ function' is invalid.npp$1.isAsyncFunction = function() {n if (this.type !== tt.name || this.options.ecmaVersion < 8 || this.value != "async")n return falsenn skipWhiteSpace.lastIndex = this.posn var skip = skipWhiteSpace.exec(this.input)n var next = this.pos + skip.lengthn return !lineBreak.test(this.input.slice(this.pos, next)) &&n this.input.slice(next, next + 8) === "function" &&n (next + 8 == this.input.length || !isIdentifierChar(this.input.charAt(next + 8)))n}nn// Parse a single statement.n//n// If expecting a statement and finding a slash operator, parse an// regular expression literal. This is to handle cases liken// `if (foo) /blah/.exec(foo)`, where looking at the previous tokenn// does not help.nnpp$1.parseStatement = function(declaration, topLevel, exports) {n var starttype = this.type, node = this.startNode(), kindnn if (this.isLet()) {n starttype = tt._varn kind = "let"n }nn // Most types of statements are recognized by the keyword theyn // start with. Many are trivial to parse, some require a bit ofn // complexity.nn switch (starttype) {n case tt._break: case tt._continue: return this.parseBreakContinueStatement(node, starttype.keyword)n case tt._debugger: return this.parseDebuggerStatement(node)n case tt._do: return this.parseDoStatement(node)n case tt._for: return this.parseForStatement(node)n case tt._function:n if (!declaration && this.options.ecmaVersion >= 6) this.unexpected()n return this.parseFunctionStatement(node, false)n case tt._class:n if (!declaration) this.unexpected()n return this.parseClass(node, true)n case tt._if: return this.parseIfStatement(node)n case tt._return: return this.parseReturnStatement(node)n case tt._switch: return this.parseSwitchStatement(node)n case tt._throw: return this.parseThrowStatement(node)n case tt._try: return this.parseTryStatement(node)n case tt._const: case tt._var:n kind = kind || this.valuen if (!declaration && kind != "var") this.unexpected()n return this.parseVarStatement(node, kind)n case tt._while: return this.parseWhileStatement(node)n case tt._with: return this.parseWithStatement(node)n case tt.braceL: return this.parseBlock()n case tt.semi: return this.parseEmptyStatement(node)n case tt._export:n case tt._import:n if (!this.options.allowImportExportEverywhere) {n if (!topLevel)n this.raise(this.start, "'import' and 'export' may only appear at the top level")n if (!this.inModule)n this.raise(this.start, "'import' and 'export' may appear only with 'sourceType: module'")n }n return starttype === tt._import ? this.parseImport(node) : this.parseExport(node, exports)nn // If the statement does not start with a statement keyword or an // brace, it's an ExpressionStatement or LabeledStatement. Wen // simply start parsing an expression, and afterwards, if then // next token is a colon and the expression was a simplen // Identifier node, we switch to interpreting it as a label.n default:n if (this.isAsyncFunction() && declaration) {n this.next()n return this.parseFunctionStatement(node, true)n }nn var maybeName = this.value, expr = this.parseExpression()n if (starttype === tt.name && expr.type === "Identifier" && this.eat(tt.colon))n return this.parseLabeledStatement(node, maybeName, expr)n else return this.parseExpressionStatement(node, expr)n }n}nnpp$1.parseBreakContinueStatement = function(node, keyword) {n var this$1 = this;nn var isBreak = keyword == "break"n this.next()n if (this.eat(tt.semi) || this.insertSemicolon()) node.label = nulln else if (this.type !== tt.name) this.unexpected()n else {n node.label = this.parseIdent()n this.semicolon()n }nn // Verify that there is an actual destination to break orn // continue to.n for (var i = 0; i < this.labels.length; ++i) {n var lab = this$1.labelsn if (node.label == null || lab.name === node.label.name) {n if (lab.kind != null && (isBreak || lab.kind === "loop")) breakn if (node.label && isBreak) breakn }n }n if (i === this.labels.length) this.raise(node.start, "Unsyntactic " + keyword)n return this.finishNode(node, isBreak ? "BreakStatement" : "ContinueStatement")n}nnpp$1.parseDebuggerStatement = function(node) {n this.next()n this.semicolon()n return this.finishNode(node, "DebuggerStatement")n}nnpp$1.parseDoStatement = function(node) {n this.next()n this.labels.push(loopLabel)n node.body = this.parseStatement(false)n this.labels.pop()n this.expect(tt._while)n node.test = this.parseParenExpression()n if (this.options.ecmaVersion >= 6)n this.eat(tt.semi)n elsen this.semicolon()n return this.finishNode(node, "DoWhileStatement")n}nn// Disambiguating between a `for` and a `for`/`in` or `for`/`of`n// loop is non-trivial. Basically, we have to parse the init `var`n// statement or expression, disallowing the `in` operator (seen// the second parameter to `parseExpression`), and then checkn// whether the next token is `in` or `of`. When there is no initn// part (semicolon immediately after the opening parenthesis), itn// is a regular `for` loop.nnpp$1.parseForStatement = function(node) {n this.next()n this.labels.push(loopLabel)n this.expect(tt.parenL)n if (this.type === tt.semi) return this.parseFor(node, null)n var isLet = this.isLet()n if (this.type === tt._var || this.type === tt._const || isLet) {n var init$1 = this.startNode(), kind = isLet ? "let" : this.valuen this.next()n this.parseVar(init$1, true, kind)n this.finishNode(init$1, "VariableDeclaration")n if ((this.type === tt._in || (this.options.ecmaVersion >= 6 && this.isContextual("of"))) && init$1.declarations.length === 1 &&n !(kind !== "var" && init$1.declarations.init))n return this.parseForIn(node, init$1)n return this.parseFor(node, init$1)n }n var refDestructuringErrors = new DestructuringErrorsn var init = this.parseExpression(true, refDestructuringErrors)n if (this.type === tt._in || (this.options.ecmaVersion >= 6 && this.isContextual("of"))) {n this.toAssignable(init)n this.checkLVal(init)n this.checkPatternErrors(refDestructuringErrors, true)n return this.parseForIn(node, init)n } else {n this.checkExpressionErrors(refDestructuringErrors, true)n }n return this.parseFor(node, init)n}nnpp$1.parseFunctionStatement = function(node, isAsync) {n this.next()n return this.parseFunction(node, true, false, isAsync)n}nnpp$1.isFunction = function() {n return this.type === tt._function || this.isAsyncFunction()n}nnpp$1.parseIfStatement = function(node) {n this.next()n node.test = this.parseParenExpression()n // allow function declarations in branches, but only in non-strict moden node.consequent = this.parseStatement(!this.strict && this.isFunction())n node.alternate = this.eat(tt._else) ? this.parseStatement(!this.strict && this.isFunction()) : nulln return this.finishNode(node, "IfStatement")n}nnpp$1.parseReturnStatement = function(node) {n if (!this.inFunction && !this.options.allowReturnOutsideFunction)n this.raise(this.start, "'return' outside of function")n this.next()nn // In `return` (and `break`/`continue`), the keywords withn // optional arguments, we eagerly look for a semicolon or then // possibility to insert one.nn if (this.eat(tt.semi) || this.insertSemicolon()) node.argument = nulln else { node.argument = this.parseExpression(); this.semicolon() }n return this.finishNode(node, "ReturnStatement")n}nnpp$1.parseSwitchStatement = function(node) {n var this$1 = this;nn this.next()n node.discriminant = this.parseParenExpression()n node.cases = []n this.expect(tt.braceL)n this.labels.push(switchLabel)nn // Statements under must be grouped (by label) in SwitchCasen // nodes. `cur` is used to keep the node that we are currentlyn // adding statements to.nn for (var cur, sawDefault = false; this.type != tt.braceR;) {n if (this$1.type === tt._case || this$1.type === tt._default) {n var isCase = this$1.type === tt._casen if (cur) this$1.finishNode(cur, "SwitchCase")n node.cases.push(cur = this$1.startNode())n cur.consequent = []n this$1.next()n if (isCase) {n cur.test = this$1.parseExpression()n } else {n if (sawDefault) this$1.raiseRecoverable(this$1.lastTokStart, "Multiple default clauses")n sawDefault = truen cur.test = nulln }n this$1.expect(tt.colon)n } else {n if (!cur) this$1.unexpected()n cur.consequent.push(this$1.parseStatement(true))n }n }n if (cur) this.finishNode(cur, "SwitchCase")n this.next() // Closing bracen this.labels.pop()n return this.finishNode(node, "SwitchStatement")n}nnpp$1.parseThrowStatement = function(node) {n this.next()n if (lineBreak.test(this.input.slice(this.lastTokEnd, this.start)))n this.raise(this.lastTokEnd, "Illegal newline after throw")n node.argument = this.parseExpression()n this.semicolon()n return this.finishNode(node, "ThrowStatement")n}nn// Reused empty array added for node fields that are always empty.nnvar empty = []nnpp$1.parseTryStatement = function(node) {n this.next()n node.block = this.parseBlock()n node.handler = nulln if (this.type === tt._catch) {n var clause = this.startNode()n this.next()n this.expect(tt.parenL)n clause.param = this.parseBindingAtom()n this.checkLVal(clause.param, true)n this.expect(tt.parenR)n clause.body = this.parseBlock()n node.handler = this.finishNode(clause, "CatchClause")n }n node.finalizer = this.eat(tt._finally) ? this.parseBlock() : nulln if (!node.handler && !node.finalizer)n this.raise(node.start, "Missing catch or finally clause")n return this.finishNode(node, "TryStatement")n}nnpp$1.parseVarStatement = function(node, kind) {n this.next()n this.parseVar(node, false, kind)n this.semicolon()n return this.finishNode(node, "VariableDeclaration")n}nnpp$1.parseWhileStatement = function(node) {n this.next()n node.test = this.parseParenExpression()n this.labels.push(loopLabel)n node.body = this.parseStatement(false)n this.labels.pop()n return this.finishNode(node, "WhileStatement")n}nnpp$1.parseWithStatement = function(node) {n if (this.strict) this.raise(this.start, "'with' in strict mode")n this.next()n node.object = this.parseParenExpression()n node.body = this.parseStatement(false)n return this.finishNode(node, "WithStatement")n}nnpp$1.parseEmptyStatement = function(node) {n this.next()n return this.finishNode(node, "EmptyStatement")n}nnpp$1.parseLabeledStatement = function(node, maybeName, expr) {n var this$1 = this;nn for (var i = 0; i < this.labels.length; ++i)n if (this$1.labels.name === maybeName) this$1.raise(expr.start, "Label '" + maybeName + "' is already declared")n var kind = this.type.isLoop ? "loop" : this.type === tt._switch ? "switch" : nulln for (var i$1 = this.labels.length - 1; i$1 >= 0; i$1–) {n var label = this$1.labelsn if (label.statementStart == node.start) {n label.statementStart = this$1.startn label.kind = kindn } else breakn }n this.labels.push({name: maybeName, kind: kind, statementStart: this.start})n node.body = this.parseStatement(true)n if (node.body.type == "ClassDeclaration" ||n node.body.type == "VariableDeclaration" && (this.strict || node.body.kind != "var") ||n node.body.type == "FunctionDeclaration" && (this.strict || node.body.generator))n this.raiseRecoverable(node.body.start, "Invalid labeled declaration")n this.labels.pop()n node.label = exprn return this.finishNode(node, "LabeledStatement")n}nnpp$1.parseExpressionStatement = function(node, expr) {n node.expression = exprn this.semicolon()n return this.finishNode(node, "ExpressionStatement")n}nn// Parse a semicolon-enclosed block of statements, handling `"usen// strict"` declarations when `allowStrict` is true (used forn// function bodies).nnpp$1.parseBlock = function() {n var this$1 = this;nn var node = this.startNode()n node.body = []n this.expect(tt.braceL)n while (!this.eat(tt.braceR)) {n var stmt = this$1.parseStatement(true)n node.body.push(stmt)n }n return this.finishNode(node, "BlockStatement")n}nn// Parse a regular `for` loop. The disambiguation code inn// `parseStatement` will already have parsed the init statement orn// expression.nnpp$1.parseFor = function(node, init) {n node.init = initn this.expect(tt.semi)n node.test = this.type === tt.semi ? null : this.parseExpression()n this.expect(tt.semi)n node.update = this.type === tt.parenR ? null : this.parseExpression()n this.expect(tt.parenR)n node.body = this.parseStatement(false)n this.labels.pop()n return this.finishNode(node, "ForStatement")n}nn// Parse a `for`/`in` and `for`/`of` loop, which are almostn// same from parser's perspective.nnpp$1.parseForIn = function(node, init) {n var type = this.type === tt._in ? "ForInStatement" : "ForOfStatement"n this.next()n node.left = initn node.right = this.parseExpression()n this.expect(tt.parenR)n node.body = this.parseStatement(false)n this.labels.pop()n return this.finishNode(node, type)n}nn// Parse a list of variable declarations.nnpp$1.parseVar = function(node, isFor, kind) {n var this$1 = this;nn node.declarations = []n node.kind = kindn for (;;) {n var decl = this$1.startNode()n this$1.parseVarId(decl)n if (this$1.eat(tt.eq)) {n decl.init = this$1.parseMaybeAssign(isFor)n } else if (kind === "const" && !(this$1.type === tt._in || (this$1.options.ecmaVersion >= 6 && this$1.isContextual("of")))) {n this$1.unexpected()n } else if (decl.id.type != "Identifier" && !(isFor && (this$1.type === tt._in || this$1.isContextual("of")))) {n this$1.raise(this$1.lastTokEnd, "Complex binding patterns require an initialization value")n } else {n decl.init = nulln }n node.declarations.push(this$1.finishNode(decl, "VariableDeclarator"))n if (!this$1.eat(tt.comma)) breakn }n return noden}nnpp$1.parseVarId = function(decl) {n decl.id = this.parseBindingAtom()n this.checkLVal(decl.id, true)n}nn// Parse a function declaration or literal (depending on then// `isStatement` parameter).nnpp$1.parseFunction = function(node, isStatement, allowExpressionBody, isAsync) {n this.initFunction(node)n if (this.options.ecmaVersion >= 6 && !isAsync)n node.generator = this.eat(tt.star)n if (this.options.ecmaVersion >= 8)n node.async = !!isAsyncnn if (isStatement == null)n isStatement = this.type == tt.namen if (isStatement)n node.id = this.parseIdent()nn var oldInGen = this.inGenerator, oldInAsync = this.inAsync,n oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, oldInFunc = this.inFunctionn this.inGenerator = node.generatorn this.inAsync = node.asyncn this.yieldPos = 0n this.awaitPos = 0n this.inFunction = truenn if (!isStatement && this.type === tt.name)n node.id = this.parseIdent()n this.parseFunctionParams(node)n this.parseFunctionBody(node, allowExpressionBody)nn this.inGenerator = oldInGenn this.inAsync = oldInAsyncn this.yieldPos = oldYieldPosn this.awaitPos = oldAwaitPosn this.inFunction = oldInFuncn return this.finishNode(node, isStatement ? "FunctionDeclaration" : "FunctionExpression")n}nnpp$1.parseFunctionParams = function(node) {n this.expect(tt.parenL)n node.params = this.parseBindingList(tt.parenR, false, this.options.ecmaVersion >= 8, true)n this.checkYieldAwaitInDefaultParams()n}nn// Parse a class declaration or literal (depending on then// `isStatement` parameter).nnpp$1.parseClass = function(node, isStatement) {n var this$1 = this;nn this.next()n if (isStatement == null) isStatement = this.type === tt.namen this.parseClassId(node, isStatement)n this.parseClassSuper(node)n var classBody = this.startNode()n var hadConstructor = falsen classBody.body = []n this.expect(tt.braceL)n while (!this.eat(tt.braceR)) {n if (this$1.eat(tt.semi)) continuen var method = this$1.startNode()n var isGenerator = this$1.eat(tt.star)n var isAsync = falsen var isMaybeStatic = this$1.type === tt.name && this$1.value === "static"n this$1.parsePropertyName(method)n method.static = isMaybeStatic && this$1.type !== tt.parenLn if (method.static) {n if (isGenerator) this$1.unexpected()n isGenerator = this$1.eat(tt.star)n this$1.parsePropertyName(method)n }n if (this$1.options.ecmaVersion >= 8 && !isGenerator && !method.computed &&n method.key.type === "Identifier" && method.key.name === "async" && this$1.type !== tt.parenL &&n !this$1.canInsertSemicolon()) {n isAsync = truen this$1.parsePropertyName(method)n }n method.kind = "method"n var isGetSet = falsen if (!method.computed) {n var key = method.key;n if (!isGenerator && !isAsync && key.type === "Identifier" && this$1.type !== tt.parenL && (key.name === "get" || key.name === "set")) {n isGetSet = truen method.kind = key.namen key = this$1.parsePropertyName(method)n }n if (!method.static && (key.type === "Identifier" && key.name === "constructor" ||n key.type === "Literal" && key.value === "constructor")) {n if (hadConstructor) this$1.raise(key.start, "Duplicate constructor in the same class")n if (isGetSet) this$1.raise(key.start, "Constructor can't have get/set modifier")n if (isGenerator) this$1.raise(key.start, "Constructor can't be a generator")n if (isAsync) this$1.raise(key.start, "Constructor can't be an async method")n method.kind = "constructor"n hadConstructor = truen }n }n this$1.parseClassMethod(classBody, method, isGenerator, isAsync)n if (isGetSet) {n var paramCount = method.kind === "get" ? 0 : 1n if (method.value.params.length !== paramCount) {n var start = method.value.startn if (method.kind === "get")n this$1.raiseRecoverable(start, "getter should have no params")n elsen this$1.raiseRecoverable(start, "setter should have exactly one param")n } else {n if (method.kind === "set" && method.value.params.type === "RestElement")n this$1.raiseRecoverable(method.value.params.start, "Setter cannot use rest params")n }n }n }n node.body = this.finishNode(classBody, "ClassBody")n return this.finishNode(node, isStatement ? "ClassDeclaration" : "ClassExpression")n}nnpp$1.parseClassMethod = function(classBody, method, isGenerator, isAsync) {n method.value = this.parseMethod(isGenerator, isAsync)n classBody.body.push(this.finishNode(method, "MethodDefinition"))n}nnpp$1.parseClassId = function(node, isStatement) {n node.id = this.type === tt.name ? this.parseIdent() : isStatement ? this.unexpected() : nulln}nnpp$1.parseClassSuper = function(node) {n node.superClass = this.eat(tt._extends) ? this.parseExprSubscripts() : nulln}nn// Parses module export declaration.nnpp$1.parseExport = function(node, exports) {n var this$1 = this;nn this.next()n // export * from '…'n if (this.eat(tt.star)) {n this.expectContextual("from")n node.source = this.type === tt.string ? this.parseExprAtom() : this.unexpected()n this.semicolon()n return this.finishNode(node, "ExportAllDeclaration")n }n if (this.eat(tt._default)) { // export default …n this.checkExport(exports, "default", this.lastTokStart)n var isAsyncn if (this.type === tt._function || (isAsync = this.isAsyncFunction())) {n var fNode = this.startNode()n this.next()n if (isAsync) this.next()n node.declaration = this.parseFunction(fNode, null, false, isAsync)n } else if (this.type === tt._class) {n var cNode = this.startNode()n node.declaration = this.parseClass(cNode, null)n } else {n node.declaration = this.parseMaybeAssign()n this.semicolon()n }n return this.finishNode(node, "ExportDefaultDeclaration")n }n // export var|const|let|function|class …n if (this.shouldParseExportStatement()) {n node.declaration = this.parseStatement(true)n if (node.declaration.type === "VariableDeclaration")n this.checkVariableExport(exports, node.declaration.declarations)n elsen this.checkExport(exports, node.declaration.id.name, node.declaration.id.start)n node.specifiers = []n node.source = nulln } else { // export { x, y as z } [from '…']n node.declaration = nulln node.specifiers = this.parseExportSpecifiers(exports)n if (this.eatContextual("from")) {n node.source = this.type === tt.string ? this.parseExprAtom() : this.unexpected()n } else {n // check for keywords used as local namesn for (var i = 0; i < node.specifiers.length; i++) {n if (this$1.keywords.test(node.specifiers.local.name) || this$1.reservedWords.test(node.specifiers.local.name)) {n this$1.unexpected(node.specifiers.local.start)n }n }nn node.source = nulln }n this.semicolon()n }n return this.finishNode(node, "ExportNamedDeclaration")n}nnpp$1.checkExport = function(exports, name, pos) {n if (!exports) returnn if (Object.prototype.hasOwnProperty.call(exports, name))n this.raiseRecoverable(pos, "Duplicate export '" + name + "'")n exports = truen}nnpp$1.checkPatternExport = function(exports, pat) {n var this$1 = this;nn var type = pat.typen if (type == "Identifier")n this.checkExport(exports, pat.name, pat.start)n else if (type == "ObjectPattern")n for (var i = 0; i < pat.properties.length; ++i)n this$1.checkPatternExport(exports, pat.properties.value)n else if (type == "ArrayPattern")n for (var i$1 = 0; i$1 < pat.elements.length; ++i$1) {n var elt = pat.elementsn if (elt) this$1.checkPatternExport(exports, elt)n }n else if (type == "AssignmentPattern")n this.checkPatternExport(exports, pat.left)n else if (type == "ParenthesizedExpression")n this.checkPatternExport(exports, pat.expression)n}nnpp$1.checkVariableExport = function(exports, decls) {n var this$1 = this;nn if (!exports) returnn for (var i = 0; i < decls.length; i++)n this$1.checkPatternExport(exports, decls.id)n}nnpp$1.shouldParseExportStatement = function() {n return this.type.keyword === "var"n || this.type.keyword === "const"n || this.type.keyword === "class"n || this.type.keyword === "function"n || this.isLet()n || this.isAsyncFunction()n}nn// Parses a comma-separated list of module exports.nnpp$1.parseExportSpecifiers = function(exports) {n var this$1 = this;nn var nodes = [], first = truen // export { x, y as z } [from '…']n this.expect(tt.braceL)n while (!this.eat(tt.braceR)) {n if (!first) {n this$1.expect(tt.comma)n if (this$1.afterTrailingComma(tt.braceR)) breakn } else first = falsenn var node = this$1.startNode()n node.local = this$1.parseIdent(true)n node.exported = this$1.eatContextual("as") ? this$1.parseIdent(true) : node.localn this$1.checkExport(exports, node.exported.name, node.exported.start)n nodes.push(this$1.finishNode(node, "ExportSpecifier"))n }n return nodesn}nn// Parses import declaration.nnpp$1.parseImport = function(node) {n this.next()n // import '…'n if (this.type === tt.string) {n node.specifiers = emptyn node.source = this.parseExprAtom()n } else {n node.specifiers = this.parseImportSpecifiers()n this.expectContextual("from")n node.source = this.type === tt.string ? this.parseExprAtom() : this.unexpected()n }n this.semicolon()n return this.finishNode(node, "ImportDeclaration")n}nn// Parses a comma-separated list of module imports.nnpp$1.parseImportSpecifiers = function() {n var this$1 = this;nn var nodes = [], first = truen if (this.type === tt.name) {n // import defaultObj, { x, y as z } from '…'n var node = this.startNode()n node.local = this.parseIdent()n this.checkLVal(node.local, true)n nodes.push(this.finishNode(node, "ImportDefaultSpecifier"))n if (!this.eat(tt.comma)) return nodesn }n if (this.type === tt.star) {n var node$1 = this.startNode()n this.next()n this.expectContextual("as")n node$1.local = this.parseIdent()n this.checkLVal(node$1.local, true)n nodes.push(this.finishNode(node$1, "ImportNamespaceSpecifier"))n return nodesn }n this.expect(tt.braceL)n while (!this.eat(tt.braceR)) {n if (!first) {n this$1.expect(tt.comma)n if (this$1.afterTrailingComma(tt.braceR)) breakn } else first = falsenn var node$2 = this$1.startNode()n node$2.imported = this$1.parseIdent(true)n if (this$1.eatContextual("as")) {n node$2.local = this$1.parseIdent()n } else {n node$2.local = node$2.importedn if (this$1.isKeyword(node$2.local.name)) this$1.unexpected(node$2.local.start)n if (this$1.reservedWordsStrict.test(node$2.local.name)) this$1.raiseRecoverable(node$2.local.start, "The keyword '" + node$2.local.name + "' is reserved")n }n this$1.checkLVal(node$2.local, true)n nodes.push(this$1.finishNode(node$2, "ImportSpecifier"))n }n return nodesn}nnvar pp$2 = Parser.prototypenn// Convert existing expression atom to assignable patternn// if possible.nnpp$2.toAssignable = function(node, isBinding) {n var this$1 = this;nn if (this.options.ecmaVersion >= 6 && node) {n switch (node.type) {n case "Identifier":n if (this.inAsync && node.name === "await")n this.raise(node.start, "Can not use 'await' as identifier inside an async function")n breaknn case "ObjectPattern":n case "ArrayPattern":n breaknn case "ObjectExpression":n node.type = "ObjectPattern"n for (var i = 0; i < node.properties.length; i++) {n var prop = node.propertiesn if (prop.kind !== "init") this$1.raise(prop.key.start, "Object pattern can't contain getter or setter")n this$1.toAssignable(prop.value, isBinding)n }n breaknn case "ArrayExpression":n node.type = "ArrayPattern"n this.toAssignableList(node.elements, isBinding)n breaknn case "AssignmentExpression":n if (node.operator === "=") {n node.type = "AssignmentPattern"n delete node.operatorn this.toAssignable(node.left, isBinding)n // falls through to AssignmentPatternn } else {n this.raise(node.left.end, "Only '=' operator can be used for specifying default value.")n breakn }nn case "AssignmentPattern":n breaknn case "ParenthesizedExpression":n node.expression = this.toAssignable(node.expression, isBinding)n breaknn case "MemberExpression":n if (!isBinding) breaknn default:n this.raise(node.start, "Assigning to rvalue")n }n }n return noden}nn// Convert list of expression atoms to binding list.nnpp$2.toAssignableList = function(exprList, isBinding) {n var this$1 = this;nn var end = exprList.lengthn if (end) {n var last = exprList[end - 1]n if (last && last.type == "RestElement") {n –endn } else if (last && last.type == "SpreadElement") {n last.type = "RestElement"n var arg = last.argumentn this.toAssignable(arg, isBinding)n if (arg.type !== "Identifier" && arg.type !== "MemberExpression" && arg.type !== "ArrayPattern")n this.unexpected(arg.start)n –endn }nn if (isBinding && last && last.type === "RestElement" && last.argument.type !== "Identifier")n this.unexpected(last.argument.start)n }n for (var i = 0; i < end; i++) {n var elt = exprListn if (elt) this$1.toAssignable(elt, isBinding)n }n return exprListn}nn// Parses spread element.nnpp$2.parseSpread = function(refDestructuringErrors) {n var node = this.startNode()n this.next()n node.argument = this.parseMaybeAssign(false, refDestructuringErrors)n return this.finishNode(node, "SpreadElement")n}nnpp$2.parseRest = function(allowNonIdent) {n var node = this.startNode()n this.next()nn // RestElement inside of a function parameter must be an identifiern if (allowNonIdent) node.argument = this.type === tt.name ? this.parseIdent() : this.unexpected()n else node.argument = this.type === tt.name || this.type === tt.bracketL ? this.parseBindingAtom() : this.unexpected()nn return this.finishNode(node, "RestElement")n}nn// Parses lvalue (assignable) atom.nnpp$2.parseBindingAtom = function() {n if (this.options.ecmaVersion < 6) return this.parseIdent()n switch (this.type) {n case tt.name:n return this.parseIdent()nn case tt.bracketL:n var node = this.startNode()n this.next()n node.elements = this.parseBindingList(tt.bracketR, true, true)n return this.finishNode(node, "ArrayPattern")nn case tt.braceL:n return this.parseObj(true)nn default:n this.unexpected()n }n}nnpp$2.parseBindingList = function(close, allowEmpty, allowTrailingComma, allowNonIdent) {n var this$1 = this;nn var elts = [], first = truen while (!this.eat(close)) {n if (first) first = falsen else this$1.expect(tt.comma)n if (allowEmpty && this$1.type === tt.comma) {n elts.push(null)n } else if (allowTrailingComma && this$1.afterTrailingComma(close)) {n breakn } else if (this$1.type === tt.ellipsis) {n var rest = this$1.parseRest(allowNonIdent)n this$1.parseBindingListItem(rest)n elts.push(rest)n if (this$1.type === tt.comma) this$1.raise(this$1.start, "Comma is not permitted after the rest element")n this$1.expect(close)n breakn } else {n var elem = this$1.parseMaybeDefault(this$1.start, this$1.startLoc)n this$1.parseBindingListItem(elem)n elts.push(elem)n }n }n return eltsn}nnpp$2.parseBindingListItem = function(param) {n return paramn}nn// Parses assignment pattern around given atom if possible.nnpp$2.parseMaybeDefault = function(startPos, startLoc, left) {n left = left || this.parseBindingAtom()n if (this.options.ecmaVersion < 6 || !this.eat(tt.eq)) return leftn var node = this.startNodeAt(startPos, startLoc)n node.left = leftn node.right = this.parseMaybeAssign()n return this.finishNode(node, "AssignmentPattern")n}nn// Verify that a node is an lval — something that can be assignedn// to.nnpp$2.checkLVal = function(expr, isBinding, checkClashes) {n var this$1 = this;nn switch (expr.type) {n case "Identifier":n if (this.strict && this.reservedWordsStrictBind.test(expr.name))n this.raiseRecoverable(expr.start, (isBinding ? "Binding " : "Assigning to ") + expr.name + " in strict mode")n if (checkClashes) {n if (has(checkClashes, expr.name))n this.raiseRecoverable(expr.start, "Argument name clash")n checkClashes = truen }n breaknn case "MemberExpression":n if (isBinding) this.raiseRecoverable(expr.start, (isBinding ? "Binding" : "Assigning to") + " member expression")n breaknn case "ObjectPattern":n for (var i = 0; i < expr.properties.length; i++)n this$1.checkLVal(expr.properties.value, isBinding, checkClashes)n breaknn case "ArrayPattern":n for (var i$1 = 0; i$1 < expr.elements.length; i$1++) {n var elem = expr.elementsn if (elem) this$1.checkLVal(elem, isBinding, checkClashes)n }n breaknn case "AssignmentPattern":n this.checkLVal(expr.left, isBinding, checkClashes)n breaknn case "RestElement":n this.checkLVal(expr.argument, isBinding, checkClashes)n breaknn case "ParenthesizedExpression":n this.checkLVal(expr.expression, isBinding, checkClashes)n breaknn default:n this.raise(expr.start, (isBinding ? "Binding" : "Assigning to") + " rvalue")n }n}nn// A recursive descent parser operates by defining functions for alln// syntactic elements, and recursively calling those, each functionn// advancing the input stream and returning an AST node. Precedencen// of constructs (for example, the fact that `!x` means `!(x)`n// instead of `(!x)` is handled by the fact that the parsern// function that parses unary prefix operators is called first, andn// in turn calls the function that parses `[]` subscripts — thatn// way, it'll receive the node for `x` already parsed, and wrapsn// that in the unary operator node.n//n// Acorn uses an [operator precedence parser] to handle binaryn// operator precedence, because it is much more compact than usingn// the technique outlined above, which uses different, nestingn// functions to specify precedence, for all of the ten binaryn// precedence levels that JavaScript defines.n//n// [opp]: en.wikipedia.org/wiki/Operator-precedence_parsernnvar pp$3 = Parser.prototypenn// Check if property name clashes with already added.n// Object/class getters and setters are not allowed to clash —n// either with each other or with an init property — and inn// strict mode, init properties are also not allowed to be repeated.nnpp$3.checkPropClash = function(prop, propHash) {n if (this.options.ecmaVersion >= 6 && (prop.computed || prop.method || prop.shorthand))n returnn var key = prop.key;n var namen switch (key.type) {n case "Identifier": name = key.name; breakn case "Literal": name = String(key.value); breakn default: returnn }n var kind = prop.kind;n if (this.options.ecmaVersion >= 6) {n if (name === "__proto__" && kind === "init") {n if (propHash.proto) this.raiseRecoverable(key.start, "Redefinition of __proto__ property")n propHash.proto = truen }n returnn }n name = "$" + namen var other = propHashn if (other) {n var isGetSet = kind !== "init"n if ((this.strict || isGetSet) && other || !(isGetSet ^ other.init))n this.raiseRecoverable(key.start, "Redefinition of property")n } else {n other = propHash = {n init: false,n get: false,n set: falsen }n }n other = truen}nn// ### Expression parsingnn// These nest, from the most general expression type at the top ton// 'atomic', nondivisible expression types at the bottom. Most ofn// the functions will simply let the function(s) below them parse,n// and, if the syntactic construct they handle is present, wrapn// the AST node that the inner parser gave them in another node.nn// Parse a full expression. The optional arguments are used ton// forbid the `in` operator (in for loops initalization expressions)n// and provide reference for storing '=' operator inside shorthandn// property assignment in contexts where both object expressionn// and object pattern might appear (so it's possible to raisen// delayed syntax error at correct position).nnpp$3.parseExpression = function(noIn, refDestructuringErrors) {n var this$1 = this;nn var startPos = this.start, startLoc = this.startLocn var expr = this.parseMaybeAssign(noIn, refDestructuringErrors)n if (this.type === tt.comma) {n var node = this.startNodeAt(startPos, startLoc)n node.expressions = [expr]n while (this.eat(tt.comma)) node.expressions.push(this$1.parseMaybeAssign(noIn, refDestructuringErrors))n return this.finishNode(node, "SequenceExpression")n }n return exprn}nn// Parse an assignment expression. This includes applications ofn// operators like `+=`.nnpp$3.parseMaybeAssign = function(noIn, refDestructuringErrors, afterLeftParse) {n if (this.inGenerator && this.isContextual("yield")) return this.parseYield()nn var ownDestructuringErrors = false, oldParenAssign = -1n if (refDestructuringErrors) {n oldParenAssign = refDestructuringErrors.parenthesizedAssignn refDestructuringErrors.parenthesizedAssign = -1n } else {n refDestructuringErrors = new DestructuringErrorsn ownDestructuringErrors = truen }nn var startPos = this.start, startLoc = this.startLocn if (this.type == tt.parenL || this.type == tt.name)n this.potentialArrowAt = this.startn var left = this.parseMaybeConditional(noIn, refDestructuringErrors)n if (afterLeftParse) left = afterLeftParse.call(this, left, startPos, startLoc)n if (this.type.isAssign) {n this.checkPatternErrors(refDestructuringErrors, true)n if (!ownDestructuringErrors) DestructuringErrors.call(refDestructuringErrors)n var node = this.startNodeAt(startPos, startLoc)n node.operator = this.valuen node.left = this.type === tt.eq ? this.toAssignable(left) : leftn refDestructuringErrors.shorthandAssign = -1 // reset because shorthand default was used correctlyn this.checkLVal(left)n this.next()n node.right = this.parseMaybeAssign(noIn)n return this.finishNode(node, "AssignmentExpression")n } else {n if (ownDestructuringErrors) this.checkExpressionErrors(refDestructuringErrors, true)n }n if (oldParenAssign > -1) refDestructuringErrors.parenthesizedAssign = oldParenAssignn return leftn}nn// Parse a ternary conditional (`?:`) operator.nnpp$3.parseMaybeConditional = function(noIn, refDestructuringErrors) {n var startPos = this.start, startLoc = this.startLocn var expr = this.parseExprOps(noIn, refDestructuringErrors)n if (this.checkExpressionErrors(refDestructuringErrors)) return exprn if (this.eat(tt.question)) {n var node = this.startNodeAt(startPos, startLoc)n node.test = exprn node.consequent = this.parseMaybeAssign()n this.expect(tt.colon)n node.alternate = this.parseMaybeAssign(noIn)n return this.finishNode(node, "ConditionalExpression")n }n return exprn}nn// Start the precedence parser.nnpp$3.parseExprOps = function(noIn, refDestructuringErrors) {n var startPos = this.start, startLoc = this.startLocn var expr = this.parseMaybeUnary(refDestructuringErrors, false)n if (this.checkExpressionErrors(refDestructuringErrors)) return exprn return this.parseExprOp(expr, startPos, startLoc, -1, noIn)n}nn// Parse binary operators with the operator precedence parsingn// algorithm. `left` is the left-hand side of the operator.n// `minPrec` provides context that allows the function to stop andn// defer further parser to one of its callers when it encounters ann// operator that has a lower precedence than the set it is parsing.nnpp$3.parseExprOp = function(left, leftStartPos, leftStartLoc, minPrec, noIn) {n var prec = this.type.binopn if (prec != null && (!noIn || this.type !== tt._in)) {n if (prec > minPrec) {n var logical = this.type === tt.logicalOR || this.type === tt.logicalANDn var op = this.valuen this.next()n var startPos = this.start, startLoc = this.startLocn var right = this.parseExprOp(this.parseMaybeUnary(null, false), startPos, startLoc, prec, noIn)n var node = this.buildBinary(leftStartPos, leftStartLoc, left, right, op, logical)n return this.parseExprOp(node, leftStartPos, leftStartLoc, minPrec, noIn)n }n }n return leftn}nnpp$3.buildBinary = function(startPos, startLoc, left, right, op, logical) {n var node = this.startNodeAt(startPos, startLoc)n node.left = leftn node.operator = opn node.right = rightn return this.finishNode(node, logical ? "LogicalExpression" : "BinaryExpression")n}nn// Parse unary operators, both prefix and postfix.nnpp$3.parseMaybeUnary = function(refDestructuringErrors, sawUnary) {n var this$1 = this;nn var startPos = this.start, startLoc = this.startLoc, exprn if (this.inAsync && this.isContextual("await")) {n expr = this.parseAwait(refDestructuringErrors)n sawUnary = truen } else if (this.type.prefix) {n var node = this.startNode(), update = this.type === tt.incDecn node.operator = this.valuen node.prefix = truen this.next()n node.argument = this.parseMaybeUnary(null, true)n this.checkExpressionErrors(refDestructuringErrors, true)n if (update) this.checkLVal(node.argument)n else if (this.strict && node.operator === "delete" &&n node.argument.type === "Identifier")n this.raiseRecoverable(node.start, "Deleting local variable in strict mode")n else sawUnary = truen expr = this.finishNode(node, update ? "UpdateExpression" : "UnaryExpression")n } else {n expr = this.parseExprSubscripts(refDestructuringErrors)n if (this.checkExpressionErrors(refDestructuringErrors)) return exprn while (this.type.postfix && !this.canInsertSemicolon()) {n var node$1 = this$1.startNodeAt(startPos, startLoc)n node$1.operator = this$1.valuen node$1.prefix = falsen node$1.argument = exprn this$1.checkLVal(expr)n this$1.next()n expr = this$1.finishNode(node$1, "UpdateExpression")n }n }nn if (!sawUnary && this.eat(tt.starstar))n return this.buildBinary(startPos, startLoc, expr, this.parseMaybeUnary(null, false), "**", false)n elsen return exprn}nn// Parse call, dot, and `[]`-subscript expressions.nnpp$3.parseExprSubscripts = function(refDestructuringErrors) {n var startPos = this.start, startLoc = this.startLocn var expr = this.parseExprAtom(refDestructuringErrors)n var skipArrowSubscripts = expr.type === "ArrowFunctionExpression" && this.input.slice(this.lastTokStart, this.lastTokEnd) !== ")"n if (this.checkExpressionErrors(refDestructuringErrors) || skipArrowSubscripts) return exprn var result = this.parseSubscripts(expr, startPos, startLoc)n if (refDestructuringErrors && result.type === "MemberExpression") {n if (refDestructuringErrors.parenthesizedAssign >= result.start) refDestructuringErrors.parenthesizedAssign = -1n if (refDestructuringErrors.parenthesizedBind >= result.start) refDestructuringErrors.parenthesizedBind = -1n }n return resultn}nnpp$3.parseSubscripts = function(base, startPos, startLoc, noCalls) {n var this$1 = this;nn var maybeAsyncArrow = this.options.ecmaVersion >= 8 && base.type === "Identifier" && base.name === "async" &&n this.lastTokEnd == base.end && !this.canInsertSemicolon()n for (var computed;;) {n if ((computed = this$1.eat(tt.bracketL)) || this$1.eat(tt.dot)) {n var node = this$1.startNodeAt(startPos, startLoc)n node.object = basen node.property = computed ? this$1.parseExpression() : this$1.parseIdent(true)n node.computed = !!computedn if (computed) this$1.expect(tt.bracketR)n base = this$1.finishNode(node, "MemberExpression")n } else if (!noCalls && this$1.eat(tt.parenL)) {n var refDestructuringErrors = new DestructuringErrors, oldYieldPos = this$1.yieldPos, oldAwaitPos = this$1.awaitPosn this$1.yieldPos = 0n this$1.awaitPos = 0n var exprList = this$1.parseExprList(tt.parenR, this$1.options.ecmaVersion >= 8, false, refDestructuringErrors)n if (maybeAsyncArrow && !this$1.canInsertSemicolon() && this$1.eat(tt.arrow)) {n this$1.checkPatternErrors(refDestructuringErrors, false)n this$1.checkYieldAwaitInDefaultParams()n this$1.yieldPos = oldYieldPosn this$1.awaitPos = oldAwaitPosn return this$1.parseArrowExpression(this$1.startNodeAt(startPos, startLoc), exprList, true)n }n this$1.checkExpressionErrors(refDestructuringErrors, true)n this$1.yieldPos = oldYieldPos || this$1.yieldPosn this$1.awaitPos = oldAwaitPos || this$1.awaitPosn var node$1 = this$1.startNodeAt(startPos, startLoc)n node$1.callee = basen node$1.arguments = exprListn base = this$1.finishNode(node$1, "CallExpression")n } else if (this$1.type === tt.backQuote) {n var node$2 = this$1.startNodeAt(startPos, startLoc)n node$2.tag = basen node$2.quasi = this$1.parseTemplate()n base = this$1.finishNode(node$2, "TaggedTemplateExpression")n } else {n return basen }n }n}nn// Parse an atomic expression — either a single token that is ann// expression, an expression started by a keyword like `function` orn// `new`, or an expression wrapped in punctuation like `()`, `[]`,n// or `{}`.nnpp$3.parseExprAtom = function(refDestructuringErrors) {n var node, canBeArrow = this.potentialArrowAt == this.startn switch (this.type) {n case tt._super:n if (!this.inFunction)n this.raise(this.start, "'super' outside of function or class")nn case tt._this:n var type = this.type === tt._this ? "ThisExpression" : "Super"n node = this.startNode()n this.next()n return this.finishNode(node, type)nn case tt.name:n var startPos = this.start, startLoc = this.startLocn var id = this.parseIdent(this.type !== tt.name)n if (this.options.ecmaVersion >= 8 && id.name === "async" && !this.canInsertSemicolon() && this.eat(tt._function))n return this.parseFunction(this.startNodeAt(startPos, startLoc), false, false, true)n if (canBeArrow && !this.canInsertSemicolon()) {n if (this.eat(tt.arrow))n return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), [id], false)n if (this.options.ecmaVersion >= 8 && id.name === "async" && this.type === tt.name) {n id = this.parseIdent()n if (this.canInsertSemicolon() || !this.eat(tt.arrow))n this.unexpected()n return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), [id], true)n }n }n return idnn case tt.regexp:n var value = this.valuen node = this.parseLiteral(value.value)n node.regex = {pattern: value.pattern, flags: value.flags}n return nodenn case tt.num: case tt.string:n return this.parseLiteral(this.value)nn case tt._null: case tt._true: case tt._false:n node = this.startNode()n node.value = this.type === tt._null ? null : this.type === tt._truen node.raw = this.type.keywordn this.next()n return this.finishNode(node, "Literal")nn case tt.parenL:n var start = this.start, expr = this.parseParenAndDistinguishExpression(canBeArrow)n if (refDestructuringErrors) {n if (refDestructuringErrors.parenthesizedAssign < 0 && !this.isSimpleAssignTarget(expr))n refDestructuringErrors.parenthesizedAssign = startn if (refDestructuringErrors.parenthesizedBind < 0)n refDestructuringErrors.parenthesizedBind = startn }n return exprnn case tt.bracketL:n node = this.startNode()n this.next()n node.elements = this.parseExprList(tt.bracketR, true, true, refDestructuringErrors)n return this.finishNode(node, "ArrayExpression")nn case tt.braceL:n return this.parseObj(false, refDestructuringErrors)nn case tt._function:n node = this.startNode()n this.next()n return this.parseFunction(node, false)nn case tt._class:n return this.parseClass(this.startNode(), false)nn case tt._new:n return this.parseNew()nn case tt.backQuote:n return this.parseTemplate()nn default:n this.unexpected()n }n}nnpp$3.parseLiteral = function(value) {n var node = this.startNode()n node.value = valuen node.raw = this.input.slice(this.start, this.end)n this.next()n return this.finishNode(node, "Literal")n}nnpp$3.parseParenExpression = function() {n this.expect(tt.parenL)n var val = this.parseExpression()n this.expect(tt.parenR)n return valn}nnpp$3.parseParenAndDistinguishExpression = function(canBeArrow) {n var this$1 = this;nn var startPos = this.start, startLoc = this.startLoc, val, allowTrailingComma = this.options.ecmaVersion >= 8n if (this.options.ecmaVersion >= 6) {n this.next()nn var innerStartPos = this.start, innerStartLoc = this.startLocn var exprList = [], first = true, lastIsComma = falsen var refDestructuringErrors = new DestructuringErrors, oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, spreadStart, innerParenStartn this.yieldPos = 0n this.awaitPos = 0n while (this.type !== tt.parenR) {n first ? first = false : this$1.expect(tt.comma)n if (allowTrailingComma && this$1.afterTrailingComma(tt.parenR, true)) {n lastIsComma = truen breakn } else if (this$1.type === tt.ellipsis) {n spreadStart = this$1.startn exprList.push(this$1.parseParenItem(this$1.parseRest()))n if (this$1.type === tt.comma) this$1.raise(this$1.start, "Comma is not permitted after the rest element")n breakn } else {n if (this$1.type === tt.parenL && !innerParenStart) {n innerParenStart = this$1.startn }n exprList.push(this$1.parseMaybeAssign(false, refDestructuringErrors, this$1.parseParenItem))n }n }n var innerEndPos = this.start, innerEndLoc = this.startLocn this.expect(tt.parenR)nn if (canBeArrow && !this.canInsertSemicolon() && this.eat(tt.arrow)) {n this.checkPatternErrors(refDestructuringErrors, false)n this.checkYieldAwaitInDefaultParams()n if (innerParenStart) this.unexpected(innerParenStart)n this.yieldPos = oldYieldPosn this.awaitPos = oldAwaitPosn return this.parseParenArrowList(startPos, startLoc, exprList)n }nn if (!exprList.length || lastIsComma) this.unexpected(this.lastTokStart)n if (spreadStart) this.unexpected(spreadStart)n this.checkExpressionErrors(refDestructuringErrors, true)n this.yieldPos = oldYieldPos || this.yieldPosn this.awaitPos = oldAwaitPos || this.awaitPosnn if (exprList.length > 1) {n val = this.startNodeAt(innerStartPos, innerStartLoc)n val.expressions = exprListn this.finishNodeAt(val, "SequenceExpression", innerEndPos, innerEndLoc)n } else {n val = exprListn }n } else {n val = this.parseParenExpression()n }nn if (this.options.preserveParens) {n var par = this.startNodeAt(startPos, startLoc)n par.expression = valn return this.finishNode(par, "ParenthesizedExpression")n } else {n return valn }n}nnpp$3.parseParenItem = function(item) {n return itemn}nnpp$3.parseParenArrowList = function(startPos, startLoc, exprList) {n return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), exprList)n}nn// New's precedence is slightly tricky. It must allow its argument ton// be a `[]` or dot subscript expression, but not a call — at least,n// not without wrapping it in parentheses. Thus, it uses the noCallsn// argument to parseSubscripts to prevent it from consuming then// argument list.nnvar empty$1 = []nnpp$3.parseNew = function() {n var node = this.startNode()n var meta = this.parseIdent(true)n if (this.options.ecmaVersion >= 6 && this.eat(tt.dot)) {n node.meta = metan node.property = this.parseIdent(true)n if (node.property.name !== "target")n this.raiseRecoverable(node.property.start, "The only valid meta property for new is new.target")n if (!this.inFunction)n this.raiseRecoverable(node.start, "new.target can only be used in functions")n return this.finishNode(node, "MetaProperty")n }n var startPos = this.start, startLoc = this.startLocn node.callee = this.parseSubscripts(this.parseExprAtom(), startPos, startLoc, true)n if (this.eat(tt.parenL)) node.arguments = this.parseExprList(tt.parenR, this.options.ecmaVersion >= 8, false)n else node.arguments = empty$1n return this.finishNode(node, "NewExpression")n}nn// Parse template expression.nnpp$3.parseTemplateElement = function() {n var elem = this.startNode()n elem.value = {n raw: this.input.slice(this.start, this.end).replace(/\r\n?/g, '\n'),n cooked: this.valuen }n this.next()n elem.tail = this.type === tt.backQuoten return this.finishNode(elem, "TemplateElement")n}nnpp$3.parseTemplate = function() {n var this$1 = this;nn var node = this.startNode()n this.next()n node.expressions = []n var curElt = this.parseTemplateElement()n node.quasis = [curElt]n while (!curElt.tail) {n this$1.expect(tt.dollarBraceL)n node.expressions.push(this$1.parseExpression())n this$1.expect(tt.braceR)n node.quasis.push(curElt = this$1.parseTemplateElement())n }n this.next()n return this.finishNode(node, "TemplateLiteral")n}nn// Parse an object literal or binding pattern.nnpp$3.parseObj = function(isPattern, refDestructuringErrors) {n var this$1 = this;nn var node = this.startNode(), first = true, propHash = {}n node.properties = []n this.next()n while (!this.eat(tt.braceR)) {n if (!first) {n this$1.expect(tt.comma)n if (this$1.afterTrailingComma(tt.braceR)) breakn } else first = falsenn var prop = this$1.startNode(), isGenerator, isAsync, startPos, startLocn if (this$1.options.ecmaVersion >= 6) {n prop.method = falsen prop.shorthand = falsen if (isPattern || refDestructuringErrors) {n startPos = this$1.startn startLoc = this$1.startLocn }n if (!isPattern)n isGenerator = this$1.eat(tt.star)n }n this$1.parsePropertyName(prop)n if (!isPattern && this$1.options.ecmaVersion >= 8 && !isGenerator && !prop.computed &&n prop.key.type === "Identifier" && prop.key.name === "async" && this$1.type !== tt.parenL &&n this$1.type !== tt.colon && !this$1.canInsertSemicolon()) {n isAsync = truen this$1.parsePropertyName(prop, refDestructuringErrors)n } else {n isAsync = falsen }n this$1.parsePropertyValue(prop, isPattern, isGenerator, isAsync, startPos, startLoc, refDestructuringErrors)n this$1.checkPropClash(prop, propHash)n node.properties.push(this$1.finishNode(prop, "Property"))n }n return this.finishNode(node, isPattern ? "ObjectPattern" : "ObjectExpression")n}nnpp$3.parsePropertyValue = function(prop, isPattern, isGenerator, isAsync, startPos, startLoc, refDestructuringErrors) {n if ((isGenerator || isAsync) && this.type === tt.colon)n this.unexpected()nn if (this.eat(tt.colon)) {n prop.value = isPattern ? this.parseMaybeDefault(this.start, this.startLoc) : this.parseMaybeAssign(false, refDestructuringErrors)n prop.kind = "init"n } else if (this.options.ecmaVersion >= 6 && this.type === tt.parenL) {n if (isPattern) this.unexpected()n prop.kind = "init"n prop.method = truen prop.value = this.parseMethod(isGenerator, isAsync)n } else if (this.options.ecmaVersion >= 5 && !prop.computed && prop.key.type === "Identifier" &&n (prop.key.name === "get" || prop.key.name === "set") &&n (this.type != tt.comma && this.type != tt.braceR)) {n if (isGenerator || isAsync || isPattern) this.unexpected()n prop.kind = prop.key.namen this.parsePropertyName(prop)n prop.value = this.parseMethod(false)n var paramCount = prop.kind === "get" ? 0 : 1n if (prop.value.params.length !== paramCount) {n var start = prop.value.startn if (prop.kind === "get")n this.raiseRecoverable(start, "getter should have no params")n elsen this.raiseRecoverable(start, "setter should have exactly one param")n } else {n if (prop.kind === "set" && prop.value.params.type === "RestElement")n this.raiseRecoverable(prop.value.params.start, "Setter cannot use rest params")n }n } else if (this.options.ecmaVersion >= 6 && !prop.computed && prop.key.type === "Identifier") {n if (this.keywords.test(prop.key.name) ||n (this.strict ? this.reservedWordsStrict : this.reservedWords).test(prop.key.name) ||n (this.inGenerator && prop.key.name == "yield") ||n (this.inAsync && prop.key.name == "await"))n this.raiseRecoverable(prop.key.start, "'" + prop.key.name + "' can not be used as shorthand property")n prop.kind = "init"n if (isPattern) {n prop.value = this.parseMaybeDefault(startPos, startLoc, prop.key)n } else if (this.type === tt.eq && refDestructuringErrors) {n if (refDestructuringErrors.shorthandAssign < 0)n refDestructuringErrors.shorthandAssign = this.startn prop.value = this.parseMaybeDefault(startPos, startLoc, prop.key)n } else {n prop.value = prop.keyn }n prop.shorthand = truen } else this.unexpected()n}nnpp$3.parsePropertyName = function(prop) {n if (this.options.ecmaVersion >= 6) {n if (this.eat(tt.bracketL)) {n prop.computed = truen prop.key = this.parseMaybeAssign()n this.expect(tt.bracketR)n return prop.keyn } else {n prop.computed = falsen }n }n return prop.key = this.type === tt.num || this.type === tt.string ? this.parseExprAtom() : this.parseIdent(true)n}nn// Initialize empty function node.nnpp$3.initFunction = function(node) {n node.id = nulln if (this.options.ecmaVersion >= 6) {n node.generator = falsen node.expression = falsen }n if (this.options.ecmaVersion >= 8)n node.async = falsen}nn// Parse object or class method.nnpp$3.parseMethod = function(isGenerator, isAsync) {n var node = this.startNode(), oldInGen = this.inGenerator, oldInAsync = this.inAsync,n oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, oldInFunc = this.inFunctionnn this.initFunction(node)n if (this.options.ecmaVersion >= 6)n node.generator = isGeneratorn if (this.options.ecmaVersion >= 8)n node.async = !!isAsyncnn this.inGenerator = node.generatorn this.inAsync = node.asyncn this.yieldPos = 0n this.awaitPos = 0n this.inFunction = truenn this.expect(tt.parenL)n node.params = this.parseBindingList(tt.parenR, false, this.options.ecmaVersion >= 8)n this.checkYieldAwaitInDefaultParams()n this.parseFunctionBody(node, false)nn this.inGenerator = oldInGenn this.inAsync = oldInAsyncn this.yieldPos = oldYieldPosn this.awaitPos = oldAwaitPosn this.inFunction = oldInFuncn return this.finishNode(node, "FunctionExpression")n}nn// Parse arrow function expression with given parameters.nnpp$3.parseArrowExpression = function(node, params, isAsync) {n var oldInGen = this.inGenerator, oldInAsync = this.inAsync,n oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, oldInFunc = this.inFunctionnn this.initFunction(node)n if (this.options.ecmaVersion >= 8)n node.async = !!isAsyncnn this.inGenerator = falsen this.inAsync = node.asyncn this.yieldPos = 0n this.awaitPos = 0n this.inFunction = truenn node.params = this.toAssignableList(params, true)n this.parseFunctionBody(node, true)nn this.inGenerator = oldInGenn this.inAsync = oldInAsyncn this.yieldPos = oldYieldPosn this.awaitPos = oldAwaitPosn this.inFunction = oldInFuncn return this.finishNode(node, "ArrowFunctionExpression")n}nn// Parse function body and check parameters.nnpp$3.parseFunctionBody = function(node, isArrowFunction) {n var isExpression = isArrowFunction && this.type !== tt.braceLn var oldStrict = this.strict, useStrict = falsenn if (isExpression) {n node.body = this.parseMaybeAssign()n node.expression = truen } else {n var nonSimple = this.options.ecmaVersion >= 7 && !this.isSimpleParamList(node.params)n if (!oldStrict || nonSimple) {n useStrict = this.strictDirective(this.end)n // If this is a strict mode function, verify that argument namesn // are not repeated, and it does not try to bind the words `eval`n // or `arguments`.n if (useStrict && nonSimple)n this.raiseRecoverable(node.start, "Illegal 'use strict' directive in function with non-simple parameter list")n }n // Start a new scope with regard to labels and the `inFunction`n // flag (restore them to their old value afterwards).n var oldLabels = this.labelsn this.labels = []n if (useStrict) this.strict = truen node.body = this.parseBlock(true)n node.expression = falsen this.labels = oldLabelsn }nn if (oldStrict || useStrict) {n this.strict = truen if (node.id)n this.checkLVal(node.id, true)n this.checkParams(node)n this.strict = oldStrictn } else if (isArrowFunction || !this.isSimpleParamList(node.params)) {n this.checkParams(node)n }n}nnpp$3.isSimpleParamList = function(params) {n for (var i = 0; i < params.length; i++)n if (params.type !== "Identifier") return falsen return truen}nn// Checks function params for various disallowed patterns such as using "eval"n// or "arguments" and duplicate parameters.nnpp$3.checkParams = function(node) {n var this$1 = this;nn var nameHash = {}n for (var i = 0; i < node.params.length; i++) this$1.checkLVal(node.params, true, nameHash)n}nn// Parses a comma-separated list of expressions, and returns them asn// an array. `close` is the token type that ends the list, andn// `allowEmpty` can be turned on to allow subsequent commas withn// nothing in between them to be parsed as `null` (which is neededn// for array literals).nnpp$3.parseExprList = function(close, allowTrailingComma, allowEmpty, refDestructuringErrors) {n var this$1 = this;nn var elts = [], first = truen while (!this.eat(close)) {n if (!first) {n this$1.expect(tt.comma)n if (allowTrailingComma && this$1.afterTrailingComma(close)) breakn } else first = falsenn var eltn if (allowEmpty && this$1.type === tt.comma)n elt = nulln else if (this$1.type === tt.ellipsis) {n elt = this$1.parseSpread(refDestructuringErrors)n if (refDestructuringErrors && this$1.type === tt.comma && refDestructuringErrors.trailingComma < 0)n refDestructuringErrors.trailingComma = this$1.startn } else {n elt = this$1.parseMaybeAssign(false, refDestructuringErrors)n }n elts.push(elt)n }n return eltsn}nn// Parse the next token as an identifier. If `liberal` is true (usedn// when parsing properties), it will also convert keywords inton// identifiers.nnpp$3.parseIdent = function(liberal) {n var node = this.startNode()n if (liberal && this.options.allowReserved == "never") liberal = falsen if (this.type === tt.name) {n if (!liberal && (this.strict ? this.reservedWordsStrict : this.reservedWords).test(this.value) &&n (this.options.ecmaVersion >= 6 ||n this.input.slice(this.start, this.end).indexOf("\\") == -1))n this.raiseRecoverable(this.start, "The keyword '" + this.value + "' is reserved")n if (this.inGenerator && this.value === "yield")n this.raiseRecoverable(this.start, "Can not use 'yield' as identifier inside a generator")n if (this.inAsync && this.value === "await")n this.raiseRecoverable(this.start, "Can not use 'await' as identifier inside an async function")n node.name = this.valuen } else if (liberal && this.type.keyword) {n node.name = this.type.keywordn } else {n this.unexpected()n }n this.next()n return this.finishNode(node, "Identifier")n}nn// Parses yield expression inside generator.nnpp$3.parseYield = function() {n if (!this.yieldPos) this.yieldPos = this.startnn var node = this.startNode()n this.next()n if (this.type == tt.semi || this.canInsertSemicolon() || (this.type != tt.star && !this.type.startsExpr)) {n node.delegate = falsen node.argument = nulln } else {n node.delegate = this.eat(tt.star)n node.argument = this.parseMaybeAssign()n }n return this.finishNode(node, "YieldExpression")n}nnpp$3.parseAwait = function() {n if (!this.awaitPos) this.awaitPos = this.startnn var node = this.startNode()n this.next()n node.argument = this.parseMaybeUnary(null, true)n return this.finishNode(node, "AwaitExpression")n}nnvar pp$4 = Parser.prototypenn// This function is used to raise exceptions on parse errors. Itn// takes an offset integer (into the current `input`) to indicaten// the location of the error, attaches the position to the endn// of the error message, and then raises a `SyntaxError` with thatn// message.nnpp$4.raise = function(pos, message) {n var loc = getLineInfo(this.input, pos)n message += " (" + loc.line + ":" + loc.column + ")"n var err = new SyntaxError(message)n err.pos = pos; err.loc = loc; err.raisedAt = this.posn throw errn}nnpp$4.raiseRecoverable = pp$4.raisennpp$4.curPosition = function() {n if (this.options.locations) {n return new Position(this.curLine, this.pos - this.lineStart)n }n}nnvar Node = function Node(parser, pos, loc) {n this.type = ""n this.start = posn this.end = 0n if (parser.options.locations)n this.loc = new SourceLocation(parser, loc)n if (parser.options.directSourceFile)n this.sourceFile = parser.options.directSourceFilen if (parser.options.ranges)n this.range = [pos, 0]n};nn// Start an AST node, attaching a start offset.nnvar pp$5 = Parser.prototypennpp$5.startNode = function() {n return new Node(this, this.start, this.startLoc)n}nnpp$5.startNodeAt = function(pos, loc) {n return new Node(this, pos, loc)n}nn// Finish an AST node, adding `type` and `end` properties.nnfunction finishNodeAt(node, type, pos, loc) {n node.type = typen node.end = posn if (this.options.locations)n node.loc.end = locn if (this.options.ranges)n node.range = posn return noden}nnpp$5.finishNode = function(node, type) {n return finishNodeAt.call(this, node, type, this.lastTokEnd, this.lastTokEndLoc)n}nn// Finish node at given positionnnpp$5.finishNodeAt = function(node, type, pos, loc) {n return finishNodeAt.call(this, node, type, pos, loc)n}nn// The algorithm used to determine whether a regexp can appear at an// given point in the program is loosely based on sweet.js' approach.n// See github.com/mozilla/sweet.js/wiki/designnnvar TokContext = function TokContext(token, isExpr, preserveSpace, override) {n this.token = tokenn this.isExpr = !!isExprn this.preserveSpace = !!preserveSpacen this.override = overriden};nnvar types = {n b_stat: new TokContext("{", false),n b_expr: new TokContext("{", true),n b_tmpl: new TokContext("${", true),n p_stat: new TokContext("(", false),n p_expr: new TokContext("(", true),n q_tmpl: new TokContext("`", true, true, function (p) { return p.readTmplToken(); }),n f_expr: new TokContext("function", true)n}nnvar pp$6 = Parser.prototypennpp$6.initialContext = function() {n return [types.b_stat]n}nnpp$6.braceIsBlock = function(prevType) {n if (prevType === tt.colon) {n var parent = this.curContext()n if (parent === types.b_stat || parent === types.b_expr)n return !parent.isExprn }n if (prevType === tt._return)n return lineBreak.test(this.input.slice(this.lastTokEnd, this.start))n if (prevType === tt._else || prevType === tt.semi || prevType === tt.eof || prevType === tt.parenR)n return truen if (prevType == tt.braceL)n return this.curContext() === types.b_statn return !this.exprAllowedn}nnpp$6.updateContext = function(prevType) {n var update, type = this.typen if (type.keyword && prevType == tt.dot)n this.exprAllowed = falsen else if (update = type.updateContext)n update.call(this, prevType)n elsen this.exprAllowed = type.beforeExprn}nn// Token-specific context update codenntt.parenR.updateContext = tt.braceR.updateContext = function() {n if (this.context.length == 1) {n this.exprAllowed = truen returnn }n var out = this.context.pop()n if (out === types.b_stat && this.curContext() === types.f_expr) {n this.context.pop()n this.exprAllowed = falsen } else if (out === types.b_tmpl) {n this.exprAllowed = truen } else {n this.exprAllowed = !out.isExprn }n}nntt.braceL.updateContext = function(prevType) {n this.context.push(this.braceIsBlock(prevType) ? types.b_stat : types.b_expr)n this.exprAllowed = truen}nntt.dollarBraceL.updateContext = function() {n this.context.push(types.b_tmpl)n this.exprAllowed = truen}nntt.parenL.updateContext = function(prevType) {n var statementParens = prevType === tt._if || prevType === tt._for || prevType === tt._with || prevType === tt._whilen this.context.push(statementParens ? types.p_stat : types.p_expr)n this.exprAllowed = truen}nntt.incDec.updateContext = function() {n // tokExprAllowed stays unchangedn}nntt._function.updateContext = function(prevType) {n if (prevType.beforeExpr && prevType !== tt.semi && prevType !== tt._else &&n !((prevType === tt.colon || prevType === tt.braceL) && this.curContext() === types.b_stat))n this.context.push(types.f_expr)n this.exprAllowed = falsen}nntt.backQuote.updateContext = function() {n if (this.curContext() === types.q_tmpl)n this.context.pop()n elsen this.context.push(types.q_tmpl)n this.exprAllowed = falsen}nn// Object type used to represent tokens. Note that normally, tokensn// simply exist as properties on the parser object. This is onlyn// used for the onToken callback and the external tokenizer.nnvar Token = function Token(p) {n this.type = p.typen this.value = p.valuen this.start = p.startn this.end = p.endn if (p.options.locations)n this.loc = new SourceLocation(p, p.startLoc, p.endLoc)n if (p.options.ranges)n this.range = [p.start, p.end]n};nn// ## Tokenizernnvar pp$7 = Parser.prototypenn// Are we running under Rhino?nvar isRhino = typeof Packages == "object" && Object.prototype.toString.call(Packages) == "[object JavaPackage]"nn// Move to the next tokennnpp$7.next = function() {n if (this.options.onToken)n this.options.onToken(new Token(this))nn this.lastTokEnd = this.endn this.lastTokStart = this.startn this.lastTokEndLoc = this.endLocn this.lastTokStartLoc = this.startLocn this.nextToken()n}nnpp$7.getToken = function() {n this.next()n return new Token(this)n}nn// If we're in an ES6 environment, make parsers iterablenif (typeof Symbol !== "undefined")n pp$7 = function () {n var self = thisn return {next: function () {n var token = self.getToken()n return {n done: token.type === tt.eof,n value: tokenn }n }}n }nn// Toggle strict mode. Re-reads the next number or string to pleasen// pedantic tests (`"use strict"; 010;` should fail).nnpp$7.curContext = function() {n return this.context[this.context.length - 1]n}nn// Read a single token, updating the parser object's token-relatedn// properties.nnpp$7.nextToken = function() {n var curContext = this.curContext()n if (!curContext || !curContext.preserveSpace) this.skipSpace()nn this.start = this.posn if (this.options.locations) this.startLoc = this.curPosition()n if (this.pos >= this.input.length) return this.finishToken(tt.eof)nn if (curContext.override) return curContext.override(this)n else this.readToken(this.fullCharCodeAtPos())n}nnpp$7.readToken = function(code) {n // Identifier or keyword. '\uXXXX' sequences are allowed inn // identifiers, so '\' also dispatches to that.n if (isIdentifierStart(code, this.options.ecmaVersion >= 6) || code === 92 /* '\' */)n return this.readWord()nn return this.getTokenFromCode(code)n}nnpp$7.fullCharCodeAtPos = function() {n var code = this.input.charCodeAt(this.pos)n if (code <= 0xd7ff || code >= 0xe000) return coden var next = this.input.charCodeAt(this.pos + 1)n return (code << 10) + next - 0x35fdc00n}nnpp$7.skipBlockComment = function() {n var this$1 = this;nn var startLoc = this.options.onComment && this.curPosition()n var start = this.pos, end = this.input.indexOf("*/", this.pos += 2)n if (end === -1) this.raise(this.pos - 2, "Unterminated comment")n this.pos = end + 2n if (this.options.locations) {n lineBreakG.lastIndex = startn var matchn while ((match = lineBreakG.exec(this.input)) && match.index < this.pos) {n ++this$1.curLinen this$1.lineStart = match.index + match.lengthn }n }n if (this.options.onComment)n this.options.onComment(true, this.input.slice(start + 2, end), start, this.pos,n startLoc, this.curPosition())n}nnpp$7.skipLineComment = function(startSkip) {n var this$1 = this;nn var start = this.posn var startLoc = this.options.onComment && this.curPosition()n var ch = this.input.charCodeAt(this.pos+=startSkip)n while (this.pos < this.input.length && ch !== 10 && ch !== 13 && ch !== 8232 && ch !== 8233) {n ++this$1.posn ch = this$1.input.charCodeAt(this$1.pos)n }n if (this.options.onComment)n this.options.onComment(false, this.input.slice(start + startSkip, this.pos), start, this.pos,n startLoc, this.curPosition())n}nn// Called at the start of the parse and after every token. Skipsn// whitespace and comments, and.nnpp$7.skipSpace = function() {n var this$1 = this;nn loop: while (this.pos < this.input.length) {n var ch = this$1.input.charCodeAt(this$1.pos)n switch (ch) {n case 32: case 160: // ' 'n ++this$1.posn breakn case 13:n if (this$1.input.charCodeAt(this$1.pos + 1) === 10) {n ++this$1.posn }n case 10: case 8232: case 8233:n ++this$1.posn if (this$1.options.locations) {n ++this$1.curLinen this$1.lineStart = this$1.posn }n breakn case 47: // '/'n switch (this$1.input.charCodeAt(this$1.pos + 1)) {n case 42: // '*'n this$1.skipBlockComment()n breakn case 47:n this$1.skipLineComment(2)n breakn default:n break loopn }n breakn default:n if (ch > 8 && ch < 14 || ch >= 5760 && nonASCIIwhitespace.test(String.fromCharCode(ch))) {n ++this$1.posn } else {n break loopn }n }n }n}nn// Called at the end of every token. Sets `end`, `val`, andn// maintains `context` and `exprAllowed`, and skips the space aftern// the token, so that the next one's `start` will point at then// right position.nnpp$7.finishToken = function(type, val) {n this.end = this.posn if (this.options.locations) this.endLoc = this.curPosition()n var prevType = this.typen this.type = typen this.value = valnn this.updateContext(prevType)n}nn// ### Token readingnn// This is the function that is called to fetch the next token. Itn// is somewhat obscure, because it works in character codes rathern// than characters, and because operator parsing has been inlinedn// into it.n//n// All in the name of speed.n//npp$7.readToken_dot = function() {n var next = this.input.charCodeAt(this.pos + 1)n if (next >= 48 && next <= 57) return this.readNumber(true)n var next2 = this.input.charCodeAt(this.pos + 2)n if (this.options.ecmaVersion >= 6 && next === 46 && next2 === 46) { // 46 = dot '.'n this.pos += 3n return this.finishToken(tt.ellipsis)n } else {n ++this.posn return this.finishToken(tt.dot)n }n}nnpp$7.readToken_slash = function() { // '/'n var next = this.input.charCodeAt(this.pos + 1)n if (this.exprAllowed) {++this.pos; return this.readRegexp()}n if (next === 61) return this.finishOp(tt.assign, 2)n return this.finishOp(tt.slash, 1)n}nnpp$7.readToken_mult_modulo_exp = function(code) { // '%*'n var next = this.input.charCodeAt(this.pos + 1)n var size = 1n var tokentype = code === 42 ? tt.star : tt.modulonn // exponentiation operator ** and **=n if (this.options.ecmaVersion >= 7 && next === 42) {n ++sizen tokentype = tt.starstarn next = this.input.charCodeAt(this.pos + 2)n }nn if (next === 61) return this.finishOp(tt.assign, size + 1)n return this.finishOp(tokentype, size)n}nnpp$7.readToken_pipe_amp = function(code) { // '|&'n var next = this.input.charCodeAt(this.pos + 1)n if (next === code) return this.finishOp(code === 124 ? tt.logicalOR : tt.logicalAND, 2)n if (next === 61) return this.finishOp(tt.assign, 2)n return this.finishOp(code === 124 ? tt.bitwiseOR : tt.bitwiseAND, 1)n}nnpp$7.readToken_caret = function() { // '^'n var next = this.input.charCodeAt(this.pos + 1)n if (next === 61) return this.finishOp(tt.assign, 2)n return this.finishOp(tt.bitwiseXOR, 1)n}nnpp$7.readToken_plus_min = function(code) { // '+-'n var next = this.input.charCodeAt(this.pos + 1)n if (next === code) {n if (next == 45 && this.input.charCodeAt(this.pos + 2) == 62 &&n lineBreak.test(this.input.slice(this.lastTokEnd, this.pos))) {n // A `–>` line commentn this.skipLineComment(3)n this.skipSpace()n return this.nextToken()n }n return this.finishOp(tt.incDec, 2)n }n if (next === 61) return this.finishOp(tt.assign, 2)n return this.finishOp(tt.plusMin, 1)n}nnpp$7.readToken_lt_gt = function(code) { // '<>'n var next = this.input.charCodeAt(this.pos + 1)n var size = 1n if (next === code) {n size = code === 62 && this.input.charCodeAt(this.pos + 2) === 62 ? 3 : 2n if (this.input.charCodeAt(this.pos + size) === 61) return this.finishOp(tt.assign, size + 1)n return this.finishOp(tt.bitShift, size)n }n if (next == 33 && code == 60 && this.input.charCodeAt(this.pos + 2) == 45 &&n this.input.charCodeAt(this.pos + 3) == 45) {n if (this.inModule) this.unexpected()n // `<!–`, an XML-style comment that should be interpreted as a line commentn this.skipLineComment(4)n this.skipSpace()n return this.nextToken()n }n if (next === 61) size = 2n return this.finishOp(tt.relational, size)n}nnpp$7.readToken_eq_excl = function(code) { // '=!'n var next = this.input.charCodeAt(this.pos + 1)n if (next === 61) return this.finishOp(tt.equality, this.input.charCodeAt(this.pos + 2) === 61 ? 3 : 2)n if (code === 61 && next === 62 && this.options.ecmaVersion >= 6) { // '=>'n this.pos += 2n return this.finishToken(tt.arrow)n }n return this.finishOp(code === 61 ? tt.eq : tt.prefix, 1)n}nnpp$7.getTokenFromCode = function(code) {n switch (code) {n // The interpretation of a dot depends on whether it is followedn // by a digit or another two dots.n case 46: // '.'n return this.readToken_dot()nn // Punctuation tokens.n case 40: ++this.pos; return this.finishToken(tt.parenL)n case 41: ++this.pos; return this.finishToken(tt.parenR)n case 59: ++this.pos; return this.finishToken(tt.semi)n case 44: ++this.pos; return this.finishToken(tt.comma)n case 91: ++this.pos; return this.finishToken(tt.bracketL)n case 93: ++this.pos; return this.finishToken(tt.bracketR)n case 123: ++this.pos; return this.finishToken(tt.braceL)n case 125: ++this.pos; return this.finishToken(tt.braceR)n case 58: ++this.pos; return this.finishToken(tt.colon)n case 63: ++this.pos; return this.finishToken(tt.question)nn case 96: // '`'n if (this.options.ecmaVersion < 6) breakn ++this.posn return this.finishToken(tt.backQuote)nn case 48: // '0'n var next = this.input.charCodeAt(this.pos + 1)n if (next === 120 || next === 88) return this.readRadixNumber(16) // '0x', '0X' - hex numbern if (this.options.ecmaVersion >= 6) {n if (next === 111 || next === 79) return this.readRadixNumber(8) // '0o', '0O' - octal numbern if (next === 98 || next === 66) return this.readRadixNumber(2) // '0b', '0B' - binary numbern }n // Anything else beginning with a digit is an integer, octaln // number, or float.n case 49: case 50: case 51: case 52: case 53: case 54: case 55: case 56: case 57: // 1-9n return this.readNumber(false)nn // Quotes produce strings.n case 34: case 39: // '"', "'"n return this.readString(code)nn // Operators are parsed inline in tiny state machines. '=' (61) isn // often referred to. `finishOp` simply skips the amount ofn // characters it is given as second argument, and returns a tokenn // of the type given by its first argument.nn case 47: // '/'n return this.readToken_slash()nn case 37: case 42: // '%*'n return this.readToken_mult_modulo_exp(code)nn case 124: case 38: // '|&'n return this.readToken_pipe_amp(code)nn case 94: // '^'n return this.readToken_caret()nn case 43: case 45: // '+-'n return this.readToken_plus_min(code)nn case 60: case 62: // '<>'n return this.readToken_lt_gt(code)nn case 61: case 33: // '=!'n return this.readToken_eq_excl(code)nn case 126: // '~'n return this.finishOp(tt.prefix, 1)n }nn this.raise(this.pos, "Unexpected character '" + codePointToString(code) + "'")n}nnpp$7.finishOp = function(type, size) {n var str = this.input.slice(this.pos, this.pos + size)n this.pos += sizen return this.finishToken(type, str)n}nn// Parse a regular expression. Some context-awareness is necessary,n// since a '/' inside a '[]' set does not end the expression.nnfunction tryCreateRegexp(src, flags, throwErrorAt, parser) {n try {n return new RegExp(src, flags)n } catch (e) {n if (throwErrorAt !== undefined) {n if (e instanceof SyntaxError) parser.raise(throwErrorAt, "Error parsing regular expression: " + e.message)n throw en }n }n}nnvar regexpUnicodeSupport = !!tryCreateRegexp("\uffff", "u")nnpp$7.readRegexp = function() {n var this$1 = this;nn var escaped, inClass, start = this.posn for (;;) {n if (this$1.pos >= this$1.input.length) this$1.raise(start, "Unterminated regular expression")n var ch = this$1.input.charAt(this$1.pos)n if (lineBreak.test(ch)) this$1.raise(start, "Unterminated regular expression")n if (!escaped) {n if (ch === "[") inClass = truen else if (ch === "]" && inClass) inClass = falsen else if (ch === "/" && !inClass) breakn escaped = ch === "\\"n } else escaped = falsen ++this$1.posn }n var content = this.input.slice(start, this.pos)n ++this.posn // Need to use `readWord1` because '\uXXXX' sequences are allowedn // here (don't ask).n var mods = this.readWord1()n var tmp = content, tmpFlags = ""n if (mods) {n var validFlags = /^[gim]*$/n if (this.options.ecmaVersion >= 6) validFlags = /^[gimuy]*$/n if (!validFlags.test(mods)) this.raise(start, "Invalid regular expression flag")n if (mods.indexOf("u") >= 0) {n if (regexpUnicodeSupport) {n tmpFlags = "u"n } else {n // Replace each astral symbol and every Unicode escape sequence thatn // possibly represents an astral symbol or a paired surrogate with an // single ASCII symbol to avoid throwing on regular expressions thatn // are only valid in combination with the `/u` flag.n // Note: replacing with the ASCII symbol `x` might cause falsen // negatives in unlikely scenarios. For example, `[\u{61}-b]` is an // perfectly valid pattern that is equivalent to `[a-b]`, but it wouldn // be replaced by `[x-b]` which throws an error.n tmp = tmp.replace(/\\u\{([0-9a-fA-F]+)\}/g, function (_match, code, offset) {n code = Number("0x" + code)n if (code > 0x10FFFF) this$1.raise(start + offset + 3, "Code point out of bounds")n return "x"n })n tmp = tmp.replace(/\\u({4})|[\uD800-\uDBFF]/g, "x")n tmpFlags = tmpFlags.replace("u", "")n }n }n }n // Detect invalid regular expressions.n var value = nulln // Rhino's regular expression parser is flaky and throws uncatchable exceptions,n // so don't do detection if we are running under Rhinon if (!isRhino) {n tryCreateRegexp(tmp, tmpFlags, start, this)n // Get a regular expression object for this pattern-flag pair, or `null` inn // case the current environment doesn't support the flags it uses.n value = tryCreateRegexp(content, mods)n }n return this.finishToken(tt.regexp, {pattern: content, flags: mods, value: value})n}nn// Read an integer in the given radix. Return null if zero digitsn// were read, the integer value otherwise. When `len` is given, thisn// will return `null` unless the integer has exactly `len` digits.nnpp$7.readInt = function(radix, len) {n var this$1 = this;nn var start = this.pos, total = 0n for (var i = 0, e = len == null ? Infinity : len; i < e; ++i) {n var code = this$1.input.charCodeAt(this$1.pos), valn if (code >= 97) val = code - 97 + 10 // an else if (code >= 65) val = code - 65 + 10 // An else if (code >= 48 && code <= 57) val = code - 48 // 0-9n else val = Infinityn if (val >= radix) breakn ++this$1.posn total = total * radix + valn }n if (this.pos === start || len != null && this.pos - start !== len) return nullnn return totaln}nnpp$7.readRadixNumber = function(radix) {n this.pos += 2 // 0xn var val = this.readInt(radix)n if (val == null) this.raise(this.start + 2, "Expected number in radix " + radix)n if (isIdentifierStart(this.fullCharCodeAtPos())) this.raise(this.pos, "Identifier directly after number")n return this.finishToken(tt.num, val)n}nn// Read an integer, octal integer, or floating-point number.nnpp$7.readNumber = function(startsWithDot) {n var start = this.pos, isFloat = false, octal = this.input.charCodeAt(this.pos) === 48n if (!startsWithDot && this.readInt(10) === null) this.raise(start, "Invalid number")n if (octal && this.pos == start + 1) octal = falsen var next = this.input.charCodeAt(this.pos)n if (next === 46 && !octal) { // '.'n ++this.posn this.readInt(10)n isFloat = truen next = this.input.charCodeAt(this.pos)n }n if ((next === 69 || next === 101) && !octal) { // 'eE'n next = this.input.charCodeAt(++this.pos)n if (next === 43 || next === 45) ++this.pos // '+-'n if (this.readInt(10) === null) this.raise(start, "Invalid number")n isFloat = truen }n if (isIdentifierStart(this.fullCharCodeAtPos())) this.raise(this.pos, "Identifier directly after number")nn var str = this.input.slice(start, this.pos), valn if (isFloat) val = parseFloat(str)n else if (!octal || str.length === 1) val = parseInt(str, 10)n else if (/[89]/.test(str) || this.strict) this.raise(start, "Invalid number")n else val = parseInt(str, 8)n return this.finishToken(tt.num, val)n}nn// Read a string value, interpreting backslash-escapes.nnpp$7.readCodePoint = function() {n var ch = this.input.charCodeAt(this.pos), codenn if (ch === 123) {n if (this.options.ecmaVersion < 6) this.unexpected()n var codePos = ++this.posn code = this.readHexChar(this.input.indexOf('}', this.pos) - this.pos)n ++this.posn if (code > 0x10FFFF) this.raise(codePos, "Code point out of bounds")n } else {n code = this.readHexChar(4)n }n return coden}nnfunction codePointToString(code) {n // UTF-16 Decodingn if (code <= 0xFFFF) return String.fromCharCode(code)n code -= 0x10000n return String.fromCharCode((code >> 10) + 0xD800, (code & 1023) + 0xDC00)n}nnpp$7.readString = function(quote) {n var this$1 = this;nn var out = "", chunkStart = ++this.posn for (;;) {n if (this$1.pos >= this$1.input.length) this$1.raise(this$1.start, "Unterminated string constant")n var ch = this$1.input.charCodeAt(this$1.pos)n if (ch === quote) breakn if (ch === 92) { // '\'n out += this$1.input.slice(chunkStart, this$1.pos)n out += this$1.readEscapedChar(false)n chunkStart = this$1.posn } else {n if (isNewLine(ch)) this$1.raise(this$1.start, "Unterminated string constant")n ++this$1.posn }n }n out += this.input.slice(chunkStart, this.pos++)n return this.finishToken(tt.string, out)n}nn// Reads template string tokens.nnpp$7.readTmplToken = function() {n var this$1 = this;nn var out = "", chunkStart = this.posn for (;;) {n if (this$1.pos >= this$1.input.length) this$1.raise(this$1.start, "Unterminated template")n var ch = this$1.input.charCodeAt(this$1.pos)n if (ch === 96 || ch === 36 && this$1.input.charCodeAt(this$1.pos + 1) === 123) { // '`', '${'n if (this$1.pos === this$1.start && this$1.type === tt.template) {n if (ch === 36) {n this$1.pos += 2n return this$1.finishToken(tt.dollarBraceL)n } else {n ++this$1.posn return this$1.finishToken(tt.backQuote)n }n }n out += this$1.input.slice(chunkStart, this$1.pos)n return this$1.finishToken(tt.template, out)n }n if (ch === 92) { // '\'n out += this$1.input.slice(chunkStart, this$1.pos)n out += this$1.readEscapedChar(true)n chunkStart = this$1.posn } else if (isNewLine(ch)) {n out += this$1.input.slice(chunkStart, this$1.pos)n ++this$1.posn switch (ch) {n case 13:n if (this$1.input.charCodeAt(this$1.pos) === 10) ++this$1.posn case 10:n out += "\n"n breakn default:n out += String.fromCharCode(ch)n breakn }n if (this$1.options.locations) {n ++this$1.curLinen this$1.lineStart = this$1.posn }n chunkStart = this$1.posn } else {n ++this$1.posn }n }n}nn// Used to read escaped charactersnnpp$7.readEscapedChar = function(inTemplate) {n var ch = this.input.charCodeAt(++this.pos)n ++this.posn switch (ch) {n case 110: return "\n" // 'n' -> '\n'n case 114: return "\r" // 'r' -> '\r'n case 120: return String.fromCharCode(this.readHexChar(2)) // 'x'n case 117: return codePointToString(this.readCodePoint()) // 'u'n case 116: return "\t" // 't' -> '\t'n case 98: return "\b" // 'b' -> '\b'n case 118: return "\u000b" // 'v' -> '\u000b'n case 102: return "\f" // 'f' -> '\f'n case 13: if (this.input.charCodeAt(this.pos) === 10) ++this.pos // '\r\n'n case 10: // ' \n'n if (this.options.locations) { this.lineStart = this.pos; ++this.curLine }n return ""n default:n if (ch >= 48 && ch <= 55) {n var octalStr = this.input.substr(this.pos - 1, 3).match(/^+/)[0]n var octal = parseInt(octalStr, 8)n if (octal > 255) {n octalStr = octalStr.slice(0, -1)n octal = parseInt(octalStr, 8)n }n if (octalStr !== "0" && (this.strict || inTemplate)) {n this.raise(this.pos - 2, "Octal literal in strict mode")n }n this.pos += octalStr.length - 1n return String.fromCharCode(octal)n }n return String.fromCharCode(ch)n }n}nn// Used to read character escape sequences ('\x', '\u', '\U').nnpp$7.readHexChar = function(len) {n var codePos = this.posn var n = this.readInt(16, len)n if (n === null) this.raise(codePos, "Bad character escape sequence")n return nn}nn// Read an identifier, and return it as a string. Sets `this.containsEsc`n// to whether the word contained a '\u' escape.n//n// Incrementally adds only escaped chars, adding other chunks as-isn// as a micro-optimization.nnpp$7.readWord1 = function() {n var this$1 = this;nn this.containsEsc = falsen var word = "", first = true, chunkStart = this.posn var astral = this.options.ecmaVersion >= 6n while (this.pos < this.input.length) {n var ch = this$1.fullCharCodeAtPos()n if (isIdentifierChar(ch, astral)) {n this$1.pos += ch <= 0xffff ? 1 : 2n } else if (ch === 92) { // "\"n this$1.containsEsc = truen word += this$1.input.slice(chunkStart, this$1.pos)n var escStart = this$1.posn if (this$1.input.charCodeAt(++this$1.pos) != 117) // "u"n this$1.raise(this$1.pos, "Expecting Unicode escape sequence \\uXXXX")n ++this$1.posn var esc = this$1.readCodePoint()n if (!(first ? isIdentifierStart : isIdentifierChar)(esc, astral))n this$1.raise(escStart, "Invalid Unicode escape")n word += codePointToString(esc)n chunkStart = this$1.posn } else {n breakn }n first = falsen }n return word + this.input.slice(chunkStart, this.pos)n}nn// Read an identifier or keyword token. Will check for reservedn// words when necessary.nnpp$7.readWord = function() {n var word = this.readWord1()n var type = tt.namen if (this.keywords.test(word)) {n if (this.containsEsc) this.raiseRecoverable(this.start, "Escape sequence in keyword " + word)n type = keywordTypesn }n return this.finishToken(type, word)n}nn// Acorn is a tiny, fast JavaScript parser written in JavaScript.n//n// Acorn was written by Marijn Haverbeke, Ingvar Stepanyan, andn// various contributors and released under an MIT license.n//n// Git repositories for Acorn are available atn//n// marijnhaverbeke.nl/git/acornn// github.com/ternjs/acorn.gitn//n// Please use the [github bug tracker] to report issues.n//n// [ghbt]: github.com/ternjs/acorn/issuesn//n// This file defines the main parser interface. The library also comesn// with a [error-tolerant parser] and ann// [abstract syntax tree walker], defined in other files.n//n// [dammit]: acorn_loose.jsn// [walk]: util/walk.jsnnvar version = "4.0.11"nn// The main exported interface (under `self.acorn` when in then// browser) is a `parse` function that takes a code string andn// returns an abstract syntax tree as specified by [Mozilla parsern// API].n//n// [api]: developer.mozilla.org/en-US/docs/SpiderMonkey/Parser_APInnfunction parse(input, options) {n return new Parser(options, input).parse()n}nn// This function tries to parse a single expression at a givenn// offset in a string. Useful for parsing mixed-language formatsn// that embed JavaScript expressions.nnfunction parseExpressionAt(input, pos, options) {n var p = new Parser(options, input, pos)n p.nextToken()n return p.parseExpression()n}nn// Acorn is organized as a tokenizer and a recursive-descent parser.n// The `tokenizer` export provides an interface to the tokenizer.nnfunction tokenizer(input, options) {n return new Parser(options, input)n}nn// This is a terrible kludge to support the existing, pre-ES6n// interface where the loose parser module retroactively adds exportsn// to this module.nfunction addLooseExports(parse, Parser, plugins) {n parse_dammit = parsen LooseParser = Parsern pluginsLoose = pluginsn}nnexport { version, parse, parseExpressionAt, tokenizer, parse_dammit, LooseParser, pluginsLoose, addLooseExports, Parser, plugins, defaultOptions, Position, SourceLocation, getLineInfo, Node, TokenType, tt as tokTypes, keywordTypes, TokContext, types as tokContexts, isIdentifierChar, isIdentifierStart, Token, isNewLine, lineBreak, lineBreakG };”,“import { parseExpressionAt } from 'acorn';nnexport default function readExpression ( parser ) {ntconst start = parser.index;nntconst name = parser.readUntil( /\s*}}/ );ntif ( name && /^\w+$/.test( name ) ) {nttreturn {nttttype: 'Identifier',ntttstart,ntttend: start + name.length,ntttnamentt};nt}nntparser.index = start;nnttry {nttconst node = parseExpressionAt( parser.template, parser.index );nttparser.index = node.end;nnttreturn node;nt} catch ( err ) {nttparser.acornError( err );nt}n}n”,“export default function spaces ( i ) {ntlet result = '';ntwhile ( i– ) result += ' ';ntreturn result;n}n”,“import { parse } from 'acorn';nimport spaces from '../../utils/spaces.js';nnconst scriptClosingTag = '<\/script>';nnexport default function readScript ( parser, start, attributes ) {ntconst scriptStart = parser.index;ntconst scriptEnd = parser.template.indexOf( scriptClosingTag, scriptStart );nntconst source = spaces( scriptStart ) + parser.template.slice( scriptStart, scriptEnd );ntparser.index = scriptEnd + scriptClosingTag.length;nntlet ast;nnttry {nttast = parse( source, {ntttecmaVersion: 8,ntttsourceType: 'module'ntt});nt} catch ( err ) {nttparser.acornError( err );nt}nntif ( !ast.body.length ) return null;nntast.start = scriptStart;ntreturn {nttstart,nttend: parser.index,nttattributes,nttcontent: astnt};n}n”,“'use strict';nnvar MAX_LINE_LENGTH = 100;nvar OFFSET_CORRECTION = 60;nnfunction sourceFragment(error, extraLines) {n function processLines(start, end) {n return lines.slice(start, end).map(function(line, idx) {n var num = String(start + idx + 1);nn while (num.length < maxNumLength) {n num = ' ' + num;n }nn return num + ' |' + line;n }).join('\n');n }nn var lines = error.source.split(/\n|\r\n?|\f/);n var column = error.column;n var line = error.line;n var startLine = Math.max(1, line - extraLines) - 1;n var endLine = Math.min(line + extraLines, lines.length + 1);n var maxNumLength = Math.max(4, String(endLine).length) + 1;n var cutLeft = 0;nn if (column > MAX_LINE_LENGTH) {n cutLeft = column - OFFSET_CORRECTION + 3;n column = OFFSET_CORRECTION - 2;n }nn for (var i = startLine; i <= endLine; i++) {n if (i >= 0 && i < lines.length) {n lines =n (cutLeft > 0 && lines.length > cutLeft ? '\u2026' : '') +n lines.substr(cutLeft, MAX_LINE_LENGTH - 2) +n (lines.length > cutLeft + MAX_LINE_LENGTH - 1 ? '\u2026' : '');n }n }nn return [n processLines(startLine, line),n new Array(column + maxNumLength + 2).join('-') + '^',n processLines(line, endLine)n ].join('\n');n}nnvar CssSyntaxError = function(message, source, offset, line, column) {n var error = new SyntaxError();n error.name = 'CssSyntaxError';n error.message = message;n error.source = source;n error.offset = offset;n error.line = line;n error.column = column;nn error.sourceFragment = function(extraLines) {n return sourceFragment(error, isNaN(extraLines) ? 0 : extraLines);n };n Object.defineProperty(error, 'formattedMessage', {n get: function() {n return (n 'Parse error: ' + error.message + '\n' +n sourceFragment(error, 2)n );n }n });nn // for backward capabilityn error.parseError = {n offset: offset,n line: line,n column: columnn };nn return error;n};nnmodule.exports = CssSyntaxError;n”,“'use strict';nn// token types (note: value shouldn't intersect with used char codes)nvar WHITESPACE = 1;nvar IDENTIFIER = 2;nvar NUMBER = 3;nvar STRING = 4;nvar COMMENT = 5;nvar PUNCTUATOR = 6;nnvar TAB = 9;nvar N = 10;nvar F = 12;nvar R = 13;nvar SPACE = 32;nnvar TYPE = {n Whitespace: WHITESPACE,n Identifier: IDENTIFIER,n Number: NUMBER,n String: STRING,n Comment: COMMENT,n Punctuator: PUNCTUATOR,nn ExclamationMark: 33, // !n QuotationMark: 34, // "n NumberSign: 35, // #n DollarSign: 36, // $n PercentSign: 37, // %n Ampersand: 38, // &n Apostrophe: 39, // 'n LeftParenthesis: 40, // (n RightParenthesis: 41, // )n Asterisk: 42, // *n PlusSign: 43, // +n Comma: 44, // ,n HyphenMinus: 45, // -n FullStop: 46, // .n Solidus: 47, // /n Colon: 58, // :n Semicolon: 59, // ;n LessThanSign: 60, // <n EqualsSign: 61, // =n GreaterThanSign: 62, // >n QuestionMark: 63, // ?n CommercialAt: 64, // @n LeftSquareBracket: 91, // [n Backslash: 92, // \n RightSquareBracket: 93, // ]n CircumflexAccent: 94, // ^n LowLine: 95, // _n GraveAccent: 96, // `n LeftCurlyBracket: 123, // {n VerticalLine: 124, // |n RightCurlyBracket: 125, // }n Tilde: 126 // ~n};nnvar NAME = Object.keys(TYPE).reduce(function(result, key) {n result[TYPE] = key;n return result;n}, {});nnvar SafeUint32Array = typeof Uint32Array !== 'undefined' ? Uint32Array : Array; // fallback on Array when TypedArray is not supportednvar SYMBOL_TYPE = new SafeUint32Array(Math.max.apply(null, Object.keys(NAME).map(Number)) + 1);nvar PUNCTUATION = new SafeUint32Array(SYMBOL_TYPE.length);nnfor (var i = 0; i < SYMBOL_TYPE.length; i++) {n SYMBOL_TYPE = IDENTIFIER;n}nn// fill categoriesn[n TYPE.ExclamationMark, // !n TYPE.QuotationMark, // "n TYPE.NumberSign, // #n TYPE.DollarSign, // $n TYPE.PercentSign, // %n TYPE.Ampersand, // &n TYPE.Apostrophe, // 'n TYPE.LeftParenthesis, // (n TYPE.RightParenthesis, // )n TYPE.Asterisk, // *n TYPE.PlusSign, // +n TYPE.Comma, // ,n TYPE.HyphenMinus, // -n TYPE.FullStop, // .n TYPE.Solidus, // /n TYPE.Colon, // :n TYPE.Semicolon, // ;n TYPE.LessThanSign, // <n TYPE.EqualsSign, // =n TYPE.GreaterThanSign, // >n TYPE.QuestionMark, // ?n TYPE.CommercialAt, // @n TYPE.LeftSquareBracket, // [n // TYPE.Backslash, // \n TYPE.RightSquareBracket, // ]n TYPE.CircumflexAccent, // ^n // TYPE.LowLine, // _n TYPE.GraveAccent, // `n TYPE.LeftCurlyBracket, // {n TYPE.VerticalLine, // |n TYPE.RightCurlyBracket, // }n TYPE.Tilde // ~n].forEach(function(key) {n SYMBOL_TYPE = PUNCTUATOR;n PUNCTUATION = PUNCTUATOR;n}, SYMBOL_TYPE);nnfor (var i = 48; i <= 57; i++) {n SYMBOL_TYPE = NUMBER;n}nnSYMBOL_TYPE = WHITESPACE;nSYMBOL_TYPE = WHITESPACE;nSYMBOL_TYPE = WHITESPACE;nSYMBOL_TYPE = WHITESPACE;nSYMBOL_TYPE = WHITESPACE;nnSYMBOL_TYPE = STRING;nSYMBOL_TYPE = STRING;nn// whitespace is punctuation …nPUNCTUATION = PUNCTUATOR;nPUNCTUATION = PUNCTUATOR;nPUNCTUATION = PUNCTUATOR;nPUNCTUATION = PUNCTUATOR;nPUNCTUATION = PUNCTUATOR;n// … hyper minus is notnPUNCTUATION = 0;nnmodule.exports = {n TYPE: TYPE,n NAME: NAME,nn SYMBOL_TYPE: SYMBOL_TYPE,n PUNCTUATION: PUNCTUATIONn};n”,“'use strict';nnvar constants = require('./const');nvar PUNCTUATION = constants.PUNCTUATION;nvar SYMBOL_TYPE = constants.SYMBOL_TYPE;nvar SYMBOL_TYPE_LENGTH = SYMBOL_TYPE.length;nvar TYPE = constants.TYPE;nvar FULLSTOP = TYPE.FullStop;nvar PLUSSIGN = TYPE.PlusSign;nvar HYPHENMINUS = TYPE.HyphenMinus;nvar PUNCTUATOR = TYPE.Punctuator;nvar TAB = 9;nvar N = 10;nvar F = 12;nvar R = 13;nvar SPACE = 32;nvar BACK_SLASH = 92;nvar E = 101; // 'e'.charCodeAt(0)nnfunction firstCharOffset(source) {n return source.charCodeAt(0) === 0xFEFF ? 1 : 0;n}nnfunction isHex(code) {n return (code >= 48 && code <= 57) || // 0 .. 9n (code >= 65 && code <= 70) || // A .. Fn (code >= 97 && code <= 102); // a .. fn}nnfunction isNumber(code) {n return code >= 48 && code <= 57;n}nnfunction isNewline(source, offset, code) {n if (code === N || code === F || code === R) {n if (code === R && offset + 1 < source.length && source.charCodeAt(offset + 1) === N) {n return 2;n }nn return 1;n }nn return 0;n}nnfunction cmpChar(testStr, offset, referenceCode) {n var code = testStr.charCodeAt(offset);nn // code.toLowerCase()n if (code >= 65 && code <= 90) {n code = code | 32;n }nn return code === referenceCode;n}nnfunction cmpStr(testStr, start, end, referenceStr) {n if (end - start !== referenceStr.length) {n return false;n }nn if (start < 0 || end > testStr.length) {n return false;n }nn for (var i = start; i < end; i++) {n var testCode = testStr.charCodeAt(i);n var refCode = referenceStr.charCodeAt(i - start);nn // testStr.toLowerCase()n if (testCode >= 65 && testCode <= 90) {n testCode = testCode | 32;n }nn if (testCode !== refCode) {n return false;n }n }nn return true;n}nnfunction endsWith(testStr, referenceStr) {n return cmpStr(testStr, testStr.length - referenceStr.length, testStr.length, referenceStr);n}nnfunction findLastNonSpaceLocation(scanner) {n for (var i = scanner.source.length - 1; i >= 0; i–) {n var code = scanner.source.charCodeAt(i);nn if (code !== SPACE && code !== TAB && code !== R && code !== N && code !== F) {n break;n }n }nn return scanner.getLocation(i + 1);n}nnfunction findWhitespaceEnd(source, offset) {n for (; offset < source.length; offset++) {n var code = source.charCodeAt(offset);nn if (code !== SPACE && code !== TAB && code !== R && code !== N && code !== F) {n break;n }n }nn return offset;n}nnfunction findCommentEnd(source, offset) {n var commentEnd = source.indexOf('*/', offset);nn if (commentEnd === -1) {n return source.length;n }nn return commentEnd + 2;n}nnfunction findStringEnd(source, offset, quote) {n for (; offset < source.length; offset++) {n var code = source.charCodeAt(offset);nn // TODO: bad stringn if (code === BACK_SLASH) {n offset++;n } else if (code === quote) {n offset++;n break;n }n }nn return offset;n}nnfunction findDecimalNumberEnd(source, offset) {n for (; offset < source.length; offset++) {n var code = source.charCodeAt(offset);nn if (code < 48 || code > 57) { // not a 0 .. 9n break;n }n }nn return offset;n}nnfunction findNumberEnd(source, offset, allowFraction) {n var code;nn offset = findDecimalNumberEnd(source, offset);nn // fraction: .\d+n if (allowFraction && offset + 1 < source.length && source.charCodeAt(offset) === FULLSTOP) {n code = source.charCodeAt(offset + 1);nn if (isNumber(code)) {n offset = findDecimalNumberEnd(source, offset + 1);n }n }nn // exponent: e\d+n if (offset + 1 < source.length) {n if ((source.charCodeAt(offset) | 32) === E) { // case insensitive check for `e`n code = source.charCodeAt(offset + 1);nn if (code === PLUSSIGN || code === HYPHENMINUS) {n if (offset + 2 < source.length) {n code = source.charCodeAt(offset + 2);n }n }nn if (isNumber(code)) {n offset = findDecimalNumberEnd(source, offset + 2);n }n }n }nn return offset;n}nn// skip escaped unicode sequence that can ends with spacen// [0-9a-f]{1,6}(\r\n|[ \n\r\t\f])?nfunction findEscaseEnd(source, offset) {n for (var i = 0; i < 7 && offset + i < source.length; i++) {n var code = source.charCodeAt(offset + i);nn if (i !== 6 && isHex(code)) {n continue;n }nn if (i > 0) {n offset += i - 1 + isNewline(source, offset + i, code);n if (code === SPACE || code === TAB) {n offset++;n }n }nn break;n }nn return offset;n}nnfunction findIdentifierEnd(source, offset) {n for (; offset < source.length; offset++) {n var code = source.charCodeAt(offset);nn if (code === BACK_SLASH) {n offset = findEscaseEnd(source, offset + 1);n } else if (code < SYMBOL_TYPE_LENGTH && PUNCTUATION === PUNCTUATOR) {n break;n }n }nn return offset;n}nnmodule.exports = {n firstCharOffset: firstCharOffset,nn isHex: isHex,n isNumber: isNumber,n isNewline: isNewline,nn cmpChar: cmpChar,n cmpStr: cmpStr,n endsWith: endsWith,nn findLastNonSpaceLocation: findLastNonSpaceLocation,n findWhitespaceEnd: findWhitespaceEnd,n findCommentEnd: findCommentEnd,n findStringEnd: findStringEnd,n findDecimalNumberEnd: findDecimalNumberEnd,n findNumberEnd: findNumberEnd,n findEscaseEnd: findEscaseEnd,n findIdentifierEnd: findIdentifierEndn};n”,“'use strict';nnvar CssSyntaxError = require('./error');nnvar constants = require('./const');nvar TYPE = constants.TYPE;nvar NAME = constants.NAME;nvar SYMBOL_TYPE = constants.SYMBOL_TYPE;nvar SYMBOL_TYPE_LENGTH = SYMBOL_TYPE.length;nnvar utils = require('./utils');nvar firstCharOffset = utils.firstCharOffset;nvar cmpStr = utils.cmpStr;nvar isNumber = utils.isNumber;nvar findLastNonSpaceLocation = utils.findLastNonSpaceLocation;nvar findWhitespaceEnd = utils.findWhitespaceEnd;nvar findCommentEnd = utils.findCommentEnd;nvar findStringEnd = utils.findStringEnd;nvar findNumberEnd = utils.findNumberEnd;nvar findIdentifierEnd = utils.findIdentifierEnd;nnvar NULL = 0;nvar WHITESPACE = TYPE.Whitespace;nvar IDENTIFIER = TYPE.Identifier;nvar NUMBER = TYPE.Number;nvar STRING = TYPE.String;nvar COMMENT = TYPE.Comment;nvar PUNCTUATOR = TYPE.Punctuator;nnvar N = 10;nvar F = 12;nvar R = 13;nvar STAR = TYPE.Asterisk;nvar SLASH = TYPE.Solidus;nvar FULLSTOP = TYPE.FullStop;nvar PLUSSIGN = TYPE.PlusSign;nvar HYPHENMINUS = TYPE.HyphenMinus;nnvar MIN_BUFFER_SIZE = 16 * 1024;nvar OFFSET_MASK = 0x00FFFFFF;nvar TYPE_OFFSET = 24;nvar SafeUint32Array = typeof Uint32Array !== 'undefined' ? Uint32Array : Array; // fallback on Array when TypedArray is not supportednnfunction computeLinesAndColumns(tokenizer, source) {n var sourceLength = source.length;n var start = firstCharOffset(source);n var lines = tokenizer.lines;n var line = tokenizer.startLine;n var columns = tokenizer.columns;n var column = tokenizer.startColumn;nn if (lines === null || lines.length < sourceLength + 1) {n lines = new SafeUint32Array(Math.max(sourceLength + 1024, MIN_BUFFER_SIZE));n columns = new SafeUint32Array(lines.length);n }nn for (var i = start; i < sourceLength; i++) {n var code = source.charCodeAt(i);nn lines = line;n columns = column++;nn if (code === N || code === R || code === F) {n if (code === R && i + 1 < sourceLength && source.charCodeAt(i + 1) === N) {n i++;n lines = line;n columns = column;n }nn line++;n column = 1;n }n }nn lines = line;n columns = column;nn tokenizer.linesAnsColumnsComputed = true;n tokenizer.lines = lines;n tokenizer.columns = columns;n}nnfunction tokenLayout(tokenizer, source, startPos) {n var sourceLength = source.length;n var offsetAndType = tokenizer.offsetAndType;n var tokenCount = 0;n var prevType = 0;n var offset = startPos;nn if (offsetAndType === null || offsetAndType.length < sourceLength + 1) {n offsetAndType = new SafeUint32Array(sourceLength + 1024);n }nn while (offset < sourceLength) {n var code = source.charCodeAt(offset);n var type = code < SYMBOL_TYPE_LENGTH ? SYMBOL_TYPE : IDENTIFIER;nn switch (type) {n case WHITESPACE:n offset = findWhitespaceEnd(source, offset + 1);n break;nn case PUNCTUATOR:n if (code === STAR && prevType === SLASH) { // /*n type = COMMENT;n offset = findCommentEnd(source, offset + 1);n tokenCount–; // rewrite prev tokenn } else {n // edge case for -.123 and +.123n if (code === FULLSTOP && (prevType === PLUSSIGN || prevType === HYPHENMINUS)) {n if (offset + 1 < sourceLength && isNumber(source.charCodeAt(offset + 1))) {n type = NUMBER;n offset = findNumberEnd(source, offset + 2, false);n tokenCount–; // rewrite prev tokenn break;n }n }nn type = code;n offset = offset + 1;n }nn break;nn case NUMBER:n offset = findNumberEnd(source, offset + 1, prevType !== FULLSTOP);nn // merge number with a preceding dot, dash or plusn if (prevType === FULLSTOP ||n prevType === HYPHENMINUS ||n prevType === PLUSSIGN) {n tokenCount–; // rewrite prev tokenn }nn break;nn case STRING:n offset = findStringEnd(source, offset + 1, code);n break;nn default:n offset = findIdentifierEnd(source, offset);nn // merge identifier with a preceding dashn if (prevType === HYPHENMINUS) {n tokenCount–; // rewrite prev tokenn }n }nn offsetAndType = (type << TYPE_OFFSET) | offset;n prevType = type;n }nn offsetAndType = offset;nn tokenizer.offsetAndType = offsetAndType;n tokenizer.tokenCount = tokenCount;n}nn//n// tokenizern//nnvar Tokenizer = function(source, startOffset, startLine, startColumn) {n this.offsetAndType = null;n this.lines = null;n this.columns = null;nn this.setSource(source || '', startOffset, startLine, startColumn);n};nnTokenizer.prototype = {n setSource: function(source, startOffset, startLine, startColumn) {n var start = firstCharOffset(source);nn this.source = source;n this.startOffset = typeof startOffset === 'undefined' ? 0 : startOffset;n this.startLine = typeof startLine === 'undefined' ? 1 : startLine;n this.startColumn = typeof startColumn === 'undefined' ? 1 : startColumn;n this.linesAnsColumnsComputed = false;nn this.eof = false;n this.currentToken = -1;n this.tokenType = 0;n this.tokenStart = start;n this.tokenEnd = start;nn tokenLayout(this, source, start);n this.next();n },nn lookupType: function(offset) {n offset += this.currentToken;nn if (offset < this.tokenCount) {n return this.offsetAndType >> TYPE_OFFSET;n }nn return NULL;n },n lookupNonWSType: function(offset) {n offset += this.currentToken;nn for (var type; offset < this.tokenCount; offset++) {n type = this.offsetAndType >> TYPE_OFFSET;nn if (type !== WHITESPACE) {n return type;n }n }nn return NULL;n },n lookupValue: function(offset, referenceStr) {n offset += this.currentToken;nn if (offset < this.tokenCount) {n return cmpStr(n this.source,n this.offsetAndType[offset - 1] & OFFSET_MASK,n this.offsetAndType & OFFSET_MASK,n referenceStrn );n }nn return false;n },nn getTokenValue: function() {n return this.source.substring(this.tokenStart, this.tokenEnd);n },n substrToCursor: function(start) {n return this.source.substring(start, this.tokenStart);n },nn skipWS: function() {n for (var i = this.currentToken, skipTokenCount = 0; i < this.tokenCount; i++, skipTokenCount++) {n if ((this.offsetAndType >> TYPE_OFFSET) !== WHITESPACE) {n break;n }n }nn if (skipTokenCount > 0) {n this.skip(skipTokenCount);n }n },n skip: function(tokenCount) {n var next = this.currentToken + tokenCount;nn if (next < this.tokenCount) {n this.currentToken = next;n this.tokenStart = this.offsetAndType[next - 1] & OFFSET_MASK;n next = this.offsetAndType;n this.tokenType = next >> TYPE_OFFSET;n this.tokenEnd = next & OFFSET_MASK;n } else {n this.currentToken = this.tokenCount;n this.next();n }n },n next: function() {n var next = this.currentToken + 1;nn if (next < this.tokenCount) {n this.currentToken = next;n this.tokenStart = this.tokenEnd;n next = this.offsetAndType;n this.tokenType = next >> TYPE_OFFSET;n this.tokenEnd = next & OFFSET_MASK;n } else {n this.currentToken = this.tokenCount;n this.eof = true;n this.tokenType = NULL;n this.tokenStart = this.tokenEnd = this.source.length;n }n },nn eat: function(tokenType) {n if (this.tokenType !== tokenType) {n this.error(n NAME + ' is expected',n // when test type is part of another token show error for current position + 1n // e.g. eat(HYPHENMINUS) will fail on "-foo", but pointing on "-" is oddn this.tokenStart + (this.source.charCodeAt(this.tokenStart) === tokenType ? 1 : 0)n );n }nn this.next();n },n eatNonWS: function(tokenType) {n this.skipWS();n this.eat(tokenType);n },nn consume: function(tokenType) {n var start = this.tokenStart;nn this.eat(tokenType);nn return this.substrToCursor(start);n },n consumeNonWS: function(tokenType) {n this.skipWS();nn return this.consume(tokenType);n },nn expectIdentifier: function(name) {n if (this.tokenType !== IDENTIFIER || cmpStr(this.source, this.tokenStart, this.tokenEnd, name) === false) {n this.error('Identifier `' + name + '` is expected');n }nn this.next();n },nn getLocation: function(offset, filename) {n if (!this.linesAnsColumnsComputed) {n computeLinesAndColumns(this, this.source);n }nn return {n source: filename,n offset: this.startOffset + offset,n line: this.lines,n column: this.columnsn };n },nn getLocationRange: function(start, end, filename) {n if (!this.linesAnsColumnsComputed) {n computeLinesAndColumns(this, this.source);n }nn return {n source: filename,n start: {n offset: this.startOffset + start,n line: this.lines,n column: this.columnsn },n end: {n offset: this.startOffset + end,n line: this.lines,n column: this.columnsn }n };n },nn error: function(message, offset) {n var location = typeof offset !== 'undefined' && offset < this.source.lengthn ? this.getLocation(offset)n : this.eofn ? findLastNonSpaceLocation(this)n : this.getLocation(this.tokenStart);nn throw new CssSyntaxError(n message || 'Unexpected input',n this.source,n location.offset,n location.line,n location.columnn );n },nn getTypes: function() {n return Array.prototype.slice.call(this.offsetAndType, 0, this.tokenCount).map(function(item) {n return NAME[item >> TYPE_OFFSET];n });n }n};nn// extend with error classnTokenizer.CssSyntaxError = CssSyntaxError;nn// extend tokenizer with constantsnObject.keys(constants).forEach(function(key) {n Tokenizer = constants;n});nn// extend tokenizer with static methods from utilsnObject.keys(utils).forEach(function(key) {n Tokenizer = utils;n});nn// warm up tokenizer to elimitate code branches that never executen// fix soft deoptimizations (insufficient type feedback)nnew Tokenizer('\n\r\r\n\f//""\'\'/*\r\n\f*/1a;.\\31\t+2{url(a);+1.2e3 -.4e-5 .6e+7}').getLocation();nnmodule.exports = Tokenizer;n”,“module.exports = require('./Tokenizer');n”,“'use strict';nn//n// item item item itemn// /——\ /——\ /——\ /——\n// | data | | data | | data | | data |n// null <–+-prev |<—+-prev |<—+-prev |<—+-prev |n// | next-+—>| next-+—>| next-+—>| next-+–> nulln// \——/ \——/ \——/ \——/n// ^ ^n// | list |n// | /——\ |n// \————–+-head | |n// | tail-+————–/n// \——/n//nnfunction createItem(data) {n return {n prev: null,n next: null,n data: datan };n}nnvar cursors = null;nvar List = function() {n this.cursor = null;n this.head = null;n this.tail = null;n};nnList.createItem = createItem;nList.prototype.createItem = createItem;nnList.prototype.getSize = function() {n var size = 0;n var cursor = this.head;nn while (cursor) {n size++;n cursor = cursor.next;n }nn return size;n};nnList.prototype.fromArray = function(array) {n var cursor = null;nn this.head = null;nn for (var i = 0; i < array.length; i++) {n var item = createItem(array);nn if (cursor !== null) {n cursor.next = item;n } else {n this.head = item;n }nn item.prev = cursor;n cursor = item;n }nn this.tail = cursor;nn return this;n};nnList.prototype.toArray = function() {n var cursor = this.head;n var result = [];nn while (cursor) {n result.push(cursor.data);n cursor = cursor.next;n }nn return result;n};nnList.prototype.toJSON = List.prototype.toArray;nnList.prototype.isEmpty = function() {n return this.head === null;n};nnList.prototype.first = function() {n return this.head && this.head.data;n};nnList.prototype.last = function() {n return this.tail && this.tail.data;n};nnfunction allocateCursor(node, prev, next) {n var cursor;nn if (cursors !== null) {n cursor = cursors;n cursors = cursors.cursor;n cursor.prev = prev;n cursor.next = next;n cursor.cursor = node.cursor;n } else {n cursor = {n prev: prev,n next: next,n cursor: node.cursorn };n }nn node.cursor = cursor;nn return cursor;n}nnfunction releaseCursor(node) {n var cursor = node.cursor;nn node.cursor = cursor.cursor;n cursor.prev = null;n cursor.next = null;n cursor.cursor = cursors;n cursors = cursor;n}nnList.prototype.each = function(fn, context) {n var item;nn if (context === undefined) {n context = this;n }nn // push cursorn var cursor = allocateCursor(this, null, this.head);nn while (cursor.next !== null) {n item = cursor.next;n cursor.next = item.next;nn fn.call(context, item.data, item, this);n }nn // pop cursorn releaseCursor(this);n};nnList.prototype.eachRight = function(fn, context) {n var item;nn if (context === undefined) {n context = this;n }nn // push cursorn var cursor = allocateCursor(this, this.tail, null);nn while (cursor.prev !== null) {n item = cursor.prev;n cursor.prev = item.prev;nn fn.call(context, item.data, item, this);n }nn // pop cursorn releaseCursor(this);n};nnList.prototype.nextUntil = function(start, fn, context) {n if (start === null) {n return;n }nn var item;nn if (context === undefined) {n context = this;n }nn // push cursorn var cursor = allocateCursor(this, null, start);nn while (cursor.next !== null) {n item = cursor.next;n cursor.next = item.next;nn if (fn.call(context, item.data, item, this)) {n break;n }n }nn // pop cursorn releaseCursor(this);n};nnList.prototype.prevUntil = function(start, fn, context) {n if (start === null) {n return;n }nn var item;nn if (context === undefined) {n context = this;n }nn // push cursorn var cursor = allocateCursor(this, start, null);nn while (cursor.prev !== null) {n item = cursor.prev;n cursor.prev = item.prev;nn if (fn.call(context, item.data, item, this)) {n break;n }n }nn // pop cursorn releaseCursor(this);n};nnList.prototype.some = function(fn, context) {n var cursor = this.head;nn if (context === undefined) {n context = this;n }nn while (cursor !== null) {n if (fn.call(context, cursor.data, cursor, this)) {n return true;n }nn cursor = cursor.next;n }nn return false;n};nnList.prototype.map = function(fn, context) {n var result = [];n var cursor = this.head;nn if (context === undefined) {n context = this;n }nn while (cursor !== null) {n result.push(fn.call(context, cursor.data, cursor, this));n cursor = cursor.next;n }nn return result;n};nnList.prototype.clear = function() {n this.head = null;n this.tail = null;n};nnList.prototype.copy = function() {n var result = new List();n var cursor = this.head;nn while (cursor !== null) {n result.insert(createItem(cursor.data));n cursor = cursor.next;n }nn return result;n};nnList.prototype.updateCursors = function(prevOld, prevNew, nextOld, nextNew) {n var cursor = this.cursor;nn while (cursor !== null) {n if (cursor.prev === prevOld) {n cursor.prev = prevNew;n }nn if (cursor.next === nextOld) {n cursor.next = nextNew;n }nn cursor = cursor.cursor;n }n};nnList.prototype.append = function(item) {n // tailn // ^n // itemn this.updateCursors(this.tail, item, null, item);nn // insert to end of the listn if (this.tail !== null) {n // if list has a tail, then it also has a head, but head doesn't changenn // last item -> new itemn this.tail.next = item;nn // last item <- new itemn item.prev = this.tail;n } else {n // if list has no a tail, then it also has no a headn // in this case points head to new itemn this.head = item;n }nn // tail always start point to new itemn this.tail = item;nn return this;n};nnList.prototype.appendData = function(data) {n return this.append(createItem(data));n};nnList.prototype.insert = function(item, before) {n if (before !== undefined && before !== null) {n // prev beforen // ^n // itemn this.updateCursors(before.prev, item, before, item);nn if (before.prev === null) {n // insert to the beginning of listn if (this.head !== before) {n throw new Error('before doesn\'t below to list');n }nn // since head points to before therefore list doesn't emptyn // no need to check tailn this.head = item;n before.prev = item;n item.next = before;nn this.updateCursors(null, item);n } else {nn // insert between two itemsn before.prev.next = item;n item.prev = before.prev;nn before.prev = item;n item.next = before;n }n } else {n this.append(item);n }n};nnList.prototype.remove = function(item) {n // itemn // ^n // prev nextn this.updateCursors(item, item.prev, item, item.next);nn if (item.prev !== null) {n item.prev.next = item.next;n } else {n if (this.head !== item) {n throw new Error('item doesn\'t below to list');n }nn this.head = item.next;n }nn if (item.next !== null) {n item.next.prev = item.prev;n } else {n if (this.tail !== item) {n throw new Error('item doesn\'t below to list');n }nn this.tail = item.prev;n }nn item.prev = null;n item.next = null;nn return item;n};nnList.prototype.appendList = function(list) {n // ignore empty listsn if (list.head === null) {n return;n }nn this.updateCursors(this.tail, list.tail, null, list.head);nn // insert to end of the listn if (this.tail !== null) {n // if destination list has a tail, then it also has a head,n // but head doesn't changenn // dest tail -> source headn this.tail.next = list.head;nn // dest tail <- source headn list.head.prev = this.tail;n } else {n // if list has no a tail, then it also has no a headn // in this case points head to new itemn this.head = list.head;n }nn // tail always start point to new itemn this.tail = list.tail;nn list.head = null;n list.tail = null;n};nnmodule.exports = List;n”,“var List = require('../utils/list');nvar cmpChar = require('../tokenizer').cmpChar;nvar TYPE = require('../tokenizer').TYPE;nnvar WHITESPACE = TYPE.Whitespace;nvar IDENTIFIER = TYPE.Identifier;nvar STRING = TYPE.String;nvar NUMBER = TYPE.Number;nvar COMMENT = TYPE.Comment;nvar NUMBERSIGN = TYPE.NumberSign;nvar LEFTPARENTHESIS = TYPE.LeftParenthesis;nvar LEFTSQUAREBRACKET = TYPE.LeftSquareBracket;nvar PLUSSIGN = TYPE.PlusSign;nvar HYPHENMINUS = TYPE.HyphenMinus;nvar COMMA = TYPE.Comma;nvar SOLIDUS = TYPE.Solidus;nvar ASTERISK = TYPE.Asterisk;nvar PERCENTSIGN = TYPE.PercentSign;nvar FULLSTOP = TYPE.FullStop;nvar COLON = TYPE.Colon;nvar GREATERTHANSIGN = TYPE.GreaterThanSign;nvar VERTICALLINE = TYPE.VerticalLine;nvar TILDE = TYPE.Tilde;nvar U = 117; // 'u'.charCodeAt(0)nnvar ALLOW_OF_CLAUSE = true;nvar DISALLOW_OF_CLAUSE = false;nnfunction singleIdentifier() {n return new List().appendData(n this.Identifier()n );n}nnfunction selectorList() {n return new List().appendData(n this.SelectorList()n );n}nnfunction compoundSelector() {n return new List().appendData(n this.Selector()n );n}nnfunction nth() {n return new List().appendData(n this.Nth(DISALLOW_OF_CLAUSE)n );n}nnfunction nthWithOfClause() {n return new List().appendData(n this.Nth(ALLOW_OF_CLAUSE)n );n}nnfunction selectorSequence() {n var children = new List();n var space = null;n var child = null;n var ignoreWSAfter = false;n var ignoreWS = false;nn this.readSC();nn scan:n while (!this.scanner.eof) {n switch (this.scanner.tokenType) {n case COMMENT:n this.scanner.next();n continue;nn case WHITESPACE:n if (ignoreWS) {n this.scanner.next();n } else {n space = this.WhiteSpace();n }n continue;nn case PLUSSIGN:n case GREATERTHANSIGN:n case TILDE:n space = null;n ignoreWSAfter = true;n child = this.Combinator();n break;nn case SOLIDUS: // /deep/n child = this.Combinator();n break;nn case FULLSTOP:n child = this.ClassSelector();n break;nn case LEFTSQUAREBRACKET:n child = this.AttributeSelector();n break;nn case NUMBERSIGN:n child = this.IdSelector();n break;nn case COLON:n if (this.scanner.lookupType(1) === COLON) {n child = this.PseudoElementSelector();n } else {n child = this.PseudoClassSelector();n }nn break;nn case IDENTIFIER:n case ASTERISK:n case VERTICALLINE:n child = this.TypeSelector();n break;nn case NUMBER:n child = this.Percentage();n break;nn default:n if (typeof this.readSelectorSequenceFallback === 'function') {n child = this.readSelectorSequenceFallback();n if (!child) {n break scan;n }n } else {n break scan;n }n }nn if (space !== null) {n children.appendData(space);n space = null;n }nn children.appendData(child);nn if (ignoreWSAfter) {n ignoreWSAfter = false;n ignoreWS = true;n } else {n ignoreWS = false;n }n }nn // nothing were consumedn if (child === null) {n this.scanner.error('Selector is expected');n }nn return children;n}nnfunction defaultSequence(scope) {n var children = new List();n var space = null;n var child = null;n var ignoreWSAfter = false;n var ignoreWS = false;nn this.readSC();nn scan:n while (!this.scanner.eof) {n switch (this.scanner.tokenType) {n case COMMENT:n this.scanner.next();n continue;nn case WHITESPACE:n if (ignoreWS) {n this.scanner.next();n } else {n space = this.WhiteSpace();n }n continue;nn case NUMBERSIGN:n child = this.HexColor();n break;nn case COMMA:n space = null;n ignoreWSAfter = true;n child = this.Operator();n break;nn case SOLIDUS:n case ASTERISK:n case PLUSSIGN:n case HYPHENMINUS:n child = this.Operator();n break;nn case LEFTPARENTHESIS:n child = this.Parentheses(defaultSequence);n break;nn case LEFTSQUAREBRACKET:n child = this.Brackets(defaultSequence);n break;nn case STRING:n child = this.String();n break;nn case NUMBER:n switch (this.scanner.lookupType(1)) {n case PERCENTSIGN:n child = this.Percentage();n break;nn case IDENTIFIER:n child = this.Dimension();n break;nn default:n child = this.Number();n }nn break;nn case IDENTIFIER:n // check for unicode range, it should start with u+ or U+n if (cmpChar(this.scanner.source, this.scanner.tokenStart, U) &&n cmpChar(this.scanner.source, this.scanner.tokenStart + 1, PLUSSIGN)) {n child = this.UnicodeRange();n } else if (this.scanner.lookupType(1) === LEFTPARENTHESIS) {n if (this.scanner.lookupValue(0, 'url')) {n child = this.Url();n } else {n child = this.Function(scope, defaultSequence);n }n } else {n child = this.Identifier();n }nn break;nn default:n if (typeof this.readSequenceFallback === 'function') {n child = this.readSequenceFallback();n if (!child) {n break scan;n }n } else {n break scan;n }n }nn if (space !== null) {n children.appendData(space);n space = null;n }nn children.appendData(child);nn if (ignoreWSAfter) {n ignoreWSAfter = false;n ignoreWS = true;n } else {n ignoreWS = false;n }n }nn return children;n}nnmodule.exports = {n singleIdentifier: singleIdentifier,n selectorList: selectorList,n compoundSelector: compoundSelector,n nth: nth,n nthWithOfClause: nthWithOfClause,n selector: selectorSequence,n default: defaultSequencen};n”,“var cmpChar = require('../../tokenizer').cmpChar;nvar isNumber = require('../../tokenizer').isNumber;nvar TYPE = require('../../tokenizer').TYPE;nnvar IDENTIFIER = TYPE.Identifier;nvar NUMBER = TYPE.Number;nvar PLUSSIGN = TYPE.PlusSign;nvar HYPHENMINUS = TYPE.HyphenMinus;nvar N = 110; // 'n'.charCodeAt(0)nvar DISALLOW_SIGN = true;nvar ALLOW_SIGN = false;nnfunction checkTokenIsInteger(scanner, disallowSign) {n var pos = scanner.tokenStart;nn if (scanner.source.charCodeAt(pos) === PLUSSIGN ||n scanner.source.charCodeAt(pos) === HYPHENMINUS) {n if (disallowSign) {n scanner.error();n }n pos++;n }nn for (; pos < scanner.tokenEnd; pos++) {n if (!isNumber(scanner.source.charCodeAt(pos))) {n scanner.error('Unexpected input', pos);n }n }n}nn// An+B microsyntax www.w3.org/TR/css-syntax-3/#anbnmodule.exports = function AnPlusB() {n var start = this.scanner.tokenStart;n var end = start;n var prefix = '';n var a = null;n var b = null;nn if (this.scanner.tokenType === NUMBER ||n this.scanner.tokenType === PLUSSIGN) {n checkTokenIsInteger(this.scanner, ALLOW_SIGN);n prefix = this.scanner.getTokenValue();n this.scanner.next();n end = this.scanner.tokenStart;n }nn if (this.scanner.tokenType === IDENTIFIER) {n var bStart = this.scanner.tokenStart;nn if (cmpChar(this.scanner.source, bStart, HYPHENMINUS)) {n if (prefix === '') {n prefix = '-';n bStart++;n } else {n this.scanner.error('Unexpected hyphen minus');n }n }nn if (!cmpChar(this.scanner.source, bStart, N)) {n this.scanner.error();n }nn a = prefix === '' ? '1' :n prefix === '+' ? '+1' :n prefix === '-' ? '-1' :n prefix;nn var len = this.scanner.tokenEnd - bStart;n if (len > 1) {n // ..n-..n if (this.scanner.source.charCodeAt(bStart + 1) !== HYPHENMINUS) {n this.scanner.error('Unexpected input', bStart + 1);n }nn if (len > 2) {n // ..n-{number}..n this.scanner.tokenStart = bStart + 2;n } else {n // ..n- {number}n this.scanner.next();n this.readSC();n }nn checkTokenIsInteger(this.scanner, DISALLOW_SIGN);n b = '-' + this.scanner.getTokenValue();n this.scanner.next();n end = this.scanner.tokenStart;n } else {n prefix = '';n this.scanner.next();n end = this.scanner.tokenStart;n this.readSC();nn if (this.scanner.tokenType === HYPHENMINUS ||n this.scanner.tokenType === PLUSSIGN) {n prefix = this.scanner.getTokenValue();n this.scanner.next();n this.readSC();n }nn if (this.scanner.tokenType === NUMBER) {n checkTokenIsInteger(this.scanner, prefix !== '');nn if (!isNumber(this.scanner.source.charCodeAt(this.scanner.tokenStart))) {n prefix = this.scanner.source.charAt(this.scanner.tokenStart);n this.scanner.tokenStart++;n }nn if (prefix === '') {n // should be an operator before numbern this.scanner.error();n } else if (prefix === '+') {n // plus is using by defaultn prefix = '';n }nn b = prefix + this.scanner.getTokenValue();nn this.scanner.next();n end = this.scanner.tokenStart;n } else {n if (prefix) {n this.scanner.eat(NUMBER);n }n }n }n } else {n if (prefix === '' || prefix === '+') { // no numbern this.scanner.error(n 'Number or identifier is expected',n this.scanner.tokenStart + (n this.scanner.tokenType === PLUSSIGN ||n this.scanner.tokenType === HYPHENMINUSn )n );n }nn b = prefix;n }nn return {n type: 'AnPlusB',n loc: this.getLocation(start, end),n a: a,n b: bn };n};n”,“var TYPE = require('../../tokenizer').TYPE;nnvar IDENTIFIER = TYPE.Identifier;nvar SEMICOLON = TYPE.Semicolon;nvar COMMERCIALAT = TYPE.CommercialAt;nvar LEFTCURLYBRACKET = TYPE.LeftCurlyBracket;nvar RIGHTCURLYBRACKET = TYPE.RightCurlyBracket;nvar BALANCED = true;nnfunction isBlockAtrule() {n for (var offset = 1, type; type = this.scanner.lookupType(offset); offset++) {n if (type === RIGHTCURLYBRACKET) {n return true;n }nn if (type === LEFTCURLYBRACKET ||n type === COMMERCIALAT) {n return false;n }n }nn this.scanner.skip(offset);n this.scanner.eat(RIGHTCURLYBRACKET);n}nnmodule.exports = function Atrule() {n var start = this.scanner.tokenStart;n var name;n var nameLowerCase;n var expression = null;n var block = null;nn this.scanner.eat(COMMERCIALAT);nn name = this.scanner.consume(IDENTIFIER);n nameLowerCase = name.toLowerCase();n this.readSC();nn if (this.parseAtruleExpression) {n expression = this.AtruleExpression(name);n this.readSC();n } else {n expression = this.Raw(BALANCED, SEMICOLON, LEFTCURLYBRACKET);n }nn if (this.atrule.hasOwnProperty(nameLowerCase)) {n if (typeof this.atrule.block === 'function') {n if (this.scanner.tokenType !== LEFTCURLYBRACKET) {n this.scanner.error('Curly bracket is expected');n }nn block = this.atrule.block.call(this);n } else {n this.scanner.eat(SEMICOLON);n }n } else {n switch (this.scanner.tokenType) {n case SEMICOLON:n this.scanner.next();n break;nn case LEFTCURLYBRACKET:n block = this.Block(isBlockAtrule.call(this) ? this.Declaration : this.Rule);n break;nn default:n this.scanner.error('Semicolon or block is expected');n }n }nn return {n type: 'Atrule',n loc: this.getLocation(start, this.scanner.tokenStart),n name: name,n expression: expression,n block: blockn };n};n”,“var List = require('../../utils/list');nnmodule.exports = function AtruleExpression(name) {n var children = null;nn if (name !== null) {n name = name.toLowerCase();n }nn // custom consumern if (this.atrule.hasOwnProperty(name)) {n if (typeof this.atrule.expression === 'function') {n children = this.atrule.expression.call(this);nn if (children instanceof List === false) {n return children;n }n }n } else {n // default consumern this.readSC();n children = this.readSequence(this.scopeAtruleExpression);n }nn if (children === null || children.isEmpty()) {n return null;n }nn return {n type: 'AtruleExpression',n loc: this.getLocationFromList(children),n children: childrenn };n};n”,“var TYPE = require('../../tokenizer').TYPE;nnvar IDENTIFIER = TYPE.Identifier;nvar STRING = TYPE.String;nvar DOLLARSIGN = TYPE.DollarSign;nvar ASTERISK = TYPE.Asterisk;nvar COLON = TYPE.Colon;nvar EQUALSSIGN = TYPE.EqualsSign;nvar LEFTSQUAREBRACKET = TYPE.LeftSquareBracket;nvar RIGHTSQUAREBRACKET = TYPE.RightSquareBracket;nvar CIRCUMFLEXACCENT = TYPE.CircumflexAccent;nvar VERTICALLINE = TYPE.VerticalLine;nvar TILDE = TYPE.Tilde;nnfunction getAttributeName() {n if (this.scanner.eof) {n this.scanner.error('Unexpected end of input');n }nn var start = this.scanner.tokenStart;n var expectIdentifier = false;n var checkColon = true;nn if (this.scanner.tokenType === ASTERISK) {n expectIdentifier = true;n checkColon = false;n this.scanner.next();n } else if (this.scanner.tokenType !== VERTICALLINE) {n this.scanner.eat(IDENTIFIER);n }nn if (this.scanner.tokenType === VERTICALLINE) {n if (this.scanner.lookupType(1) !== EQUALSSIGN) {n this.scanner.next();n this.scanner.eat(IDENTIFIER);n } else if (expectIdentifier) {n this.scanner.error('Identifier is expected', this.scanner.tokenEnd);n }n } else if (expectIdentifier) {n this.scanner.error('Vertical line is expected');n }nn if (checkColon && this.scanner.tokenType === COLON) {n this.scanner.next();n this.scanner.eat(IDENTIFIER);n }nn return {n type: 'Identifier',n loc: this.getLocation(start, this.scanner.tokenStart),n name: this.scanner.substrToCursor(start)n };n}nnfunction getOperator() {n var start = this.scanner.tokenStart;n var tokenType = this.scanner.tokenType;nn if (tokenType !== EQUALSSIGN && // =n tokenType !== TILDE && // ~=n tokenType !== CIRCUMFLEXACCENT && // ^=n tokenType !== DOLLARSIGN && // $=n tokenType !== ASTERISK && // *=n tokenType !== VERTICALLINE // |=n ) {n this.scanner.error('Attribute selector (=, ~=, ^=, $=, *=, |=) is expected');n }nn if (tokenType === EQUALSSIGN) {n this.scanner.next();n } else {n this.scanner.next();n this.scanner.eat(EQUALSSIGN);n }nn return this.scanner.substrToCursor(start);n}nn// '[' S* attrib_name ']'n// '[' S* attrib_name S* attrib_match S* [ IDENT | STRING ] S* attrib_flags? S* ']'nmodule.exports = function AttributeSelector() {n var start = this.scanner.tokenStart;n var name;n var operator = null;n var value = null;n var flags = null;nn this.scanner.eat(LEFTSQUAREBRACKET);n this.readSC();nn name = getAttributeName.call(this);n this.readSC();nn if (this.scanner.tokenType !== RIGHTSQUAREBRACKET) {n // avoid case `[name i]`n if (this.scanner.tokenType !== IDENTIFIER) {n operator = getOperator.call(this);nn this.readSC();nn value = this.scanner.tokenType === STRINGn ? this.String()n : this.Identifier();nn this.readSC();n }nn // attribute flagsn if (this.scanner.tokenType === IDENTIFIER) {n flags = this.scanner.getTokenValue();n this.scanner.next();nn this.readSC();n }n }nn this.scanner.eat(RIGHTSQUAREBRACKET);nn return {n type: 'AttributeSelector',n loc: this.getLocation(start, this.scanner.tokenStart),n name: name,n operator: operator,n value: value,n flags: flagsn };n};n”,“var List = require('../../utils/list');nvar TYPE = require('../../tokenizer').TYPE;nnvar WHITESPACE = TYPE.Whitespace;nvar COMMENT = TYPE.Comment;nvar SEMICOLON = TYPE.Semicolon;nvar COMMERCIALAT = TYPE.CommercialAt;nvar LEFTCURLYBRACKET = TYPE.LeftCurlyBracket;nvar RIGHTCURLYBRACKET = TYPE.RightCurlyBracket;nnmodule.exports = function Block(defaultConsumer) {n defaultConsumer = defaultConsumer || this.Declaration;nn var start = this.scanner.tokenStart;n var children = new List();nn this.scanner.eat(LEFTCURLYBRACKET);nn scan:n while (!this.scanner.eof) {n switch (this.scanner.tokenType) {n case RIGHTCURLYBRACKET:n break scan;nn case WHITESPACE:n case COMMENT:n case SEMICOLON:n this.scanner.next();n break;nn case COMMERCIALAT:n children.appendData(this.Atrule());n break;nn default:n children.appendData(defaultConsumer.call(this));n }n }nn this.scanner.eat(RIGHTCURLYBRACKET);nn return {n type: 'Block',n loc: this.getLocation(start, this.scanner.tokenStart),n children: childrenn };n};n”,“var TYPE = require('../../tokenizer').TYPE;nvar LEFTSQUAREBRACKET = TYPE.LeftSquareBracket;nvar RIGHTSQUAREBRACKET = TYPE.RightSquareBracket;nn// currently only Grid Layout uses square brackets, but left it universaln// drafts.csswg.org/css-grid/#track-sizingn// [ ident* ]nmodule.exports = function Brackets(readSequence) {n var start = this.scanner.tokenStart;n var children = null;nn this.scanner.eat(LEFTSQUAREBRACKET);n children = readSequence.call(this);n this.scanner.eat(RIGHTSQUAREBRACKET);nn return {n type: 'Brackets',n loc: this.getLocation(start, this.scanner.tokenStart),n children: childrenn };n};n”,“var TYPE = require('../../tokenizer').TYPE;nvar IDENTIFIER = TYPE.Identifier;nvar FULLSTOP = TYPE.FullStop;nn// '.' identnmodule.exports = function ClassSelector() {n this.scanner.eat(FULLSTOP);nn return {n type: 'ClassSelector',n loc: this.getLocation(this.scanner.tokenStart - 1, this.scanner.tokenEnd),n name: this.scanner.consume(IDENTIFIER)n };n};n”,“var TYPE = require('../../tokenizer').TYPE;nnvar PLUSSIGN = TYPE.PlusSign;nvar SOLIDUS = TYPE.Solidus;nvar GREATERTHANSIGN = TYPE.GreaterThanSign;nvar TILDE = TYPE.Tilde;nn// + | > | ~ | /deep/nmodule.exports = function Combinator() {n var start = this.scanner.tokenStart;nn switch (this.scanner.tokenType) {n case GREATERTHANSIGN:n case PLUSSIGN:n case TILDE:n this.scanner.next();n break;nn case SOLIDUS:n this.scanner.next();n this.scanner.expectIdentifier('deep');n this.scanner.eat(SOLIDUS);n break;nn default:n this.scanner.error('Combinator is expected');n }nn return {n type: 'Combinator',n loc: this.getLocation(start, this.scanner.tokenStart),n name: this.scanner.substrToCursor(start)n };n};n”,“var TYPE = require('../../tokenizer').TYPE;nnvar ASTERISK = TYPE.Asterisk;nvar SOLIDUS = TYPE.Solidus;nn// '/*' .* '*/'nmodule.exports = function Comment() {n var start = this.scanner.tokenStart;n var end = this.scanner.tokenEnd;nn if ((end - start + 2) >= 2 &&n this.scanner.source.charCodeAt(end - 2) === ASTERISK &&n this.scanner.source.charCodeAt(end - 1) === SOLIDUS) {n end -= 2;n }nn this.scanner.next();nn return {n type: 'Comment',n loc: this.getLocation(start, this.scanner.tokenStart),n value: this.scanner.source.substring(start + 2, end)n };n};n”,“var TYPE = require('../../tokenizer').TYPE;nnvar IDENTIFIER = TYPE.Identifier;nvar COLON = TYPE.Colon;nvar EXCLAMATIONMARK = TYPE.ExclamationMark;nvar SOLIDUS = TYPE.Solidus;nvar ASTERISK = TYPE.Asterisk;nvar DOLLARSIGN = TYPE.DollarSign;nvar HYPHENMINUS = TYPE.HyphenMinus;nvar SEMICOLON = TYPE.Semicolon;nvar RIGHTCURLYBRACKET = TYPE.RightCurlyBracket;nvar RIGHTPARENTHESIS = TYPE.RightParenthesis;nvar BALANCED = true;nnfunction readProperty() {n var start = this.scanner.tokenStart;n var prefix = 0;nn // hacksn switch (this.scanner.tokenType) {n case ASTERISK:n case DOLLARSIGN:n prefix = 1;n break;nn // TODO: not sure we should support this hackn case SOLIDUS:n prefix = this.scanner.lookupType(1) === SOLIDUS ? 2 : 1;n break;n }nn if (this.scanner.lookupType(prefix) === HYPHENMINUS) {n prefix++;n }nn if (prefix) {n this.scanner.skip(prefix);n }nn this.scanner.eat(IDENTIFIER);nn return this.scanner.substrToCursor(start);n}nn// ! ws* importantnfunction getImportant() {n this.scanner.eat(EXCLAMATIONMARK);n this.readSC();nn this.scanner.expectIdentifier('important');nn // should return identifier in future for original source restoring as isn // returns true for now since it's fit to optimizer purposesn return true;n}nnfunction isCustomProperty(name) {n return name.length >= 2 &&n name.charCodeAt(0) === HYPHENMINUS &&n name.charCodeAt(1) === HYPHENMINUS;n}nnmodule.exports = function Declaration() {n var start = this.scanner.tokenStart;n var property = readProperty.call(this);n var important = false;n var value;nn this.readSC();n this.scanner.eat(COLON);nn if (isCustomProperty(property) ? this.parseCustomProperty : this.parseValue) {n value = this.Value(property);n } else {n value = this.Raw(BALANCED, SEMICOLON, EXCLAMATIONMARK);n }nn if (this.scanner.tokenType === EXCLAMATIONMARK) {n important = getImportant.call(this);n this.readSC();n }nn // TODO: include or not to include semicolon to range?n // if (this.scanner.tokenType === SEMICOLON) {n // this.scanner.next();n // }nn if (!this.scanner.eof &&n this.scanner.tokenType !== SEMICOLON &&n this.scanner.tokenType !== RIGHTPARENTHESIS &&n this.scanner.tokenType !== RIGHTCURLYBRACKET) {n this.scanner.error();n }nn return {n type: 'Declaration',n loc: this.getLocation(start, this.scanner.tokenStart),n important: important,n property: property,n value: valuen };n};n”,“var List = require('../../utils/list');nvar TYPE = require('../../tokenizer').TYPE;nnvar WHITESPACE = TYPE.Whitespace;nvar COMMENT = TYPE.Comment;nvar SEMICOLON = TYPE.Semicolon;nnmodule.exports = function DeclarationList() {n var children = new List();nn scan:n while (!this.scanner.eof) {n switch (this.scanner.tokenType) {n case WHITESPACE:n case COMMENT:n case SEMICOLON:n this.scanner.next();n break;nn default:n children.appendData(this.Declaration());n }n }nn return {n type: 'DeclarationList',n loc: this.getLocationFromList(children),n children: childrenn };n};n”,“var NUMBER = require('../../tokenizer').TYPE.Number;nn// special reader for units to avoid adjoined IE hacks (i.e. '1px\9')nfunction readUnit(scanner) {n var unit = scanner.getTokenValue();n var backSlashPos = unit.indexOf('\\');nn if (backSlashPos !== -1) {n // patch token offsetn scanner.tokenStart += backSlashPos;nn // return part before backslashn return unit.substring(0, backSlashPos);n }nn // no backslash in unit namen scanner.next();nn return unit;n}nn// number identnmodule.exports = function Dimension() {n var start = this.scanner.tokenStart;n var value = this.scanner.consume(NUMBER);n var unit = readUnit(this.scanner);nn return {n type: 'Dimension',n loc: this.getLocation(start, this.scanner.tokenStart),n value: value,n unit: unitn };n};n”,“var TYPE = require('../../tokenizer').TYPE;nnvar IDENTIFIER = TYPE.Identifier;nvar LEFTPARENTHESIS = TYPE.LeftParenthesis;nvar RIGHTPARENTHESIS = TYPE.RightParenthesis;nn// ident '(' <sequence> ')'nmodule.exports = function Function(scope, readSequence) {n var start = this.scanner.tokenStart;n var name = this.scanner.consume(IDENTIFIER);n var nameLowerCase = name.toLowerCase();n var children;nn this.scanner.eat(LEFTPARENTHESIS);nn children = scope.hasOwnProperty(nameLowerCase)n ? scope.call(this, scope, start, readSequence)n : readSequence.call(this, scope);nn this.scanner.eat(RIGHTPARENTHESIS);nn return {n type: 'Function',n loc: this.getLocation(start, this.scanner.tokenStart),n name: name,n children: childrenn };n};n”,“var isNumber = require('../../tokenizer').isNumber;nvar TYPE = require('../../tokenizer').TYPE;nnvar IDENTIFIER = TYPE.Identifier;nvar NUMBER = TYPE.Number;nvar NUMBERSIGN = TYPE.NumberSign;nvar PLUSSIGN = TYPE.PlusSign;nvar HYPHENMINUS = TYPE.HyphenMinus;nvar FULLSTOP = TYPE.FullStop;nn// # identnmodule.exports = function HexColor() {n var start = this.scanner.tokenStart;nn this.scanner.eat(NUMBERSIGN);nn scan:n switch (this.scanner.tokenType) {n case NUMBER:n if (!isNumber(this.scanner.source.charCodeAt(this.scanner.tokenStart))) {n this.scanner.error('Unexpected input', this.scanner.tokenStart);n }nn for (var pos = this.scanner.tokenStart + 1; pos < this.scanner.tokenEnd; pos++) {n var code = this.scanner.source.charCodeAt(pos);nn // break on fullstop or hyperminus/plussign after exponentn if (code === FULLSTOP || code === HYPHENMINUS || code === PLUSSIGN) {n // break token, exclude symboln this.scanner.tokenStart = pos;n break scan;n }n }nn // number contains digits only, go to next tokenn this.scanner.next();nn // if next token is identifier add it to resultn // TODO: consume hex onlyn if (this.scanner.tokenType === IDENTIFIER) {n this.scanner.next();n }nn break;nn case IDENTIFIER:n // TODO: consume hex onlyn this.scanner.next(); // add token to resultn break;nn default:n this.scanner.error('Number or identifier is expected');n }nn return {n type: 'HexColor',n loc: this.getLocation(start, this.scanner.tokenStart),n value: this.scanner.substrToCursor(start + 1) // skip #n };n};n”,“var TYPE = require('../../tokenizer').TYPE;nvar IDENTIFIER = TYPE.Identifier;nnmodule.exports = function Identifier() {n return {n type: 'Identifier',n loc: this.getLocation(this.scanner.tokenStart, this.scanner.tokenEnd),n name: this.scanner.consume(IDENTIFIER)n };n};n”,“var TYPE = require('../../tokenizer').TYPE;nvar IDENTIFIER = TYPE.Identifier;nvar NUMBERSIGN = TYPE.NumberSign;nn// '#' identnmodule.exports = function IdSelector() {n this.scanner.eat(NUMBERSIGN);nn return {n type: 'IdSelector',n loc: this.getLocation(this.scanner.tokenStart - 1, this.scanner.tokenEnd),n name: this.scanner.consume(IDENTIFIER)n };n};n”,“var TYPE = require('../../tokenizer').TYPE;nnvar IDENTIFIER = TYPE.Identifier;nvar NUMBER = TYPE.Number;nvar LEFTPARENTHESIS = TYPE.LeftParenthesis;nvar RIGHTPARENTHESIS = TYPE.RightParenthesis;nvar COLON = TYPE.Colon;nvar SOLIDUS = TYPE.Solidus;nnmodule.exports = function MediaFeature() {n var start = this.scanner.tokenStart;n var name;n var value = null;nn this.scanner.eat(LEFTPARENTHESIS);n this.readSC();nn name = this.scanner.consume(IDENTIFIER);n this.readSC();nn if (this.scanner.tokenType !== RIGHTPARENTHESIS) {n this.scanner.eat(COLON);n this.readSC();nn switch (this.scanner.tokenType) {n case NUMBER:n if (this.scanner.lookupType(1) === IDENTIFIER) {n value = this.Dimension();n } else if (this.scanner.lookupNonWSType(1) === SOLIDUS) {n value = this.Ratio();n } else {n value = this.Number();n }nn break;nn case IDENTIFIER:n value = this.Identifier();nn break;nn default:n this.scanner.error('Number, dimension, ratio or identifier is expected');n }nn this.readSC();n }nn this.scanner.eat(RIGHTPARENTHESIS);nn return {n type: 'MediaFeature',n loc: this.getLocation(start, this.scanner.tokenStart),n name: name,n value: valuen };n};n”,“var List = require('../../utils/list');nvar TYPE = require('../../tokenizer').TYPE;nnvar WHITESPACE = TYPE.Whitespace;nvar COMMENT = TYPE.Comment;nvar IDENTIFIER = TYPE.Identifier;nvar LEFTPARENTHESIS = TYPE.LeftParenthesis;nnmodule.exports = function MediaQuery() {n this.readSC();nn var children = new List();n var child = null;n var space = null;nn scan:n while (!this.scanner.eof) {n switch (this.scanner.tokenType) {n case COMMENT:n this.scanner.next();n continue;nn case WHITESPACE:n space = this.WhiteSpace();n continue;nn case IDENTIFIER:n child = this.Identifier();n break;nn case LEFTPARENTHESIS:n child = this.MediaFeature();n break;nn default:n break scan;n }nn if (space !== null) {n children.appendData(space);n space = null;n }nn children.appendData(child);n }nn if (child === null) {n this.scanner.error('Identifier or parenthesis is expected');n }nn return {n type: 'MediaQuery',n loc: this.getLocationFromList(children),n children: childrenn };n};n”,“var List = require('../../utils/list');nvar COMMA = require('../../tokenizer').TYPE.Comma;nnmodule.exports = function MediaQueryList(relative) {n var children = new List();nn this.readSC();nn while (!this.scanner.eof) {n children.appendData(this.MediaQuery(relative));nn if (this.scanner.tokenType !== COMMA) {n break;n }nn this.scanner.next();n }nn return {n type: 'MediaQueryList',n loc: this.getLocationFromList(children),n children: childrenn };n};n”,“// drafts.csswg.org/css-syntax-3/#the-anb-typenmodule.exports = function Nth(allowOfClause) {n this.readSC();nn var start = this.scanner.tokenStart;n var end = start;n var selector = null;n var query;nn if (this.scanner.lookupValue(0, 'odd') || this.scanner.lookupValue(0, 'even')) {n query = this.Identifier();n } else {n query = this.AnPlusB();n }nn this.readSC();nn if (allowOfClause && this.scanner.lookupValue(0, 'of')) {n this.scanner.next();nn selector = this.SelectorList();nn if (this.needPositions) {n end = selector.children.last().loc.end.offset;n }n } else {n if (this.needPositions) {n end = query.loc.end.offset;n }n }nn return {n type: 'Nth',n loc: this.getLocation(start, end),n nth: query,n selector: selectorn };n};n”,“var NUMBER = require('../../tokenizer').TYPE.Number;nnmodule.exports = function Number() {n return {n type: 'Number',n loc: this.getLocation(this.scanner.tokenStart, this.scanner.tokenEnd),n value: this.scanner.consume(NUMBER)n };n};n”,“// '/' | '*' | ',' | ':' | '+' | '-'nmodule.exports = function Operator() {n var start = this.scanner.tokenStart;nn this.scanner.next();nn return {n type: 'Operator',n loc: this.getLocation(start, this.scanner.tokenStart),n value: this.scanner.substrToCursor(start)n };n};n”,“var TYPE = require('../../tokenizer').TYPE;nvar LEFTPARENTHESIS = TYPE.LeftParenthesis;nvar RIGHTPARENTHESIS = TYPE.RightParenthesis;nnmodule.exports = function Parentheses(readSequence) {n var start = this.scanner.tokenStart;n var children = null;nn this.scanner.eat(LEFTPARENTHESIS);n children = readSequence.call(this);n this.scanner.eat(RIGHTPARENTHESIS);nn return {n type: 'Parentheses',n loc: this.getLocation(start, this.scanner.tokenStart),n children: childrenn };n};n”,“var TYPE = require('../../tokenizer').TYPE;nnvar NUMBER = TYPE.Number;nvar PERCENTSIGN = TYPE.PercentSign;nnmodule.exports = function Percentage() {n var start = this.scanner.tokenStart;n var number = this.scanner.consume(NUMBER);nn this.scanner.eat(PERCENTSIGN);nn return {n type: 'Percentage',n loc: this.getLocation(start, this.scanner.tokenStart),n value: numbern };n};n”,“var List = require('../../utils/list');nvar TYPE = require('../../tokenizer').TYPE;nnvar IDENTIFIER = TYPE.Identifier;nvar COLON = TYPE.Colon;nvar LEFTPARENTHESIS = TYPE.LeftParenthesis;nvar RIGHTPARENTHESIS = TYPE.RightParenthesis;nvar BALANCED = true;nn// : ident [ '(' .. ')' ]?nmodule.exports = function PseudoClassSelector() {n var start = this.scanner.tokenStart;n var name;n var children = null;nn this.scanner.eat(COLON);nn name = this.scanner.consume(IDENTIFIER);nn if (this.scanner.tokenType === LEFTPARENTHESIS) {n var nameLowerCase = name.toLowerCase();nn this.scanner.next();nn if (this.pseudo.hasOwnProperty(nameLowerCase)) {n this.readSC();n children = this.pseudo.call(this);n this.readSC();n } else {n children = new List().appendData(this.Raw(BALANCED, 0, 0));n }nn this.scanner.eat(RIGHTPARENTHESIS);n }nn return {n type: 'PseudoClassSelector',n loc: this.getLocation(start, this.scanner.tokenStart),n name: name,n children: childrenn };n};n”,“var List = require('../../utils/list');nvar TYPE = require('../../tokenizer').TYPE;nnvar IDENTIFIER = TYPE.Identifier;nvar COLON = TYPE.Colon;nvar LEFTPARENTHESIS = TYPE.LeftParenthesis;nvar RIGHTPARENTHESIS = TYPE.RightParenthesis;nvar BALANCED = true;nn//

ident [ '(' .. ')' ]?nmodule.exports = function PseudoElementSelector() n var start = this.scanner.tokenStart;n var name;n var children = null;nn this.scanner.eat(COLON);n this.scanner.eat(COLON);nn name = this.scanner.consume(IDENTIFIER);nn if (this.scanner.tokenType === LEFTPARENTHESIS) {n var nameLowerCase = name.toLowerCase();nn this.scanner.next();nn if (this.pseudo.hasOwnProperty(nameLowerCase)) {n this.readSC();n children = this.pseudo[nameLowerCase].call(this);n this.readSC();n } else {n children = new List().appendData(this.Raw(BALANCED, 0, 0));n }nn this.scanner.eat(RIGHTPARENTHESIS);n }nn return {n type: ‘PseudoElementSelector’,n loc: this.getLocation(start, this.scanner.tokenStart),n name: name,n children: childrenn };n};n“,”var isNumber = require(‘../../tokenizer’).isNumber;nvar TYPE = require(‘../../tokenizer’).TYPE;nvar NUMBER = TYPE.Number;nvar SOLIDUS = TYPE.Solidus;nnfunction readPositiveInteger(scanner) {n var value = scanner.consumeNonWS(NUMBER);nn for (var i = 0; i < value.length; i++) {\n if (!isNumber(value.charCodeAt(i))) {\n scanner.error('Positive integer is expected', scanner.tokenStart - value.length + i);\n }\n }\n\n return value;\n}\n\n// S* ‘/’ S* nmodule.exports = function Ratio() {n var start = this.scanner.tokenStart;n var left = readPositiveInteger(this.scanner);n var right;nn this.scanner.eatNonWS(SOLIDUS);n right = readPositiveInteger(this.scanner);nn return {n type: ‘Ratio’,n loc: this.getLocation(start, this.scanner.tokenStart),n left: left,n right: rightn };n};n“,”var TYPE = require(‘../../tokenizer’).TYPE;nnvar WHITESPACE = TYPE.Whitespace;nvar LEFTPARENTHESIS = TYPE.LeftParenthesis;nvar RIGHTPARENTHESIS = TYPE.RightParenthesis;nvar LEFTCURLYBRACKET = TYPE.LeftCurlyBracket;nvar RIGHTCURLYBRACKET = TYPE.RightCurlyBracket;nvar LEFTSQUAREBRACKET = TYPE.LeftSquareBracket;nvar RIGHTSQUAREBRACKET = TYPE.RightSquareBracket;nnmodule.exports = function Raw(balanced, endTokenType1, endTokenType2) {n var start = this.scanner.tokenStart;n var stack = [];n var popType = 0;n var type = 0;nn if (balanced) {n scan:n for (var i = 0; type = this.scanner.lookupType(i); i++) {n if (popType === 0) {n if (type === endTokenType1 ||n type === endTokenType2) {n break scan;n }n }nn switch (type) {n case popType:n popType = stack.pop();n break;nn case RIGHTPARENTHESIS:n case RIGHTCURLYBRACKET:n case RIGHTSQUAREBRACKET:n if (popType !== 0) {n this.scanner.skip(i);n this.scanner.error();n }n break scan;nn case LEFTPARENTHESIS:n stack.push(popType);n popType = RIGHTPARENTHESIS;n break;nn case LEFTCURLYBRACKET:n stack.push(popType);n popType = RIGHTCURLYBRACKET;n break;nn case LEFTSQUAREBRACKET:n stack.push(popType);n popType = RIGHTSQUAREBRACKET;n break;n }n }n } else {n for (var i = 0; type = this.scanner.lookupType(i); i++) {n if (type === WHITESPACE ||n type === endTokenType1 ||n type === endTokenType2) {n break;n }n }n }nn this.scanner.skip(i);nn if (popType !== 0) {n this.scanner.eat(popType);n }nn return {n type: ‘Raw’,n loc: this.getLocation(start, this.scanner.tokenStart),n value: this.scanner.substrToCursor(start)n };n};n“,”var TYPE = require(‘../../tokenizer’).TYPE;nvar LEFTCURLYBRACKET = TYPE.LeftCurlyBracket;nvar BALANCED = true;nnmodule.exports = function Rule() {n var start = this.scanner.tokenStart;n var selector = this.parseSelector ? this.SelectorList() : this.Raw(BALANCED, LEFTCURLYBRACKET, 0);n var block = this.Block(this.Declaration);nn return {n type: ‘Rule’,n loc: this.getLocation(start, this.scanner.tokenStart),n selector: selector,n block: blockn };n};n“,”module.exports = function Selector() {n var children = this.readSelectorSequence();nn return {n type: ‘Selector’,n loc: this.getLocationFromList(children),n children: childrenn };n};n“,”var List = require(‘../../utils/list’);nvar TYPE = require(‘../../tokenizer’).TYPE;nnvar COMMA = TYPE.Comma;nvar LEFTCURLYBRACKET = TYPE.LeftCurlyBracket;nvar BALANCED = true;nnmodule.exports = function SelectorList() {n var children = new List();nn while (!this.scanner.eof) {n children.appendData(this.parseSelectorn ? this.Selector()n : this.Raw(BALANCED, COMMA, LEFTCURLYBRACKET)n );nn if (this.scanner.tokenType === COMMA) {n this.scanner.next();n continue;n }nn break;n }nn return {n type: ‘SelectorList’,n loc: this.getLocationFromList(children),n children: childrenn };n};n“,”var STRING = require(‘../../tokenizer’).TYPE.String;nnmodule.exports = function String() {n return {n type: ‘String’,n loc: this.getLocation(this.scanner.tokenStart, this.scanner.tokenEnd),n value: this.scanner.consume(STRING)n };n};n“,”var List = require(‘../../utils/list’);nvar TYPE = require(‘../../tokenizer’).TYPE;nnvar WHITESPACE = TYPE.Whitespace;nvar COMMENT = TYPE.Comment;nvar EXCLAMATIONMARK = TYPE.ExclamationMark;nvar COMMERCIALAT = TYPE.CommercialAt;nnmodule.exports = function StyleSheet() {n var start = this.scanner.tokenStart;n var children = new List();n var child;nn scan:n while (!this.scanner.eof) {n switch (this.scanner.tokenType) {n case WHITESPACE:n this.scanner.next();n continue;nn case COMMENT:n // ignore comments except exclamation comments (i.e. /*! .. */) on top leveln if (this.scanner.source.charCodeAt(this.scanner.tokenStart + 2) !== EXCLAMATIONMARK) {n this.scanner.next();n continue;n }nn child = this.Comment();n break;nn case COMMERCIALAT:n child = this.Atrule();n break;nn default:n child = this.Rule();n }nn children.appendData(child);n }nn return {n type: ‘StyleSheet’,n loc: this.getLocation(start, this.scanner.tokenStart),n children: childrenn };n};n“,”var TYPE = require(‘../../tokenizer’).TYPE;nnvar IDENTIFIER = TYPE.Identifier;nvar ASTERISK = TYPE.Asterisk;nvar VERTICALLINE = TYPE.VerticalLine;nnfunction eatIdentifierOrAsterisk() {n if (this.scanner.tokenType !== IDENTIFIER &&n this.scanner.tokenType !== ASTERISK) {n this.scanner.error(‘Identifier or asterisk is expected’);n }nn this.scanner.next();n}nn// identn// ident|identn// ident|*n// *n// *|identn// *|*n// |identn// |*nmodule.exports = function TypeSelector() {n var start = this.scanner.tokenStart;nn if (this.scanner.tokenType === VERTICALLINE) {n this.scanner.next();n eatIdentifierOrAsterisk.call(this);n } else {n eatIdentifierOrAsterisk.call(this);nn if (this.scanner.tokenType === VERTICALLINE) {n this.scanner.next();n eatIdentifierOrAsterisk.call(this);n }n }nn return {n type: ‘TypeSelector’,n loc: this.getLocation(start, this.scanner.tokenStart),n name: this.scanner.substrToCursor(start)n };n};n“,”var isHex = require(‘../../tokenizer’).isHex;nvar TYPE = require(‘../../tokenizer’).TYPE;nnvar IDENTIFIER = TYPE.Identifier;nvar NUMBER = TYPE.Number;nvar PLUSSIGN = TYPE.PlusSign;nvar HYPHENMINUS = TYPE.HyphenMinus;nvar FULLSTOP = TYPE.FullStop;nvar QUESTIONMARK = TYPE.QuestionMark;nnfunction scanUnicodeNumber(scanner) {n for (var pos = scanner.tokenStart + 1; pos < scanner.tokenEnd; pos++) {\n var code = scanner.source.charCodeAt(pos);\n\n // break on fullstop or hyperminus/plussign after exponent\n if (code === FULLSTOP || code === PLUSSIGN) {\n // break token, exclude symbol\n scanner.tokenStart = pos;\n return false;\n }\n }\n\n return true;\n}\n\n// https://drafts.csswg.org/css-syntax-3/#urange\nfunction scanUnicodeRange(scanner) {\n var hexStart = scanner.tokenStart + 1; // skip +\n var hexLength = 0;\n\n scan: {\n if (scanner.tokenType === NUMBER) {\n if (scanner.source.charCodeAt(scanner.tokenStart) !== FULLSTOP && scanUnicodeNumber(scanner)) {\n scanner.next();\n } else if (scanner.source.charCodeAt(scanner.tokenStart) !== HYPHENMINUS) {\n break scan;\n }\n } else {\n scanner.next(); // PLUSSIGN\n }\n\n if (scanner.tokenType === HYPHENMINUS) {\n scanner.next();\n }\n\n if (scanner.tokenType === NUMBER) {\n scanner.next();\n }\n\n if (scanner.tokenType === IDENTIFIER) {\n scanner.next();\n }\n\n if (scanner.tokenStart === hexStart) {\n scanner.error('Unexpected input', hexStart);\n }\n }\n\n // validate for U+x{1,6} or U+x{1,6}-x{1,6}\n // where x is [0-9a-fA-F]\n for (var i = hexStart, wasHyphenMinus = false; i < scanner.tokenStart; i++) {\n var code = scanner.source.charCodeAt(i);\n\n if (isHex(code) === false && (code !== HYPHENMINUS || wasHyphenMinus)) {\n scanner.error('Unexpected input', i);\n }\n\n if (code === HYPHENMINUS) {\n // hex sequence shouldn't be an empty\n if (hexLength === 0) {\n scanner.error('Unexpected input', i);\n }\n\n wasHyphenMinus = true;\n hexLength = 0;\n } else {\n hexLength++;\n\n // too long hex sequence\n if (hexLength > 6) {n scanner.error(‘Too long hex sequence’, i);n }n }nn }nn // check we have a non-zero sequencen if (hexLength === 0) {n scanner.error(‘Unexpected input’, i - 1);n }nn // U+abc???n if (!wasHyphenMinus) {n // consume as many U+003F QUESTION MARK (?) code points as possiblen for (; hexLength < 6 && !scanner.eof; scanner.next()) {\n if (scanner.tokenType !== QUESTIONMARK) {\n break;\n }\n\n hexLength++;\n }\n }\n}\n\nmodule.exports = function UnicodeRange() {\n var start = this.scanner.tokenStart;\n\n this.scanner.next(); // U or u\n scanUnicodeRange(this.scanner);\n\n return {\n type: 'UnicodeRange',\n loc: this.getLocation(start, this.scanner.tokenStart),\n value: this.scanner.substrToCursor(start)\n };\n};\n","var TYPE = require('../../tokenizer').TYPE;\n\nvar STRING = TYPE.String;\nvar LEFTPARENTHESIS = TYPE.LeftParenthesis;\nvar RIGHTPARENTHESIS = TYPE.RightParenthesis;\nvar NONBALANCED = false;\n\n// url '(' S* (string | raw) S* ')'\nmodule.exports = function Url() {\n var start = this.scanner.tokenStart;\n var value;\n\n this.scanner.expectIdentifier('url');\n this.scanner.eat(LEFTPARENTHESIS);\n this.readSC();\n\n if (this.scanner.tokenType === STRING) {\n value = this.String();\n } else {\n value = this.Raw(NONBALANCED, LEFTPARENTHESIS, RIGHTPARENTHESIS);\n }\n\n this.readSC();\n this.scanner.eat(RIGHTPARENTHESIS);\n\n return {\n type: 'Url',\n loc: this.getLocation(start, this.scanner.tokenStart),\n value: value\n };\n};\n","var endsWith = require('../../tokenizer').endsWith;\nvar TYPE = require('../../tokenizer').TYPE;\n\nvar WHITESPACE = TYPE.Whitespace;\nvar COMMENT = TYPE.Comment;\nvar LEFTPARENTHESIS = TYPE.LeftParenthesis;\nvar COLON = TYPE.Colon;\nvar SEMICOLON = TYPE.Semicolon;\nvar EXCLAMATIONMARK = TYPE.ExclamationMark;\nvar BALANCED = true;\n\nmodule.exports = function Value(property) {\n // special parser for filter property since it can contains non-standart syntax for old IE\n if (property !== null && endsWith(property, 'filter') && checkProgid(this.scanner)) {\n this.readSC();\n return this.Raw(BALANCED, SEMICOLON, EXCLAMATIONMARK);\n }\n\n var start = this.scanner.tokenStart;\n var children = this.readSequence(this.scopeValue);\n\n return {\n type: 'Value',\n loc: this.getLocation(start, this.scanner.tokenStart),\n children: children\n };\n};\n\n// 'progid:' ws* 'DXImageTransform.Microsoft.' ident ws* '(' .* ')'\nfunction checkProgid(scanner) {\n var offset = 0;\n\n for (var type; type = scanner.lookupType(offset); offset++) {\n if (type !== WHITESPACE && type !== COMMENT) {\n break;\n }\n }\n\n if (scanner.lookupValue(offset, 'alpha') ||\n scanner.lookupValue(offset, 'dropshadow')) {\n if (scanner.lookupType(offset + 1) !== LEFTPARENTHESIS) {\n return false;\n }\n } else {\n if (scanner.lookupValue(offset, 'progid') === false ||\n scanner.lookupType(offset + 1) !== COLON) {\n return false;\n }\n }\n\n return true;\n}\n","var WHITESPACE = require('../../tokenizer').TYPE.Whitespace;\nvar SPACE = Object.freeze({\n type: 'WhiteSpace',\n loc: null,\n value: ' '\n});\n\nmodule.exports = function WhiteSpace() {\n this.scanner.eat(WHITESPACE);\n return SPACE;\n\n // return {\n // type: 'WhiteSpace',\n // loc: this.getLocation(this.scanner.tokenStart, this.scanner.tokenEnd),\n // value: this.scanner.consume(WHITESPACE)\n // };\n};\n","var List = require('../../utils/list');\n\n// https://drafts.csswg.org/css-images-4/#element-notation\n// https://developer.mozilla.org/en-US/docs/Web/CSS/element\nmodule.exports = function() {\n this.readSC();\n\n var id = this.IdSelector();\n\n this.readSC();\n\n return new List().appendData(\n id\n );\n};\n","var List = require('../../utils/list');\nvar BALANCED = true;\n\n// legacy IE function\n// expression '(' raw ')'\nmodule.exports = function getOldIEExpression() {\n return new List().appendData(\n this.Raw(BALANCED, 0, 0)\n );\n};\n","var List = require('../../utils/list');\nvar TYPE = require('../../tokenizer').TYPE;\n\nvar IDENTIFIER = TYPE.Identifier;\nvar COMMA = TYPE.Comma;\nvar HYPHENMINUS = TYPE.HyphenMinus;\nvar EXCLAMATIONMARK = TYPE.ExclamationMark;\nvar BALANCED = true;\n\n// var '(' ident (',' ? )? ‘)’nmodule.exports = function getVarFunction() {n var children = new List();nn this.readSC();nn var identStart = this.scanner.tokenStart;nn this.scanner.eat(HYPHENMINUS);n if (this.scanner.source.charCodeAt(this.scanner.tokenStart) !== HYPHENMINUS) {n this.scanner.error(‘HyphenMinus is expected’);n }n this.scanner.eat(IDENTIFIER);nn children.appendData({n type: ‘Identifier’,n loc: this.getLocation(identStart, this.scanner.tokenStart),n name: this.scanner.substrToCursor(identStart)n });nn this.readSC();nn if (this.scanner.tokenType === COMMA) {n children.appendData(this.Operator());n children.appendData(this.parseCustomPropertyn ? this.Value(null)n : this.Raw(BALANCED, HYPHENMINUS, EXCLAMATIONMARK)n );n }nn return children;n};n“,”var List = require(‘../../utils/list’);nvar TYPE = require(‘../../tokenizer’).TYPE;nnvar STRING = TYPE.String;nvar IDENTIFIER = TYPE.Identifier;nvar LEFTPARENTHESIS = TYPE.LeftParenthesis;nnmodule.exports = {n expression: function() {n var children = new List();nn this.readSC();nn switch (this.scanner.tokenType) {n case STRING:n children.appendData(this.String());n break;nn case IDENTIFIER:n children.appendData(this.Url());n break;nn default:n this.scanner.error(‘String or url() is expected’);n }nn if (this.scanner.lookupNonWSType(0) === IDENTIFIER ||n this.scanner.lookupNonWSType(0) === LEFTPARENTHESIS) {n children.appendData(this.WhiteSpace());n children.appendData(this.MediaQueryList());n }nn return children;n },n block: falsen};n“,”module.exports = {n expression: function() {n return this.MediaQueryList();n },n block: function() {n return this.Block(this.Rule);n }n};n“,”var TYPE = require(‘../../tokenizer’).TYPE;nvar LEFTCURLYBRACKET = TYPE.LeftCurlyBracket;nnmodule.exports = {n expression: function() {n if (this.scanner.lookupNonWSType(0) === LEFTCURLYBRACKET) {n return null;n }nn return this.SelectorList();n },n block: function() {n return this.Block(this.Declaration);n }n};n“,”var List = require(‘../../utils/list’);nvar TYPE = require(‘../../tokenizer’).TYPE;nnvar WHITESPACE = TYPE.Whitespace;nvar COMMENT = TYPE.Comment;nvar IDENTIFIER = TYPE.Identifier;nvar LEFTPARENTHESIS = TYPE.LeftParenthesis;nvar HYPHENMINUS = TYPE.HyphenMinus;nvar COLON = TYPE.Colon;nvar BALANCED = true;nnfunction readRaw() {n return new List().appendData(n this.Raw(BALANCED, 0, 0)n );n}nnfunction parentheses() {n var index = 0;nn this.readSC();nn // TODO: make it simpliern if (this.scanner.tokenType === IDENTIFIER) {n index = 1;n } else if (this.scanner.tokenType === HYPHENMINUS &&n this.scanner.lookupType(1) === IDENTIFIER) {n index = 2;n }nn if (index !== 0 && this.scanner.lookupNonWSType(index) === COLON) {n return new List().appendData(n this.Declaration()n );n }nn return readSequence.call(this);n}nnfunction readSequence() {n var children = new List();n var space = null;n var child;nn this.readSC();nn scan:n while (!this.scanner.eof) {n switch (this.scanner.tokenType) {n case WHITESPACE:n space = this.WhiteSpace();n continue;nn case COMMENT:n this.scanner.next();n continue;nn case IDENTIFIER:n if (this.scanner.lookupType(1) === LEFTPARENTHESIS) {n child = this.Function(this.scopeAtruleExpression, readRaw);n } else {n child = this.Identifier();n }nn break;nn case LEFTPARENTHESIS:n child = this.Parentheses(parentheses);n break;nn default:n break scan;n }nn if (space !== null) {n children.appendData(space);n space = null;n }nn children.appendData(child);n }nn return children;n}nnmodule.exports = {n expression: function() {n var children = readSequence.call(this);nn if (children.isEmpty()) {n this.scanner.error(‘Condition is expected’);n }nn return children;n },n block: function() {n return this.Block(this.Rule);n }n};n“,”‘use strict’;nnvar Tokenizer = require(‘../tokenizer’);nnvar TYPE = Tokenizer.TYPE;nvar WHITESPACE = TYPE.Whitespace;nvar COMMENT = TYPE.Comment;nnvar sequence = require(‘./sequence’);nvar getAnPlusB = require(‘./type/AnPlusB’);nvar getAtrule = require(‘./type/Atrule’);nvar getAtruleExpression = require(‘./type/AtruleExpression’);nvar getAttributeSelector = require(‘./type/AttributeSelector’);nvar getBlock = require(‘./type/Block’);nvar getBrackets = require(‘./type/Brackets’);nvar getClassSelector = require(‘./type/ClassSelector’);nvar getCombinator = require(‘./type/Combinator’);nvar getComment = require(‘./type/Comment’);nvar getDeclaration = require(‘./type/Declaration’);nvar getDeclarationList = require(‘./type/DeclarationList’);nvar getDimension = require(‘./type/Dimention’);nvar getFunction = require(‘./type/Function’);nvar getHexColor = require(‘./type/HexColor’);nvar getIdentifier = require(‘./type/Identifier’);nvar getIdSelector = require(‘./type/IdSelector’);nvar getMediaFeature = require(‘./type/MediaFeature’);nvar getMediaQuery = require(‘./type/MediaQuery’);nvar getMediaQueryList = require(‘./type/MediaQueryList’);nvar getNth = require(‘./type/Nth’);nvar getNumber = require(‘./type/Number’);nvar getOperator = require(‘./type/Operator’);nvar getParentheses = require(‘./type/Parentheses’);nvar getPercentage = require(‘./type/Percentage’);nvar getPseudoClassSelector = require(‘./type/PseudoClassSelector’);nvar getPseudoElementSelector = require(‘./type/PseudoElementSelector’);nvar getRatio = require(‘./type/Ratio’);nvar getRaw = require(‘./type/Raw’);nvar getRule = require(‘./type/Rule’);nvar getSelector = require(‘./type/Selector’);nvar getSelectorList = require(‘./type/SelectorList’);nvar getString = require(‘./type/String’);nvar getStyleSheet = require(‘./type/StyleSheet’);nvar getTypeSelector = require(‘./type/TypeSelector’);nvar getUnicodeRange = require(‘./type/UnicodeRange’);nvar getUrl = require(‘./type/Url’);nvar getValue = require(‘./type/Value’);nvar getWhiteSpace = require(‘./type/WhiteSpace’);nnfunction readSC() {n while (this.scanner.tokenType === WHITESPACE || this.scanner.tokenType === COMMENT) {n this.scanner.next();n }n}nnvar Parser = function() {n this.scanner = new Tokenizer();n this.filename = ‘’;n this.needPositions = false;n};nnParser.prototype = {n scanner: null,n filename: ‘’,n needPositions: false,n parseAtruleExpression: true,n parseSelector: true,n parseValue: true,n parseCustomProperty: false,nn scopeAtruleExpression: {},n scopeValue: {n ‘-moz-element’: require(‘./function/element’),n ‘element’: require(‘./function/element’),n ‘expression’: require(‘./function/expression’),n ‘var’: require(‘./function/var’)n },n atrule: {n ‘import’: require(‘./atrule/import’),n ‘media’: require(‘./atrule/media’),n ‘page’: require(‘./atrule/page’),n ‘supports’: require(‘./atrule/supports’)n },n pseudo: {n ‘lang’: sequence.singleIdentifier,n ‘dir’: sequence.singleIdentifier,n ‘not’: sequence.selectorList,n ‘matches’: sequence.selectorList,n ‘has’: sequence.selectorList,n ‘nth-child’: sequence.nthWithOfClause,n ‘nth-last-child’: sequence.nthWithOfClause,n ‘nth-of-type’: sequence.nth,n ‘nth-last-of-type’: sequence.nth,n ‘slotted’: sequence.compoundSelectorn },n context: {n stylesheet: getStyleSheet,n atrule: getAtrule,n atruleExpression: getAtruleExpression,n rule: getRule,n selectorList: getSelectorList,n selector: getSelector,n block: getBlock,n declarationList: getDeclarationList,n declaration: getDeclaration,n value: getValuen },nn // consumersn AnPlusB: getAnPlusB,n Atrule: getAtrule,n AtruleExpression: getAtruleExpression,n AttributeSelector: getAttributeSelector,n Block: getBlock,n Brackets: getBrackets,n ClassSelector: getClassSelector,n Combinator: getCombinator,n Comment: getComment,n Declaration: getDeclaration,n DeclarationList: getDeclarationList,n Dimension: getDimension,n Function: getFunction,n HexColor: getHexColor,n Identifier: getIdentifier,n IdSelector: getIdSelector,n MediaFeature: getMediaFeature,n MediaQuery: getMediaQuery,n MediaQueryList: getMediaQueryList,n Nth: getNth,n Number: getNumber,n Operator: getOperator,n Parentheses: getParentheses,n Percentage: getPercentage,n PseudoClassSelector: getPseudoClassSelector,n PseudoElementSelector: getPseudoElementSelector,n Ratio: getRatio,n Raw: getRaw,n Rule: getRule,n Selector: getSelector,n SelectorList: getSelectorList,n String: getString,n StyleSheet: getStyleSheet,n TypeSelector: getTypeSelector,n UnicodeRange: getUnicodeRange,n Url: getUrl,n Value: getValue,n WhiteSpace: getWhiteSpace,nn readSC: readSC,n readSelectorSequence: sequence.selector,n readSelectorSequenceFallback: null,n readSequence: sequence.default,n readSequenceFallback: null,nn getLocation: function(start, end) {n if (this.needPositions) {n return this.scanner.getLocationRange(n start,n end,n this.filenamen );n }nn return null;n },n getLocationFromList: function(list) {n if (this.needPositions) {n return this.scanner.getLocationRange(n list.head !== null ? list.first().loc.start.offset - this.scanner.startOffset : this.scanner.tokenStart,n list.head !== null ? list.last().loc.end.offset - this.scanner.startOffset : this.scanner.tokenStart,n this.filenamen );n }nn return null;n },nn parse: function(source, options) {n options = options || {};nn var context = options.context || ‘stylesheet’;n var ast;nn this.scanner.setSource(source, options.offset, options.line, options.column);n this.filename = options.filename || ‘’;n this.needPositions = Boolean(options.positions);n this.parseAtruleExpression = ‘parseAtruleExpression’ in options ? Boolean(options.parseAtruleExpression) : true;n this.parseSelector = ‘parseSelector’ in options ? Boolean(options.parseSelector) : true;n this.parseValue = ‘parseValue’ in options ? Boolean(options.parseValue) : true;n this.parseCustomProperty = ‘parseCustomProperty’ in options ? Boolean(options.parseCustomProperty) : false;nn switch (context) {n case ‘value’:n ast = this.Value(options.property ? String(options.property) : null);n break;nn case ‘atruleExpression’:n ast = this.AtruleExpression(options.atrule ? String(options.atrule) : null);n break;nn default:n if (!this.context.hasOwnProperty(context)) {n throw new Error(‘Unknown context `’ + context + ‘`’);n }nn ast = this.context[context].call(this);n }nn if (!this.scanner.eof) {n this.scanner.error();n }nn // console.log(JSON.stringify(ast, null, 4));n return ast;n }n};nn// warm up parse to elimitate code branches that never executen// fix soft deoptimizations (insufficient type feedback)nnew Parser().parse(n ‘a.b#c:e:Not(a/**/):AFTER:Nth-child(2n+1)::g::slotted(a/**/),* b >c+d~e/deep/f,100%{’ +n ‘v:U+123 1 2em t a(2%, var(–a)) -b() url(..) -foo-bar !important}’n);nnmodule.exports = Parser;n“,”var Parser = require(‘./Parser’);nvar parser = new Parser();nnmodule.exports = parser.parse.bind(parser);n“,”‘use strict’;nnfunction walkRules(node, item, list) {n switch (node.type) {n case ‘StyleSheet’:n var oldStylesheet = this.stylesheet;n this.stylesheet = node;nn node.children.each(walkRules, this);nn this.stylesheet = oldStylesheet;n break;nn case ‘Atrule’:n if (node.block !== null) {n walkRules.call(this, node.block);n }nn this.fn(node, item, list);n break;nn case ‘Rule’:n this.fn(node, item, list);nn var oldRule = this.rule;n this.rule = node;nn walkRules.call(this, node.block);nn this.rule = oldRule;n break;nn case ‘Block’:n var oldBlock = this.block;n this.block = node;nn node.children.each(walkRules, this);nn this.block = oldBlock;n break;n }nn}nnfunction walkRulesRight(node, item, list) {n switch (node.type) {n case ‘StyleSheet’:n var oldStylesheet = this.stylesheet;n this.stylesheet = node;nn node.children.eachRight(walkRulesRight, this);nn this.stylesheet = oldStylesheet;n break;nn case ‘Atrule’:n if (node.block !== null) {n walkRulesRight.call(this, node.block);n }nn this.fn(node, item, list);n break;nn case ‘Rule’:n var oldRule = this.rule;n this.rule = node;nn walkRulesRight.call(this, node.block);nn this.rule = oldRule;nn this.fn(node, item, list);n break;nn case ‘Block’:n var oldBlock = this.block;n this.block = node;nn node.children.eachRight(walkRulesRight, this);nn this.block = oldBlock;n break;n }n}nnfunction walkDeclarations(node) {n switch (node.type) {n case ‘StyleSheet’:n var oldStylesheet = this.stylesheet;n this.stylesheet = node;nn node.children.each(walkDeclarations, this);nn this.stylesheet = oldStylesheet;n break;nn case ‘Atrule’:n if (node.block !== null) {n walkDeclarations.call(this, node.block);n }n break;nn case ‘Rule’:n var oldRule = this.rule;n this.rule = node;nn if (node.block !== null) {n walkDeclarations.call(this, node.block);n }nn this.rule = oldRule;n break;nn case ‘Block’:n node.children.each(function(node, item, list) {n if (node.type === ‘Declaration’) {n this.fn(node, item, list);n } else {n walkDeclarations.call(this, node);n }n }, this);n break;n }n}nnfunction walkAll(node, item, list) {n this.fn(node, item, list);n walk.call(this, walkAll, node, item, list);n}nnfunction walkAllUp(node, item, list) {n walk.call(this, walkAllUp, node, item, list);n this.fn(node, item, list);n}nnfunction walk(walk, node) {n switch (node.type) {n case ‘StyleSheet’:n var oldStylesheet = this.stylesheet;n this.stylesheet = node;nn node.children.each(walk, this);nn this.stylesheet = oldStylesheet;n break;nn case ‘Atrule’:n if (node.expression !== null) {n walk.call(this, node.expression);n }n if (node.block !== null) {n walk.call(this, node.block);n }n break;nn case ‘Rule’:n this.rule = node;nn if (node.selector !== null) {n walk.call(this, node.selector);n }n walk.call(this, node.block);nn this.rule = null;n break;nn case ‘SelectorList’:n var oldSelector = this.selector;n this.selector = node;nn node.children.each(walk, this);nn this.selector = oldSelector;n break;nn case ‘Selector’:n node.children.each(walk, this);n break;nn case ‘Nth’:n walk.call(this, node.nth);n if (node.selector !== null) {n walk.call(this, node.selector);n }n break;nn case ‘Block’:n var oldBlock = this.block;n this.block = node;nn node.children.each(walk, this);nn this.block = oldBlock;n break;nn case ‘DeclarationList’:n node.children.each(walk, this);n break;nn case ‘Declaration’:n this.declaration = node;nn walk.call(this, node.value);nn this.declaration = null;n break;nn case ‘AttributeSelector’:n walk.call(this, node.name);n if (node.value !== null) {n walk.call(this, node.value);n }n break;nn case ‘PseudoClassSelector’:n if (node.children !== null) {n this[‘function’] = node;nn node.children.each(walk, this);nn this[‘function’] = null;n }n break;nn case ‘PseudoElementSelector’:n if (node.children !== null) {n this[‘function’] = node;nn node.children.each(walk, this);nn this[‘function’] = null;n }n break;nn case ‘Function’:n this[‘function’] = node;nn node.children.each(walk, this);nn this[‘function’] = null;n break;nn case ‘AtruleExpression’:n this.atruleExpression = node;nn node.children.each(walk, this);nn this.atruleExpression = null;n break;nn case ‘MediaQueryList’:n node.children.each(walk, this);n break;nn case ‘MediaQuery’:n node.children.each(walk, this);n break;nn case ‘MediaFeature’:n if (node.value !== null) {n walk.call(this, node.value);n }n break;nn case ‘Value’:n node.children.each(walk, this);n break;nn case ‘Parentheses’:n node.children.each(walk, this);n break;nn case ‘Brackets’:n node.children.each(walk, this);n break;nn case ‘Url’:n walk.call(this, node.value);n break;n }n}nnfunction createContext(root, fn) {n var context = {n fn: fn,n root: root,n stylesheet: null,n atruleExpression: null,n rule: null,n selector: null,n block: null,n declaration: null,n function: nulln };nn return context;n}nnmodule.exports = {n all: function(root, fn) {n walkAll.call(createContext(root, fn), root);n },n allUp: function(root, fn) {n walkAllUp.call(createContext(root, fn), root);n },n rules: function(root, fn) {n walkRules.call(createContext(root, fn), root);n },n rulesRight: function(root, fn) {n walkRulesRight.call(createContext(root, fn), root);n },n declarations: function(root, fn) {n walkDeclarations.call(createContext(root, fn), root);n }n};n“,”import parse from ‘css-tree/lib/parser/index.js’;nimport walk from ‘css-tree/lib/utils/walk.js’;nnexport default function readStyle ( parser, start, attributes ) {ntconst contentStart = parser.index;ntconst styles = parser.readUntil( /<\\/style>/ );ntconst contentEnd = parser.index;nntlet ast;nnttry {nttast = parse( styles, {ntttpositions: true,ntttoffset: contentStartntt});nt} catch ( err ) {nttif ( err.name === ‘CssSyntaxError’ ) {ntttparser.error( err.message, err.offset );ntt} else {ntttthrow err;ntt}nt}nnt// tidy up ASTntwalk.all( ast, node => {nttif ( node.loc ) {ntttnode.start = node.loc.start.offset;ntttnode.end = node.loc.end.offset;ntttdelete node.loc;ntt}nt});nntparser.eat( ‘’, true );ntconst end = parser.index;nntreturn {nttstart,nttend,nttattributes,nttchildren: JSON.parse( JSON.stringify( ast.children ) ),nttcontent: {ntttstart: contentStart,ntttend: contentEnd,ntttstylesntt}nt};n}n“,”import { parse, parseExpressionAt } from ‘acorn’;nimport spaces from ‘../../utils/spaces.js’;nnexport function readEventHandlerDirective ( parser, start, name ) {ntconst quoteMark = (nttparser.eat( `‘` ) ? `’` :nttparser.eat( `"` ) ? `"` :nttnullnt);nntconst expressionStart = parser.index;nntlet str = ”;ntlet escaped = false;nntfor ( let i = expressionStart; i < parser.template.length; i += 1 ) {\n\t\tconst char = parser.template[i];\n\n\t\tif ( quoteMark ) {\n\t\t\tif ( char === quoteMark ) {\n\t\t\t\tif ( escaped ) {\n\t\t\t\t\tstr += quoteMark;\n\t\t\t\t} else {\n\t\t\t\t\tparser.index = i + 1;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t} else if ( escaped ) {\n\t\t\t\tstr += '\\\\' + char;\n\t\t\t\tescaped = false;\n\t\t\t} else if ( char === '\\\\' ) {\n\t\t\t\tescaped = true;\n\t\t\t} else {\n\t\t\t\tstr += char;\n\t\t\t}\n\t\t}\n\n\t\telse if ( /\\s/.test( char ) ) {\n\t\t\tparser.index = i;\n\t\t\tbreak;\n\t\t}\n\n\t\telse {\n\t\t\tstr += char;\n\t\t}\n\t}\n\n\tconst ast = parse( spaces( expressionStart ) + str );\n\n\tif ( ast.body.length > 1 ) {nttparser.error( `Event handler should be a single call expression`, ast.body[1].start );nt}nntconst expression = ast.body[0].expression;nntif ( expression.type !== ‘CallExpression’ ) {nttparser.error( `Expected call expression`, expressionStart );nt}nntreturn {nttstart,nttend: parser.index,ntttype: ‘EventHandler’,nttname,nttexpressionnt};n}nnexport function readBindingDirective ( parser, start, name ) {ntlet value;nntif ( parser.eat( ‘=’ ) ) {nttconst quoteMark = (ntttparser.eat( `‘` ) ? `’` :ntttparser.eat( `"` ) ? `"` :ntttnullntt);nnttconst a = parser.index;nntt// this is a bit of a hack so that we can give Acorn something parseablenttlet b;nttif ( quoteMark ) {ntttb = parser.index = parser.template.indexOf( quoteMark, parser.index );ntt} else {ntttparser.readUntil( /[\s\r\n\/>]/ );ntttb = parser.index;ntt}nnttconst source = spaces( a ) + parser.template.slice( a, b );nttvalue = parseExpressionAt( source, a );nnttif ( value.type !== ‘Identifier’ && value.type !== ‘MemberExpression’ ) {ntttparser.error( `Expected valid property name` );ntt}nnttparser.allowWhitespace();nnttif ( quoteMark ) {ntttparser.eat( quoteMark, true );ntt}nt} else {ntt// shorthand – bind:foo equivalent to bind:foo=‘foo’nttvalue = {nttttype: ‘Identifier’,ntttstart: start + 5,ntttend: parser.index,ntttnamentt};nt}nntreturn {nttstart,nttend: parser.index,ntttype: ‘Binding’,nttname,nttvaluent};n}n“,”export const whitespace = /[ \t\r\n]/;n“,”import { whitespace } from ‘../patterns.js’;nnexport function trimStart ( str ) {ntlet i = 0;ntwhile ( whitespace.test( str[i] ) ) i += 1;nntreturn str.slice( i );n}nnexport function trimEnd ( str ) {ntlet i = str.length;ntwhile ( whitespace.test( str[ i - 1 ] ) ) i -= 1;nntreturn str.slice( 0, i );n}n“,”// borrowed from Ractive – https://github.com/ractivejs/ractive/blob/faf93cbd33c3fedfd8d6dd48340990540bde4a94/src/utils/html.jsnconst htmlEntities = { quot: 34, amp: 38, apos: 39, lt: 60, gt: 62, nbsp: 160, iexcl: 161, cent: 162, pound: 163, curren: 164, yen: 165, brvbar: 166, sect: 167, uml: 168, copy: 169, ordf: 170, laquo: 171, not: 172, shy: 173, reg: 174, macr: 175, deg: 176, plusmn: 177, sup2: 178, sup3: 179, acute: 180, micro: 181, para: 182, middot: 183, cedil: 184, sup1: 185, ordm: 186, raquo: 187, frac14: 188, frac12: 189, frac34: 190, iquest: 191, Agrave: 192, Aacute: 193, Acirc: 194, Atilde: 195, Auml: 196, Aring: 197, AElig: 198, Ccedil: 199, Egrave: 200, Eacute: 201, Ecirc: 202, Euml: 203, Igrave: 204, Iacute: 205, Icirc: 206, Iuml: 207, ETH: 208, Ntilde: 209, Ograve: 210, Oacute: 211, Ocirc: 212, Otilde: 213, Ouml: 214, times: 215, Oslash: 216, Ugrave: 217, Uacute: 218, Ucirc: 219, Uuml: 220, Yacute: 221, THORN: 222, szlig: 223, agrave: 224, aacute: 225, acirc: 226, atilde: 227, auml: 228, aring: 229, aelig: 230, ccedil: 231, egrave: 232, eacute: 233, ecirc: 234, euml: 235, igrave: 236, iacute: 237, icirc: 238, iuml: 239, eth: 240, ntilde: 241, ograve: 242, oacute: 243, ocirc: 244, otilde: 245, ouml: 246, divide: 247, oslash: 248, ugrave: 249, uacute: 250, ucirc: 251, uuml: 252, yacute: 253, thorn: 254, yuml: 255, OElig: 338, oelig: 339, Scaron: 352, scaron: 353, Yuml: 376, fnof: 402, circ: 710, tilde: 732, Alpha: 913, Beta: 914, Gamma: 915, Delta: 916, Epsilon: 917, Zeta: 918, Eta: 919, Theta: 920, Iota: 921, Kappa: 922, Lambda: 923, Mu: 924, Nu: 925, Xi: 926, Omicron: 927, Pi: 928, Rho: 929, Sigma: 931, Tau: 932, Upsilon: 933, Phi: 934, Chi: 935, Psi: 936, Omega: 937, alpha: 945, beta: 946, gamma: 947, delta: 948, epsilon: 949, zeta: 950, eta: 951, theta: 952, iota: 953, kappa: 954, lambda: 955, mu: 956, nu: 957, xi: 958, omicron: 959, pi: 960, rho: 961, sigmaf: 962, sigma: 963, tau: 964, upsilon: 965, phi: 966, chi: 967, psi: 968, omega: 969, thetasym: 977, upsih: 978, piv: 982, ensp: 8194, emsp: 8195, thinsp: 8201, zwnj: 8204, zwj: 8205, lrm: 8206, rlm: 8207, ndash: 8211, mdash: 8212, lsquo: 8216, rsquo: 8217, sbquo: 8218, ldquo: 8220, rdquo: 8221, bdquo: 8222, dagger: 8224, Dagger: 8225, bull: 8226, hellip: 8230, permil: 8240, prime: 8242, Prime: 8243, lsaquo: 8249, rsaquo: 8250, oline: 8254, frasl: 8260, euro: 8364, image: 8465, weierp: 8472, real: 8476, trade: 8482, alefsym: 8501, larr: 8592, uarr: 8593, rarr: 8594, darr: 8595, harr: 8596, crarr: 8629, lArr: 8656, uArr: 8657, rArr: 8658, dArr: 8659, hArr: 8660, forall: 8704, part: 8706, exist: 8707, empty: 8709, nabla: 8711, isin: 8712, notin: 8713, ni: 8715, prod: 8719, sum: 8721, minus: 8722, lowast: 8727, radic: 8730, prop: 8733, infin: 8734, ang: 8736, and: 8743, or: 8744, cap: 8745, cup: 8746, int: 8747, there4: 8756, sim: 8764, cong: 8773, asymp: 8776, ne: 8800, equiv: 8801, le: 8804, ge: 8805, sub: 8834, sup: 8835, nsub: 8836, sube: 8838, supe: 8839, oplus: 8853, otimes: 8855, perp: 8869, sdot: 8901, lceil: 8968, rceil: 8969, lfloor: 8970, rfloor: 8971, lang: 9001, rang: 9002, loz: 9674, spades: 9824, clubs: 9827, hearts: 9829, diams: 9830t};nconst controlCharacters = [ 8364, 129, 8218, 402, 8222, 8230, 8224, 8225, 710, 8240, 352, 8249, 338, 141, 381, 143, 144, 8216, 8217, 8220, 8221, 8226, 8211, 8212, 732, 8482, 353, 8250, 339, 157, 382, 376 ];nconst entityPattern = new RegExp( ‘&(#?(?:x[\\w\\d]+|\\d+|’ + Object.keys( htmlEntities ).join( ‘|’ ) + ‘));?’, ‘g’ );nnexport function decodeCharacterReferences ( html ) {ntreturn html.replace( entityPattern, ( match, entity ) => {nttlet code;nntt// Handle named entitiesnttif ( entity[0] !== ‘#’ ) {ntttcode = htmlEntities[ entity ];ntt} else if ( entity[1] === ‘x’ ) {ntttcode = parseInt( entity.substring( 2 ), 16 );ntt} else {ntttcode = parseInt( entity.substring( 1 ), 10 );ntt}nnttif ( !code ) {ntttreturn match;ntt}nnttreturn String.fromCodePoint( validateCode( code ) );nt});n}nconst invalid = 65533;nn// some code points are verboten. If we were inserting HTML, the browser would replace the illegaln// code points with alternatives in some cases - since we’re bypassing that mechanism, we needn// to replace them ourselvesn//n// Source: http://en.wikipedia.org/wiki/Character_encodings_in_HTML#Illegal_charactersnfunction validateCode ( code ) {ntif ( !code ) {nttreturn invalid;nt}nnt// line feed becomes generic whitespacentif ( code === 10 ) {nttreturn 32;nt}nnt// ASCII range. (Why someone would use HTML entities for ASCII characters I don’t know, but…)ntif ( code < 128 ) {\n\t\treturn code;\n\t}\n\n\t// code points 128-159 are dealt with leniently by browsers, but they're incorrect. We need\n\t// to correct the mistake or we'll end up with missing € signs and so on\n\tif ( code <= 159 ) {\n\t\treturn controlCharacters[ code - 128 ];\n\t}\n\n\t// basic multilingual plane\n\tif ( code < 55296 ) {\n\t\treturn code;\n\t}\n\n\t// UTF-16 surrogate halves\n\tif ( code <= 57343 ) {\n\t\treturn invalid;\n\t}\n\n\t// rest of the basic multilingual plane\n\tif ( code <= 65535 ) {\n\t\treturn code;\n\t}\n\n\t// supplementary multilingual plane 0x10000 - 0x1ffff\n\tif ( code >= 65536 && code <= 131071 ) {\n\t\treturn code;\n\t}\n\n\t// supplementary ideographic plane 0x20000 - 0x2ffff\n\tif ( code >= 131072 && code <= 196607 ) {\n\t\treturn code;\n\t}\n\n\treturn invalid;\n}\n","const voidElementNames = /^(?:area|base|br|col|command|embed|hr|img|input|keygen|link|meta|param|source|track|wbr)$/;\n\nexport default function isVoidElementName ( name ) {\n\treturn voidElementNames.test( name ) || name.toLowerCase() === '!doctype';\n}\n","import readExpression from '../read/expression.js';\nimport readScript from '../read/script.js';\nimport readStyle from '../read/style.js';\nimport { readEventHandlerDirective, readBindingDirective } from '../read/directives.js';\nimport { trimStart, trimEnd } from '../utils/trim.js';\nimport { decodeCharacterReferences } from '../utils/html.js';\nimport isVoidElementName from '../../utils/isVoidElementName.js';\n\nconst validTagName = /^\\!?[a-zA-Z]{1,}:?[a-zA-Z0-9\\-]*/;\nconst invalidUnquotedAttributeCharacters = /[\\s\"'=<>\/`]/;nnconst SELF = ‘:Self’;nnconst specials = {ntscript: {nttread: readScript,nttproperty: ‘js’nt},nntstyle: {nttread: readStyle,nttproperty: ‘css’nt}n};nn// based on http://developers.whatwg.org/syntax.html#syntax-tag-omissionnconst disallowedContents = {ntli: [ ‘li’ ],ntdt: [ ‘dt’, ‘dd’ ],ntdd: [ ‘dt’, ‘dd’ ],ntp: ‘address article aside blockquote div dl fieldset footer form h1 h2 h3 h4 h5 h6 header hgroup hr main menu nav ol p pre section table ul’.split( ‘ ’ ),ntrt: [ ‘rt’, ‘rp’ ],ntrp: [ ‘rt’, ‘rp’ ],ntoptgroup: [ ‘optgroup’ ],ntoption: [ ‘option’, ‘optgroup’ ],ntthead: [ ‘tbody’, ‘tfoot’ ],nttbody: [ ‘tbody’, ‘tfoot’ ],nttfoot: [ ‘tbody’ ],nttr: [ ‘tr’, ‘tbody’ ],nttd: [ ‘td’, ‘th’, ‘tr’ ],ntth: [ ‘td’, ‘th’, ‘tr’ ]n};nnfunction stripWhitespace ( element ) {ntif ( element.children.length ) {nttconst firstChild = element.children[0];nttconst lastChild = element.children[ element.children.length - 1 ];nnttif ( firstChild.type === ‘Text’ ) {ntttfirstChild.data = trimStart( firstChild.data );ntttif ( !firstChild.data ) element.children.shift();ntt}nnttif ( lastChild.type === ‘Text’ ) {ntttlastChild.data = trimEnd( lastChild.data );ntttif ( !lastChild.data ) element.children.pop();ntt}nt}n}nnexport default function tag ( parser ) {ntconst start = parser.index++;nntlet parent = parser.current();nntif ( parser.eat( ‘!–’ ) ) {nttconst data = parser.readUntil( /–>/ );nttparser.eat( ‘–>’ );nnttparser.current().children.push({ntttstart,ntttend: parser.index,nttttype: ‘Comment’,ntttdatantt});nnttreturn null;nt}nntconst isClosingTag = parser.eat( ‘/’ );nntconst name = readTagName( parser );nntparser.allowWhitespace();nntif ( isClosingTag ) {nttif ( isVoidElementName( name ) ) {ntttparser.error( `<${name}> is a void element and cannot have children, or a closing tag`, start );ntt}nnttif ( !parser.eat( ‘>’ ) ) parser.error( `Expected ‘>’` );nntt// close any elements that don’t have their own closing tags, e.g.

nttwhile ( parent.name !== name ) {ntttif ( parent.type !== ‘Element’ ) parser.error( ` attempted to close an element that was not open`, start );nntttparent.end = start;ntttparser.stack.pop();nntttparent = parser.current();ntt}nntt// strip leading/trailing whitespace as necessarynttstripWhitespace( parent );nnttparent.end = parser.index;nttparser.stack.pop();nnttreturn null;nt} else if ( parent.name in disallowedContents ) {ntt// can this be a child of the parent element, or does it implicitlyntt// close it, like `
  • one
  • two`?nttconst disallowed = disallowedContents[ parent.name ];nttif ( ~disallowed.indexOf( name ) ) {ntttstripWhitespace( parent );nntttparent.end = start;ntttparser.stack.pop();ntt}nt}nntconst attributes = [];ntconst uniqueNames = new Set();nntlet attribute;ntwhile ( attribute = readAttribute( parser, uniqueNames ) ) {nttattributes.push( attribute );nttparser.allowWhitespace();nt}nntparser.allowWhitespace();nnt// special cases – top-level