babel/lib/acorn/test/compare/esprima.js
2015-03-21 15:25:32 +11:00

1 line
97 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

"use strict";(function(root, factory){"use strict";if(typeof define === "function" && define.amd){define(["exports"], factory);}else if(typeof exports !== "undefined"){factory(exports);}else {factory(root.esprima = {});}})(undefined, function(exports){"use strict";var Token, TokenName, FnExprTokens, Syntax, PropertyKind, Messages, Regex, SyntaxTreeDelegate, ClassPropertyType, source, strict, index, lineNumber, lineStart, length, delegate, lookahead, state, extra;Token = {BooleanLiteral:1, EOF:2, Identifier:3, Keyword:4, NullLiteral:5, NumericLiteral:6, Punctuator:7, StringLiteral:8, RegularExpression:9, Template:10};TokenName = {};TokenName[Token.BooleanLiteral] = "Boolean";TokenName[Token.EOF] = "<end>";TokenName[Token.Identifier] = "Identifier";TokenName[Token.Keyword] = "Keyword";TokenName[Token.NullLiteral] = "Null";TokenName[Token.NumericLiteral] = "Numeric";TokenName[Token.Punctuator] = "Punctuator";TokenName[Token.StringLiteral] = "String";TokenName[Token.RegularExpression] = "RegularExpression";FnExprTokens = ["(", "{", "[", "in", "typeof", "instanceof", "new", "return", "case", "delete", "throw", "void", "=", "+=", "-=", "*=", "/=", "%=", "<<=", ">>=", ">>>=", "&=", "|=", "^=", ",", "+", "-", "*", "/", "%", "++", "--", "<<", ">>", ">>>", "&", "|", "^", "!", "~", "&&", "||", "?", ":", "===", "==", ">=", "<=", "<", ">", "!=", "!=="];Syntax = {ArrayExpression:"ArrayExpression", ArrayPattern:"ArrayPattern", ArrowFunctionExpression:"ArrowFunctionExpression", AssignmentExpression:"AssignmentExpression", BinaryExpression:"BinaryExpression", BlockStatement:"BlockStatement", BreakStatement:"BreakStatement", CallExpression:"CallExpression", CatchClause:"CatchClause", ClassBody:"ClassBody", ClassDeclaration:"ClassDeclaration", ClassExpression:"ClassExpression", ComprehensionBlock:"ComprehensionBlock", ComprehensionExpression:"ComprehensionExpression", ConditionalExpression:"ConditionalExpression", ContinueStatement:"ContinueStatement", DebuggerStatement:"DebuggerStatement", DoWhileStatement:"DoWhileStatement", EmptyStatement:"EmptyStatement", ExportDeclaration:"ExportDeclaration", ExportBatchSpecifier:"ExportBatchSpecifier", ExportSpecifier:"ExportSpecifier", ExpressionStatement:"ExpressionStatement", ForInStatement:"ForInStatement", ForOfStatement:"ForOfStatement", ForStatement:"ForStatement", FunctionDeclaration:"FunctionDeclaration", FunctionExpression:"FunctionExpression", Identifier:"Identifier", IfStatement:"IfStatement", ImportDeclaration:"ImportDeclaration", ImportSpecifier:"ImportSpecifier", LabeledStatement:"LabeledStatement", Literal:"Literal", LogicalExpression:"LogicalExpression", MemberExpression:"MemberExpression", MethodDefinition:"MethodDefinition", ModuleDeclaration:"ModuleDeclaration", NewExpression:"NewExpression", ObjectExpression:"ObjectExpression", ObjectPattern:"ObjectPattern", Program:"Program", Property:"Property", ReturnStatement:"ReturnStatement", SequenceExpression:"SequenceExpression", SpreadElement:"SpreadElement", SwitchCase:"SwitchCase", SwitchStatement:"SwitchStatement", TaggedTemplateExpression:"TaggedTemplateExpression", TemplateElement:"TemplateElement", TemplateLiteral:"TemplateLiteral", ThisExpression:"ThisExpression", ThrowStatement:"ThrowStatement", TryStatement:"TryStatement", UnaryExpression:"UnaryExpression", UpdateExpression:"UpdateExpression", VariableDeclaration:"VariableDeclaration", VariableDeclarator:"VariableDeclarator", WhileStatement:"WhileStatement", WithStatement:"WithStatement", YieldExpression:"YieldExpression"};PropertyKind = {Data:1, Get:2, Set:4};ClassPropertyType = {"static":"static", prototype:"prototype"};Messages = {UnexpectedToken:"Unexpected token %0", UnexpectedNumber:"Unexpected number", UnexpectedString:"Unexpected string", UnexpectedIdentifier:"Unexpected identifier", UnexpectedReserved:"Unexpected reserved word", UnexpectedTemplate:"Unexpected quasi %0", UnexpectedEOS:"Unexpected end of input", NewlineAfterThrow:"Illegal newline after throw", InvalidRegExp:"Invalid regular expression", UnterminatedRegExp:"Invalid regular expression: missing /", InvalidLHSInAssignment:"Invalid left-hand side in assignment", InvalidLHSInFormalsList:"Invalid left-hand side in formals list", InvalidLHSInForIn:"Invalid left-hand side in for-in", MultipleDefaultsInSwitch:"More than one default clause in switch statement", NoCatchOrFinally:"Missing catch or finally after try", UnknownLabel:"Undefined label '%0'", Redeclaration:"%0 '%1' has already been declared", IllegalContinue:"Illegal continue statement", IllegalBreak:"Illegal break statement", IllegalDuplicateClassProperty:"Illegal duplicate property in class definition", IllegalReturn:"Illegal return statement", IllegalYield:"Illegal yield expression", IllegalSpread:"Illegal spread element", StrictModeWith:"Strict mode code may not include a with statement", StrictCatchVariable:"Catch variable may not be eval or arguments in strict mode", StrictVarName:"Variable name may not be eval or arguments in strict mode", StrictParamName:"Parameter name eval or arguments is not allowed in strict mode", StrictParamDupe:"Strict mode function may not have duplicate parameter names", ParameterAfterRestParameter:"Rest parameter must be final parameter of an argument list", DefaultRestParameter:"Rest parameter can not have a default value", ElementAfterSpreadElement:"Spread must be the final element of an element list", ObjectPatternAsRestParameter:"Invalid rest parameter", ObjectPatternAsSpread:"Invalid spread argument", StrictFunctionName:"Function name may not be eval or arguments in strict mode", StrictOctalLiteral:"Octal literals are not allowed in strict mode.", StrictDelete:"Delete of an unqualified identifier in strict mode.", StrictDuplicateProperty:"Duplicate data property in object literal not allowed in strict mode", AccessorDataProperty:"Object literal may not have data and accessor property with the same name", AccessorGetSet:"Object literal may not have multiple get/set accessors with the same name", StrictLHSAssignment:"Assignment to eval or arguments is not allowed in strict mode", StrictLHSPostfix:"Postfix increment/decrement may not have eval or arguments operand in strict mode", StrictLHSPrefix:"Prefix increment/decrement may not have eval or arguments operand in strict mode", StrictReservedWord:"Use of future reserved word in strict mode", NewlineAfterModule:"Illegal newline after module", NoFromAfterImport:"Missing from after import", InvalidModuleSpecifier:"Invalid module specifier", NestedModule:"Module declaration can not be nested", NoUnintializedConst:"Const must be initialized", ComprehensionRequiresBlock:"Comprehension must have at least one block", ComprehensionError:"Comprehension Error", EachNotAllowed:"Each is not supported"};Regex = {NonAsciiIdentifierStart:new RegExp("[ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԧԱ-Ֆՙա-ևא-תװ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࢠࢢ-ࢬऄ-हऽॐक़-ॡॱ-ॷॹ-ॿঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-ళవ-హఽౘౙౠౡಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೞೠೡೱೲഅ-ഌഎ-ഐഒ-ഺഽൎൠൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄງຈຊຍດ-ທນ-ຟມ-ຣລວສຫອ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏼᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛰᜀ-ᜌᜎ-ᜑᜠ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡷᢀ-ᢨᢪᢰ-ᣵᤀ-ᤜᥐ-ᥭᥰ-ᥴᦀ-ᦫᧁ-ᧇᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭋᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᳩ-ᳬᳮ-ᳱᳵᳶᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ--ℝℤΩℨK--ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞⸯ々-〇〡-〩〱-〵〸-〼ぁ-ゖゝ-ゟァ-ヺー-ヿㄅ-ㄭㄱ-ㆎㆠ-ㆺㇰ-ㇿ㐀-䶵一-鿌ꀀ-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚗꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ-ꞎꞐ-ꞓꞠ-Ɦꟸ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꪀ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꯀ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA--zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ]"), NonAsciiIdentifierPart:new RegExp("[ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮ̀-ʹͶͷͺ-ͽΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁ҃-҇Ҋ-ԧԱ-Ֆՙա-և֑-ׇֽֿׁׂׅׄא-תװ-ײؐ-ؚؠ-٩ٮ-ۓە-ۜ۟-۪ۨ-ۼۿܐ-݊ݍ-ޱ߀-ߵߺࠀ-࠭ࡀ-࡛ࢠࢢ-ࢬࣤ-ࣾऀ-ॣ०-९ॱ-ॷॹ-ॿঁ-ঃঅ-ঌএঐও-নপ-রলশ-হ়-ৄেৈো-ৎৗড়ঢ়য়-ৣ০-ৱਁ-ਃਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹ਼ਾ-ੂੇੈੋ-੍ੑਖ਼-ੜਫ਼੦-ੵઁ-ઃઅ-ઍએ-ઑઓ-નપ-રલળવ-હ઼-ૅે-ૉો-્ૐૠ-ૣ૦-૯ଁ-ଃଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହ଼-ୄେୈୋ-୍ୖୗଡ଼ଢ଼ୟ-ୣ୦-୯ୱஂஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹா-ூெ-ைொ-்ௐௗ௦-௯ఁ-ఃఅ-ఌఎ-ఐఒ-నప-ళవ-హఽ-ౄె-ైొ-్ౕౖౘౙౠ-ౣ౦-౯ಂಃಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹ಼-ೄೆ-ೈೊ-್ೕೖೞೠ-ೣ೦-೯ೱೲംഃഅ-ഌഎ-ഐഒ-ഺഽ-ൄെ-ൈൊ-ൎൗൠ-ൣ൦-൯ൺ-ൿංඃඅ-ඖක-නඳ-රලව-ෆ්ා-ුූෘ-ෟෲෳก-ฺเ-๎๐-๙ກຂຄງຈຊຍດ-ທນ-ຟມ-ຣລວສຫອ-ູົ-ຽເ-ໄໆ່-ໍ໐-໙ໜ-ໟༀ༘༙༠-༩༹༵༷༾-ཇཉ-ཬཱ-྄྆-ྗྙ-ྼ࿆က-၉ၐ-ႝႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚ፝-፟ᎀ-ᎏᎠ-Ᏼᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛰᜀ-ᜌᜎ-᜔ᜠ-᜴ᝀ-ᝓᝠ-ᝬᝮ-ᝰᝲᝳក-៓ៗៜ៝០-៩᠋-᠍᠐-᠙ᠠ-ᡷᢀ-ᢪᢰ-ᣵᤀ-ᤜᤠ-ᤫᤰ-᤻᥆-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉ᧐-᧙ᨀ-ᨛᨠ-ᩞ᩠-᩿᩼-᪉᪐-᪙ᪧᬀ-ᭋ᭐-᭙᭫-᭳ᮀ-᯳ᰀ-᰷᱀-᱉ᱍ-ᱽ᳐-᳔᳒-ᳶᴀ-ᷦ᷼-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼ‌‍‿⁀⁔ⁱⁿₐ-ₜ⃐-⃥⃜⃡-⃰ℂℇℊ--ℝℤΩℨK--ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯ⵿-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞⷠ-ⷿⸯ々-〇〡-〯〱-〵〸-〼ぁ-ゖ゙゚ゝ-ゟァ-ヺー-ヿㄅ-ㄭㄱ-ㆎㆠ-ㆺㇰ-ㇿ㐀-䶵一-鿌ꀀ-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘫꙀ-꙯ꙴ-꙽ꙿ-ꚗꚟ-꛱ꜗ-ꜟꜢ-ꞈꞋ-ꞎꞐ-ꞓꞠ-Ɦꟸ-ꠧꡀ-ꡳꢀ-꣄꣐-꣙꣠-ꣷꣻ꤀-꤭ꤰ-꥓ꥠ-ꥼꦀ-꧀ꧏ-꧙ꨀ-ꨶꩀ-ꩍ꩐-꩙ꩠ-ꩶꩺꩻꪀ-ꫂꫛ-ꫝꫠ-ꫯꫲ-꫶ꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꯀ-ꯪ꯬꯭꯰-꯹가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻ︀-️︠-︦︳︴﹍-﹏ﹰ-ﹴﹶ-ﻼ0--_-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ]")};function assert(condition, message){if(!condition){throw new Error("ASSERT: " + message);}}function isDecimalDigit(ch){return ch >= 48 && ch <= 57;}function isHexDigit(ch){return "0123456789abcdefABCDEF".indexOf(ch) >= 0;}function isOctalDigit(ch){return "01234567".indexOf(ch) >= 0;}function isWhiteSpace(ch){return ch === 32 || ch === 9 || ch === 11 || ch === 12 || ch === 160 || ch >= 5760 && "  ".indexOf(String.fromCharCode(ch)) > 0;}function isLineTerminator(ch){return ch === 10 || ch === 13 || ch === 8232 || ch === 8233;}function isIdentifierStart(ch){return ch === 36 || ch === 95 || ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122 || ch === 92 || ch >= 128 && Regex.NonAsciiIdentifierStart.test(String.fromCharCode(ch));}function isIdentifierPart(ch){return ch === 36 || ch === 95 || ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122 || ch >= 48 && ch <= 57 || ch === 92 || ch >= 128 && Regex.NonAsciiIdentifierPart.test(String.fromCharCode(ch));}function isFutureReservedWord(id){switch(id){case "class":case "enum":case "export":case "extends":case "import":case "super":return true;default:return false;}}function isStrictModeReservedWord(id){switch(id){case "implements":case "interface":case "package":case "private":case "protected":case "public":case "static":case "yield":case "let":return true;default:return false;}}function isRestrictedWord(id){return id === "eval" || id === "arguments";}function isKeyword(id){if(strict && isStrictModeReservedWord(id)){return true;}switch(id.length){case 2:return id === "if" || id === "in" || id === "do";case 3:return id === "var" || id === "for" || id === "new" || id === "try" || id === "let";case 4:return id === "this" || id === "else" || id === "case" || id === "void" || id === "with" || id === "enum";case 5:return id === "while" || id === "break" || id === "catch" || id === "throw" || id === "const" || id === "class" || id === "super";case 6:return id === "return" || id === "typeof" || id === "delete" || id === "switch" || id === "export" || id === "import";case 7:return id === "default" || id === "finally" || id === "extends";case 8:return id === "function" || id === "continue" || id === "debugger";case 10:return id === "instanceof";default:return false;}}function skipComment(){var ch, blockComment, lineComment;blockComment = false;lineComment = false;while(index < length) {ch = source.charCodeAt(index);if(lineComment){++index;if(isLineTerminator(ch)){lineComment = false;if(ch === 13 && source.charCodeAt(index) === 10){++index;}++lineNumber;lineStart = index;}}else if(blockComment){if(isLineTerminator(ch)){if(ch === 13 && source.charCodeAt(index + 1) === 10){++index;}++lineNumber;++index;lineStart = index;if(index >= length){throwError({}, Messages.UnexpectedToken, "ILLEGAL");}}else {ch = source.charCodeAt(index++);if(index >= length){throwError({}, Messages.UnexpectedToken, "ILLEGAL");}if(ch === 42){ch = source.charCodeAt(index);if(ch === 47){++index;blockComment = false;}}}}else if(ch === 47){ch = source.charCodeAt(index + 1);if(ch === 47){index += 2;lineComment = true;}else if(ch === 42){index += 2;blockComment = true;if(index >= length){throwError({}, Messages.UnexpectedToken, "ILLEGAL");}}else {break;}}else if(isWhiteSpace(ch)){++index;}else if(isLineTerminator(ch)){++index;if(ch === 13 && source.charCodeAt(index) === 10){++index;}++lineNumber;lineStart = index;}else {break;}}}function scanHexEscape(prefix){var i, len, ch, code=0;len = prefix === "u"?4:2;for(i = 0; i < len; ++i) {if(index < length && isHexDigit(source[index])){ch = source[index++];code = code * 16 + "0123456789abcdef".indexOf(ch.toLowerCase());}else {return "";}}return String.fromCharCode(code);}function scanUnicodeCodePointEscape(){var ch, code, cu1, cu2;ch = source[index];code = 0;if(ch === "}"){throwError({}, Messages.UnexpectedToken, "ILLEGAL");}while(index < length) {ch = source[index++];if(!isHexDigit(ch)){break;}code = code * 16 + "0123456789abcdef".indexOf(ch.toLowerCase());}if(code > 1114111 || ch !== "}"){throwError({}, Messages.UnexpectedToken, "ILLEGAL");}if(code <= 65535){return String.fromCharCode(code);}cu1 = (code - 65536 >> 10) + 55296;cu2 = (code - 65536 & 1023) + 56320;return String.fromCharCode(cu1, cu2);}function getEscapedIdentifier(){var ch, id;ch = source.charCodeAt(index++);id = String.fromCharCode(ch);if(ch === 92){if(source.charCodeAt(index) !== 117){throwError({}, Messages.UnexpectedToken, "ILLEGAL");}++index;ch = scanHexEscape("u");if(!ch || ch === "\\" || !isIdentifierStart(ch.charCodeAt(0))){throwError({}, Messages.UnexpectedToken, "ILLEGAL");}id = ch;}while(index < length) {ch = source.charCodeAt(index);if(!isIdentifierPart(ch)){break;}++index;id += String.fromCharCode(ch);if(ch === 92){id = id.substr(0, id.length - 1);if(source.charCodeAt(index) !== 117){throwError({}, Messages.UnexpectedToken, "ILLEGAL");}++index;ch = scanHexEscape("u");if(!ch || ch === "\\" || !isIdentifierPart(ch.charCodeAt(0))){throwError({}, Messages.UnexpectedToken, "ILLEGAL");}id += ch;}}return id;}function getIdentifier(){var start, ch;start = index++;while(index < length) {ch = source.charCodeAt(index);if(ch === 92){index = start;return getEscapedIdentifier();}if(isIdentifierPart(ch)){++index;}else {break;}}return source.slice(start, index);}function scanIdentifier(){var start, id, type;start = index;id = source.charCodeAt(index) === 92?getEscapedIdentifier():getIdentifier();if(id.length === 1){type = Token.Identifier;}else if(isKeyword(id)){type = Token.Keyword;}else if(id === "null"){type = Token.NullLiteral;}else if(id === "true" || id === "false"){type = Token.BooleanLiteral;}else {type = Token.Identifier;}return {type:type, value:id, lineNumber:lineNumber, lineStart:lineStart, range:[start, index]};}function scanPunctuator(){var start=index, code=source.charCodeAt(index), code2, ch1=source[index], ch2, ch3, ch4;switch(code){case 40:case 41:case 59:case 44:case 123:case 125:case 91:case 93:case 58:case 63:case 126:++index;if(extra.tokenize){if(code === 40){extra.openParenToken = extra.tokens.length;}else if(code === 123){extra.openCurlyToken = extra.tokens.length;}}return {type:Token.Punctuator, value:String.fromCharCode(code), lineNumber:lineNumber, lineStart:lineStart, range:[start, index]};default:code2 = source.charCodeAt(index + 1);if(code2 === 61){switch(code){case 37:case 38:case 42:case 43:case 45:case 47:case 60:case 62:case 94:case 124:index += 2;return {type:Token.Punctuator, value:String.fromCharCode(code) + String.fromCharCode(code2), lineNumber:lineNumber, lineStart:lineStart, range:[start, index]};case 33:case 61:index += 2;if(source.charCodeAt(index) === 61){++index;}return {type:Token.Punctuator, value:source.slice(start, index), lineNumber:lineNumber, lineStart:lineStart, range:[start, index]};default:break;}}break;}ch2 = source[index + 1];ch3 = source[index + 2];ch4 = source[index + 3];if(ch1 === ">" && ch2 === ">" && ch3 === ">"){if(ch4 === "="){index += 4;return {type:Token.Punctuator, value:">>>=", lineNumber:lineNumber, lineStart:lineStart, range:[start, index]};}}if(ch1 === ">" && ch2 === ">" && ch3 === ">"){index += 3;return {type:Token.Punctuator, value:">>>", lineNumber:lineNumber, lineStart:lineStart, range:[start, index]};}if(ch1 === "<" && ch2 === "<" && ch3 === "="){index += 3;return {type:Token.Punctuator, value:"<<=", lineNumber:lineNumber, lineStart:lineStart, range:[start, index]};}if(ch1 === ">" && ch2 === ">" && ch3 === "="){index += 3;return {type:Token.Punctuator, value:">>=", lineNumber:lineNumber, lineStart:lineStart, range:[start, index]};}if(ch1 === "." && ch2 === "." && ch3 === "."){index += 3;return {type:Token.Punctuator, value:"...", lineNumber:lineNumber, lineStart:lineStart, range:[start, index]};}if(ch1 === ch2 && "+-<>&|".indexOf(ch1) >= 0){index += 2;return {type:Token.Punctuator, value:ch1 + ch2, lineNumber:lineNumber, lineStart:lineStart, range:[start, index]};}if(ch1 === "=" && ch2 === ">"){index += 2;return {type:Token.Punctuator, value:"=>", lineNumber:lineNumber, lineStart:lineStart, range:[start, index]};}if("<>=!+-*%&|^/".indexOf(ch1) >= 0){++index;return {type:Token.Punctuator, value:ch1, lineNumber:lineNumber, lineStart:lineStart, range:[start, index]};}if(ch1 === "."){++index;return {type:Token.Punctuator, value:ch1, lineNumber:lineNumber, lineStart:lineStart, range:[start, index]};}throwError({}, Messages.UnexpectedToken, "ILLEGAL");}function scanHexLiteral(start){var number="";while(index < length) {if(!isHexDigit(source[index])){break;}number += source[index++];}if(number.length === 0){throwError({}, Messages.UnexpectedToken, "ILLEGAL");}if(isIdentifierStart(source.charCodeAt(index))){throwError({}, Messages.UnexpectedToken, "ILLEGAL");}return {type:Token.NumericLiteral, value:parseInt("0x" + number, 16), lineNumber:lineNumber, lineStart:lineStart, range:[start, index]};}function scanOctalLiteral(prefix, start){var number, octal;if(isOctalDigit(prefix)){octal = true;number = "0" + source[index++];}else {octal = false;++index;number = "";}while(index < length) {if(!isOctalDigit(source[index])){break;}number += source[index++];}if(!octal && number.length === 0){throwError({}, Messages.UnexpectedToken, "ILLEGAL");}if(isIdentifierStart(source.charCodeAt(index)) || isDecimalDigit(source.charCodeAt(index))){throwError({}, Messages.UnexpectedToken, "ILLEGAL");}return {type:Token.NumericLiteral, value:parseInt(number, 8), octal:octal, lineNumber:lineNumber, lineStart:lineStart, range:[start, index]};}function scanNumericLiteral(){var number, start, ch, octal;ch = source[index];assert(isDecimalDigit(ch.charCodeAt(0)) || ch === ".", "Numeric literal must start with a decimal digit or a decimal point");start = index;number = "";if(ch !== "."){number = source[index++];ch = source[index];if(number === "0"){if(ch === "x" || ch === "X"){++index;return scanHexLiteral(start);}if(ch === "b" || ch === "B"){++index;number = "";while(index < length) {ch = source[index];if(ch !== "0" && ch !== "1"){break;}number += source[index++];}if(number.length === 0){throwError({}, Messages.UnexpectedToken, "ILLEGAL");}if(index < length){ch = source.charCodeAt(index);if(isIdentifierStart(ch) || isDecimalDigit(ch)){throwError({}, Messages.UnexpectedToken, "ILLEGAL");}}return {type:Token.NumericLiteral, value:parseInt(number, 2), lineNumber:lineNumber, lineStart:lineStart, range:[start, index]};}if(ch === "o" || ch === "O" || isOctalDigit(ch)){return scanOctalLiteral(ch, start);}if(ch && isDecimalDigit(ch.charCodeAt(0))){throwError({}, Messages.UnexpectedToken, "ILLEGAL");}}while(isDecimalDigit(source.charCodeAt(index))) {number += source[index++];}ch = source[index];}if(ch === "."){number += source[index++];while(isDecimalDigit(source.charCodeAt(index))) {number += source[index++];}ch = source[index];}if(ch === "e" || ch === "E"){number += source[index++];ch = source[index];if(ch === "+" || ch === "-"){number += source[index++];}if(isDecimalDigit(source.charCodeAt(index))){while(isDecimalDigit(source.charCodeAt(index))) {number += source[index++];}}else {throwError({}, Messages.UnexpectedToken, "ILLEGAL");}}if(isIdentifierStart(source.charCodeAt(index))){throwError({}, Messages.UnexpectedToken, "ILLEGAL");}return {type:Token.NumericLiteral, value:parseFloat(number), lineNumber:lineNumber, lineStart:lineStart, range:[start, index]};}function scanStringLiteral(){var str="", quote, start, ch, code, unescaped, restore, octal=false;quote = source[index];assert(quote === "'" || quote === "\"", "String literal must starts with a quote");start = index;++index;while(index < length) {ch = source[index++];if(ch === quote){quote = "";break;}else if(ch === "\\"){ch = source[index++];if(!ch || !isLineTerminator(ch.charCodeAt(0))){switch(ch){case "n":str += "\n";break;case "r":str += "\r";break;case "t":str += "\t";break;case "u":case "x":if(source[index] === "{"){++index;str += scanUnicodeCodePointEscape();}else {restore = index;unescaped = scanHexEscape(ch);if(unescaped){str += unescaped;}else {index = restore;str += ch;}}break;case "b":str += "\b";break;case "f":str += "\f";break;case "v":str += "\u000b";break;default:if(isOctalDigit(ch)){code = "01234567".indexOf(ch);if(code !== 0){octal = true;}if(index < length && isOctalDigit(source[index])){octal = true;code = code * 8 + "01234567".indexOf(source[index++]);if("0123".indexOf(ch) >= 0 && index < length && isOctalDigit(source[index])){code = code * 8 + "01234567".indexOf(source[index++]);}}str += String.fromCharCode(code);}else {str += ch;}break;}}else {++lineNumber;if(ch === "\r" && source[index] === "\n"){++index;}}}else if(isLineTerminator(ch.charCodeAt(0))){break;}else {str += ch;}}if(quote !== ""){throwError({}, Messages.UnexpectedToken, "ILLEGAL");}return {type:Token.StringLiteral, value:str, octal:octal, lineNumber:lineNumber, lineStart:lineStart, range:[start, index]};}function scanTemplate(){var cooked="", ch, start, terminated, tail, restore, unescaped, code, octal;terminated = false;tail = false;start = index;++index;while(index < length) {ch = source[index++];if(ch === "`"){tail = true;terminated = true;break;}else if(ch === "$"){if(source[index] === "{"){++index;terminated = true;break;}cooked += ch;}else if(ch === "\\"){ch = source[index++];if(!isLineTerminator(ch.charCodeAt(0))){switch(ch){case "n":cooked += "\n";break;case "r":cooked += "\r";break;case "t":cooked += "\t";break;case "u":case "x":if(source[index] === "{"){++index;cooked += scanUnicodeCodePointEscape();}else {restore = index;unescaped = scanHexEscape(ch);if(unescaped){cooked += unescaped;}else {index = restore;cooked += ch;}}break;case "b":cooked += "\b";break;case "f":cooked += "\f";break;case "v":cooked += "\u000b";break;default:if(isOctalDigit(ch)){code = "01234567".indexOf(ch);if(code !== 0){octal = true;}if(index < length && isOctalDigit(source[index])){octal = true;code = code * 8 + "01234567".indexOf(source[index++]);if("0123".indexOf(ch) >= 0 && index < length && isOctalDigit(source[index])){code = code * 8 + "01234567".indexOf(source[index++]);}}cooked += String.fromCharCode(code);}else {cooked += ch;}break;}}else {++lineNumber;if(ch === "\r" && source[index] === "\n"){++index;}}}else if(isLineTerminator(ch.charCodeAt(0))){++lineNumber;if(ch === "\r" && source[index] === "\n"){++index;}cooked += "\n";}else {cooked += ch;}}if(!terminated){throwError({}, Messages.UnexpectedToken, "ILLEGAL");}return {type:Token.Template, value:{cooked:cooked, raw:source.slice(start + 1, index - (tail?1:2))}, tail:tail, octal:octal, lineNumber:lineNumber, lineStart:lineStart, range:[start, index]};}function scanTemplateElement(option){var startsWith, template;lookahead = null;skipComment();startsWith = option.head?"`":"}";if(source[index] !== startsWith){throwError({}, Messages.UnexpectedToken, "ILLEGAL");}template = scanTemplate();peek();return template;}function scanRegExp(){var str, ch, start, pattern, flags, value, classMarker=false, restore, terminated=false;lookahead = null;skipComment();start = index;ch = source[index];assert(ch === "/", "Regular expression literal must start with a slash");str = source[index++];while(index < length) {ch = source[index++];str += ch;if(classMarker){if(ch === "]"){classMarker = false;}}else {if(ch === "\\"){ch = source[index++];if(isLineTerminator(ch.charCodeAt(0))){throwError({}, Messages.UnterminatedRegExp);}str += ch;}else if(ch === "/"){terminated = true;break;}else if(ch === "["){classMarker = true;}else if(isLineTerminator(ch.charCodeAt(0))){throwError({}, Messages.UnterminatedRegExp);}}}if(!terminated){throwError({}, Messages.UnterminatedRegExp);}pattern = str.substr(1, str.length - 2);flags = "";while(index < length) {ch = source[index];if(!isIdentifierPart(ch.charCodeAt(0))){break;}++index;if(ch === "\\" && index < length){ch = source[index];if(ch === "u"){++index;restore = index;ch = scanHexEscape("u");if(ch){flags += ch;for(str += "\\u"; restore < index; ++restore) {str += source[restore];}}else {index = restore;flags += "u";str += "\\u";}}else {str += "\\";}}else {flags += ch;str += ch;}}try{value = new RegExp(pattern, flags);}catch(e) {throwError({}, Messages.InvalidRegExp);}peek();if(extra.tokenize){return {type:Token.RegularExpression, value:value, lineNumber:lineNumber, lineStart:lineStart, range:[start, index]};}return {literal:str, value:value, range:[start, index]};}function isIdentifierName(token){return token.type === Token.Identifier || token.type === Token.Keyword || token.type === Token.BooleanLiteral || token.type === Token.NullLiteral;}function advanceSlash(){var prevToken, checkToken;prevToken = extra.tokens[extra.tokens.length - 1];if(!prevToken){return scanRegExp();}if(prevToken.type === "Punctuator"){if(prevToken.value === ")"){checkToken = extra.tokens[extra.openParenToken - 1];if(checkToken && checkToken.type === "Keyword" && (checkToken.value === "if" || checkToken.value === "while" || checkToken.value === "for" || checkToken.value === "with")){return scanRegExp();}return scanPunctuator();}if(prevToken.value === "}"){if(extra.tokens[extra.openCurlyToken - 3] && extra.tokens[extra.openCurlyToken - 3].type === "Keyword"){checkToken = extra.tokens[extra.openCurlyToken - 4];if(!checkToken){return scanPunctuator();}}else if(extra.tokens[extra.openCurlyToken - 4] && extra.tokens[extra.openCurlyToken - 4].type === "Keyword"){checkToken = extra.tokens[extra.openCurlyToken - 5];if(!checkToken){return scanRegExp();}}else {return scanPunctuator();}if(FnExprTokens.indexOf(checkToken.value) >= 0){return scanPunctuator();}return scanRegExp();}return scanRegExp();}if(prevToken.type === "Keyword"){return scanRegExp();}return scanPunctuator();}function advance(){var ch;skipComment();if(index >= length){return {type:Token.EOF, lineNumber:lineNumber, lineStart:lineStart, range:[index, index]};}ch = source.charCodeAt(index);if(ch === 40 || ch === 41 || ch === 58){return scanPunctuator();}if(ch === 39 || ch === 34){return scanStringLiteral();}if(ch === 96){return scanTemplate();}if(isIdentifierStart(ch)){return scanIdentifier();}if(ch === 46){if(isDecimalDigit(source.charCodeAt(index + 1))){return scanNumericLiteral();}return scanPunctuator();}if(isDecimalDigit(ch)){return scanNumericLiteral();}if(extra.tokenize && ch === 47){return advanceSlash();}return scanPunctuator();}function lex(){var token;token = lookahead;index = token.range[1];lineNumber = token.lineNumber;lineStart = token.lineStart;lookahead = advance();index = token.range[1];lineNumber = token.lineNumber;lineStart = token.lineStart;return token;}function peek(){var pos, line, start;pos = index;line = lineNumber;start = lineStart;lookahead = advance();index = pos;lineNumber = line;lineStart = start;}function lookahead2(){var adv, pos, line, start, result;adv = typeof extra.advance === "function"?extra.advance:advance;pos = index;line = lineNumber;start = lineStart;if(lookahead === null){lookahead = adv();}index = lookahead.range[1];lineNumber = lookahead.lineNumber;lineStart = lookahead.lineStart;result = adv();index = pos;lineNumber = line;lineStart = start;return result;}function markerCreate(){if(!extra.loc && !extra.range){return undefined;}skipComment();return {offset:index, line:lineNumber, col:index - lineStart};}function markerApply(marker, node){if(extra.range){node.range = [marker.offset, index];}if(extra.loc){node.loc = {start:{line:marker.line, column:marker.col}, end:{line:lineNumber, column:index - lineStart}};node = delegate.postProcess(node);}return node;}SyntaxTreeDelegate = {name:"SyntaxTree", postProcess:function postProcess(node){return node;}, createArrayExpression:function createArrayExpression(elements){return {type:Syntax.ArrayExpression, elements:elements};}, createAssignmentExpression:function createAssignmentExpression(operator, left, right){return {type:Syntax.AssignmentExpression, operator:operator, left:left, right:right};}, createBinaryExpression:function createBinaryExpression(operator, left, right){var type=operator === "||" || operator === "&&"?Syntax.LogicalExpression:Syntax.BinaryExpression;return {type:type, operator:operator, left:left, right:right};}, createBlockStatement:function createBlockStatement(body){return {type:Syntax.BlockStatement, body:body};}, createBreakStatement:function createBreakStatement(label){return {type:Syntax.BreakStatement, label:label};}, createCallExpression:function createCallExpression(callee, args){return {type:Syntax.CallExpression, callee:callee, arguments:args};}, createCatchClause:function createCatchClause(param, body){return {type:Syntax.CatchClause, param:param, body:body};}, createConditionalExpression:function createConditionalExpression(test, consequent, alternate){return {type:Syntax.ConditionalExpression, test:test, consequent:consequent, alternate:alternate};}, createContinueStatement:function createContinueStatement(label){return {type:Syntax.ContinueStatement, label:label};}, createDebuggerStatement:function createDebuggerStatement(){return {type:Syntax.DebuggerStatement};}, createDoWhileStatement:function createDoWhileStatement(body, test){return {type:Syntax.DoWhileStatement, body:body, test:test};}, createEmptyStatement:function createEmptyStatement(){return {type:Syntax.EmptyStatement};}, createExpressionStatement:function createExpressionStatement(expression){return {type:Syntax.ExpressionStatement, expression:expression};}, createForStatement:function createForStatement(init, test, update, body){return {type:Syntax.ForStatement, init:init, test:test, update:update, body:body};}, createForInStatement:function createForInStatement(left, right, body){return {type:Syntax.ForInStatement, left:left, right:right, body:body, each:false};}, createForOfStatement:function createForOfStatement(left, right, body){return {type:Syntax.ForOfStatement, left:left, right:right, body:body};}, createFunctionDeclaration:function createFunctionDeclaration(id, params, defaults, body, rest, generator, expression){return {type:Syntax.FunctionDeclaration, id:id, params:params, defaults:defaults, body:body, rest:rest, generator:generator, expression:expression};}, createFunctionExpression:function createFunctionExpression(id, params, defaults, body, rest, generator, expression){return {type:Syntax.FunctionExpression, id:id, params:params, defaults:defaults, body:body, rest:rest, generator:generator, expression:expression};}, createIdentifier:function createIdentifier(name){return {type:Syntax.Identifier, name:name};}, createIfStatement:function createIfStatement(test, consequent, alternate){return {type:Syntax.IfStatement, test:test, consequent:consequent, alternate:alternate};}, createLabeledStatement:function createLabeledStatement(label, body){return {type:Syntax.LabeledStatement, label:label, body:body};}, createLiteral:function createLiteral(token){return {type:Syntax.Literal, value:token.value, raw:source.slice(token.range[0], token.range[1])};}, createMemberExpression:function createMemberExpression(accessor, object, property){return {type:Syntax.MemberExpression, computed:accessor === "[", object:object, property:property};}, createNewExpression:function createNewExpression(callee, args){return {type:Syntax.NewExpression, callee:callee, arguments:args};}, createObjectExpression:function createObjectExpression(properties){return {type:Syntax.ObjectExpression, properties:properties};}, createPostfixExpression:function createPostfixExpression(operator, argument){return {type:Syntax.UpdateExpression, operator:operator, argument:argument, prefix:false};}, createProgram:function createProgram(body){return {type:Syntax.Program, body:body};}, createProperty:function createProperty(kind, key, value, method, shorthand, computed){return {type:Syntax.Property, key:key, value:value, kind:kind, method:method, shorthand:shorthand, computed:computed};}, createReturnStatement:function createReturnStatement(argument){return {type:Syntax.ReturnStatement, argument:argument};}, createSequenceExpression:function createSequenceExpression(expressions){return {type:Syntax.SequenceExpression, expressions:expressions};}, createSwitchCase:function createSwitchCase(test, consequent){return {type:Syntax.SwitchCase, test:test, consequent:consequent};}, createSwitchStatement:function createSwitchStatement(discriminant, cases){return {type:Syntax.SwitchStatement, discriminant:discriminant, cases:cases};}, createThisExpression:function createThisExpression(){return {type:Syntax.ThisExpression};}, createThrowStatement:function createThrowStatement(argument){return {type:Syntax.ThrowStatement, argument:argument};}, createTryStatement:function createTryStatement(block, guardedHandlers, handlers, finalizer){return {type:Syntax.TryStatement, block:block, guardedHandlers:guardedHandlers, handlers:handlers, finalizer:finalizer};}, createUnaryExpression:function createUnaryExpression(operator, argument){if(operator === "++" || operator === "--"){return {type:Syntax.UpdateExpression, operator:operator, argument:argument, prefix:true};}return {type:Syntax.UnaryExpression, operator:operator, argument:argument, prefix:true};}, createVariableDeclaration:function createVariableDeclaration(declarations, kind){return {type:Syntax.VariableDeclaration, declarations:declarations, kind:kind};}, createVariableDeclarator:function createVariableDeclarator(id, init){return {type:Syntax.VariableDeclarator, id:id, init:init};}, createWhileStatement:function createWhileStatement(test, body){return {type:Syntax.WhileStatement, test:test, body:body};}, createWithStatement:function createWithStatement(object, body){return {type:Syntax.WithStatement, object:object, body:body};}, createTemplateElement:function createTemplateElement(value, tail){return {type:Syntax.TemplateElement, value:value, tail:tail};}, createTemplateLiteral:function createTemplateLiteral(quasis, expressions){return {type:Syntax.TemplateLiteral, quasis:quasis, expressions:expressions};}, createSpreadElement:function createSpreadElement(argument){return {type:Syntax.SpreadElement, argument:argument};}, createTaggedTemplateExpression:function createTaggedTemplateExpression(tag, quasi){return {type:Syntax.TaggedTemplateExpression, tag:tag, quasi:quasi};}, createArrowFunctionExpression:function createArrowFunctionExpression(params, defaults, body, rest, expression){return {type:Syntax.ArrowFunctionExpression, id:null, params:params, defaults:defaults, body:body, rest:rest, generator:false, expression:expression};}, createMethodDefinition:function createMethodDefinition(propertyType, kind, key, value){return {type:Syntax.MethodDefinition, key:key, value:value, kind:kind, "static":propertyType === ClassPropertyType["static"]};}, createClassBody:function createClassBody(body){return {type:Syntax.ClassBody, body:body};}, createClassExpression:function createClassExpression(id, superClass, body){return {type:Syntax.ClassExpression, id:id, superClass:superClass, body:body};}, createClassDeclaration:function createClassDeclaration(id, superClass, body){return {type:Syntax.ClassDeclaration, id:id, superClass:superClass, body:body};}, createExportSpecifier:function createExportSpecifier(id, name){return {type:Syntax.ExportSpecifier, id:id, name:name};}, createExportBatchSpecifier:function createExportBatchSpecifier(){return {type:Syntax.ExportBatchSpecifier};}, createExportDeclaration:function createExportDeclaration(declaration, specifiers, source){return {type:Syntax.ExportDeclaration, declaration:declaration, specifiers:specifiers, source:source};}, createImportSpecifier:function createImportSpecifier(id, name){return {type:Syntax.ImportSpecifier, id:id, name:name};}, createImportDeclaration:function createImportDeclaration(specifiers, kind, source){return {type:Syntax.ImportDeclaration, specifiers:specifiers, kind:kind, source:source};}, createYieldExpression:function createYieldExpression(argument, delegate){return {type:Syntax.YieldExpression, argument:argument, delegate:delegate};}, createModuleDeclaration:function createModuleDeclaration(id, source, body){return {type:Syntax.ModuleDeclaration, id:id, source:source, body:body};}, createComprehensionExpression:function createComprehensionExpression(filter, blocks, body){return {type:Syntax.ComprehensionExpression, filter:filter, blocks:blocks, body:body};}};function peekLineTerminator(){var pos, line, start, found;pos = index;line = lineNumber;start = lineStart;skipComment();found = lineNumber !== line;index = pos;lineNumber = line;lineStart = start;return found;}function throwError(token, messageFormat){var error, args=Array.prototype.slice.call(arguments, 2), msg=messageFormat.replace(/%(\d)/g, function(whole, index){assert(index < args.length, "Message reference must be in range");return args[index];});if(typeof token.lineNumber === "number"){error = new Error("Line " + token.lineNumber + ": " + msg);error.index = token.range[0];error.lineNumber = token.lineNumber;error.column = token.range[0] - lineStart + 1;}else {error = new Error("Line " + lineNumber + ": " + msg);error.index = index;error.lineNumber = lineNumber;error.column = index - lineStart + 1;}error.description = msg;throw error;}function throwErrorTolerant(){try{throwError.apply(null, arguments);}catch(e) {if(extra.errors){extra.errors.push(e);}else {throw e;}}}function throwUnexpected(token){if(token.type === Token.EOF){throwError(token, Messages.UnexpectedEOS);}if(token.type === Token.NumericLiteral){throwError(token, Messages.UnexpectedNumber);}if(token.type === Token.StringLiteral){throwError(token, Messages.UnexpectedString);}if(token.type === Token.Identifier){throwError(token, Messages.UnexpectedIdentifier);}if(token.type === Token.Keyword){if(isFutureReservedWord(token.value)){throwError(token, Messages.UnexpectedReserved);}else if(strict && isStrictModeReservedWord(token.value)){throwErrorTolerant(token, Messages.StrictReservedWord);return;}throwError(token, Messages.UnexpectedToken, token.value);}if(token.type === Token.Template){throwError(token, Messages.UnexpectedTemplate, token.value.raw);}throwError(token, Messages.UnexpectedToken, token.value);}function expect(value){var token=lex();if(token.type !== Token.Punctuator || token.value !== value){throwUnexpected(token);}}function expectKeyword(keyword){var token=lex();if(token.type !== Token.Keyword || token.value !== keyword){throwUnexpected(token);}}function match(value){return lookahead.type === Token.Punctuator && lookahead.value === value;}function matchKeyword(keyword){return lookahead.type === Token.Keyword && lookahead.value === keyword;}function matchContextualKeyword(keyword){return lookahead.type === Token.Identifier && lookahead.value === keyword;}function matchAssign(){var op;if(lookahead.type !== Token.Punctuator){return false;}op = lookahead.value;return op === "=" || op === "*=" || op === "/=" || op === "%=" || op === "+=" || op === "-=" || op === "<<=" || op === ">>=" || op === ">>>=" || op === "&=" || op === "^=" || op === "|=";}function consumeSemicolon(){var line;if(source.charCodeAt(index) === 59){lex();return;}line = lineNumber;skipComment();if(lineNumber !== line){return;}if(match(";")){lex();return;}if(lookahead.type !== Token.EOF && !match("}")){throwUnexpected(lookahead);}}function isLeftHandSide(expr){return expr.type === Syntax.Identifier || expr.type === Syntax.MemberExpression;}function isAssignableLeftHandSide(expr){return isLeftHandSide(expr) || expr.type === Syntax.ObjectPattern || expr.type === Syntax.ArrayPattern;}function parseArrayInitialiser(){var elements=[], blocks=[], filter=null, tmp, possiblecomprehension=true, body, marker=markerCreate();expect("[");while(!match("]")) {if(lookahead.value === "for" && lookahead.type === Token.Keyword){if(!possiblecomprehension){throwError({}, Messages.ComprehensionError);}matchKeyword("for");tmp = parseForStatement({ignoreBody:true});tmp.of = tmp.type === Syntax.ForOfStatement;tmp.type = Syntax.ComprehensionBlock;if(tmp.left.kind){throwError({}, Messages.ComprehensionError);}blocks.push(tmp);}else if(lookahead.value === "if" && lookahead.type === Token.Keyword){if(!possiblecomprehension){throwError({}, Messages.ComprehensionError);}expectKeyword("if");expect("(");filter = parseExpression();expect(")");}else if(lookahead.value === "," && lookahead.type === Token.Punctuator){possiblecomprehension = false;lex();elements.push(null);}else {tmp = parseSpreadOrAssignmentExpression();elements.push(tmp);if(tmp && tmp.type === Syntax.SpreadElement){if(!match("]")){throwError({}, Messages.ElementAfterSpreadElement);}}else if(!(match("]") || matchKeyword("for") || matchKeyword("if"))){expect(",");possiblecomprehension = false;}}}expect("]");if(filter && !blocks.length){throwError({}, Messages.ComprehensionRequiresBlock);}if(blocks.length){if(elements.length !== 1){throwError({}, Messages.ComprehensionError);}return markerApply(marker, delegate.createComprehensionExpression(filter, blocks, elements[0]));}return markerApply(marker, delegate.createArrayExpression(elements));}function parsePropertyFunction(options){var previousStrict, previousYieldAllowed, params, defaults, body, marker=markerCreate();previousStrict = strict;previousYieldAllowed = state.yieldAllowed;state.yieldAllowed = options.generator;params = options.params || [];defaults = options.defaults || [];body = parseConciseBody();if(options.name && strict && isRestrictedWord(params[0].name)){throwErrorTolerant(options.name, Messages.StrictParamName);}strict = previousStrict;state.yieldAllowed = previousYieldAllowed;return markerApply(marker, delegate.createFunctionExpression(null, params, defaults, body, options.rest || null, options.generator, body.type !== Syntax.BlockStatement));}function parsePropertyMethodFunction(options){var previousStrict, tmp, method;previousStrict = strict;strict = true;tmp = parseParams();if(tmp.stricted){throwErrorTolerant(tmp.stricted, tmp.message);}method = parsePropertyFunction({params:tmp.params, defaults:tmp.defaults, rest:tmp.rest, generator:options.generator});strict = previousStrict;return method;}function parseObjectPropertyKey(){var marker=markerCreate(), token=lex(), propertyKey, result;if(token.type === Token.StringLiteral || token.type === Token.NumericLiteral){if(strict && token.octal){throwErrorTolerant(token, Messages.StrictOctalLiteral);}return markerApply(marker, delegate.createLiteral(token));}if(token.type === Token.Punctuator && token.value === "["){marker = markerCreate();propertyKey = parseAssignmentExpression();result = markerApply(marker, propertyKey);expect("]");return result;}return markerApply(marker, delegate.createIdentifier(token.value));}function parseObjectProperty(){var token, key, id, value, param, expr, computed, marker=markerCreate();token = lookahead;computed = token.value === "[";if(token.type === Token.Identifier || computed){id = parseObjectPropertyKey();if(token.value === "get" && !(match(":") || match("("))){computed = lookahead.value === "[";key = parseObjectPropertyKey();expect("(");expect(")");return markerApply(marker, delegate.createProperty("get", key, parsePropertyFunction({generator:false}), false, false, computed));}if(token.value === "set" && !(match(":") || match("("))){computed = lookahead.value === "[";key = parseObjectPropertyKey();expect("(");token = lookahead;param = [parseVariableIdentifier()];expect(")");return markerApply(marker, delegate.createProperty("set", key, parsePropertyFunction({params:param, generator:false, name:token}), false, false, computed));}if(match(":")){lex();return markerApply(marker, delegate.createProperty("init", id, parseAssignmentExpression(), false, false, computed));}if(match("(")){return markerApply(marker, delegate.createProperty("init", id, parsePropertyMethodFunction({generator:false}), true, false, computed));}if(computed){throwUnexpected(lookahead);}return markerApply(marker, delegate.createProperty("init", id, id, false, true, false));}if(token.type === Token.EOF || token.type === Token.Punctuator){if(!match("*")){throwUnexpected(token);}lex();computed = lookahead.type === Token.Punctuator && lookahead.value === "[";id = parseObjectPropertyKey();if(!match("(")){throwUnexpected(lex());}return markerApply(marker, delegate.createProperty("init", id, parsePropertyMethodFunction({generator:true}), true, false, computed));}key = parseObjectPropertyKey();if(match(":")){lex();return markerApply(marker, delegate.createProperty("init", key, parseAssignmentExpression(), false, false, false));}if(match("(")){return markerApply(marker, delegate.createProperty("init", key, parsePropertyMethodFunction({generator:false}), true, false, false));}throwUnexpected(lex());}function parseObjectInitialiser(){var properties=[], property, name, key, kind, map={}, toString=String, marker=markerCreate();expect("{");while(!match("}")) {property = parseObjectProperty();if(property.key.type === Syntax.Identifier){name = property.key.name;}else {name = toString(property.key.value);}kind = property.kind === "init"?PropertyKind.Data:property.kind === "get"?PropertyKind.Get:PropertyKind.Set;key = "$" + name;if(Object.prototype.hasOwnProperty.call(map, key)){if(map[key] === PropertyKind.Data){if(strict && kind === PropertyKind.Data){throwErrorTolerant({}, Messages.StrictDuplicateProperty);}else if(kind !== PropertyKind.Data){throwErrorTolerant({}, Messages.AccessorDataProperty);}}else {if(kind === PropertyKind.Data){throwErrorTolerant({}, Messages.AccessorDataProperty);}else if(map[key] & kind){throwErrorTolerant({}, Messages.AccessorGetSet);}}map[key] |= kind;}else {map[key] = kind;}properties.push(property);if(!match("}")){expect(",");}}expect("}");return markerApply(marker, delegate.createObjectExpression(properties));}function parseTemplateElement(option){var marker=markerCreate(), token=scanTemplateElement(option);if(strict && token.octal){throwError(token, Messages.StrictOctalLiteral);}return markerApply(marker, delegate.createTemplateElement({raw:token.value.raw, cooked:token.value.cooked}, token.tail));}function parseTemplateLiteral(){var quasi, quasis, expressions, marker=markerCreate();quasi = parseTemplateElement({head:true});quasis = [quasi];expressions = [];while(!quasi.tail) {expressions.push(parseExpression());quasi = parseTemplateElement({head:false});quasis.push(quasi);}return markerApply(marker, delegate.createTemplateLiteral(quasis, expressions));}function parseGroupExpression(){var expr;expect("(");++state.parenthesizedCount;expr = parseExpression();expect(")");return expr;}function parsePrimaryExpression(){var marker, type, token, expr;type = lookahead.type;if(type === Token.Identifier){marker = markerCreate();return markerApply(marker, delegate.createIdentifier(lex().value));}if(type === Token.StringLiteral || type === Token.NumericLiteral){if(strict && lookahead.octal){throwErrorTolerant(lookahead, Messages.StrictOctalLiteral);}marker = markerCreate();return markerApply(marker, delegate.createLiteral(lex()));}if(type === Token.Keyword){if(matchKeyword("this")){marker = markerCreate();lex();return markerApply(marker, delegate.createThisExpression());}if(matchKeyword("function")){return parseFunctionExpression();}if(matchKeyword("class")){return parseClassExpression();}if(matchKeyword("super")){marker = markerCreate();lex();return markerApply(marker, delegate.createIdentifier("super"));}}if(type === Token.BooleanLiteral){marker = markerCreate();token = lex();token.value = token.value === "true";return markerApply(marker, delegate.createLiteral(token));}if(type === Token.NullLiteral){marker = markerCreate();token = lex();token.value = null;return markerApply(marker, delegate.createLiteral(token));}if(match("[")){return parseArrayInitialiser();}if(match("{")){return parseObjectInitialiser();}if(match("(")){return parseGroupExpression();}if(match("/") || match("/=")){marker = markerCreate();return markerApply(marker, delegate.createLiteral(scanRegExp()));}if(type === Token.Template){return parseTemplateLiteral();}throwUnexpected(lex());}function parseArguments(){var args=[], arg;expect("(");if(!match(")")){while(index < length) {arg = parseSpreadOrAssignmentExpression();args.push(arg);if(match(")")){break;}else if(arg.type === Syntax.SpreadElement){throwError({}, Messages.ElementAfterSpreadElement);}expect(",");}}expect(")");return args;}function parseSpreadOrAssignmentExpression(){if(match("...")){var marker=markerCreate();lex();return markerApply(marker, delegate.createSpreadElement(parseAssignmentExpression()));}return parseAssignmentExpression();}function parseNonComputedProperty(){var marker=markerCreate(), token=lex();if(!isIdentifierName(token)){throwUnexpected(token);}return markerApply(marker, delegate.createIdentifier(token.value));}function parseNonComputedMember(){expect(".");return parseNonComputedProperty();}function parseComputedMember(){var expr;expect("[");expr = parseExpression();expect("]");return expr;}function parseNewExpression(){var callee, args, marker=markerCreate();expectKeyword("new");callee = parseLeftHandSideExpression();args = match("(")?parseArguments():[];return markerApply(marker, delegate.createNewExpression(callee, args));}function parseLeftHandSideExpressionAllowCall(){var expr, args, marker=markerCreate();expr = matchKeyword("new")?parseNewExpression():parsePrimaryExpression();while(match(".") || match("[") || match("(") || lookahead.type === Token.Template) {if(match("(")){args = parseArguments();expr = markerApply(marker, delegate.createCallExpression(expr, args));}else if(match("[")){expr = markerApply(marker, delegate.createMemberExpression("[", expr, parseComputedMember()));}else if(match(".")){expr = markerApply(marker, delegate.createMemberExpression(".", expr, parseNonComputedMember()));}else {expr = markerApply(marker, delegate.createTaggedTemplateExpression(expr, parseTemplateLiteral()));}}return expr;}function parseLeftHandSideExpression(){var expr, marker=markerCreate();expr = matchKeyword("new")?parseNewExpression():parsePrimaryExpression();while(match(".") || match("[") || lookahead.type === Token.Template) {if(match("[")){expr = markerApply(marker, delegate.createMemberExpression("[", expr, parseComputedMember()));}else if(match(".")){expr = markerApply(marker, delegate.createMemberExpression(".", expr, parseNonComputedMember()));}else {expr = markerApply(marker, delegate.createTaggedTemplateExpression(expr, parseTemplateLiteral()));}}return expr;}function parsePostfixExpression(){var marker=markerCreate(), expr=parseLeftHandSideExpressionAllowCall(), token;if(lookahead.type !== Token.Punctuator){return expr;}if((match("++") || match("--")) && !peekLineTerminator()){if(strict && expr.type === Syntax.Identifier && isRestrictedWord(expr.name)){throwErrorTolerant({}, Messages.StrictLHSPostfix);}if(!isLeftHandSide(expr)){throwError({}, Messages.InvalidLHSInAssignment);}token = lex();expr = markerApply(marker, delegate.createPostfixExpression(token.value, expr));}return expr;}function parseUnaryExpression(){var marker, token, expr;if(lookahead.type !== Token.Punctuator && lookahead.type !== Token.Keyword){return parsePostfixExpression();}if(match("++") || match("--")){marker = markerCreate();token = lex();expr = parseUnaryExpression();if(strict && expr.type === Syntax.Identifier && isRestrictedWord(expr.name)){throwErrorTolerant({}, Messages.StrictLHSPrefix);}if(!isLeftHandSide(expr)){throwError({}, Messages.InvalidLHSInAssignment);}return markerApply(marker, delegate.createUnaryExpression(token.value, expr));}if(match("+") || match("-") || match("~") || match("!")){marker = markerCreate();token = lex();expr = parseUnaryExpression();return markerApply(marker, delegate.createUnaryExpression(token.value, expr));}if(matchKeyword("delete") || matchKeyword("void") || matchKeyword("typeof")){marker = markerCreate();token = lex();expr = parseUnaryExpression();expr = markerApply(marker, delegate.createUnaryExpression(token.value, expr));if(strict && expr.operator === "delete" && expr.argument.type === Syntax.Identifier){throwErrorTolerant({}, Messages.StrictDelete);}return expr;}return parsePostfixExpression();}function binaryPrecedence(token, allowIn){var prec=0;if(token.type !== Token.Punctuator && token.type !== Token.Keyword){return 0;}switch(token.value){case "||":prec = 1;break;case "&&":prec = 2;break;case "|":prec = 3;break;case "^":prec = 4;break;case "&":prec = 5;break;case "==":case "!=":case "===":case "!==":prec = 6;break;case "<":case ">":case "<=":case ">=":case "instanceof":prec = 7;break;case "in":prec = allowIn?7:0;break;case "<<":case ">>":case ">>>":prec = 8;break;case "+":case "-":prec = 9;break;case "*":case "/":case "%":prec = 11;break;default:break;}return prec;}function parseBinaryExpression(){var expr, token, prec, previousAllowIn, stack, right, operator, left, i, marker, markers;previousAllowIn = state.allowIn;state.allowIn = true;marker = markerCreate();left = parseUnaryExpression();token = lookahead;prec = binaryPrecedence(token, previousAllowIn);if(prec === 0){return left;}token.prec = prec;lex();markers = [marker, markerCreate()];right = parseUnaryExpression();stack = [left, token, right];while((prec = binaryPrecedence(lookahead, previousAllowIn)) > 0) {while(stack.length > 2 && prec <= stack[stack.length - 2].prec) {right = stack.pop();operator = stack.pop().value;left = stack.pop();expr = delegate.createBinaryExpression(operator, left, right);markers.pop();marker = markers.pop();markerApply(marker, expr);stack.push(expr);markers.push(marker);}token = lex();token.prec = prec;stack.push(token);markers.push(markerCreate());expr = parseUnaryExpression();stack.push(expr);}state.allowIn = previousAllowIn;i = stack.length - 1;expr = stack[i];markers.pop();while(i > 1) {expr = delegate.createBinaryExpression(stack[i - 1].value, stack[i - 2], expr);i -= 2;marker = markers.pop();markerApply(marker, expr);}return expr;}function parseConditionalExpression(){var expr, previousAllowIn, consequent, alternate, marker=markerCreate();expr = parseBinaryExpression();if(match("?")){lex();previousAllowIn = state.allowIn;state.allowIn = true;consequent = parseAssignmentExpression();state.allowIn = previousAllowIn;expect(":");alternate = parseAssignmentExpression();expr = markerApply(marker, delegate.createConditionalExpression(expr, consequent, alternate));}return expr;}function reinterpretAsAssignmentBindingPattern(expr){var i, len, property, element;if(expr.type === Syntax.ObjectExpression){expr.type = Syntax.ObjectPattern;for(i = 0, len = expr.properties.length; i < len; i += 1) {property = expr.properties[i];if(property.kind !== "init"){throwError({}, Messages.InvalidLHSInAssignment);}reinterpretAsAssignmentBindingPattern(property.value);}}else if(expr.type === Syntax.ArrayExpression){expr.type = Syntax.ArrayPattern;for(i = 0, len = expr.elements.length; i < len; i += 1) {element = expr.elements[i];if(element){reinterpretAsAssignmentBindingPattern(element);}}}else if(expr.type === Syntax.Identifier){if(isRestrictedWord(expr.name)){throwError({}, Messages.InvalidLHSInAssignment);}}else if(expr.type === Syntax.SpreadElement){reinterpretAsAssignmentBindingPattern(expr.argument);if(expr.argument.type === Syntax.ObjectPattern){throwError({}, Messages.ObjectPatternAsSpread);}}else {if(expr.type !== Syntax.MemberExpression && expr.type !== Syntax.CallExpression && expr.type !== Syntax.NewExpression){throwError({}, Messages.InvalidLHSInAssignment);}}}function reinterpretAsDestructuredParameter(options, expr){var i, len, property, element;if(expr.type === Syntax.ObjectExpression){expr.type = Syntax.ObjectPattern;for(i = 0, len = expr.properties.length; i < len; i += 1) {property = expr.properties[i];if(property.kind !== "init"){throwError({}, Messages.InvalidLHSInFormalsList);}reinterpretAsDestructuredParameter(options, property.value);}}else if(expr.type === Syntax.ArrayExpression){expr.type = Syntax.ArrayPattern;for(i = 0, len = expr.elements.length; i < len; i += 1) {element = expr.elements[i];if(element){reinterpretAsDestructuredParameter(options, element);}}}else if(expr.type === Syntax.Identifier){validateParam(options, expr, expr.name);}else {if(expr.type !== Syntax.MemberExpression){throwError({}, Messages.InvalidLHSInFormalsList);}}}function reinterpretAsCoverFormalsList(expressions){var i, len, param, params, defaults, defaultCount, options, rest;params = [];defaults = [];defaultCount = 0;rest = null;options = {paramSet:{}};for(i = 0, len = expressions.length; i < len; i += 1) {param = expressions[i];if(param.type === Syntax.Identifier){params.push(param);defaults.push(null);validateParam(options, param, param.name);}else if(param.type === Syntax.ObjectExpression || param.type === Syntax.ArrayExpression){reinterpretAsDestructuredParameter(options, param);params.push(param);defaults.push(null);}else if(param.type === Syntax.SpreadElement){assert(i === len - 1, "It is guaranteed that SpreadElement is last element by parseExpression");reinterpretAsDestructuredParameter(options, param.argument);rest = param.argument;}else if(param.type === Syntax.AssignmentExpression){params.push(param.left);defaults.push(param.right);++defaultCount;validateParam(options, param.left, param.left.name);}else {return null;}}if(options.message === Messages.StrictParamDupe){throwError(strict?options.stricted:options.firstRestricted, options.message);}if(defaultCount === 0){defaults = [];}return {params:params, defaults:defaults, rest:rest, stricted:options.stricted, firstRestricted:options.firstRestricted, message:options.message};}function parseArrowFunctionExpression(options, marker){var previousStrict, previousYieldAllowed, body;expect("=>");previousStrict = strict;previousYieldAllowed = state.yieldAllowed;state.yieldAllowed = false;body = parseConciseBody();if(strict && options.firstRestricted){throwError(options.firstRestricted, options.message);}if(strict && options.stricted){throwErrorTolerant(options.stricted, options.message);}strict = previousStrict;state.yieldAllowed = previousYieldAllowed;return markerApply(marker, delegate.createArrowFunctionExpression(options.params, options.defaults, body, options.rest, body.type !== Syntax.BlockStatement));}function parseAssignmentExpression(){var marker, expr, token, params, oldParenthesizedCount;if(state.yieldAllowed && matchContextualKeyword("yield") || strict && matchKeyword("yield")){return parseYieldExpression();}oldParenthesizedCount = state.parenthesizedCount;marker = markerCreate();if(match("(")){token = lookahead2();if(token.type === Token.Punctuator && token.value === ")" || token.value === "..."){params = parseParams();if(!match("=>")){throwUnexpected(lex());}return parseArrowFunctionExpression(params, marker);}}token = lookahead;expr = parseConditionalExpression();if(match("=>") && (state.parenthesizedCount === oldParenthesizedCount || state.parenthesizedCount === oldParenthesizedCount + 1)){if(expr.type === Syntax.Identifier){params = reinterpretAsCoverFormalsList([expr]);}else if(expr.type === Syntax.SequenceExpression){params = reinterpretAsCoverFormalsList(expr.expressions);}if(params){return parseArrowFunctionExpression(params, marker);}}if(matchAssign()){if(strict && expr.type === Syntax.Identifier && isRestrictedWord(expr.name)){throwErrorTolerant(token, Messages.StrictLHSAssignment);}if(match("=") && (expr.type === Syntax.ObjectExpression || expr.type === Syntax.ArrayExpression)){reinterpretAsAssignmentBindingPattern(expr);}else if(!isLeftHandSide(expr)){throwError({}, Messages.InvalidLHSInAssignment);}expr = markerApply(marker, delegate.createAssignmentExpression(lex().value, expr, parseAssignmentExpression()));}return expr;}function parseExpression(){var marker, expr, expressions, sequence, coverFormalsList, spreadFound, oldParenthesizedCount;oldParenthesizedCount = state.parenthesizedCount;marker = markerCreate();expr = parseAssignmentExpression();expressions = [expr];if(match(",")){while(index < length) {if(!match(",")){break;}lex();expr = parseSpreadOrAssignmentExpression();expressions.push(expr);if(expr.type === Syntax.SpreadElement){spreadFound = true;if(!match(")")){throwError({}, Messages.ElementAfterSpreadElement);}break;}}sequence = markerApply(marker, delegate.createSequenceExpression(expressions));}if(match("=>")){if(state.parenthesizedCount === oldParenthesizedCount || state.parenthesizedCount === oldParenthesizedCount + 1){expr = expr.type === Syntax.SequenceExpression?expr.expressions:expressions;coverFormalsList = reinterpretAsCoverFormalsList(expr);if(coverFormalsList){return parseArrowFunctionExpression(coverFormalsList, marker);}}throwUnexpected(lex());}if(spreadFound && lookahead2().value !== "=>"){throwError({}, Messages.IllegalSpread);}return sequence || expr;}function parseStatementList(){var list=[], statement;while(index < length) {if(match("}")){break;}statement = parseSourceElement();if(typeof statement === "undefined"){break;}list.push(statement);}return list;}function parseBlock(){var block, marker=markerCreate();expect("{");block = parseStatementList();expect("}");return markerApply(marker, delegate.createBlockStatement(block));}function parseVariableIdentifier(){var marker=markerCreate(), token=lex();if(token.type !== Token.Identifier){throwUnexpected(token);}return markerApply(marker, delegate.createIdentifier(token.value));}function parseVariableDeclaration(kind){var id, marker=markerCreate(), init=null;if(match("{")){id = parseObjectInitialiser();reinterpretAsAssignmentBindingPattern(id);}else if(match("[")){id = parseArrayInitialiser();reinterpretAsAssignmentBindingPattern(id);}else {id = state.allowKeyword?parseNonComputedProperty():parseVariableIdentifier();if(strict && isRestrictedWord(id.name)){throwErrorTolerant({}, Messages.StrictVarName);}}if(kind === "const"){if(!match("=")){throwError({}, Messages.NoUnintializedConst);}expect("=");init = parseAssignmentExpression();}else if(match("=")){lex();init = parseAssignmentExpression();}return markerApply(marker, delegate.createVariableDeclarator(id, init));}function parseVariableDeclarationList(kind){var list=[];do{list.push(parseVariableDeclaration(kind));if(!match(",")){break;}lex();}while(index < length);return list;}function parseVariableStatement(){var declarations, marker=markerCreate();expectKeyword("var");declarations = parseVariableDeclarationList();consumeSemicolon();return markerApply(marker, delegate.createVariableDeclaration(declarations, "var"));}function parseConstLetDeclaration(kind){var declarations, marker=markerCreate();expectKeyword(kind);declarations = parseVariableDeclarationList(kind);consumeSemicolon();return markerApply(marker, delegate.createVariableDeclaration(declarations, kind));}function parseModuleDeclaration(){var id, src, body, marker=markerCreate();lex();if(peekLineTerminator()){throwError({}, Messages.NewlineAfterModule);}switch(lookahead.type){case Token.StringLiteral:id = parsePrimaryExpression();body = parseModuleBlock();src = null;break;case Token.Identifier:id = parseVariableIdentifier();body = null;if(!matchContextualKeyword("from")){throwUnexpected(lex());}lex();src = parsePrimaryExpression();if(src.type !== Syntax.Literal){throwError({}, Messages.InvalidModuleSpecifier);}break;}consumeSemicolon();return markerApply(marker, delegate.createModuleDeclaration(id, src, body));}function parseExportBatchSpecifier(){var marker=markerCreate();expect("*");return markerApply(marker, delegate.createExportBatchSpecifier());}function parseExportSpecifier(){var id, name=null, marker=markerCreate();id = parseVariableIdentifier();if(matchContextualKeyword("as")){lex();name = parseNonComputedProperty();}return markerApply(marker, delegate.createExportSpecifier(id, name));}function parseExportDeclaration(){var previousAllowKeyword, decl, def, src, specifiers, marker=markerCreate();expectKeyword("export");if(lookahead.type === Token.Keyword){switch(lookahead.value){case "let":case "const":case "var":case "class":case "function":return markerApply(marker, delegate.createExportDeclaration(parseSourceElement(), null, null));}}if(isIdentifierName(lookahead)){previousAllowKeyword = state.allowKeyword;state.allowKeyword = true;decl = parseVariableDeclarationList("let");state.allowKeyword = previousAllowKeyword;return markerApply(marker, delegate.createExportDeclaration(decl, null, null));}specifiers = [];src = null;if(match("*")){specifiers.push(parseExportBatchSpecifier());}else {expect("{");do{specifiers.push(parseExportSpecifier());}while(match(",") && lex());expect("}");}if(matchContextualKeyword("from")){lex();src = parsePrimaryExpression();if(src.type !== Syntax.Literal){throwError({}, Messages.InvalidModuleSpecifier);}}consumeSemicolon();return markerApply(marker, delegate.createExportDeclaration(null, specifiers, src));}function parseImportDeclaration(){var specifiers, kind, src, marker=markerCreate();expectKeyword("import");specifiers = [];if(isIdentifierName(lookahead)){kind = "default";specifiers.push(parseImportSpecifier());if(!matchContextualKeyword("from")){throwError({}, Messages.NoFromAfterImport);}lex();}else if(match("{")){kind = "named";lex();do{specifiers.push(parseImportSpecifier());}while(match(",") && lex());expect("}");if(!matchContextualKeyword("from")){throwError({}, Messages.NoFromAfterImport);}lex();}src = parsePrimaryExpression();if(src.type !== Syntax.Literal){throwError({}, Messages.InvalidModuleSpecifier);}consumeSemicolon();return markerApply(marker, delegate.createImportDeclaration(specifiers, kind, src));}function parseImportSpecifier(){var id, name=null, marker=markerCreate();id = parseNonComputedProperty();if(matchContextualKeyword("as")){lex();name = parseVariableIdentifier();}return markerApply(marker, delegate.createImportSpecifier(id, name));}function parseEmptyStatement(){var marker=markerCreate();expect(";");return markerApply(marker, delegate.createEmptyStatement());}function parseExpressionStatement(){var marker=markerCreate(), expr=parseExpression();consumeSemicolon();return markerApply(marker, delegate.createExpressionStatement(expr));}function parseIfStatement(){var test, consequent, alternate, marker=markerCreate();expectKeyword("if");expect("(");test = parseExpression();expect(")");consequent = parseStatement();if(matchKeyword("else")){lex();alternate = parseStatement();}else {alternate = null;}return markerApply(marker, delegate.createIfStatement(test, consequent, alternate));}function parseDoWhileStatement(){var body, test, oldInIteration, marker=markerCreate();expectKeyword("do");oldInIteration = state.inIteration;state.inIteration = true;body = parseStatement();state.inIteration = oldInIteration;expectKeyword("while");expect("(");test = parseExpression();expect(")");if(match(";")){lex();}return markerApply(marker, delegate.createDoWhileStatement(body, test));}function parseWhileStatement(){var test, body, oldInIteration, marker=markerCreate();expectKeyword("while");expect("(");test = parseExpression();expect(")");oldInIteration = state.inIteration;state.inIteration = true;body = parseStatement();state.inIteration = oldInIteration;return markerApply(marker, delegate.createWhileStatement(test, body));}function parseForVariableDeclaration(){var marker=markerCreate(), token=lex(), declarations=parseVariableDeclarationList();return markerApply(marker, delegate.createVariableDeclaration(declarations, token.value));}function parseForStatement(opts){var init, test, update, left, right, body, operator, oldInIteration, marker=markerCreate();init = test = update = null;expectKeyword("for");if(matchContextualKeyword("each")){throwError({}, Messages.EachNotAllowed);}expect("(");if(match(";")){lex();}else {if(matchKeyword("var") || matchKeyword("let") || matchKeyword("const")){state.allowIn = false;init = parseForVariableDeclaration();state.allowIn = true;if(init.declarations.length === 1){if(matchKeyword("in") || matchContextualKeyword("of")){operator = lookahead;if(!((operator.value === "in" || init.kind !== "var") && init.declarations[0].init)){lex();left = init;right = parseExpression();init = null;}}}}else {state.allowIn = false;init = parseExpression();state.allowIn = true;if(matchContextualKeyword("of")){operator = lex();left = init;right = parseExpression();init = null;}else if(matchKeyword("in")){if(!isAssignableLeftHandSide(init)){throwError({}, Messages.InvalidLHSInForIn);}operator = lex();left = init;right = parseExpression();init = null;}}if(typeof left === "undefined"){expect(";");}}if(typeof left === "undefined"){if(!match(";")){test = parseExpression();}expect(";");if(!match(")")){update = parseExpression();}}expect(")");oldInIteration = state.inIteration;state.inIteration = true;if(!(opts !== undefined && opts.ignoreBody)){body = parseStatement();}state.inIteration = oldInIteration;if(typeof left === "undefined"){return markerApply(marker, delegate.createForStatement(init, test, update, body));}if(operator.value === "in"){return markerApply(marker, delegate.createForInStatement(left, right, body));}return markerApply(marker, delegate.createForOfStatement(left, right, body));}function parseContinueStatement(){var label=null, key, marker=markerCreate();expectKeyword("continue");if(source.charCodeAt(index) === 59){lex();if(!state.inIteration){throwError({}, Messages.IllegalContinue);}return markerApply(marker, delegate.createContinueStatement(null));}if(peekLineTerminator()){if(!state.inIteration){throwError({}, Messages.IllegalContinue);}return markerApply(marker, delegate.createContinueStatement(null));}if(lookahead.type === Token.Identifier){label = parseVariableIdentifier();key = "$" + label.name;if(!Object.prototype.hasOwnProperty.call(state.labelSet, key)){throwError({}, Messages.UnknownLabel, label.name);}}consumeSemicolon();if(label === null && !state.inIteration){throwError({}, Messages.IllegalContinue);}return markerApply(marker, delegate.createContinueStatement(label));}function parseBreakStatement(){var label=null, key, marker=markerCreate();expectKeyword("break");if(source.charCodeAt(index) === 59){lex();if(!(state.inIteration || state.inSwitch)){throwError({}, Messages.IllegalBreak);}return markerApply(marker, delegate.createBreakStatement(null));}if(peekLineTerminator()){if(!(state.inIteration || state.inSwitch)){throwError({}, Messages.IllegalBreak);}return markerApply(marker, delegate.createBreakStatement(null));}if(lookahead.type === Token.Identifier){label = parseVariableIdentifier();key = "$" + label.name;if(!Object.prototype.hasOwnProperty.call(state.labelSet, key)){throwError({}, Messages.UnknownLabel, label.name);}}consumeSemicolon();if(label === null && !(state.inIteration || state.inSwitch)){throwError({}, Messages.IllegalBreak);}return markerApply(marker, delegate.createBreakStatement(label));}function parseReturnStatement(){var argument=null, marker=markerCreate();expectKeyword("return");if(!state.inFunctionBody){throwErrorTolerant({}, Messages.IllegalReturn);}if(source.charCodeAt(index) === 32){if(isIdentifierStart(source.charCodeAt(index + 1))){argument = parseExpression();consumeSemicolon();return markerApply(marker, delegate.createReturnStatement(argument));}}if(peekLineTerminator()){return markerApply(marker, delegate.createReturnStatement(null));}if(!match(";")){if(!match("}") && lookahead.type !== Token.EOF){argument = parseExpression();}}consumeSemicolon();return markerApply(marker, delegate.createReturnStatement(argument));}function parseWithStatement(){var object, body, marker=markerCreate();if(strict){throwErrorTolerant({}, Messages.StrictModeWith);}expectKeyword("with");expect("(");object = parseExpression();expect(")");body = parseStatement();return markerApply(marker, delegate.createWithStatement(object, body));}function parseSwitchCase(){var test, consequent=[], sourceElement, marker=markerCreate();if(matchKeyword("default")){lex();test = null;}else {expectKeyword("case");test = parseExpression();}expect(":");while(index < length) {if(match("}") || matchKeyword("default") || matchKeyword("case")){break;}sourceElement = parseSourceElement();if(typeof sourceElement === "undefined"){break;}consequent.push(sourceElement);}return markerApply(marker, delegate.createSwitchCase(test, consequent));}function parseSwitchStatement(){var discriminant, cases, clause, oldInSwitch, defaultFound, marker=markerCreate();expectKeyword("switch");expect("(");discriminant = parseExpression();expect(")");expect("{");cases = [];if(match("}")){lex();return markerApply(marker, delegate.createSwitchStatement(discriminant, cases));}oldInSwitch = state.inSwitch;state.inSwitch = true;defaultFound = false;while(index < length) {if(match("}")){break;}clause = parseSwitchCase();if(clause.test === null){if(defaultFound){throwError({}, Messages.MultipleDefaultsInSwitch);}defaultFound = true;}cases.push(clause);}state.inSwitch = oldInSwitch;expect("}");return markerApply(marker, delegate.createSwitchStatement(discriminant, cases));}function parseThrowStatement(){var argument, marker=markerCreate();expectKeyword("throw");if(peekLineTerminator()){throwError({}, Messages.NewlineAfterThrow);}argument = parseExpression();consumeSemicolon();return markerApply(marker, delegate.createThrowStatement(argument));}function parseCatchClause(){var param, body, marker=markerCreate();expectKeyword("catch");expect("(");if(match(")")){throwUnexpected(lookahead);}param = parseExpression();if(strict && param.type === Syntax.Identifier && isRestrictedWord(param.name)){throwErrorTolerant({}, Messages.StrictCatchVariable);}expect(")");body = parseBlock();return markerApply(marker, delegate.createCatchClause(param, body));}function parseTryStatement(){var block, handlers=[], finalizer=null, marker=markerCreate();expectKeyword("try");block = parseBlock();if(matchKeyword("catch")){handlers.push(parseCatchClause());}if(matchKeyword("finally")){lex();finalizer = parseBlock();}if(handlers.length === 0 && !finalizer){throwError({}, Messages.NoCatchOrFinally);}return markerApply(marker, delegate.createTryStatement(block, [], handlers, finalizer));}function parseDebuggerStatement(){var marker=markerCreate();expectKeyword("debugger");consumeSemicolon();return markerApply(marker, delegate.createDebuggerStatement());}function parseStatement(){var type=lookahead.type, marker, expr, labeledBody, key;if(type === Token.EOF){throwUnexpected(lookahead);}if(type === Token.Punctuator){switch(lookahead.value){case ";":return parseEmptyStatement();case "{":return parseBlock();case "(":return parseExpressionStatement();default:break;}}if(type === Token.Keyword){switch(lookahead.value){case "break":return parseBreakStatement();case "continue":return parseContinueStatement();case "debugger":return parseDebuggerStatement();case "do":return parseDoWhileStatement();case "for":return parseForStatement();case "function":return parseFunctionDeclaration();case "class":return parseClassDeclaration();case "if":return parseIfStatement();case "return":return parseReturnStatement();case "switch":return parseSwitchStatement();case "throw":return parseThrowStatement();case "try":return parseTryStatement();case "var":return parseVariableStatement();case "while":return parseWhileStatement();case "with":return parseWithStatement();default:break;}}marker = markerCreate();expr = parseExpression();if(expr.type === Syntax.Identifier && match(":")){lex();key = "$" + expr.name;if(Object.prototype.hasOwnProperty.call(state.labelSet, key)){throwError({}, Messages.Redeclaration, "Label", expr.name);}state.labelSet[key] = true;labeledBody = parseStatement();delete state.labelSet[key];return markerApply(marker, delegate.createLabeledStatement(expr, labeledBody));}consumeSemicolon();return markerApply(marker, delegate.createExpressionStatement(expr));}function parseConciseBody(){if(match("{")){return parseFunctionSourceElements();}return parseAssignmentExpression();}function parseFunctionSourceElements(){var sourceElement, sourceElements=[], token, directive, firstRestricted, oldLabelSet, oldInIteration, oldInSwitch, oldInFunctionBody, oldParenthesizedCount, marker=markerCreate();expect("{");while(index < length) {if(lookahead.type !== Token.StringLiteral){break;}token = lookahead;sourceElement = parseSourceElement();sourceElements.push(sourceElement);if(sourceElement.expression.type !== Syntax.Literal){break;}directive = source.slice(token.range[0] + 1, token.range[1] - 1);if(directive === "use strict"){strict = true;if(firstRestricted){throwErrorTolerant(firstRestricted, Messages.StrictOctalLiteral);}}else {if(!firstRestricted && token.octal){firstRestricted = token;}}}oldLabelSet = state.labelSet;oldInIteration = state.inIteration;oldInSwitch = state.inSwitch;oldInFunctionBody = state.inFunctionBody;oldParenthesizedCount = state.parenthesizedCount;state.labelSet = {};state.inIteration = false;state.inSwitch = false;state.inFunctionBody = true;state.parenthesizedCount = 0;while(index < length) {if(match("}")){break;}sourceElement = parseSourceElement();if(typeof sourceElement === "undefined"){break;}sourceElements.push(sourceElement);}expect("}");state.labelSet = oldLabelSet;state.inIteration = oldInIteration;state.inSwitch = oldInSwitch;state.inFunctionBody = oldInFunctionBody;state.parenthesizedCount = oldParenthesizedCount;return markerApply(marker, delegate.createBlockStatement(sourceElements));}function validateParam(options, param, name){var key="$" + name;if(strict){if(isRestrictedWord(name)){options.stricted = param;options.message = Messages.StrictParamName;}if(Object.prototype.hasOwnProperty.call(options.paramSet, key)){options.stricted = param;options.message = Messages.StrictParamDupe;}}else if(!options.firstRestricted){if(isRestrictedWord(name)){options.firstRestricted = param;options.message = Messages.StrictParamName;}else if(isStrictModeReservedWord(name)){options.firstRestricted = param;options.message = Messages.StrictReservedWord;}else if(Object.prototype.hasOwnProperty.call(options.paramSet, key)){options.firstRestricted = param;options.message = Messages.StrictParamDupe;}}options.paramSet[key] = true;}function parseParam(options){var token, rest, param, def;token = lookahead;if(token.value === "..."){token = lex();rest = true;}if(match("[")){param = parseArrayInitialiser();reinterpretAsDestructuredParameter(options, param);}else if(match("{")){if(rest){throwError({}, Messages.ObjectPatternAsRestParameter);}param = parseObjectInitialiser();reinterpretAsDestructuredParameter(options, param);}else {param = parseVariableIdentifier();validateParam(options, token, token.value);}if(match("=")){if(rest){throwErrorTolerant(lookahead, Messages.DefaultRestParameter);}lex();def = parseAssignmentExpression();++options.defaultCount;}if(rest){if(!match(")")){throwError({}, Messages.ParameterAfterRestParameter);}options.rest = param;return false;}options.params.push(param);options.defaults.push(def);return !match(")");}function parseParams(firstRestricted){var options, marker=markerCreate();options = {params:[], defaultCount:0, defaults:[], rest:null, firstRestricted:firstRestricted};expect("(");if(!match(")")){options.paramSet = {};while(index < length) {if(!parseParam(options)){break;}expect(",");}}expect(")");if(options.defaultCount === 0){options.defaults = [];}return markerApply(marker, options);}function parseFunctionDeclaration(){var id, body, token, tmp, firstRestricted, message, previousStrict, previousYieldAllowed, generator, marker=markerCreate();expectKeyword("function");generator = false;if(match("*")){lex();generator = true;}token = lookahead;id = parseVariableIdentifier();if(strict){if(isRestrictedWord(token.value)){throwErrorTolerant(token, Messages.StrictFunctionName);}}else {if(isRestrictedWord(token.value)){firstRestricted = token;message = Messages.StrictFunctionName;}else if(isStrictModeReservedWord(token.value)){firstRestricted = token;message = Messages.StrictReservedWord;}}tmp = parseParams(firstRestricted);firstRestricted = tmp.firstRestricted;if(tmp.message){message = tmp.message;}previousStrict = strict;previousYieldAllowed = state.yieldAllowed;state.yieldAllowed = generator;body = parseFunctionSourceElements();if(strict && firstRestricted){throwError(firstRestricted, message);}if(strict && tmp.stricted){throwErrorTolerant(tmp.stricted, message);}strict = previousStrict;state.yieldAllowed = previousYieldAllowed;return markerApply(marker, delegate.createFunctionDeclaration(id, tmp.params, tmp.defaults, body, tmp.rest, generator, false));}function parseFunctionExpression(){var token, id=null, firstRestricted, message, tmp, body, previousStrict, previousYieldAllowed, generator, marker=markerCreate();expectKeyword("function");generator = false;if(match("*")){lex();generator = true;}if(!match("(")){token = lookahead;id = parseVariableIdentifier();if(strict){if(isRestrictedWord(token.value)){throwErrorTolerant(token, Messages.StrictFunctionName);}}else {if(isRestrictedWord(token.value)){firstRestricted = token;message = Messages.StrictFunctionName;}else if(isStrictModeReservedWord(token.value)){firstRestricted = token;message = Messages.StrictReservedWord;}}}tmp = parseParams(firstRestricted);firstRestricted = tmp.firstRestricted;if(tmp.message){message = tmp.message;}previousStrict = strict;previousYieldAllowed = state.yieldAllowed;state.yieldAllowed = generator;body = parseFunctionSourceElements();if(strict && firstRestricted){throwError(firstRestricted, message);}if(strict && tmp.stricted){throwErrorTolerant(tmp.stricted, message);}strict = previousStrict;state.yieldAllowed = previousYieldAllowed;return markerApply(marker, delegate.createFunctionExpression(id, tmp.params, tmp.defaults, body, tmp.rest, generator, false));}function parseYieldExpression(){var yieldToken, delegateFlag, expr, marker=markerCreate();yieldToken = lex();assert(yieldToken.value === "yield", "Called parseYieldExpression with non-yield lookahead.");if(!state.yieldAllowed){throwErrorTolerant({}, Messages.IllegalYield);}delegateFlag = false;if(match("*")){lex();delegateFlag = true;}expr = parseAssignmentExpression();return markerApply(marker, delegate.createYieldExpression(expr, delegateFlag));}function parseMethodDefinition(existingPropNames){var token, key, param, propType, isValidDuplicateProp=false, marker=markerCreate();if(lookahead.value === "static"){propType = ClassPropertyType["static"];lex();}else {propType = ClassPropertyType.prototype;}if(match("*")){lex();return markerApply(marker, delegate.createMethodDefinition(propType, "", parseObjectPropertyKey(), parsePropertyMethodFunction({generator:true})));}token = lookahead;key = parseObjectPropertyKey();if(token.value === "get" && !match("(")){key = parseObjectPropertyKey();if(existingPropNames[propType].hasOwnProperty(key.name)){isValidDuplicateProp = existingPropNames[propType][key.name].get === undefined && existingPropNames[propType][key.name].data === undefined && existingPropNames[propType][key.name].set !== undefined;if(!isValidDuplicateProp){throwError(key, Messages.IllegalDuplicateClassProperty);}}else {existingPropNames[propType][key.name] = {};}existingPropNames[propType][key.name].get = true;expect("(");expect(")");return markerApply(marker, delegate.createMethodDefinition(propType, "get", key, parsePropertyFunction({generator:false})));}if(token.value === "set" && !match("(")){key = parseObjectPropertyKey();if(existingPropNames[propType].hasOwnProperty(key.name)){isValidDuplicateProp = existingPropNames[propType][key.name].set === undefined && existingPropNames[propType][key.name].data === undefined && existingPropNames[propType][key.name].get !== undefined;if(!isValidDuplicateProp){throwError(key, Messages.IllegalDuplicateClassProperty);}}else {existingPropNames[propType][key.name] = {};}existingPropNames[propType][key.name].set = true;expect("(");token = lookahead;param = [parseVariableIdentifier()];expect(")");return markerApply(marker, delegate.createMethodDefinition(propType, "set", key, parsePropertyFunction({params:param, generator:false, name:token})));}if(existingPropNames[propType].hasOwnProperty(key.name)){throwError(key, Messages.IllegalDuplicateClassProperty);}else {existingPropNames[propType][key.name] = {};}existingPropNames[propType][key.name].data = true;return markerApply(marker, delegate.createMethodDefinition(propType, "", key, parsePropertyMethodFunction({generator:false})));}function parseClassElement(existingProps){if(match(";")){lex();return;}return parseMethodDefinition(existingProps);}function parseClassBody(){var classElement, classElements=[], existingProps={}, marker=markerCreate();existingProps[ClassPropertyType["static"]] = {};existingProps[ClassPropertyType.prototype] = {};expect("{");while(index < length) {if(match("}")){break;}classElement = parseClassElement(existingProps);if(typeof classElement !== "undefined"){classElements.push(classElement);}}expect("}");return markerApply(marker, delegate.createClassBody(classElements));}function parseClassExpression(){var id, previousYieldAllowed, superClass=null, marker=markerCreate();expectKeyword("class");if(!matchKeyword("extends") && !match("{")){id = parseVariableIdentifier();}if(matchKeyword("extends")){expectKeyword("extends");previousYieldAllowed = state.yieldAllowed;state.yieldAllowed = false;superClass = parseAssignmentExpression();state.yieldAllowed = previousYieldAllowed;}return markerApply(marker, delegate.createClassExpression(id, superClass, parseClassBody()));}function parseClassDeclaration(){var id, previousYieldAllowed, superClass=null, marker=markerCreate();expectKeyword("class");id = parseVariableIdentifier();if(matchKeyword("extends")){expectKeyword("extends");previousYieldAllowed = state.yieldAllowed;state.yieldAllowed = false;superClass = parseAssignmentExpression();state.yieldAllowed = previousYieldAllowed;}return markerApply(marker, delegate.createClassDeclaration(id, superClass, parseClassBody()));}function matchModuleDeclaration(){var id;if(matchContextualKeyword("module")){id = lookahead2();return id.type === Token.StringLiteral || id.type === Token.Identifier;}return false;}function parseSourceElement(){if(lookahead.type === Token.Keyword){switch(lookahead.value){case "const":case "let":return parseConstLetDeclaration(lookahead.value);case "function":return parseFunctionDeclaration();case "export":return parseExportDeclaration();case "import":return parseImportDeclaration();default:return parseStatement();}}if(matchModuleDeclaration()){throwError({}, Messages.NestedModule);}if(lookahead.type !== Token.EOF){return parseStatement();}}function parseProgramElement(){if(lookahead.type === Token.Keyword){switch(lookahead.value){case "export":return parseExportDeclaration();case "import":return parseImportDeclaration();}}if(matchModuleDeclaration()){return parseModuleDeclaration();}return parseSourceElement();}function parseProgramElements(){var sourceElement, sourceElements=[], token, directive, firstRestricted;while(index < length) {token = lookahead;if(token.type !== Token.StringLiteral){break;}sourceElement = parseProgramElement();sourceElements.push(sourceElement);if(sourceElement.expression.type !== Syntax.Literal){break;}directive = source.slice(token.range[0] + 1, token.range[1] - 1);if(directive === "use strict"){strict = true;if(firstRestricted){throwErrorTolerant(firstRestricted, Messages.StrictOctalLiteral);}}else {if(!firstRestricted && token.octal){firstRestricted = token;}}}while(index < length) {sourceElement = parseProgramElement();if(typeof sourceElement === "undefined"){break;}sourceElements.push(sourceElement);}return sourceElements;}function parseModuleElement(){return parseSourceElement();}function parseModuleElements(){var list=[], statement;while(index < length) {if(match("}")){break;}statement = parseModuleElement();if(typeof statement === "undefined"){break;}list.push(statement);}return list;}function parseModuleBlock(){var block, marker=markerCreate();expect("{");block = parseModuleElements();expect("}");return markerApply(marker, delegate.createBlockStatement(block));}function parseProgram(){var body, marker=markerCreate();strict = false;peek();body = parseProgramElements();return markerApply(marker, delegate.createProgram(body));}function addComment(type, value, start, end, loc){var comment;assert(typeof start === "number", "Comment must have valid position");if(state.lastCommentStart >= start){return;}state.lastCommentStart = start;comment = {type:type, value:value};if(extra.range){comment.range = [start, end];}if(extra.loc){comment.loc = loc;}extra.comments.push(comment);}function scanComment(){var comment, ch, loc, start, blockComment, lineComment;comment = "";blockComment = false;lineComment = false;while(index < length) {ch = source[index];if(lineComment){ch = source[index++];if(isLineTerminator(ch.charCodeAt(0))){loc.end = {line:lineNumber, column:index - lineStart - 1};lineComment = false;addComment("Line", comment, start, index - 1, loc);if(ch === "\r" && source[index] === "\n"){++index;}++lineNumber;lineStart = index;comment = "";}else if(index >= length){lineComment = false;comment += ch;loc.end = {line:lineNumber, column:length - lineStart};addComment("Line", comment, start, length, loc);}else {comment += ch;}}else if(blockComment){if(isLineTerminator(ch.charCodeAt(0))){if(ch === "\r" && source[index + 1] === "\n"){++index;comment += "\r\n";}else {comment += ch;}++lineNumber;++index;lineStart = index;if(index >= length){throwError({}, Messages.UnexpectedToken, "ILLEGAL");}}else {ch = source[index++];if(index >= length){throwError({}, Messages.UnexpectedToken, "ILLEGAL");}comment += ch;if(ch === "*"){ch = source[index];if(ch === "/"){comment = comment.substr(0, comment.length - 1);blockComment = false;++index;loc.end = {line:lineNumber, column:index - lineStart};addComment("Block", comment, start, index, loc);comment = "";}}}}else if(ch === "/"){ch = source[index + 1];if(ch === "/"){loc = {start:{line:lineNumber, column:index - lineStart}};start = index;index += 2;lineComment = true;if(index >= length){loc.end = {line:lineNumber, column:index - lineStart};lineComment = false;addComment("Line", comment, start, index, loc);}}else if(ch === "*"){start = index;index += 2;blockComment = true;loc = {start:{line:lineNumber, column:index - lineStart - 2}};if(index >= length){throwError({}, Messages.UnexpectedToken, "ILLEGAL");}}else {break;}}else if(isWhiteSpace(ch.charCodeAt(0))){++index;}else if(isLineTerminator(ch.charCodeAt(0))){++index;if(ch === "\r" && source[index] === "\n"){++index;}++lineNumber;lineStart = index;}else {break;}}}function collectToken(){var start, loc, token, range, value;skipComment();start = index;loc = {start:{line:lineNumber, column:index - lineStart}};token = extra.advance();loc.end = {line:lineNumber, column:index - lineStart};if(token.type !== Token.EOF){range = [token.range[0], token.range[1]];value = source.slice(token.range[0], token.range[1]);extra.tokens.push({type:TokenName[token.type], value:value, range:range, loc:loc});}return token;}function collectRegex(){var pos, loc, regex, token;skipComment();pos = index;loc = {start:{line:lineNumber, column:index - lineStart}};regex = extra.scanRegExp();loc.end = {line:lineNumber, column:index - lineStart};if(!extra.tokenize){if(extra.tokens.length > 0){token = extra.tokens[extra.tokens.length - 1];if(token.range[0] === pos && token.type === "Punctuator"){if(token.value === "/" || token.value === "/="){extra.tokens.pop();}}}extra.tokens.push({type:"RegularExpression", value:regex.literal, range:[pos, index], loc:loc});}return regex;}function filterTokenLocation(){var i, entry, token, tokens=[];for(i = 0; i < extra.tokens.length; ++i) {entry = extra.tokens[i];token = {type:entry.type, value:entry.value};if(extra.range){token.range = entry.range;}if(extra.loc){token.loc = entry.loc;}tokens.push(token);}extra.tokens = tokens;}function patch(){if(extra.comments){extra.skipComment = skipComment;skipComment = scanComment;}if(typeof extra.tokens !== "undefined"){extra.advance = advance;extra.scanRegExp = scanRegExp;advance = collectToken;scanRegExp = collectRegex;}}function unpatch(){if(typeof extra.skipComment === "function"){skipComment = extra.skipComment;}if(typeof extra.scanRegExp === "function"){advance = extra.advance;scanRegExp = extra.scanRegExp;}}function extend(object, properties){var entry, result={};for(entry in object) {if(object.hasOwnProperty(entry)){result[entry] = object[entry];}}for(entry in properties) {if(properties.hasOwnProperty(entry)){result[entry] = properties[entry];}}return result;}function tokenize(code, options){var toString, token, tokens;toString = String;if(typeof code !== "string" && !(code instanceof String)){code = toString(code);}delegate = SyntaxTreeDelegate;source = code;index = 0;lineNumber = source.length > 0?1:0;lineStart = 0;length = source.length;lookahead = null;state = {allowKeyword:true, allowIn:true, labelSet:{}, inFunctionBody:false, inIteration:false, inSwitch:false, lastCommentStart:-1};extra = {};options = options || {};options.tokens = true;extra.tokens = [];extra.tokenize = true;extra.openParenToken = -1;extra.openCurlyToken = -1;extra.range = typeof options.range === "boolean" && options.range;extra.loc = typeof options.loc === "boolean" && options.loc;if(typeof options.comment === "boolean" && options.comment){extra.comments = [];}if(typeof options.tolerant === "boolean" && options.tolerant){extra.errors = [];}if(length > 0){if(typeof source[0] === "undefined"){if(code instanceof String){source = code.valueOf();}}}patch();try{peek();if(lookahead.type === Token.EOF){return extra.tokens;}token = lex();while(lookahead.type !== Token.EOF) {try{token = lex();}catch(lexError) {token = lookahead;if(extra.errors){extra.errors.push(lexError);break;}else {throw lexError;}}}filterTokenLocation();tokens = extra.tokens;if(typeof extra.comments !== "undefined"){tokens.comments = extra.comments;}if(typeof extra.errors !== "undefined"){tokens.errors = extra.errors;}}catch(e) {throw e;}finally {unpatch();extra = {};}return tokens;}function parse(code, options){var program, toString;toString = String;if(typeof code !== "string" && !(code instanceof String)){code = toString(code);}delegate = SyntaxTreeDelegate;source = code;index = 0;lineNumber = source.length > 0?1:0;lineStart = 0;length = source.length;lookahead = null;state = {allowKeyword:false, allowIn:true, labelSet:{}, parenthesizedCount:0, inFunctionBody:false, inIteration:false, inSwitch:false, lastCommentStart:-1, yieldAllowed:false};extra = {};if(typeof options !== "undefined"){extra.range = typeof options.range === "boolean" && options.range;extra.loc = typeof options.loc === "boolean" && options.loc;if(extra.loc && options.source !== null && options.source !== undefined){delegate = extend(delegate, {postProcess:function postProcess(node){node.loc.source = toString(options.source);return node;}});}if(typeof options.tokens === "boolean" && options.tokens){extra.tokens = [];}if(typeof options.comment === "boolean" && options.comment){extra.comments = [];}if(typeof options.tolerant === "boolean" && options.tolerant){extra.errors = [];}}if(length > 0){if(typeof source[0] === "undefined"){if(code instanceof String){source = code.valueOf();}}}patch();try{program = parseProgram();if(typeof extra.comments !== "undefined"){program.comments = extra.comments;}if(typeof extra.tokens !== "undefined"){filterTokenLocation();program.tokens = extra.tokens;}if(typeof extra.errors !== "undefined"){program.errors = extra.errors;}}catch(e) {throw e;}finally {unpatch();extra = {};}return program;}exports.version = "1.1.0-dev-harmony";exports.tokenize = tokenize;exports.parse = parse;exports.Syntax = (function(){var name, types={};if(typeof Object.create === "function"){types = Object.create(null);}for(name in Syntax) {if(Syntax.hasOwnProperty(name)){types[name] = Syntax[name];}}if(typeof Object.freeze === "function"){Object.freeze(types);}return types;})();});