Initial commit
[yaffs-website] / node_modules / esprima / dist / esprima.js
1 (function webpackUniversalModuleDefinition(root, factory) {
2 /* istanbul ignore next */
3         if(typeof exports === 'object' && typeof module === 'object')
4                 module.exports = factory();
5         else if(typeof define === 'function' && define.amd)
6                 define([], factory);
7 /* istanbul ignore next */
8         else if(typeof exports === 'object')
9                 exports["esprima"] = factory();
10         else
11                 root["esprima"] = factory();
12 })(this, function() {
13 return /******/ (function(modules) { // webpackBootstrap
14 /******/        // The module cache
15 /******/        var installedModules = {};
16
17 /******/        // The require function
18 /******/        function __webpack_require__(moduleId) {
19
20 /******/                // Check if module is in cache
21 /* istanbul ignore if */
22 /******/                if(installedModules[moduleId])
23 /******/                        return installedModules[moduleId].exports;
24
25 /******/                // Create a new module (and put it into the cache)
26 /******/                var module = installedModules[moduleId] = {
27 /******/                        exports: {},
28 /******/                        id: moduleId,
29 /******/                        loaded: false
30 /******/                };
31
32 /******/                // Execute the module function
33 /******/                modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
34
35 /******/                // Flag the module as loaded
36 /******/                module.loaded = true;
37
38 /******/                // Return the exports of the module
39 /******/                return module.exports;
40 /******/        }
41
42
43 /******/        // expose the modules object (__webpack_modules__)
44 /******/        __webpack_require__.m = modules;
45
46 /******/        // expose the module cache
47 /******/        __webpack_require__.c = installedModules;
48
49 /******/        // __webpack_public_path__
50 /******/        __webpack_require__.p = "";
51
52 /******/        // Load entry module and return exports
53 /******/        return __webpack_require__(0);
54 /******/ })
55 /************************************************************************/
56 /******/ ([
57 /* 0 */
58 /***/ function(module, exports, __webpack_require__) {
59
60         /*
61           Copyright JS Foundation and other contributors, https://js.foundation/
62
63           Redistribution and use in source and binary forms, with or without
64           modification, are permitted provided that the following conditions are met:
65
66             * Redistributions of source code must retain the above copyright
67               notice, this list of conditions and the following disclaimer.
68             * Redistributions in binary form must reproduce the above copyright
69               notice, this list of conditions and the following disclaimer in the
70               documentation and/or other materials provided with the distribution.
71
72           THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
73           AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
74           IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
75           ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
76           DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
77           (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
78           LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
79           ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
80           (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
81           THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
82         */
83         "use strict";
84         var comment_handler_1 = __webpack_require__(1);
85         var parser_1 = __webpack_require__(3);
86         var jsx_parser_1 = __webpack_require__(11);
87         var tokenizer_1 = __webpack_require__(15);
88         function parse(code, options, delegate) {
89             var commentHandler = null;
90             var proxyDelegate = function (node, metadata) {
91                 if (delegate) {
92                     delegate(node, metadata);
93                 }
94                 if (commentHandler) {
95                     commentHandler.visit(node, metadata);
96                 }
97             };
98             var parserDelegate = (typeof delegate === 'function') ? proxyDelegate : null;
99             var collectComment = false;
100             if (options) {
101                 collectComment = (typeof options.comment === 'boolean' && options.comment);
102                 var attachComment = (typeof options.attachComment === 'boolean' && options.attachComment);
103                 if (collectComment || attachComment) {
104                     commentHandler = new comment_handler_1.CommentHandler();
105                     commentHandler.attach = attachComment;
106                     options.comment = true;
107                     parserDelegate = proxyDelegate;
108                 }
109             }
110             var parser;
111             if (options && typeof options.jsx === 'boolean' && options.jsx) {
112                 parser = new jsx_parser_1.JSXParser(code, options, parserDelegate);
113             }
114             else {
115                 parser = new parser_1.Parser(code, options, parserDelegate);
116             }
117             var ast = (parser.parseProgram());
118             if (collectComment) {
119                 ast.comments = commentHandler.comments;
120             }
121             if (parser.config.tokens) {
122                 ast.tokens = parser.tokens;
123             }
124             if (parser.config.tolerant) {
125                 ast.errors = parser.errorHandler.errors;
126             }
127             return ast;
128         }
129         exports.parse = parse;
130         function tokenize(code, options, delegate) {
131             var tokenizer = new tokenizer_1.Tokenizer(code, options);
132             var tokens;
133             tokens = [];
134             try {
135                 while (true) {
136                     var token = tokenizer.getNextToken();
137                     if (!token) {
138                         break;
139                     }
140                     if (delegate) {
141                         token = delegate(token);
142                     }
143                     tokens.push(token);
144                 }
145             }
146             catch (e) {
147                 tokenizer.errorHandler.tolerate(e);
148             }
149             if (tokenizer.errorHandler.tolerant) {
150                 tokens.errors = tokenizer.errors();
151             }
152             return tokens;
153         }
154         exports.tokenize = tokenize;
155         var syntax_1 = __webpack_require__(2);
156         exports.Syntax = syntax_1.Syntax;
157         // Sync with *.json manifests.
158         exports.version = '3.1.3';
159
160
161 /***/ },
162 /* 1 */
163 /***/ function(module, exports, __webpack_require__) {
164
165         "use strict";
166         var syntax_1 = __webpack_require__(2);
167         var CommentHandler = (function () {
168             function CommentHandler() {
169                 this.attach = false;
170                 this.comments = [];
171                 this.stack = [];
172                 this.leading = [];
173                 this.trailing = [];
174             }
175             CommentHandler.prototype.insertInnerComments = function (node, metadata) {
176                 //  innnerComments for properties empty block
177                 //  `function a() {/** comments **\/}`
178                 if (node.type === syntax_1.Syntax.BlockStatement && node.body.length === 0) {
179                     var innerComments = [];
180                     for (var i = this.leading.length - 1; i >= 0; --i) {
181                         var entry = this.leading[i];
182                         if (metadata.end.offset >= entry.start) {
183                             innerComments.unshift(entry.comment);
184                             this.leading.splice(i, 1);
185                             this.trailing.splice(i, 1);
186                         }
187                     }
188                     if (innerComments.length) {
189                         node.innerComments = innerComments;
190                     }
191                 }
192             };
193             CommentHandler.prototype.findTrailingComments = function (node, metadata) {
194                 var trailingComments = [];
195                 if (this.trailing.length > 0) {
196                     for (var i = this.trailing.length - 1; i >= 0; --i) {
197                         var entry_1 = this.trailing[i];
198                         if (entry_1.start >= metadata.end.offset) {
199                             trailingComments.unshift(entry_1.comment);
200                         }
201                     }
202                     this.trailing.length = 0;
203                     return trailingComments;
204                 }
205                 var entry = this.stack[this.stack.length - 1];
206                 if (entry && entry.node.trailingComments) {
207                     var firstComment = entry.node.trailingComments[0];
208                     if (firstComment && firstComment.range[0] >= metadata.end.offset) {
209                         trailingComments = entry.node.trailingComments;
210                         delete entry.node.trailingComments;
211                     }
212                 }
213                 return trailingComments;
214             };
215             CommentHandler.prototype.findLeadingComments = function (node, metadata) {
216                 var leadingComments = [];
217                 var target;
218                 while (this.stack.length > 0) {
219                     var entry = this.stack[this.stack.length - 1];
220                     if (entry && entry.start >= metadata.start.offset) {
221                         target = this.stack.pop().node;
222                     }
223                     else {
224                         break;
225                     }
226                 }
227                 if (target) {
228                     var count = target.leadingComments ? target.leadingComments.length : 0;
229                     for (var i = count - 1; i >= 0; --i) {
230                         var comment = target.leadingComments[i];
231                         if (comment.range[1] <= metadata.start.offset) {
232                             leadingComments.unshift(comment);
233                             target.leadingComments.splice(i, 1);
234                         }
235                     }
236                     if (target.leadingComments && target.leadingComments.length === 0) {
237                         delete target.leadingComments;
238                     }
239                     return leadingComments;
240                 }
241                 for (var i = this.leading.length - 1; i >= 0; --i) {
242                     var entry = this.leading[i];
243                     if (entry.start <= metadata.start.offset) {
244                         leadingComments.unshift(entry.comment);
245                         this.leading.splice(i, 1);
246                     }
247                 }
248                 return leadingComments;
249             };
250             CommentHandler.prototype.visitNode = function (node, metadata) {
251                 if (node.type === syntax_1.Syntax.Program && node.body.length > 0) {
252                     return;
253                 }
254                 this.insertInnerComments(node, metadata);
255                 var trailingComments = this.findTrailingComments(node, metadata);
256                 var leadingComments = this.findLeadingComments(node, metadata);
257                 if (leadingComments.length > 0) {
258                     node.leadingComments = leadingComments;
259                 }
260                 if (trailingComments.length > 0) {
261                     node.trailingComments = trailingComments;
262                 }
263                 this.stack.push({
264                     node: node,
265                     start: metadata.start.offset
266                 });
267             };
268             CommentHandler.prototype.visitComment = function (node, metadata) {
269                 var type = (node.type[0] === 'L') ? 'Line' : 'Block';
270                 var comment = {
271                     type: type,
272                     value: node.value
273                 };
274                 if (node.range) {
275                     comment.range = node.range;
276                 }
277                 if (node.loc) {
278                     comment.loc = node.loc;
279                 }
280                 this.comments.push(comment);
281                 if (this.attach) {
282                     var entry = {
283                         comment: {
284                             type: type,
285                             value: node.value,
286                             range: [metadata.start.offset, metadata.end.offset]
287                         },
288                         start: metadata.start.offset
289                     };
290                     if (node.loc) {
291                         entry.comment.loc = node.loc;
292                     }
293                     node.type = type;
294                     this.leading.push(entry);
295                     this.trailing.push(entry);
296                 }
297             };
298             CommentHandler.prototype.visit = function (node, metadata) {
299                 if (node.type === 'LineComment') {
300                     this.visitComment(node, metadata);
301                 }
302                 else if (node.type === 'BlockComment') {
303                     this.visitComment(node, metadata);
304                 }
305                 else if (this.attach) {
306                     this.visitNode(node, metadata);
307                 }
308             };
309             return CommentHandler;
310         }());
311         exports.CommentHandler = CommentHandler;
312
313
314 /***/ },
315 /* 2 */
316 /***/ function(module, exports) {
317
318         "use strict";
319         exports.Syntax = {
320             AssignmentExpression: 'AssignmentExpression',
321             AssignmentPattern: 'AssignmentPattern',
322             ArrayExpression: 'ArrayExpression',
323             ArrayPattern: 'ArrayPattern',
324             ArrowFunctionExpression: 'ArrowFunctionExpression',
325             BlockStatement: 'BlockStatement',
326             BinaryExpression: 'BinaryExpression',
327             BreakStatement: 'BreakStatement',
328             CallExpression: 'CallExpression',
329             CatchClause: 'CatchClause',
330             ClassBody: 'ClassBody',
331             ClassDeclaration: 'ClassDeclaration',
332             ClassExpression: 'ClassExpression',
333             ConditionalExpression: 'ConditionalExpression',
334             ContinueStatement: 'ContinueStatement',
335             DoWhileStatement: 'DoWhileStatement',
336             DebuggerStatement: 'DebuggerStatement',
337             EmptyStatement: 'EmptyStatement',
338             ExportAllDeclaration: 'ExportAllDeclaration',
339             ExportDefaultDeclaration: 'ExportDefaultDeclaration',
340             ExportNamedDeclaration: 'ExportNamedDeclaration',
341             ExportSpecifier: 'ExportSpecifier',
342             ExpressionStatement: 'ExpressionStatement',
343             ForStatement: 'ForStatement',
344             ForOfStatement: 'ForOfStatement',
345             ForInStatement: 'ForInStatement',
346             FunctionDeclaration: 'FunctionDeclaration',
347             FunctionExpression: 'FunctionExpression',
348             Identifier: 'Identifier',
349             IfStatement: 'IfStatement',
350             ImportDeclaration: 'ImportDeclaration',
351             ImportDefaultSpecifier: 'ImportDefaultSpecifier',
352             ImportNamespaceSpecifier: 'ImportNamespaceSpecifier',
353             ImportSpecifier: 'ImportSpecifier',
354             Literal: 'Literal',
355             LabeledStatement: 'LabeledStatement',
356             LogicalExpression: 'LogicalExpression',
357             MemberExpression: 'MemberExpression',
358             MetaProperty: 'MetaProperty',
359             MethodDefinition: 'MethodDefinition',
360             NewExpression: 'NewExpression',
361             ObjectExpression: 'ObjectExpression',
362             ObjectPattern: 'ObjectPattern',
363             Program: 'Program',
364             Property: 'Property',
365             RestElement: 'RestElement',
366             ReturnStatement: 'ReturnStatement',
367             SequenceExpression: 'SequenceExpression',
368             SpreadElement: 'SpreadElement',
369             Super: 'Super',
370             SwitchCase: 'SwitchCase',
371             SwitchStatement: 'SwitchStatement',
372             TaggedTemplateExpression: 'TaggedTemplateExpression',
373             TemplateElement: 'TemplateElement',
374             TemplateLiteral: 'TemplateLiteral',
375             ThisExpression: 'ThisExpression',
376             ThrowStatement: 'ThrowStatement',
377             TryStatement: 'TryStatement',
378             UnaryExpression: 'UnaryExpression',
379             UpdateExpression: 'UpdateExpression',
380             VariableDeclaration: 'VariableDeclaration',
381             VariableDeclarator: 'VariableDeclarator',
382             WhileStatement: 'WhileStatement',
383             WithStatement: 'WithStatement',
384             YieldExpression: 'YieldExpression'
385         };
386
387
388 /***/ },
389 /* 3 */
390 /***/ function(module, exports, __webpack_require__) {
391
392         "use strict";
393         var assert_1 = __webpack_require__(4);
394         var messages_1 = __webpack_require__(5);
395         var error_handler_1 = __webpack_require__(6);
396         var token_1 = __webpack_require__(7);
397         var scanner_1 = __webpack_require__(8);
398         var syntax_1 = __webpack_require__(2);
399         var Node = __webpack_require__(10);
400         var ArrowParameterPlaceHolder = 'ArrowParameterPlaceHolder';
401         var Parser = (function () {
402             function Parser(code, options, delegate) {
403                 if (options === void 0) { options = {}; }
404                 this.config = {
405                     range: (typeof options.range === 'boolean') && options.range,
406                     loc: (typeof options.loc === 'boolean') && options.loc,
407                     source: null,
408                     tokens: (typeof options.tokens === 'boolean') && options.tokens,
409                     comment: (typeof options.comment === 'boolean') && options.comment,
410                     tolerant: (typeof options.tolerant === 'boolean') && options.tolerant
411                 };
412                 if (this.config.loc && options.source && options.source !== null) {
413                     this.config.source = String(options.source);
414                 }
415                 this.delegate = delegate;
416                 this.errorHandler = new error_handler_1.ErrorHandler();
417                 this.errorHandler.tolerant = this.config.tolerant;
418                 this.scanner = new scanner_1.Scanner(code, this.errorHandler);
419                 this.scanner.trackComment = this.config.comment;
420                 this.operatorPrecedence = {
421                     ')': 0,
422                     ';': 0,
423                     ',': 0,
424                     '=': 0,
425                     ']': 0,
426                     '||': 1,
427                     '&&': 2,
428                     '|': 3,
429                     '^': 4,
430                     '&': 5,
431                     '==': 6,
432                     '!=': 6,
433                     '===': 6,
434                     '!==': 6,
435                     '<': 7,
436                     '>': 7,
437                     '<=': 7,
438                     '>=': 7,
439                     '<<': 8,
440                     '>>': 8,
441                     '>>>': 8,
442                     '+': 9,
443                     '-': 9,
444                     '*': 11,
445                     '/': 11,
446                     '%': 11
447                 };
448                 this.sourceType = (options && options.sourceType === 'module') ? 'module' : 'script';
449                 this.lookahead = null;
450                 this.hasLineTerminator = false;
451                 this.context = {
452                     allowIn: true,
453                     allowYield: true,
454                     firstCoverInitializedNameError: null,
455                     isAssignmentTarget: false,
456                     isBindingElement: false,
457                     inFunctionBody: false,
458                     inIteration: false,
459                     inSwitch: false,
460                     labelSet: {},
461                     strict: (this.sourceType === 'module')
462                 };
463                 this.tokens = [];
464                 this.startMarker = {
465                     index: 0,
466                     lineNumber: this.scanner.lineNumber,
467                     lineStart: 0
468                 };
469                 this.lastMarker = {
470                     index: 0,
471                     lineNumber: this.scanner.lineNumber,
472                     lineStart: 0
473                 };
474                 this.nextToken();
475                 this.lastMarker = {
476                     index: this.scanner.index,
477                     lineNumber: this.scanner.lineNumber,
478                     lineStart: this.scanner.lineStart
479                 };
480             }
481             Parser.prototype.throwError = function (messageFormat) {
482                 var values = [];
483                 for (var _i = 1; _i < arguments.length; _i++) {
484                     values[_i - 1] = arguments[_i];
485                 }
486                 var args = Array.prototype.slice.call(arguments, 1);
487                 var msg = messageFormat.replace(/%(\d)/g, function (whole, idx) {
488                     assert_1.assert(idx < args.length, 'Message reference must be in range');
489                     return args[idx];
490                 });
491                 var index = this.lastMarker.index;
492                 var line = this.lastMarker.lineNumber;
493                 var column = this.lastMarker.index - this.lastMarker.lineStart + 1;
494                 throw this.errorHandler.createError(index, line, column, msg);
495             };
496             Parser.prototype.tolerateError = function (messageFormat) {
497                 var values = [];
498                 for (var _i = 1; _i < arguments.length; _i++) {
499                     values[_i - 1] = arguments[_i];
500                 }
501                 var args = Array.prototype.slice.call(arguments, 1);
502                 var msg = messageFormat.replace(/%(\d)/g, function (whole, idx) {
503                     assert_1.assert(idx < args.length, 'Message reference must be in range');
504                     return args[idx];
505                 });
506                 var index = this.lastMarker.index;
507                 var line = this.scanner.lineNumber;
508                 var column = this.lastMarker.index - this.lastMarker.lineStart + 1;
509                 this.errorHandler.tolerateError(index, line, column, msg);
510             };
511             // Throw an exception because of the token.
512             Parser.prototype.unexpectedTokenError = function (token, message) {
513                 var msg = message || messages_1.Messages.UnexpectedToken;
514                 var value;
515                 if (token) {
516                     if (!message) {
517                         msg = (token.type === token_1.Token.EOF) ? messages_1.Messages.UnexpectedEOS :
518                             (token.type === token_1.Token.Identifier) ? messages_1.Messages.UnexpectedIdentifier :
519                                 (token.type === token_1.Token.NumericLiteral) ? messages_1.Messages.UnexpectedNumber :
520                                     (token.type === token_1.Token.StringLiteral) ? messages_1.Messages.UnexpectedString :
521                                         (token.type === token_1.Token.Template) ? messages_1.Messages.UnexpectedTemplate :
522                                             messages_1.Messages.UnexpectedToken;
523                         if (token.type === token_1.Token.Keyword) {
524                             if (this.scanner.isFutureReservedWord(token.value)) {
525                                 msg = messages_1.Messages.UnexpectedReserved;
526                             }
527                             else if (this.context.strict && this.scanner.isStrictModeReservedWord(token.value)) {
528                                 msg = messages_1.Messages.StrictReservedWord;
529                             }
530                         }
531                     }
532                     value = (token.type === token_1.Token.Template) ? token.value.raw : token.value;
533                 }
534                 else {
535                     value = 'ILLEGAL';
536                 }
537                 msg = msg.replace('%0', value);
538                 if (token && typeof token.lineNumber === 'number') {
539                     var index = token.start;
540                     var line = token.lineNumber;
541                     var column = token.start - this.lastMarker.lineStart + 1;
542                     return this.errorHandler.createError(index, line, column, msg);
543                 }
544                 else {
545                     var index = this.lastMarker.index;
546                     var line = this.lastMarker.lineNumber;
547                     var column = index - this.lastMarker.lineStart + 1;
548                     return this.errorHandler.createError(index, line, column, msg);
549                 }
550             };
551             Parser.prototype.throwUnexpectedToken = function (token, message) {
552                 throw this.unexpectedTokenError(token, message);
553             };
554             Parser.prototype.tolerateUnexpectedToken = function (token, message) {
555                 this.errorHandler.tolerate(this.unexpectedTokenError(token, message));
556             };
557             Parser.prototype.collectComments = function () {
558                 if (!this.config.comment) {
559                     this.scanner.scanComments();
560                 }
561                 else {
562                     var comments = this.scanner.scanComments();
563                     if (comments.length > 0 && this.delegate) {
564                         for (var i = 0; i < comments.length; ++i) {
565                             var e = comments[i];
566                             var node = void 0;
567                             node = {
568                                 type: e.multiLine ? 'BlockComment' : 'LineComment',
569                                 value: this.scanner.source.slice(e.slice[0], e.slice[1])
570                             };
571                             if (this.config.range) {
572                                 node.range = e.range;
573                             }
574                             if (this.config.loc) {
575                                 node.loc = e.loc;
576                             }
577                             var metadata = {
578                                 start: {
579                                     line: e.loc.start.line,
580                                     column: e.loc.start.column,
581                                     offset: e.range[0]
582                                 },
583                                 end: {
584                                     line: e.loc.end.line,
585                                     column: e.loc.end.column,
586                                     offset: e.range[1]
587                                 }
588                             };
589                             this.delegate(node, metadata);
590                         }
591                     }
592                 }
593             };
594             // From internal representation to an external structure
595             Parser.prototype.getTokenRaw = function (token) {
596                 return this.scanner.source.slice(token.start, token.end);
597             };
598             Parser.prototype.convertToken = function (token) {
599                 var t;
600                 t = {
601                     type: token_1.TokenName[token.type],
602                     value: this.getTokenRaw(token)
603                 };
604                 if (this.config.range) {
605                     t.range = [token.start, token.end];
606                 }
607                 if (this.config.loc) {
608                     t.loc = {
609                         start: {
610                             line: this.startMarker.lineNumber,
611                             column: this.startMarker.index - this.startMarker.lineStart
612                         },
613                         end: {
614                             line: this.scanner.lineNumber,
615                             column: this.scanner.index - this.scanner.lineStart
616                         }
617                     };
618                 }
619                 if (token.regex) {
620                     t.regex = token.regex;
621                 }
622                 return t;
623             };
624             Parser.prototype.nextToken = function () {
625                 var token = this.lookahead;
626                 this.lastMarker.index = this.scanner.index;
627                 this.lastMarker.lineNumber = this.scanner.lineNumber;
628                 this.lastMarker.lineStart = this.scanner.lineStart;
629                 this.collectComments();
630                 this.startMarker.index = this.scanner.index;
631                 this.startMarker.lineNumber = this.scanner.lineNumber;
632                 this.startMarker.lineStart = this.scanner.lineStart;
633                 var next;
634                 next = this.scanner.lex();
635                 this.hasLineTerminator = (token && next) ? (token.lineNumber !== next.lineNumber) : false;
636                 if (next && this.context.strict && next.type === token_1.Token.Identifier) {
637                     if (this.scanner.isStrictModeReservedWord(next.value)) {
638                         next.type = token_1.Token.Keyword;
639                     }
640                 }
641                 this.lookahead = next;
642                 if (this.config.tokens && next.type !== token_1.Token.EOF) {
643                     this.tokens.push(this.convertToken(next));
644                 }
645                 return token;
646             };
647             Parser.prototype.nextRegexToken = function () {
648                 this.collectComments();
649                 var token = this.scanner.scanRegExp();
650                 if (this.config.tokens) {
651                     // Pop the previous token, '/' or '/='
652                     // This is added from the lookahead token.
653                     this.tokens.pop();
654                     this.tokens.push(this.convertToken(token));
655                 }
656                 // Prime the next lookahead.
657                 this.lookahead = token;
658                 this.nextToken();
659                 return token;
660             };
661             Parser.prototype.createNode = function () {
662                 return {
663                     index: this.startMarker.index,
664                     line: this.startMarker.lineNumber,
665                     column: this.startMarker.index - this.startMarker.lineStart
666                 };
667             };
668             Parser.prototype.startNode = function (token) {
669                 return {
670                     index: token.start,
671                     line: token.lineNumber,
672                     column: token.start - token.lineStart
673                 };
674             };
675             Parser.prototype.finalize = function (meta, node) {
676                 if (this.config.range) {
677                     node.range = [meta.index, this.lastMarker.index];
678                 }
679                 if (this.config.loc) {
680                     node.loc = {
681                         start: {
682                             line: meta.line,
683                             column: meta.column
684                         },
685                         end: {
686                             line: this.lastMarker.lineNumber,
687                             column: this.lastMarker.index - this.lastMarker.lineStart
688                         }
689                     };
690                     if (this.config.source) {
691                         node.loc.source = this.config.source;
692                     }
693                 }
694                 if (this.delegate) {
695                     var metadata = {
696                         start: {
697                             line: meta.line,
698                             column: meta.column,
699                             offset: meta.index
700                         },
701                         end: {
702                             line: this.lastMarker.lineNumber,
703                             column: this.lastMarker.index - this.lastMarker.lineStart,
704                             offset: this.lastMarker.index
705                         }
706                     };
707                     this.delegate(node, metadata);
708                 }
709                 return node;
710             };
711             // Expect the next token to match the specified punctuator.
712             // If not, an exception will be thrown.
713             Parser.prototype.expect = function (value) {
714                 var token = this.nextToken();
715                 if (token.type !== token_1.Token.Punctuator || token.value !== value) {
716                     this.throwUnexpectedToken(token);
717                 }
718             };
719             // Quietly expect a comma when in tolerant mode, otherwise delegates to expect().
720             Parser.prototype.expectCommaSeparator = function () {
721                 if (this.config.tolerant) {
722                     var token = this.lookahead;
723                     if (token.type === token_1.Token.Punctuator && token.value === ',') {
724                         this.nextToken();
725                     }
726                     else if (token.type === token_1.Token.Punctuator && token.value === ';') {
727                         this.nextToken();
728                         this.tolerateUnexpectedToken(token);
729                     }
730                     else {
731                         this.tolerateUnexpectedToken(token, messages_1.Messages.UnexpectedToken);
732                     }
733                 }
734                 else {
735                     this.expect(',');
736                 }
737             };
738             // Expect the next token to match the specified keyword.
739             // If not, an exception will be thrown.
740             Parser.prototype.expectKeyword = function (keyword) {
741                 var token = this.nextToken();
742                 if (token.type !== token_1.Token.Keyword || token.value !== keyword) {
743                     this.throwUnexpectedToken(token);
744                 }
745             };
746             // Return true if the next token matches the specified punctuator.
747             Parser.prototype.match = function (value) {
748                 return this.lookahead.type === token_1.Token.Punctuator && this.lookahead.value === value;
749             };
750             // Return true if the next token matches the specified keyword
751             Parser.prototype.matchKeyword = function (keyword) {
752                 return this.lookahead.type === token_1.Token.Keyword && this.lookahead.value === keyword;
753             };
754             // Return true if the next token matches the specified contextual keyword
755             // (where an identifier is sometimes a keyword depending on the context)
756             Parser.prototype.matchContextualKeyword = function (keyword) {
757                 return this.lookahead.type === token_1.Token.Identifier && this.lookahead.value === keyword;
758             };
759             // Return true if the next token is an assignment operator
760             Parser.prototype.matchAssign = function () {
761                 if (this.lookahead.type !== token_1.Token.Punctuator) {
762                     return false;
763                 }
764                 var op = this.lookahead.value;
765                 return op === '=' ||
766                     op === '*=' ||
767                     op === '**=' ||
768                     op === '/=' ||
769                     op === '%=' ||
770                     op === '+=' ||
771                     op === '-=' ||
772                     op === '<<=' ||
773                     op === '>>=' ||
774                     op === '>>>=' ||
775                     op === '&=' ||
776                     op === '^=' ||
777                     op === '|=';
778             };
779             // Cover grammar support.
780             //
781             // When an assignment expression position starts with an left parenthesis, the determination of the type
782             // of the syntax is to be deferred arbitrarily long until the end of the parentheses pair (plus a lookahead)
783             // or the first comma. This situation also defers the determination of all the expressions nested in the pair.
784             //
785             // There are three productions that can be parsed in a parentheses pair that needs to be determined
786             // after the outermost pair is closed. They are:
787             //
788             //   1. AssignmentExpression
789             //   2. BindingElements
790             //   3. AssignmentTargets
791             //
792             // In order to avoid exponential backtracking, we use two flags to denote if the production can be
793             // binding element or assignment target.
794             //
795             // The three productions have the relationship:
796             //
797             //   BindingElements âŠ† AssignmentTargets âŠ† AssignmentExpression
798             //
799             // with a single exception that CoverInitializedName when used directly in an Expression, generates
800             // an early error. Therefore, we need the third state, firstCoverInitializedNameError, to track the
801             // first usage of CoverInitializedName and report it when we reached the end of the parentheses pair.
802             //
803             // isolateCoverGrammar function runs the given parser function with a new cover grammar context, and it does not
804             // effect the current flags. This means the production the parser parses is only used as an expression. Therefore
805             // the CoverInitializedName check is conducted.
806             //
807             // inheritCoverGrammar function runs the given parse function with a new cover grammar context, and it propagates
808             // the flags outside of the parser. This means the production the parser parses is used as a part of a potential
809             // pattern. The CoverInitializedName check is deferred.
810             Parser.prototype.isolateCoverGrammar = function (parseFunction) {
811                 var previousIsBindingElement = this.context.isBindingElement;
812                 var previousIsAssignmentTarget = this.context.isAssignmentTarget;
813                 var previousFirstCoverInitializedNameError = this.context.firstCoverInitializedNameError;
814                 this.context.isBindingElement = true;
815                 this.context.isAssignmentTarget = true;
816                 this.context.firstCoverInitializedNameError = null;
817                 var result = parseFunction.call(this);
818                 if (this.context.firstCoverInitializedNameError !== null) {
819                     this.throwUnexpectedToken(this.context.firstCoverInitializedNameError);
820                 }
821                 this.context.isBindingElement = previousIsBindingElement;
822                 this.context.isAssignmentTarget = previousIsAssignmentTarget;
823                 this.context.firstCoverInitializedNameError = previousFirstCoverInitializedNameError;
824                 return result;
825             };
826             Parser.prototype.inheritCoverGrammar = function (parseFunction) {
827                 var previousIsBindingElement = this.context.isBindingElement;
828                 var previousIsAssignmentTarget = this.context.isAssignmentTarget;
829                 var previousFirstCoverInitializedNameError = this.context.firstCoverInitializedNameError;
830                 this.context.isBindingElement = true;
831                 this.context.isAssignmentTarget = true;
832                 this.context.firstCoverInitializedNameError = null;
833                 var result = parseFunction.call(this);
834                 this.context.isBindingElement = this.context.isBindingElement && previousIsBindingElement;
835                 this.context.isAssignmentTarget = this.context.isAssignmentTarget && previousIsAssignmentTarget;
836                 this.context.firstCoverInitializedNameError = previousFirstCoverInitializedNameError || this.context.firstCoverInitializedNameError;
837                 return result;
838             };
839             Parser.prototype.consumeSemicolon = function () {
840                 if (this.match(';')) {
841                     this.nextToken();
842                 }
843                 else if (!this.hasLineTerminator) {
844                     if (this.lookahead.type !== token_1.Token.EOF && !this.match('}')) {
845                         this.throwUnexpectedToken(this.lookahead);
846                     }
847                     this.lastMarker.index = this.startMarker.index;
848                     this.lastMarker.lineNumber = this.startMarker.lineNumber;
849                     this.lastMarker.lineStart = this.startMarker.lineStart;
850                 }
851             };
852             // ECMA-262 12.2 Primary Expressions
853             Parser.prototype.parsePrimaryExpression = function () {
854                 var node = this.createNode();
855                 var expr;
856                 var value, token, raw;
857                 switch (this.lookahead.type) {
858                     case token_1.Token.Identifier:
859                         if (this.sourceType === 'module' && this.lookahead.value === 'await') {
860                             this.tolerateUnexpectedToken(this.lookahead);
861                         }
862                         expr = this.finalize(node, new Node.Identifier(this.nextToken().value));
863                         break;
864                     case token_1.Token.NumericLiteral:
865                     case token_1.Token.StringLiteral:
866                         if (this.context.strict && this.lookahead.octal) {
867                             this.tolerateUnexpectedToken(this.lookahead, messages_1.Messages.StrictOctalLiteral);
868                         }
869                         this.context.isAssignmentTarget = false;
870                         this.context.isBindingElement = false;
871                         token = this.nextToken();
872                         raw = this.getTokenRaw(token);
873                         expr = this.finalize(node, new Node.Literal(token.value, raw));
874                         break;
875                     case token_1.Token.BooleanLiteral:
876                         this.context.isAssignmentTarget = false;
877                         this.context.isBindingElement = false;
878                         token = this.nextToken();
879                         token.value = (token.value === 'true');
880                         raw = this.getTokenRaw(token);
881                         expr = this.finalize(node, new Node.Literal(token.value, raw));
882                         break;
883                     case token_1.Token.NullLiteral:
884                         this.context.isAssignmentTarget = false;
885                         this.context.isBindingElement = false;
886                         token = this.nextToken();
887                         token.value = null;
888                         raw = this.getTokenRaw(token);
889                         expr = this.finalize(node, new Node.Literal(token.value, raw));
890                         break;
891                     case token_1.Token.Template:
892                         expr = this.parseTemplateLiteral();
893                         break;
894                     case token_1.Token.Punctuator:
895                         value = this.lookahead.value;
896                         switch (value) {
897                             case '(':
898                                 this.context.isBindingElement = false;
899                                 expr = this.inheritCoverGrammar(this.parseGroupExpression);
900                                 break;
901                             case '[':
902                                 expr = this.inheritCoverGrammar(this.parseArrayInitializer);
903                                 break;
904                             case '{':
905                                 expr = this.inheritCoverGrammar(this.parseObjectInitializer);
906                                 break;
907                             case '/':
908                             case '/=':
909                                 this.context.isAssignmentTarget = false;
910                                 this.context.isBindingElement = false;
911                                 this.scanner.index = this.startMarker.index;
912                                 token = this.nextRegexToken();
913                                 raw = this.getTokenRaw(token);
914                                 expr = this.finalize(node, new Node.RegexLiteral(token.value, raw, token.regex));
915                                 break;
916                             default:
917                                 this.throwUnexpectedToken(this.nextToken());
918                         }
919                         break;
920                     case token_1.Token.Keyword:
921                         if (!this.context.strict && this.context.allowYield && this.matchKeyword('yield')) {
922                             expr = this.parseIdentifierName();
923                         }
924                         else if (!this.context.strict && this.matchKeyword('let')) {
925                             expr = this.finalize(node, new Node.Identifier(this.nextToken().value));
926                         }
927                         else {
928                             this.context.isAssignmentTarget = false;
929                             this.context.isBindingElement = false;
930                             if (this.matchKeyword('function')) {
931                                 expr = this.parseFunctionExpression();
932                             }
933                             else if (this.matchKeyword('this')) {
934                                 this.nextToken();
935                                 expr = this.finalize(node, new Node.ThisExpression());
936                             }
937                             else if (this.matchKeyword('class')) {
938                                 expr = this.parseClassExpression();
939                             }
940                             else {
941                                 this.throwUnexpectedToken(this.nextToken());
942                             }
943                         }
944                         break;
945                     default:
946                         this.throwUnexpectedToken(this.nextToken());
947                 }
948                 return expr;
949             };
950             // ECMA-262 12.2.5 Array Initializer
951             Parser.prototype.parseSpreadElement = function () {
952                 var node = this.createNode();
953                 this.expect('...');
954                 var arg = this.inheritCoverGrammar(this.parseAssignmentExpression);
955                 return this.finalize(node, new Node.SpreadElement(arg));
956             };
957             Parser.prototype.parseArrayInitializer = function () {
958                 var node = this.createNode();
959                 var elements = [];
960                 this.expect('[');
961                 while (!this.match(']')) {
962                     if (this.match(',')) {
963                         this.nextToken();
964                         elements.push(null);
965                     }
966                     else if (this.match('...')) {
967                         var element = this.parseSpreadElement();
968                         if (!this.match(']')) {
969                             this.context.isAssignmentTarget = false;
970                             this.context.isBindingElement = false;
971                             this.expect(',');
972                         }
973                         elements.push(element);
974                     }
975                     else {
976                         elements.push(this.inheritCoverGrammar(this.parseAssignmentExpression));
977                         if (!this.match(']')) {
978                             this.expect(',');
979                         }
980                     }
981                 }
982                 this.expect(']');
983                 return this.finalize(node, new Node.ArrayExpression(elements));
984             };
985             // ECMA-262 12.2.6 Object Initializer
986             Parser.prototype.parsePropertyMethod = function (params) {
987                 this.context.isAssignmentTarget = false;
988                 this.context.isBindingElement = false;
989                 var previousStrict = this.context.strict;
990                 var body = this.isolateCoverGrammar(this.parseFunctionSourceElements);
991                 if (this.context.strict && params.firstRestricted) {
992                     this.tolerateUnexpectedToken(params.firstRestricted, params.message);
993                 }
994                 if (this.context.strict && params.stricted) {
995                     this.tolerateUnexpectedToken(params.stricted, params.message);
996                 }
997                 this.context.strict = previousStrict;
998                 return body;
999             };
1000             Parser.prototype.parsePropertyMethodFunction = function () {
1001                 var isGenerator = false;
1002                 var node = this.createNode();
1003                 var previousAllowYield = this.context.allowYield;
1004                 this.context.allowYield = false;
1005                 var params = this.parseFormalParameters();
1006                 var method = this.parsePropertyMethod(params);
1007                 this.context.allowYield = previousAllowYield;
1008                 return this.finalize(node, new Node.FunctionExpression(null, params.params, method, isGenerator));
1009             };
1010             Parser.prototype.parseObjectPropertyKey = function () {
1011                 var node = this.createNode();
1012                 var token = this.nextToken();
1013                 var key = null;
1014                 switch (token.type) {
1015                     case token_1.Token.StringLiteral:
1016                     case token_1.Token.NumericLiteral:
1017                         if (this.context.strict && token.octal) {
1018                             this.tolerateUnexpectedToken(token, messages_1.Messages.StrictOctalLiteral);
1019                         }
1020                         var raw = this.getTokenRaw(token);
1021                         key = this.finalize(node, new Node.Literal(token.value, raw));
1022                         break;
1023                     case token_1.Token.Identifier:
1024                     case token_1.Token.BooleanLiteral:
1025                     case token_1.Token.NullLiteral:
1026                     case token_1.Token.Keyword:
1027                         key = this.finalize(node, new Node.Identifier(token.value));
1028                         break;
1029                     case token_1.Token.Punctuator:
1030                         if (token.value === '[') {
1031                             key = this.isolateCoverGrammar(this.parseAssignmentExpression);
1032                             this.expect(']');
1033                         }
1034                         else {
1035                             this.throwUnexpectedToken(token);
1036                         }
1037                         break;
1038                     default:
1039                         this.throwUnexpectedToken(token);
1040                 }
1041                 return key;
1042             };
1043             Parser.prototype.isPropertyKey = function (key, value) {
1044                 return (key.type === syntax_1.Syntax.Identifier && key.name === value) ||
1045                     (key.type === syntax_1.Syntax.Literal && key.value === value);
1046             };
1047             Parser.prototype.parseObjectProperty = function (hasProto) {
1048                 var node = this.createNode();
1049                 var token = this.lookahead;
1050                 var kind;
1051                 var key;
1052                 var value;
1053                 var computed = false;
1054                 var method = false;
1055                 var shorthand = false;
1056                 if (token.type === token_1.Token.Identifier) {
1057                     this.nextToken();
1058                     key = this.finalize(node, new Node.Identifier(token.value));
1059                 }
1060                 else if (this.match('*')) {
1061                     this.nextToken();
1062                 }
1063                 else {
1064                     computed = this.match('[');
1065                     key = this.parseObjectPropertyKey();
1066                 }
1067                 var lookaheadPropertyKey = this.qualifiedPropertyName(this.lookahead);
1068                 if (token.type === token_1.Token.Identifier && token.value === 'get' && lookaheadPropertyKey) {
1069                     kind = 'get';
1070                     computed = this.match('[');
1071                     key = this.parseObjectPropertyKey();
1072                     this.context.allowYield = false;
1073                     value = this.parseGetterMethod();
1074                 }
1075                 else if (token.type === token_1.Token.Identifier && token.value === 'set' && lookaheadPropertyKey) {
1076                     kind = 'set';
1077                     computed = this.match('[');
1078                     key = this.parseObjectPropertyKey();
1079                     value = this.parseSetterMethod();
1080                 }
1081                 else if (token.type === token_1.Token.Punctuator && token.value === '*' && lookaheadPropertyKey) {
1082                     kind = 'init';
1083                     computed = this.match('[');
1084                     key = this.parseObjectPropertyKey();
1085                     value = this.parseGeneratorMethod();
1086                     method = true;
1087                 }
1088                 else {
1089                     if (!key) {
1090                         this.throwUnexpectedToken(this.lookahead);
1091                     }
1092                     kind = 'init';
1093                     if (this.match(':')) {
1094                         if (!computed && this.isPropertyKey(key, '__proto__')) {
1095                             if (hasProto.value) {
1096                                 this.tolerateError(messages_1.Messages.DuplicateProtoProperty);
1097                             }
1098                             hasProto.value = true;
1099                         }
1100                         this.nextToken();
1101                         value = this.inheritCoverGrammar(this.parseAssignmentExpression);
1102                     }
1103                     else if (this.match('(')) {
1104                         value = this.parsePropertyMethodFunction();
1105                         method = true;
1106                     }
1107                     else if (token.type === token_1.Token.Identifier) {
1108                         var id = this.finalize(node, new Node.Identifier(token.value));
1109                         if (this.match('=')) {
1110                             this.context.firstCoverInitializedNameError = this.lookahead;
1111                             this.nextToken();
1112                             shorthand = true;
1113                             var init = this.isolateCoverGrammar(this.parseAssignmentExpression);
1114                             value = this.finalize(node, new Node.AssignmentPattern(id, init));
1115                         }
1116                         else {
1117                             shorthand = true;
1118                             value = id;
1119                         }
1120                     }
1121                     else {
1122                         this.throwUnexpectedToken(this.nextToken());
1123                     }
1124                 }
1125                 return this.finalize(node, new Node.Property(kind, key, computed, value, method, shorthand));
1126             };
1127             Parser.prototype.parseObjectInitializer = function () {
1128                 var node = this.createNode();
1129                 this.expect('{');
1130                 var properties = [];
1131                 var hasProto = { value: false };
1132                 while (!this.match('}')) {
1133                     properties.push(this.parseObjectProperty(hasProto));
1134                     if (!this.match('}')) {
1135                         this.expectCommaSeparator();
1136                     }
1137                 }
1138                 this.expect('}');
1139                 return this.finalize(node, new Node.ObjectExpression(properties));
1140             };
1141             // ECMA-262 12.2.9 Template Literals
1142             Parser.prototype.parseTemplateHead = function () {
1143                 assert_1.assert(this.lookahead.head, 'Template literal must start with a template head');
1144                 var node = this.createNode();
1145                 var token = this.nextToken();
1146                 var value = {
1147                     raw: token.value.raw,
1148                     cooked: token.value.cooked
1149                 };
1150                 return this.finalize(node, new Node.TemplateElement(value, token.tail));
1151             };
1152             Parser.prototype.parseTemplateElement = function () {
1153                 if (this.lookahead.type !== token_1.Token.Template) {
1154                     this.throwUnexpectedToken();
1155                 }
1156                 var node = this.createNode();
1157                 var token = this.nextToken();
1158                 var value = {
1159                     raw: token.value.raw,
1160                     cooked: token.value.cooked
1161                 };
1162                 return this.finalize(node, new Node.TemplateElement(value, token.tail));
1163             };
1164             Parser.prototype.parseTemplateLiteral = function () {
1165                 var node = this.createNode();
1166                 var expressions = [];
1167                 var quasis = [];
1168                 var quasi = this.parseTemplateHead();
1169                 quasis.push(quasi);
1170                 while (!quasi.tail) {
1171                     expressions.push(this.parseExpression());
1172                     quasi = this.parseTemplateElement();
1173                     quasis.push(quasi);
1174                 }
1175                 return this.finalize(node, new Node.TemplateLiteral(quasis, expressions));
1176             };
1177             // ECMA-262 12.2.10 The Grouping Operator
1178             Parser.prototype.reinterpretExpressionAsPattern = function (expr) {
1179                 switch (expr.type) {
1180                     case syntax_1.Syntax.Identifier:
1181                     case syntax_1.Syntax.MemberExpression:
1182                     case syntax_1.Syntax.RestElement:
1183                     case syntax_1.Syntax.AssignmentPattern:
1184                         break;
1185                     case syntax_1.Syntax.SpreadElement:
1186                         expr.type = syntax_1.Syntax.RestElement;
1187                         this.reinterpretExpressionAsPattern(expr.argument);
1188                         break;
1189                     case syntax_1.Syntax.ArrayExpression:
1190                         expr.type = syntax_1.Syntax.ArrayPattern;
1191                         for (var i = 0; i < expr.elements.length; i++) {
1192                             if (expr.elements[i] !== null) {
1193                                 this.reinterpretExpressionAsPattern(expr.elements[i]);
1194                             }
1195                         }
1196                         break;
1197                     case syntax_1.Syntax.ObjectExpression:
1198                         expr.type = syntax_1.Syntax.ObjectPattern;
1199                         for (var i = 0; i < expr.properties.length; i++) {
1200                             this.reinterpretExpressionAsPattern(expr.properties[i].value);
1201                         }
1202                         break;
1203                     case syntax_1.Syntax.AssignmentExpression:
1204                         expr.type = syntax_1.Syntax.AssignmentPattern;
1205                         delete expr.operator;
1206                         this.reinterpretExpressionAsPattern(expr.left);
1207                         break;
1208                     default:
1209                         // Allow other node type for tolerant parsing.
1210                         break;
1211                 }
1212             };
1213             Parser.prototype.parseGroupExpression = function () {
1214                 var expr;
1215                 this.expect('(');
1216                 if (this.match(')')) {
1217                     this.nextToken();
1218                     if (!this.match('=>')) {
1219                         this.expect('=>');
1220                     }
1221                     expr = {
1222                         type: ArrowParameterPlaceHolder,
1223                         params: []
1224                     };
1225                 }
1226                 else {
1227                     var startToken = this.lookahead;
1228                     var params = [];
1229                     if (this.match('...')) {
1230                         expr = this.parseRestElement(params);
1231                         this.expect(')');
1232                         if (!this.match('=>')) {
1233                             this.expect('=>');
1234                         }
1235                         expr = {
1236                             type: ArrowParameterPlaceHolder,
1237                             params: [expr]
1238                         };
1239                     }
1240                     else {
1241                         var arrow = false;
1242                         this.context.isBindingElement = true;
1243                         expr = this.inheritCoverGrammar(this.parseAssignmentExpression);
1244                         if (this.match(',')) {
1245                             var expressions = [];
1246                             this.context.isAssignmentTarget = false;
1247                             expressions.push(expr);
1248                             while (this.startMarker.index < this.scanner.length) {
1249                                 if (!this.match(',')) {
1250                                     break;
1251                                 }
1252                                 this.nextToken();
1253                                 if (this.match('...')) {
1254                                     if (!this.context.isBindingElement) {
1255                                         this.throwUnexpectedToken(this.lookahead);
1256                                     }
1257                                     expressions.push(this.parseRestElement(params));
1258                                     this.expect(')');
1259                                     if (!this.match('=>')) {
1260                                         this.expect('=>');
1261                                     }
1262                                     this.context.isBindingElement = false;
1263                                     for (var i = 0; i < expressions.length; i++) {
1264                                         this.reinterpretExpressionAsPattern(expressions[i]);
1265                                     }
1266                                     arrow = true;
1267                                     expr = {
1268                                         type: ArrowParameterPlaceHolder,
1269                                         params: expressions
1270                                     };
1271                                 }
1272                                 else {
1273                                     expressions.push(this.inheritCoverGrammar(this.parseAssignmentExpression));
1274                                 }
1275                                 if (arrow) {
1276                                     break;
1277                                 }
1278                             }
1279                             if (!arrow) {
1280                                 expr = this.finalize(this.startNode(startToken), new Node.SequenceExpression(expressions));
1281                             }
1282                         }
1283                         if (!arrow) {
1284                             this.expect(')');
1285                             if (this.match('=>')) {
1286                                 if (expr.type === syntax_1.Syntax.Identifier && expr.name === 'yield') {
1287                                     arrow = true;
1288                                     expr = {
1289                                         type: ArrowParameterPlaceHolder,
1290                                         params: [expr]
1291                                     };
1292                                 }
1293                                 if (!arrow) {
1294                                     if (!this.context.isBindingElement) {
1295                                         this.throwUnexpectedToken(this.lookahead);
1296                                     }
1297                                     if (expr.type === syntax_1.Syntax.SequenceExpression) {
1298                                         for (var i = 0; i < expr.expressions.length; i++) {
1299                                             this.reinterpretExpressionAsPattern(expr.expressions[i]);
1300                                         }
1301                                     }
1302                                     else {
1303                                         this.reinterpretExpressionAsPattern(expr);
1304                                     }
1305                                     var params_1 = (expr.type === syntax_1.Syntax.SequenceExpression ? expr.expressions : [expr]);
1306                                     expr = {
1307                                         type: ArrowParameterPlaceHolder,
1308                                         params: params_1
1309                                     };
1310                                 }
1311                             }
1312                             this.context.isBindingElement = false;
1313                         }
1314                     }
1315                 }
1316                 return expr;
1317             };
1318             // ECMA-262 12.3 Left-Hand-Side Expressions
1319             Parser.prototype.parseArguments = function () {
1320                 this.expect('(');
1321                 var args = [];
1322                 if (!this.match(')')) {
1323                     while (true) {
1324                         var expr = this.match('...') ? this.parseSpreadElement() :
1325                             this.isolateCoverGrammar(this.parseAssignmentExpression);
1326                         args.push(expr);
1327                         if (this.match(')')) {
1328                             break;
1329                         }
1330                         this.expectCommaSeparator();
1331                     }
1332                 }
1333                 this.expect(')');
1334                 return args;
1335             };
1336             Parser.prototype.isIdentifierName = function (token) {
1337                 return token.type === token_1.Token.Identifier ||
1338                     token.type === token_1.Token.Keyword ||
1339                     token.type === token_1.Token.BooleanLiteral ||
1340                     token.type === token_1.Token.NullLiteral;
1341             };
1342             Parser.prototype.parseIdentifierName = function () {
1343                 var node = this.createNode();
1344                 var token = this.nextToken();
1345                 if (!this.isIdentifierName(token)) {
1346                     this.throwUnexpectedToken(token);
1347                 }
1348                 return this.finalize(node, new Node.Identifier(token.value));
1349             };
1350             Parser.prototype.parseNewExpression = function () {
1351                 var node = this.createNode();
1352                 var id = this.parseIdentifierName();
1353                 assert_1.assert(id.name === 'new', 'New expression must start with `new`');
1354                 var expr;
1355                 if (this.match('.')) {
1356                     this.nextToken();
1357                     if (this.lookahead.type === token_1.Token.Identifier && this.context.inFunctionBody && this.lookahead.value === 'target') {
1358                         var property = this.parseIdentifierName();
1359                         expr = new Node.MetaProperty(id, property);
1360                     }
1361                     else {
1362                         this.throwUnexpectedToken(this.lookahead);
1363                     }
1364                 }
1365                 else {
1366                     var callee = this.isolateCoverGrammar(this.parseLeftHandSideExpression);
1367                     var args = this.match('(') ? this.parseArguments() : [];
1368                     expr = new Node.NewExpression(callee, args);
1369                     this.context.isAssignmentTarget = false;
1370                     this.context.isBindingElement = false;
1371                 }
1372                 return this.finalize(node, expr);
1373             };
1374             Parser.prototype.parseLeftHandSideExpressionAllowCall = function () {
1375                 var startToken = this.lookahead;
1376                 var previousAllowIn = this.context.allowIn;
1377                 this.context.allowIn = true;
1378                 var expr;
1379                 if (this.matchKeyword('super') && this.context.inFunctionBody) {
1380                     expr = this.createNode();
1381                     this.nextToken();
1382                     expr = this.finalize(expr, new Node.Super());
1383                     if (!this.match('(') && !this.match('.') && !this.match('[')) {
1384                         this.throwUnexpectedToken(this.lookahead);
1385                     }
1386                 }
1387                 else {
1388                     expr = this.inheritCoverGrammar(this.matchKeyword('new') ? this.parseNewExpression : this.parsePrimaryExpression);
1389                 }
1390                 while (true) {
1391                     if (this.match('.')) {
1392                         this.context.isBindingElement = false;
1393                         this.context.isAssignmentTarget = true;
1394                         this.expect('.');
1395                         var property = this.parseIdentifierName();
1396                         expr = this.finalize(this.startNode(startToken), new Node.StaticMemberExpression(expr, property));
1397                     }
1398                     else if (this.match('(')) {
1399                         this.context.isBindingElement = false;
1400                         this.context.isAssignmentTarget = false;
1401                         var args = this.parseArguments();
1402                         expr = this.finalize(this.startNode(startToken), new Node.CallExpression(expr, args));
1403                     }
1404                     else if (this.match('[')) {
1405                         this.context.isBindingElement = false;
1406                         this.context.isAssignmentTarget = true;
1407                         this.expect('[');
1408                         var property = this.isolateCoverGrammar(this.parseExpression);
1409                         this.expect(']');
1410                         expr = this.finalize(this.startNode(startToken), new Node.ComputedMemberExpression(expr, property));
1411                     }
1412                     else if (this.lookahead.type === token_1.Token.Template && this.lookahead.head) {
1413                         var quasi = this.parseTemplateLiteral();
1414                         expr = this.finalize(this.startNode(startToken), new Node.TaggedTemplateExpression(expr, quasi));
1415                     }
1416                     else {
1417                         break;
1418                     }
1419                 }
1420                 this.context.allowIn = previousAllowIn;
1421                 return expr;
1422             };
1423             Parser.prototype.parseSuper = function () {
1424                 var node = this.createNode();
1425                 this.expectKeyword('super');
1426                 if (!this.match('[') && !this.match('.')) {
1427                     this.throwUnexpectedToken(this.lookahead);
1428                 }
1429                 return this.finalize(node, new Node.Super());
1430             };
1431             Parser.prototype.parseLeftHandSideExpression = function () {
1432                 assert_1.assert(this.context.allowIn, 'callee of new expression always allow in keyword.');
1433                 var node = this.startNode(this.lookahead);
1434                 var expr = (this.matchKeyword('super') && this.context.inFunctionBody) ? this.parseSuper() :
1435                     this.inheritCoverGrammar(this.matchKeyword('new') ? this.parseNewExpression : this.parsePrimaryExpression);
1436                 while (true) {
1437                     if (this.match('[')) {
1438                         this.context.isBindingElement = false;
1439                         this.context.isAssignmentTarget = true;
1440                         this.expect('[');
1441                         var property = this.isolateCoverGrammar(this.parseExpression);
1442                         this.expect(']');
1443                         expr = this.finalize(node, new Node.ComputedMemberExpression(expr, property));
1444                     }
1445                     else if (this.match('.')) {
1446                         this.context.isBindingElement = false;
1447                         this.context.isAssignmentTarget = true;
1448                         this.expect('.');
1449                         var property = this.parseIdentifierName();
1450                         expr = this.finalize(node, new Node.StaticMemberExpression(expr, property));
1451                     }
1452                     else if (this.lookahead.type === token_1.Token.Template && this.lookahead.head) {
1453                         var quasi = this.parseTemplateLiteral();
1454                         expr = this.finalize(node, new Node.TaggedTemplateExpression(expr, quasi));
1455                     }
1456                     else {
1457                         break;
1458                     }
1459                 }
1460                 return expr;
1461             };
1462             // ECMA-262 12.4 Update Expressions
1463             Parser.prototype.parseUpdateExpression = function () {
1464                 var expr;
1465                 var startToken = this.lookahead;
1466                 if (this.match('++') || this.match('--')) {
1467                     var node = this.startNode(startToken);
1468                     var token = this.nextToken();
1469                     expr = this.inheritCoverGrammar(this.parseUnaryExpression);
1470                     if (this.context.strict && expr.type === syntax_1.Syntax.Identifier && this.scanner.isRestrictedWord(expr.name)) {
1471                         this.tolerateError(messages_1.Messages.StrictLHSPrefix);
1472                     }
1473                     if (!this.context.isAssignmentTarget) {
1474                         this.tolerateError(messages_1.Messages.InvalidLHSInAssignment);
1475                     }
1476                     var prefix = true;
1477                     expr = this.finalize(node, new Node.UpdateExpression(token.value, expr, prefix));
1478                     this.context.isAssignmentTarget = false;
1479                     this.context.isBindingElement = false;
1480                 }
1481                 else {
1482                     expr = this.inheritCoverGrammar(this.parseLeftHandSideExpressionAllowCall);
1483                     if (!this.hasLineTerminator && this.lookahead.type === token_1.Token.Punctuator) {
1484                         if (this.match('++') || this.match('--')) {
1485                             if (this.context.strict && expr.type === syntax_1.Syntax.Identifier && this.scanner.isRestrictedWord(expr.name)) {
1486                                 this.tolerateError(messages_1.Messages.StrictLHSPostfix);
1487                             }
1488                             if (!this.context.isAssignmentTarget) {
1489                                 this.tolerateError(messages_1.Messages.InvalidLHSInAssignment);
1490                             }
1491                             this.context.isAssignmentTarget = false;
1492                             this.context.isBindingElement = false;
1493                             var operator = this.nextToken().value;
1494                             var prefix = false;
1495                             expr = this.finalize(this.startNode(startToken), new Node.UpdateExpression(operator, expr, prefix));
1496                         }
1497                     }
1498                 }
1499                 return expr;
1500             };
1501             // ECMA-262 12.5 Unary Operators
1502             Parser.prototype.parseUnaryExpression = function () {
1503                 var expr;
1504                 if (this.match('+') || this.match('-') || this.match('~') || this.match('!') ||
1505                     this.matchKeyword('delete') || this.matchKeyword('void') || this.matchKeyword('typeof')) {
1506                     var node = this.startNode(this.lookahead);
1507                     var token = this.nextToken();
1508                     expr = this.inheritCoverGrammar(this.parseUnaryExpression);
1509                     expr = this.finalize(node, new Node.UnaryExpression(token.value, expr));
1510                     if (this.context.strict && expr.operator === 'delete' && expr.argument.type === syntax_1.Syntax.Identifier) {
1511                         this.tolerateError(messages_1.Messages.StrictDelete);
1512                     }
1513                     this.context.isAssignmentTarget = false;
1514                     this.context.isBindingElement = false;
1515                 }
1516                 else {
1517                     expr = this.parseUpdateExpression();
1518                 }
1519                 return expr;
1520             };
1521             Parser.prototype.parseExponentiationExpression = function () {
1522                 var startToken = this.lookahead;
1523                 var expr = this.inheritCoverGrammar(this.parseUnaryExpression);
1524                 if (expr.type !== syntax_1.Syntax.UnaryExpression && this.match('**')) {
1525                     this.nextToken();
1526                     this.context.isAssignmentTarget = false;
1527                     this.context.isBindingElement = false;
1528                     var left = expr;
1529                     var right = this.isolateCoverGrammar(this.parseExponentiationExpression);
1530                     expr = this.finalize(this.startNode(startToken), new Node.BinaryExpression('**', left, right));
1531                 }
1532                 return expr;
1533             };
1534             // ECMA-262 12.6 Exponentiation Operators
1535             // ECMA-262 12.7 Multiplicative Operators
1536             // ECMA-262 12.8 Additive Operators
1537             // ECMA-262 12.9 Bitwise Shift Operators
1538             // ECMA-262 12.10 Relational Operators
1539             // ECMA-262 12.11 Equality Operators
1540             // ECMA-262 12.12 Binary Bitwise Operators
1541             // ECMA-262 12.13 Binary Logical Operators
1542             Parser.prototype.binaryPrecedence = function (token) {
1543                 var op = token.value;
1544                 var precedence;
1545                 if (token.type === token_1.Token.Punctuator) {
1546                     precedence = this.operatorPrecedence[op] || 0;
1547                 }
1548                 else if (token.type === token_1.Token.Keyword) {
1549                     precedence = (op === 'instanceof' || (this.context.allowIn && op === 'in')) ? 7 : 0;
1550                 }
1551                 else {
1552                     precedence = 0;
1553                 }
1554                 return precedence;
1555             };
1556             Parser.prototype.parseBinaryExpression = function () {
1557                 var startToken = this.lookahead;
1558                 var expr = this.inheritCoverGrammar(this.parseExponentiationExpression);
1559                 var token = this.lookahead;
1560                 var prec = this.binaryPrecedence(token);
1561                 if (prec > 0) {
1562                     this.nextToken();
1563                     token.prec = prec;
1564                     this.context.isAssignmentTarget = false;
1565                     this.context.isBindingElement = false;
1566                     var markers = [startToken, this.lookahead];
1567                     var left = expr;
1568                     var right = this.isolateCoverGrammar(this.parseExponentiationExpression);
1569                     var stack = [left, token, right];
1570                     while (true) {
1571                         prec = this.binaryPrecedence(this.lookahead);
1572                         if (prec <= 0) {
1573                             break;
1574                         }
1575                         // Reduce: make a binary expression from the three topmost entries.
1576                         while ((stack.length > 2) && (prec <= stack[stack.length - 2].prec)) {
1577                             right = stack.pop();
1578                             var operator = stack.pop().value;
1579                             left = stack.pop();
1580                             markers.pop();
1581                             var node = this.startNode(markers[markers.length - 1]);
1582                             stack.push(this.finalize(node, new Node.BinaryExpression(operator, left, right)));
1583                         }
1584                         // Shift.
1585                         token = this.nextToken();
1586                         token.prec = prec;
1587                         stack.push(token);
1588                         markers.push(this.lookahead);
1589                         stack.push(this.isolateCoverGrammar(this.parseExponentiationExpression));
1590                     }
1591                     // Final reduce to clean-up the stack.
1592                     var i = stack.length - 1;
1593                     expr = stack[i];
1594                     markers.pop();
1595                     while (i > 1) {
1596                         var node = this.startNode(markers.pop());
1597                         expr = this.finalize(node, new Node.BinaryExpression(stack[i - 1].value, stack[i - 2], expr));
1598                         i -= 2;
1599                     }
1600                 }
1601                 return expr;
1602             };
1603             // ECMA-262 12.14 Conditional Operator
1604             Parser.prototype.parseConditionalExpression = function () {
1605                 var startToken = this.lookahead;
1606                 var expr = this.inheritCoverGrammar(this.parseBinaryExpression);
1607                 if (this.match('?')) {
1608                     this.nextToken();
1609                     var previousAllowIn = this.context.allowIn;
1610                     this.context.allowIn = true;
1611                     var consequent = this.isolateCoverGrammar(this.parseAssignmentExpression);
1612                     this.context.allowIn = previousAllowIn;
1613                     this.expect(':');
1614                     var alternate = this.isolateCoverGrammar(this.parseAssignmentExpression);
1615                     expr = this.finalize(this.startNode(startToken), new Node.ConditionalExpression(expr, consequent, alternate));
1616                     this.context.isAssignmentTarget = false;
1617                     this.context.isBindingElement = false;
1618                 }
1619                 return expr;
1620             };
1621             // ECMA-262 12.15 Assignment Operators
1622             Parser.prototype.checkPatternParam = function (options, param) {
1623                 switch (param.type) {
1624                     case syntax_1.Syntax.Identifier:
1625                         this.validateParam(options, param, param.name);
1626                         break;
1627                     case syntax_1.Syntax.RestElement:
1628                         this.checkPatternParam(options, param.argument);
1629                         break;
1630                     case syntax_1.Syntax.AssignmentPattern:
1631                         this.checkPatternParam(options, param.left);
1632                         break;
1633                     case syntax_1.Syntax.ArrayPattern:
1634                         for (var i = 0; i < param.elements.length; i++) {
1635                             if (param.elements[i] !== null) {
1636                                 this.checkPatternParam(options, param.elements[i]);
1637                             }
1638                         }
1639                         break;
1640                     case syntax_1.Syntax.YieldExpression:
1641                         break;
1642                     default:
1643                         assert_1.assert(param.type === syntax_1.Syntax.ObjectPattern, 'Invalid type');
1644                         for (var i = 0; i < param.properties.length; i++) {
1645                             this.checkPatternParam(options, param.properties[i].value);
1646                         }
1647                         break;
1648                 }
1649             };
1650             Parser.prototype.reinterpretAsCoverFormalsList = function (expr) {
1651                 var params = [expr];
1652                 var options;
1653                 switch (expr.type) {
1654                     case syntax_1.Syntax.Identifier:
1655                         break;
1656                     case ArrowParameterPlaceHolder:
1657                         params = expr.params;
1658                         break;
1659                     default:
1660                         return null;
1661                 }
1662                 options = {
1663                     paramSet: {}
1664                 };
1665                 for (var i = 0; i < params.length; ++i) {
1666                     var param = params[i];
1667                     if (param.type === syntax_1.Syntax.AssignmentPattern) {
1668                         if (param.right.type === syntax_1.Syntax.YieldExpression) {
1669                             if (param.right.argument) {
1670                                 this.throwUnexpectedToken(this.lookahead);
1671                             }
1672                             param.right.type = syntax_1.Syntax.Identifier;
1673                             param.right.name = 'yield';
1674                             delete param.right.argument;
1675                             delete param.right.delegate;
1676                         }
1677                     }
1678                     this.checkPatternParam(options, param);
1679                     params[i] = param;
1680                 }
1681                 if (this.context.strict || !this.context.allowYield) {
1682                     for (var i = 0; i < params.length; ++i) {
1683                         var param = params[i];
1684                         if (param.type === syntax_1.Syntax.YieldExpression) {
1685                             this.throwUnexpectedToken(this.lookahead);
1686                         }
1687                     }
1688                 }
1689                 if (options.message === messages_1.Messages.StrictParamDupe) {
1690                     var token = this.context.strict ? options.stricted : options.firstRestricted;
1691                     this.throwUnexpectedToken(token, options.message);
1692                 }
1693                 return {
1694                     params: params,
1695                     stricted: options.stricted,
1696                     firstRestricted: options.firstRestricted,
1697                     message: options.message
1698                 };
1699             };
1700             Parser.prototype.parseAssignmentExpression = function () {
1701                 var expr;
1702                 if (!this.context.allowYield && this.matchKeyword('yield')) {
1703                     expr = this.parseYieldExpression();
1704                 }
1705                 else {
1706                     var startToken = this.lookahead;
1707                     var token = startToken;
1708                     expr = this.parseConditionalExpression();
1709                     if (expr.type === ArrowParameterPlaceHolder || this.match('=>')) {
1710                         // ECMA-262 14.2 Arrow Function Definitions
1711                         this.context.isAssignmentTarget = false;
1712                         this.context.isBindingElement = false;
1713                         var list = this.reinterpretAsCoverFormalsList(expr);
1714                         if (list) {
1715                             if (this.hasLineTerminator) {
1716                                 this.tolerateUnexpectedToken(this.lookahead);
1717                             }
1718                             this.context.firstCoverInitializedNameError = null;
1719                             var previousStrict = this.context.strict;
1720                             var previousAllowYield = this.context.allowYield;
1721                             this.context.allowYield = true;
1722                             var node = this.startNode(startToken);
1723                             this.expect('=>');
1724                             var body = this.match('{') ? this.parseFunctionSourceElements() :
1725                                 this.isolateCoverGrammar(this.parseAssignmentExpression);
1726                             var expression = body.type !== syntax_1.Syntax.BlockStatement;
1727                             if (this.context.strict && list.firstRestricted) {
1728                                 this.throwUnexpectedToken(list.firstRestricted, list.message);
1729                             }
1730                             if (this.context.strict && list.stricted) {
1731                                 this.tolerateUnexpectedToken(list.stricted, list.message);
1732                             }
1733                             expr = this.finalize(node, new Node.ArrowFunctionExpression(list.params, body, expression));
1734                             this.context.strict = previousStrict;
1735                             this.context.allowYield = previousAllowYield;
1736                         }
1737                     }
1738                     else {
1739                         if (this.matchAssign()) {
1740                             if (!this.context.isAssignmentTarget) {
1741                                 this.tolerateError(messages_1.Messages.InvalidLHSInAssignment);
1742                             }
1743                             if (this.context.strict && expr.type === syntax_1.Syntax.Identifier) {
1744                                 var id = (expr);
1745                                 if (this.scanner.isRestrictedWord(id.name)) {
1746                                     this.tolerateUnexpectedToken(token, messages_1.Messages.StrictLHSAssignment);
1747                                 }
1748                                 if (this.scanner.isStrictModeReservedWord(id.name)) {
1749                                     this.tolerateUnexpectedToken(token, messages_1.Messages.StrictReservedWord);
1750                                 }
1751                             }
1752                             if (!this.match('=')) {
1753                                 this.context.isAssignmentTarget = false;
1754                                 this.context.isBindingElement = false;
1755                             }
1756                             else {
1757                                 this.reinterpretExpressionAsPattern(expr);
1758                             }
1759                             token = this.nextToken();
1760                             var right = this.isolateCoverGrammar(this.parseAssignmentExpression);
1761                             expr = this.finalize(this.startNode(startToken), new Node.AssignmentExpression(token.value, expr, right));
1762                             this.context.firstCoverInitializedNameError = null;
1763                         }
1764                     }
1765                 }
1766                 return expr;
1767             };
1768             // ECMA-262 12.16 Comma Operator
1769             Parser.prototype.parseExpression = function () {
1770                 var startToken = this.lookahead;
1771                 var expr = this.isolateCoverGrammar(this.parseAssignmentExpression);
1772                 if (this.match(',')) {
1773                     var expressions = [];
1774                     expressions.push(expr);
1775                     while (this.startMarker.index < this.scanner.length) {
1776                         if (!this.match(',')) {
1777                             break;
1778                         }
1779                         this.nextToken();
1780                         expressions.push(this.isolateCoverGrammar(this.parseAssignmentExpression));
1781                     }
1782                     expr = this.finalize(this.startNode(startToken), new Node.SequenceExpression(expressions));
1783                 }
1784                 return expr;
1785             };
1786             // ECMA-262 13.2 Block
1787             Parser.prototype.parseStatementListItem = function () {
1788                 var statement = null;
1789                 this.context.isAssignmentTarget = true;
1790                 this.context.isBindingElement = true;
1791                 if (this.lookahead.type === token_1.Token.Keyword) {
1792                     switch (this.lookahead.value) {
1793                         case 'export':
1794                             if (this.sourceType !== 'module') {
1795                                 this.tolerateUnexpectedToken(this.lookahead, messages_1.Messages.IllegalExportDeclaration);
1796                             }
1797                             statement = this.parseExportDeclaration();
1798                             break;
1799                         case 'import':
1800                             if (this.sourceType !== 'module') {
1801                                 this.tolerateUnexpectedToken(this.lookahead, messages_1.Messages.IllegalImportDeclaration);
1802                             }
1803                             statement = this.parseImportDeclaration();
1804                             break;
1805                         case 'const':
1806                             statement = this.parseLexicalDeclaration({ inFor: false });
1807                             break;
1808                         case 'function':
1809                             statement = this.parseFunctionDeclaration();
1810                             break;
1811                         case 'class':
1812                             statement = this.parseClassDeclaration();
1813                             break;
1814                         case 'let':
1815                             statement = this.isLexicalDeclaration() ? this.parseLexicalDeclaration({ inFor: false }) : this.parseStatement();
1816                             break;
1817                         default:
1818                             statement = this.parseStatement();
1819                             break;
1820                     }
1821                 }
1822                 else {
1823                     statement = this.parseStatement();
1824                 }
1825                 return statement;
1826             };
1827             Parser.prototype.parseBlock = function () {
1828                 var node = this.createNode();
1829                 this.expect('{');
1830                 var block = [];
1831                 while (true) {
1832                     if (this.match('}')) {
1833                         break;
1834                     }
1835                     block.push(this.parseStatementListItem());
1836                 }
1837                 this.expect('}');
1838                 return this.finalize(node, new Node.BlockStatement(block));
1839             };
1840             // ECMA-262 13.3.1 Let and Const Declarations
1841             Parser.prototype.parseLexicalBinding = function (kind, options) {
1842                 var node = this.createNode();
1843                 var params = [];
1844                 var id = this.parsePattern(params, kind);
1845                 // ECMA-262 12.2.1
1846                 if (this.context.strict && id.type === syntax_1.Syntax.Identifier) {
1847                     if (this.scanner.isRestrictedWord((id).name)) {
1848                         this.tolerateError(messages_1.Messages.StrictVarName);
1849                     }
1850                 }
1851                 var init = null;
1852                 if (kind === 'const') {
1853                     if (!this.matchKeyword('in') && !this.matchContextualKeyword('of')) {
1854                         this.expect('=');
1855                         init = this.isolateCoverGrammar(this.parseAssignmentExpression);
1856                     }
1857                 }
1858                 else if ((!options.inFor && id.type !== syntax_1.Syntax.Identifier) || this.match('=')) {
1859                     this.expect('=');
1860                     init = this.isolateCoverGrammar(this.parseAssignmentExpression);
1861                 }
1862                 return this.finalize(node, new Node.VariableDeclarator(id, init));
1863             };
1864             Parser.prototype.parseBindingList = function (kind, options) {
1865                 var list = [this.parseLexicalBinding(kind, options)];
1866                 while (this.match(',')) {
1867                     this.nextToken();
1868                     list.push(this.parseLexicalBinding(kind, options));
1869                 }
1870                 return list;
1871             };
1872             Parser.prototype.isLexicalDeclaration = function () {
1873                 var previousIndex = this.scanner.index;
1874                 var previousLineNumber = this.scanner.lineNumber;
1875                 var previousLineStart = this.scanner.lineStart;
1876                 this.collectComments();
1877                 var next = this.scanner.lex();
1878                 this.scanner.index = previousIndex;
1879                 this.scanner.lineNumber = previousLineNumber;
1880                 this.scanner.lineStart = previousLineStart;
1881                 return (next.type === token_1.Token.Identifier) ||
1882                     (next.type === token_1.Token.Punctuator && next.value === '[') ||
1883                     (next.type === token_1.Token.Punctuator && next.value === '{') ||
1884                     (next.type === token_1.Token.Keyword && next.value === 'let') ||
1885                     (next.type === token_1.Token.Keyword && next.value === 'yield');
1886             };
1887             Parser.prototype.parseLexicalDeclaration = function (options) {
1888                 var node = this.createNode();
1889                 var kind = this.nextToken().value;
1890                 assert_1.assert(kind === 'let' || kind === 'const', 'Lexical declaration must be either let or const');
1891                 var declarations = this.parseBindingList(kind, options);
1892                 this.consumeSemicolon();
1893                 return this.finalize(node, new Node.VariableDeclaration(declarations, kind));
1894             };
1895             // ECMA-262 13.3.3 Destructuring Binding Patterns
1896             Parser.prototype.parseBindingRestElement = function (params, kind) {
1897                 var node = this.createNode();
1898                 this.expect('...');
1899                 var arg = this.parsePattern(params, kind);
1900                 return this.finalize(node, new Node.RestElement(arg));
1901             };
1902             Parser.prototype.parseArrayPattern = function (params, kind) {
1903                 var node = this.createNode();
1904                 this.expect('[');
1905                 var elements = [];
1906                 while (!this.match(']')) {
1907                     if (this.match(',')) {
1908                         this.nextToken();
1909                         elements.push(null);
1910                     }
1911                     else {
1912                         if (this.match('...')) {
1913                             elements.push(this.parseBindingRestElement(params, kind));
1914                             break;
1915                         }
1916                         else {
1917                             elements.push(this.parsePatternWithDefault(params, kind));
1918                         }
1919                         if (!this.match(']')) {
1920                             this.expect(',');
1921                         }
1922                     }
1923                 }
1924                 this.expect(']');
1925                 return this.finalize(node, new Node.ArrayPattern(elements));
1926             };
1927             Parser.prototype.parsePropertyPattern = function (params, kind) {
1928                 var node = this.createNode();
1929                 var computed = false;
1930                 var shorthand = false;
1931                 var method = false;
1932                 var key;
1933                 var value;
1934                 if (this.lookahead.type === token_1.Token.Identifier) {
1935                     var keyToken = this.lookahead;
1936                     key = this.parseVariableIdentifier();
1937                     var init = this.finalize(node, new Node.Identifier(keyToken.value));
1938                     if (this.match('=')) {
1939                         params.push(keyToken);
1940                         shorthand = true;
1941                         this.nextToken();
1942                         var expr = this.parseAssignmentExpression();
1943                         value = this.finalize(this.startNode(keyToken), new Node.AssignmentPattern(init, expr));
1944                     }
1945                     else if (!this.match(':')) {
1946                         params.push(keyToken);
1947                         shorthand = true;
1948                         value = init;
1949                     }
1950                     else {
1951                         this.expect(':');
1952                         value = this.parsePatternWithDefault(params, kind);
1953                     }
1954                 }
1955                 else {
1956                     computed = this.match('[');
1957                     key = this.parseObjectPropertyKey();
1958                     this.expect(':');
1959                     value = this.parsePatternWithDefault(params, kind);
1960                 }
1961                 return this.finalize(node, new Node.Property('init', key, computed, value, method, shorthand));
1962             };
1963             Parser.prototype.parseObjectPattern = function (params, kind) {
1964                 var node = this.createNode();
1965                 var properties = [];
1966                 this.expect('{');
1967                 while (!this.match('}')) {
1968                     properties.push(this.parsePropertyPattern(params, kind));
1969                     if (!this.match('}')) {
1970                         this.expect(',');
1971                     }
1972                 }
1973                 this.expect('}');
1974                 return this.finalize(node, new Node.ObjectPattern(properties));
1975             };
1976             Parser.prototype.parsePattern = function (params, kind) {
1977                 var pattern;
1978                 if (this.match('[')) {
1979                     pattern = this.parseArrayPattern(params, kind);
1980                 }
1981                 else if (this.match('{')) {
1982                     pattern = this.parseObjectPattern(params, kind);
1983                 }
1984                 else {
1985                     if (this.matchKeyword('let') && (kind === 'const' || kind === 'let')) {
1986                         this.tolerateUnexpectedToken(this.lookahead, messages_1.Messages.UnexpectedToken);
1987                     }
1988                     params.push(this.lookahead);
1989                     pattern = this.parseVariableIdentifier(kind);
1990                 }
1991                 return pattern;
1992             };
1993             Parser.prototype.parsePatternWithDefault = function (params, kind) {
1994                 var startToken = this.lookahead;
1995                 var pattern = this.parsePattern(params, kind);
1996                 if (this.match('=')) {
1997                     this.nextToken();
1998                     var previousAllowYield = this.context.allowYield;
1999                     this.context.allowYield = true;
2000                     var right = this.isolateCoverGrammar(this.parseAssignmentExpression);
2001                     this.context.allowYield = previousAllowYield;
2002                     pattern = this.finalize(this.startNode(startToken), new Node.AssignmentPattern(pattern, right));
2003                 }
2004                 return pattern;
2005             };
2006             // ECMA-262 13.3.2 Variable Statement
2007             Parser.prototype.parseVariableIdentifier = function (kind) {
2008                 var node = this.createNode();
2009                 var token = this.nextToken();
2010                 if (token.type === token_1.Token.Keyword && token.value === 'yield') {
2011                     if (this.context.strict) {
2012                         this.tolerateUnexpectedToken(token, messages_1.Messages.StrictReservedWord);
2013                     }
2014                     if (!this.context.allowYield) {
2015                         this.throwUnexpectedToken(token);
2016                     }
2017                 }
2018                 else if (token.type !== token_1.Token.Identifier) {
2019                     if (this.context.strict && token.type === token_1.Token.Keyword && this.scanner.isStrictModeReservedWord(token.value)) {
2020                         this.tolerateUnexpectedToken(token, messages_1.Messages.StrictReservedWord);
2021                     }
2022                     else {
2023                         if (this.context.strict || token.value !== 'let' || kind !== 'var') {
2024                             this.throwUnexpectedToken(token);
2025                         }
2026                     }
2027                 }
2028                 else if (this.sourceType === 'module' && token.type === token_1.Token.Identifier && token.value === 'await') {
2029                     this.tolerateUnexpectedToken(token);
2030                 }
2031                 return this.finalize(node, new Node.Identifier(token.value));
2032             };
2033             Parser.prototype.parseVariableDeclaration = function (options) {
2034                 var node = this.createNode();
2035                 var params = [];
2036                 var id = this.parsePattern(params, 'var');
2037                 // ECMA-262 12.2.1
2038                 if (this.context.strict && id.type === syntax_1.Syntax.Identifier) {
2039                     if (this.scanner.isRestrictedWord((id).name)) {
2040                         this.tolerateError(messages_1.Messages.StrictVarName);
2041                     }
2042                 }
2043                 var init = null;
2044                 if (this.match('=')) {
2045                     this.nextToken();
2046                     init = this.isolateCoverGrammar(this.parseAssignmentExpression);
2047                 }
2048                 else if (id.type !== syntax_1.Syntax.Identifier && !options.inFor) {
2049                     this.expect('=');
2050                 }
2051                 return this.finalize(node, new Node.VariableDeclarator(id, init));
2052             };
2053             Parser.prototype.parseVariableDeclarationList = function (options) {
2054                 var opt = { inFor: options.inFor };
2055                 var list = [];
2056                 list.push(this.parseVariableDeclaration(opt));
2057                 while (this.match(',')) {
2058                     this.nextToken();
2059                     list.push(this.parseVariableDeclaration(opt));
2060                 }
2061                 return list;
2062             };
2063             Parser.prototype.parseVariableStatement = function () {
2064                 var node = this.createNode();
2065                 this.expectKeyword('var');
2066                 var declarations = this.parseVariableDeclarationList({ inFor: false });
2067                 this.consumeSemicolon();
2068                 return this.finalize(node, new Node.VariableDeclaration(declarations, 'var'));
2069             };
2070             // ECMA-262 13.4 Empty Statement
2071             Parser.prototype.parseEmptyStatement = function () {
2072                 var node = this.createNode();
2073                 this.expect(';');
2074                 return this.finalize(node, new Node.EmptyStatement());
2075             };
2076             // ECMA-262 13.5 Expression Statement
2077             Parser.prototype.parseExpressionStatement = function () {
2078                 var node = this.createNode();
2079                 var expr = this.parseExpression();
2080                 this.consumeSemicolon();
2081                 return this.finalize(node, new Node.ExpressionStatement(expr));
2082             };
2083             // ECMA-262 13.6 If statement
2084             Parser.prototype.parseIfStatement = function () {
2085                 var node = this.createNode();
2086                 var consequent;
2087                 var alternate = null;
2088                 this.expectKeyword('if');
2089                 this.expect('(');
2090                 var test = this.parseExpression();
2091                 if (!this.match(')') && this.config.tolerant) {
2092                     this.tolerateUnexpectedToken(this.nextToken());
2093                     consequent = this.finalize(this.createNode(), new Node.EmptyStatement());
2094                 }
2095                 else {
2096                     this.expect(')');
2097                     consequent = this.parseStatement();
2098                     if (this.matchKeyword('else')) {
2099                         this.nextToken();
2100                         alternate = this.parseStatement();
2101                     }
2102                 }
2103                 return this.finalize(node, new Node.IfStatement(test, consequent, alternate));
2104             };
2105             // ECMA-262 13.7.2 The do-while Statement
2106             Parser.prototype.parseDoWhileStatement = function () {
2107                 var node = this.createNode();
2108                 this.expectKeyword('do');
2109                 var previousInIteration = this.context.inIteration;
2110                 this.context.inIteration = true;
2111                 var body = this.parseStatement();
2112                 this.context.inIteration = previousInIteration;
2113                 this.expectKeyword('while');
2114                 this.expect('(');
2115                 var test = this.parseExpression();
2116                 this.expect(')');
2117                 if (this.match(';')) {
2118                     this.nextToken();
2119                 }
2120                 return this.finalize(node, new Node.DoWhileStatement(body, test));
2121             };
2122             // ECMA-262 13.7.3 The while Statement
2123             Parser.prototype.parseWhileStatement = function () {
2124                 var node = this.createNode();
2125                 var body;
2126                 this.expectKeyword('while');
2127                 this.expect('(');
2128                 var test = this.parseExpression();
2129                 if (!this.match(')') && this.config.tolerant) {
2130                     this.tolerateUnexpectedToken(this.nextToken());
2131                     body = this.finalize(this.createNode(), new Node.EmptyStatement());
2132                 }
2133                 else {
2134                     this.expect(')');
2135                     var previousInIteration = this.context.inIteration;
2136                     this.context.inIteration = true;
2137                     body = this.parseStatement();
2138                     this.context.inIteration = previousInIteration;
2139                 }
2140                 return this.finalize(node, new Node.WhileStatement(test, body));
2141             };
2142             // ECMA-262 13.7.4 The for Statement
2143             // ECMA-262 13.7.5 The for-in and for-of Statements
2144             Parser.prototype.parseForStatement = function () {
2145                 var init = null;
2146                 var test = null;
2147                 var update = null;
2148                 var forIn = true;
2149                 var left, right;
2150                 var node = this.createNode();
2151                 this.expectKeyword('for');
2152                 this.expect('(');
2153                 if (this.match(';')) {
2154                     this.nextToken();
2155                 }
2156                 else {
2157                     if (this.matchKeyword('var')) {
2158                         init = this.createNode();
2159                         this.nextToken();
2160                         var previousAllowIn = this.context.allowIn;
2161                         this.context.allowIn = false;
2162                         var declarations = this.parseVariableDeclarationList({ inFor: true });
2163                         this.context.allowIn = previousAllowIn;
2164                         if (declarations.length === 1 && this.matchKeyword('in')) {
2165                             var decl = declarations[0];
2166                             if (decl.init && (decl.id.type === syntax_1.Syntax.ArrayPattern || decl.id.type === syntax_1.Syntax.ObjectPattern || this.context.strict)) {
2167                                 this.tolerateError(messages_1.Messages.ForInOfLoopInitializer, 'for-in');
2168                             }
2169                             init = this.finalize(init, new Node.VariableDeclaration(declarations, 'var'));
2170                             this.nextToken();
2171                             left = init;
2172                             right = this.parseExpression();
2173                             init = null;
2174                         }
2175                         else if (declarations.length === 1 && declarations[0].init === null && this.matchContextualKeyword('of')) {
2176                             init = this.finalize(init, new Node.VariableDeclaration(declarations, 'var'));
2177                             this.nextToken();
2178                             left = init;
2179                             right = this.parseAssignmentExpression();
2180                             init = null;
2181                             forIn = false;
2182                         }
2183                         else {
2184                             init = this.finalize(init, new Node.VariableDeclaration(declarations, 'var'));
2185                             this.expect(';');
2186                         }
2187                     }
2188                     else if (this.matchKeyword('const') || this.matchKeyword('let')) {
2189                         init = this.createNode();
2190                         var kind = this.nextToken().value;
2191                         if (!this.context.strict && this.lookahead.value === 'in') {
2192                             init = this.finalize(init, new Node.Identifier(kind));
2193                             this.nextToken();
2194                             left = init;
2195                             right = this.parseExpression();
2196                             init = null;
2197                         }
2198                         else {
2199                             var previousAllowIn = this.context.allowIn;
2200                             this.context.allowIn = false;
2201                             var declarations = this.parseBindingList(kind, { inFor: true });
2202                             this.context.allowIn = previousAllowIn;
2203                             if (declarations.length === 1 && declarations[0].init === null && this.matchKeyword('in')) {
2204                                 init = this.finalize(init, new Node.VariableDeclaration(declarations, kind));
2205                                 this.nextToken();
2206                                 left = init;
2207                                 right = this.parseExpression();
2208                                 init = null;
2209                             }
2210                             else if (declarations.length === 1 && declarations[0].init === null && this.matchContextualKeyword('of')) {
2211                                 init = this.finalize(init, new Node.VariableDeclaration(declarations, kind));
2212                                 this.nextToken();
2213                                 left = init;
2214                                 right = this.parseAssignmentExpression();
2215                                 init = null;
2216                                 forIn = false;
2217                             }
2218                             else {
2219                                 this.consumeSemicolon();
2220                                 init = this.finalize(init, new Node.VariableDeclaration(declarations, kind));
2221                             }
2222                         }
2223                     }
2224                     else {
2225                         var initStartToken = this.lookahead;
2226                         var previousAllowIn = this.context.allowIn;
2227                         this.context.allowIn = false;
2228                         init = this.inheritCoverGrammar(this.parseAssignmentExpression);
2229                         this.context.allowIn = previousAllowIn;
2230                         if (this.matchKeyword('in')) {
2231                             if (!this.context.isAssignmentTarget || init.type === syntax_1.Syntax.AssignmentExpression) {
2232                                 this.tolerateError(messages_1.Messages.InvalidLHSInForIn);
2233                             }
2234                             this.nextToken();
2235                             this.reinterpretExpressionAsPattern(init);
2236                             left = init;
2237                             right = this.parseExpression();
2238                             init = null;
2239                         }
2240                         else if (this.matchContextualKeyword('of')) {
2241                             if (!this.context.isAssignmentTarget || init.type === syntax_1.Syntax.AssignmentExpression) {
2242                                 this.tolerateError(messages_1.Messages.InvalidLHSInForLoop);
2243                             }
2244                             this.nextToken();
2245                             this.reinterpretExpressionAsPattern(init);
2246                             left = init;
2247                             right = this.parseAssignmentExpression();
2248                             init = null;
2249                             forIn = false;
2250                         }
2251                         else {
2252                             if (this.match(',')) {
2253                                 var initSeq = [init];
2254                                 while (this.match(',')) {
2255                                     this.nextToken();
2256                                     initSeq.push(this.isolateCoverGrammar(this.parseAssignmentExpression));
2257                                 }
2258                                 init = this.finalize(this.startNode(initStartToken), new Node.SequenceExpression(initSeq));
2259                             }
2260                             this.expect(';');
2261                         }
2262                     }
2263                 }
2264                 if (typeof left === 'undefined') {
2265                     if (!this.match(';')) {
2266                         test = this.parseExpression();
2267                     }
2268                     this.expect(';');
2269                     if (!this.match(')')) {
2270                         update = this.parseExpression();
2271                     }
2272                 }
2273                 var body;
2274                 if (!this.match(')') && this.config.tolerant) {
2275                     this.tolerateUnexpectedToken(this.nextToken());
2276                     body = this.finalize(this.createNode(), new Node.EmptyStatement());
2277                 }
2278                 else {
2279                     this.expect(')');
2280                     var previousInIteration = this.context.inIteration;
2281                     this.context.inIteration = true;
2282                     body = this.isolateCoverGrammar(this.parseStatement);
2283                     this.context.inIteration = previousInIteration;
2284                 }
2285                 return (typeof left === 'undefined') ?
2286                     this.finalize(node, new Node.ForStatement(init, test, update, body)) :
2287                     forIn ? this.finalize(node, new Node.ForInStatement(left, right, body)) :
2288                         this.finalize(node, new Node.ForOfStatement(left, right, body));
2289             };
2290             // ECMA-262 13.8 The continue statement
2291             Parser.prototype.parseContinueStatement = function () {
2292                 var node = this.createNode();
2293                 this.expectKeyword('continue');
2294                 var label = null;
2295                 if (this.lookahead.type === token_1.Token.Identifier && !this.hasLineTerminator) {
2296                     label = this.parseVariableIdentifier();
2297                     var key = '$' + label.name;
2298                     if (!Object.prototype.hasOwnProperty.call(this.context.labelSet, key)) {
2299                         this.throwError(messages_1.Messages.UnknownLabel, label.name);
2300                     }
2301                 }
2302                 this.consumeSemicolon();
2303                 if (label === null && !this.context.inIteration) {
2304                     this.throwError(messages_1.Messages.IllegalContinue);
2305                 }
2306                 return this.finalize(node, new Node.ContinueStatement(label));
2307             };
2308             // ECMA-262 13.9 The break statement
2309             Parser.prototype.parseBreakStatement = function () {
2310                 var node = this.createNode();
2311                 this.expectKeyword('break');
2312                 var label = null;
2313                 if (this.lookahead.type === token_1.Token.Identifier && !this.hasLineTerminator) {
2314                     label = this.parseVariableIdentifier();
2315                     var key = '$' + label.name;
2316                     if (!Object.prototype.hasOwnProperty.call(this.context.labelSet, key)) {
2317                         this.throwError(messages_1.Messages.UnknownLabel, label.name);
2318                     }
2319                 }
2320                 this.consumeSemicolon();
2321                 if (label === null && !this.context.inIteration && !this.context.inSwitch) {
2322                     this.throwError(messages_1.Messages.IllegalBreak);
2323                 }
2324                 return this.finalize(node, new Node.BreakStatement(label));
2325             };
2326             // ECMA-262 13.10 The return statement
2327             Parser.prototype.parseReturnStatement = function () {
2328                 if (!this.context.inFunctionBody) {
2329                     this.tolerateError(messages_1.Messages.IllegalReturn);
2330                 }
2331                 var node = this.createNode();
2332                 this.expectKeyword('return');
2333                 var hasArgument = !this.match(';') && !this.match('}') &&
2334                     !this.hasLineTerminator && this.lookahead.type !== token_1.Token.EOF;
2335                 var argument = hasArgument ? this.parseExpression() : null;
2336                 this.consumeSemicolon();
2337                 return this.finalize(node, new Node.ReturnStatement(argument));
2338             };
2339             // ECMA-262 13.11 The with statement
2340             Parser.prototype.parseWithStatement = function () {
2341                 if (this.context.strict) {
2342                     this.tolerateError(messages_1.Messages.StrictModeWith);
2343                 }
2344                 var node = this.createNode();
2345                 this.expectKeyword('with');
2346                 this.expect('(');
2347                 var object = this.parseExpression();
2348                 this.expect(')');
2349                 var body = this.parseStatement();
2350                 return this.finalize(node, new Node.WithStatement(object, body));
2351             };
2352             // ECMA-262 13.12 The switch statement
2353             Parser.prototype.parseSwitchCase = function () {
2354                 var node = this.createNode();
2355                 var test;
2356                 if (this.matchKeyword('default')) {
2357                     this.nextToken();
2358                     test = null;
2359                 }
2360                 else {
2361                     this.expectKeyword('case');
2362                     test = this.parseExpression();
2363                 }
2364                 this.expect(':');
2365                 var consequent = [];
2366                 while (true) {
2367                     if (this.match('}') || this.matchKeyword('default') || this.matchKeyword('case')) {
2368                         break;
2369                     }
2370                     consequent.push(this.parseStatementListItem());
2371                 }
2372                 return this.finalize(node, new Node.SwitchCase(test, consequent));
2373             };
2374             Parser.prototype.parseSwitchStatement = function () {
2375                 var node = this.createNode();
2376                 this.expectKeyword('switch');
2377                 this.expect('(');
2378                 var discriminant = this.parseExpression();
2379                 this.expect(')');
2380                 var previousInSwitch = this.context.inSwitch;
2381                 this.context.inSwitch = true;
2382                 var cases = [];
2383                 var defaultFound = false;
2384                 this.expect('{');
2385                 while (true) {
2386                     if (this.match('}')) {
2387                         break;
2388                     }
2389                     var clause = this.parseSwitchCase();
2390                     if (clause.test === null) {
2391                         if (defaultFound) {
2392                             this.throwError(messages_1.Messages.MultipleDefaultsInSwitch);
2393                         }
2394                         defaultFound = true;
2395                     }
2396                     cases.push(clause);
2397                 }
2398                 this.expect('}');
2399                 this.context.inSwitch = previousInSwitch;
2400                 return this.finalize(node, new Node.SwitchStatement(discriminant, cases));
2401             };
2402             // ECMA-262 13.13 Labelled Statements
2403             Parser.prototype.parseLabelledStatement = function () {
2404                 var node = this.createNode();
2405                 var expr = this.parseExpression();
2406                 var statement;
2407                 if ((expr.type === syntax_1.Syntax.Identifier) && this.match(':')) {
2408                     this.nextToken();
2409                     var id = (expr);
2410                     var key = '$' + id.name;
2411                     if (Object.prototype.hasOwnProperty.call(this.context.labelSet, key)) {
2412                         this.throwError(messages_1.Messages.Redeclaration, 'Label', id.name);
2413                     }
2414                     this.context.labelSet[key] = true;
2415                     var labeledBody = this.parseStatement();
2416                     delete this.context.labelSet[key];
2417                     statement = new Node.LabeledStatement(id, labeledBody);
2418                 }
2419                 else {
2420                     this.consumeSemicolon();
2421                     statement = new Node.ExpressionStatement(expr);
2422                 }
2423                 return this.finalize(node, statement);
2424             };
2425             // ECMA-262 13.14 The throw statement
2426             Parser.prototype.parseThrowStatement = function () {
2427                 var node = this.createNode();
2428                 this.expectKeyword('throw');
2429                 if (this.hasLineTerminator) {
2430                     this.throwError(messages_1.Messages.NewlineAfterThrow);
2431                 }
2432                 var argument = this.parseExpression();
2433                 this.consumeSemicolon();
2434                 return this.finalize(node, new Node.ThrowStatement(argument));
2435             };
2436             // ECMA-262 13.15 The try statement
2437             Parser.prototype.parseCatchClause = function () {
2438                 var node = this.createNode();
2439                 this.expectKeyword('catch');
2440                 this.expect('(');
2441                 if (this.match(')')) {
2442                     this.throwUnexpectedToken(this.lookahead);
2443                 }
2444                 var params = [];
2445                 var param = this.parsePattern(params);
2446                 var paramMap = {};
2447                 for (var i = 0; i < params.length; i++) {
2448                     var key = '$' + params[i].value;
2449                     if (Object.prototype.hasOwnProperty.call(paramMap, key)) {
2450                         this.tolerateError(messages_1.Messages.DuplicateBinding, params[i].value);
2451                     }
2452                     paramMap[key] = true;
2453                 }
2454                 if (this.context.strict && param.type === syntax_1.Syntax.Identifier) {
2455                     if (this.scanner.isRestrictedWord((param).name)) {
2456                         this.tolerateError(messages_1.Messages.StrictCatchVariable);
2457                     }
2458                 }
2459                 this.expect(')');
2460                 var body = this.parseBlock();
2461                 return this.finalize(node, new Node.CatchClause(param, body));
2462             };
2463             Parser.prototype.parseFinallyClause = function () {
2464                 this.expectKeyword('finally');
2465                 return this.parseBlock();
2466             };
2467             Parser.prototype.parseTryStatement = function () {
2468                 var node = this.createNode();
2469                 this.expectKeyword('try');
2470                 var block = this.parseBlock();
2471                 var handler = this.matchKeyword('catch') ? this.parseCatchClause() : null;
2472                 var finalizer = this.matchKeyword('finally') ? this.parseFinallyClause() : null;
2473                 if (!handler && !finalizer) {
2474                     this.throwError(messages_1.Messages.NoCatchOrFinally);
2475                 }
2476                 return this.finalize(node, new Node.TryStatement(block, handler, finalizer));
2477             };
2478             // ECMA-262 13.16 The debugger statement
2479             Parser.prototype.parseDebuggerStatement = function () {
2480                 var node = this.createNode();
2481                 this.expectKeyword('debugger');
2482                 this.consumeSemicolon();
2483                 return this.finalize(node, new Node.DebuggerStatement());
2484             };
2485             // ECMA-262 13 Statements
2486             Parser.prototype.parseStatement = function () {
2487                 var statement = null;
2488                 switch (this.lookahead.type) {
2489                     case token_1.Token.BooleanLiteral:
2490                     case token_1.Token.NullLiteral:
2491                     case token_1.Token.NumericLiteral:
2492                     case token_1.Token.StringLiteral:
2493                     case token_1.Token.Template:
2494                     case token_1.Token.RegularExpression:
2495                         statement = this.parseExpressionStatement();
2496                         break;
2497                     case token_1.Token.Punctuator:
2498                         var value = this.lookahead.value;
2499                         if (value === '{') {
2500                             statement = this.parseBlock();
2501                         }
2502                         else if (value === '(') {
2503                             statement = this.parseExpressionStatement();
2504                         }
2505                         else if (value === ';') {
2506                             statement = this.parseEmptyStatement();
2507                         }
2508                         else {
2509                             statement = this.parseExpressionStatement();
2510                         }
2511                         break;
2512                     case token_1.Token.Identifier:
2513                         statement = this.parseLabelledStatement();
2514                         break;
2515                     case token_1.Token.Keyword:
2516                         switch (this.lookahead.value) {
2517                             case 'break':
2518                                 statement = this.parseBreakStatement();
2519                                 break;
2520                             case 'continue':
2521                                 statement = this.parseContinueStatement();
2522                                 break;
2523                             case 'debugger':
2524                                 statement = this.parseDebuggerStatement();
2525                                 break;
2526                             case 'do':
2527                                 statement = this.parseDoWhileStatement();
2528                                 break;
2529                             case 'for':
2530                                 statement = this.parseForStatement();
2531                                 break;
2532                             case 'function':
2533                                 statement = this.parseFunctionDeclaration();
2534                                 break;
2535                             case 'if':
2536                                 statement = this.parseIfStatement();
2537                                 break;
2538                             case 'return':
2539                                 statement = this.parseReturnStatement();
2540                                 break;
2541                             case 'switch':
2542                                 statement = this.parseSwitchStatement();
2543                                 break;
2544                             case 'throw':
2545                                 statement = this.parseThrowStatement();
2546                                 break;
2547                             case 'try':
2548                                 statement = this.parseTryStatement();
2549                                 break;
2550                             case 'var':
2551                                 statement = this.parseVariableStatement();
2552                                 break;
2553                             case 'while':
2554                                 statement = this.parseWhileStatement();
2555                                 break;
2556                             case 'with':
2557                                 statement = this.parseWithStatement();
2558                                 break;
2559                             default:
2560                                 statement = this.parseExpressionStatement();
2561                                 break;
2562                         }
2563                         break;
2564                     default:
2565                         this.throwUnexpectedToken(this.lookahead);
2566                 }
2567                 return statement;
2568             };
2569             // ECMA-262 14.1 Function Definition
2570             Parser.prototype.parseFunctionSourceElements = function () {
2571                 var node = this.createNode();
2572                 this.expect('{');
2573                 var body = this.parseDirectivePrologues();
2574                 var previousLabelSet = this.context.labelSet;
2575                 var previousInIteration = this.context.inIteration;
2576                 var previousInSwitch = this.context.inSwitch;
2577                 var previousInFunctionBody = this.context.inFunctionBody;
2578                 this.context.labelSet = {};
2579                 this.context.inIteration = false;
2580                 this.context.inSwitch = false;
2581                 this.context.inFunctionBody = true;
2582                 while (this.startMarker.index < this.scanner.length) {
2583                     if (this.match('}')) {
2584                         break;
2585                     }
2586                     body.push(this.parseStatementListItem());
2587                 }
2588                 this.expect('}');
2589                 this.context.labelSet = previousLabelSet;
2590                 this.context.inIteration = previousInIteration;
2591                 this.context.inSwitch = previousInSwitch;
2592                 this.context.inFunctionBody = previousInFunctionBody;
2593                 return this.finalize(node, new Node.BlockStatement(body));
2594             };
2595             Parser.prototype.validateParam = function (options, param, name) {
2596                 var key = '$' + name;
2597                 if (this.context.strict) {
2598                     if (this.scanner.isRestrictedWord(name)) {
2599                         options.stricted = param;
2600                         options.message = messages_1.Messages.StrictParamName;
2601                     }
2602                     if (Object.prototype.hasOwnProperty.call(options.paramSet, key)) {
2603                         options.stricted = param;
2604                         options.message = messages_1.Messages.StrictParamDupe;
2605                     }
2606                 }
2607                 else if (!options.firstRestricted) {
2608                     if (this.scanner.isRestrictedWord(name)) {
2609                         options.firstRestricted = param;
2610                         options.message = messages_1.Messages.StrictParamName;
2611                     }
2612                     else if (this.scanner.isStrictModeReservedWord(name)) {
2613                         options.firstRestricted = param;
2614                         options.message = messages_1.Messages.StrictReservedWord;
2615                     }
2616                     else if (Object.prototype.hasOwnProperty.call(options.paramSet, key)) {
2617                         options.stricted = param;
2618                         options.message = messages_1.Messages.StrictParamDupe;
2619                     }
2620                 }
2621                 /* istanbul ignore next */
2622                 if (typeof Object.defineProperty === 'function') {
2623                     Object.defineProperty(options.paramSet, key, { value: true, enumerable: true, writable: true, configurable: true });
2624                 }
2625                 else {
2626                     options.paramSet[key] = true;
2627                 }
2628             };
2629             Parser.prototype.parseRestElement = function (params) {
2630                 var node = this.createNode();
2631                 this.expect('...');
2632                 var arg = this.parsePattern(params);
2633                 if (this.match('=')) {
2634                     this.throwError(messages_1.Messages.DefaultRestParameter);
2635                 }
2636                 if (!this.match(')')) {
2637                     this.throwError(messages_1.Messages.ParameterAfterRestParameter);
2638                 }
2639                 return this.finalize(node, new Node.RestElement(arg));
2640             };
2641             Parser.prototype.parseFormalParameter = function (options) {
2642                 var params = [];
2643                 var param = this.match('...') ? this.parseRestElement(params) : this.parsePatternWithDefault(params);
2644                 for (var i = 0; i < params.length; i++) {
2645                     this.validateParam(options, params[i], params[i].value);
2646                 }
2647                 options.params.push(param);
2648                 return !this.match(')');
2649             };
2650             Parser.prototype.parseFormalParameters = function (firstRestricted) {
2651                 var options;
2652                 options = {
2653                     params: [],
2654                     firstRestricted: firstRestricted
2655                 };
2656                 this.expect('(');
2657                 if (!this.match(')')) {
2658                     options.paramSet = {};
2659                     while (this.startMarker.index < this.scanner.length) {
2660                         if (!this.parseFormalParameter(options)) {
2661                             break;
2662                         }
2663                         this.expect(',');
2664                     }
2665                 }
2666                 this.expect(')');
2667                 return {
2668                     params: options.params,
2669                     stricted: options.stricted,
2670                     firstRestricted: options.firstRestricted,
2671                     message: options.message
2672                 };
2673             };
2674             Parser.prototype.parseFunctionDeclaration = function (identifierIsOptional) {
2675                 var node = this.createNode();
2676                 this.expectKeyword('function');
2677                 var isGenerator = this.match('*');
2678                 if (isGenerator) {
2679                     this.nextToken();
2680                 }
2681                 var message;
2682                 var id = null;
2683                 var firstRestricted = null;
2684                 if (!identifierIsOptional || !this.match('(')) {
2685                     var token = this.lookahead;
2686                     id = this.parseVariableIdentifier();
2687                     if (this.context.strict) {
2688                         if (this.scanner.isRestrictedWord(token.value)) {
2689                             this.tolerateUnexpectedToken(token, messages_1.Messages.StrictFunctionName);
2690                         }
2691                     }
2692                     else {
2693                         if (this.scanner.isRestrictedWord(token.value)) {
2694                             firstRestricted = token;
2695                             message = messages_1.Messages.StrictFunctionName;
2696                         }
2697                         else if (this.scanner.isStrictModeReservedWord(token.value)) {
2698                             firstRestricted = token;
2699                             message = messages_1.Messages.StrictReservedWord;
2700                         }
2701                     }
2702                 }
2703                 var previousAllowYield = this.context.allowYield;
2704                 this.context.allowYield = !isGenerator;
2705                 var formalParameters = this.parseFormalParameters(firstRestricted);
2706                 var params = formalParameters.params;
2707                 var stricted = formalParameters.stricted;
2708                 firstRestricted = formalParameters.firstRestricted;
2709                 if (formalParameters.message) {
2710                     message = formalParameters.message;
2711                 }
2712                 var previousStrict = this.context.strict;
2713                 var body = this.parseFunctionSourceElements();
2714                 if (this.context.strict && firstRestricted) {
2715                     this.throwUnexpectedToken(firstRestricted, message);
2716                 }
2717                 if (this.context.strict && stricted) {
2718                     this.tolerateUnexpectedToken(stricted, message);
2719                 }
2720                 this.context.strict = previousStrict;
2721                 this.context.allowYield = previousAllowYield;
2722                 return this.finalize(node, new Node.FunctionDeclaration(id, params, body, isGenerator));
2723             };
2724             Parser.prototype.parseFunctionExpression = function () {
2725                 var node = this.createNode();
2726                 this.expectKeyword('function');
2727                 var isGenerator = this.match('*');
2728                 if (isGenerator) {
2729                     this.nextToken();
2730                 }
2731                 var message;
2732                 var id = null;
2733                 var firstRestricted;
2734                 var previousAllowYield = this.context.allowYield;
2735                 this.context.allowYield = !isGenerator;
2736                 if (!this.match('(')) {
2737                     var token = this.lookahead;
2738                     id = (!this.context.strict && !isGenerator && this.matchKeyword('yield')) ? this.parseIdentifierName() : this.parseVariableIdentifier();
2739                     if (this.context.strict) {
2740                         if (this.scanner.isRestrictedWord(token.value)) {
2741                             this.tolerateUnexpectedToken(token, messages_1.Messages.StrictFunctionName);
2742                         }
2743                     }
2744                     else {
2745                         if (this.scanner.isRestrictedWord(token.value)) {
2746                             firstRestricted = token;
2747                             message = messages_1.Messages.StrictFunctionName;
2748                         }
2749                         else if (this.scanner.isStrictModeReservedWord(token.value)) {
2750                             firstRestricted = token;
2751                             message = messages_1.Messages.StrictReservedWord;
2752                         }
2753                     }
2754                 }
2755                 var formalParameters = this.parseFormalParameters(firstRestricted);
2756                 var params = formalParameters.params;
2757                 var stricted = formalParameters.stricted;
2758                 firstRestricted = formalParameters.firstRestricted;
2759                 if (formalParameters.message) {
2760                     message = formalParameters.message;
2761                 }
2762                 var previousStrict = this.context.strict;
2763                 var body = this.parseFunctionSourceElements();
2764                 if (this.context.strict && firstRestricted) {
2765                     this.throwUnexpectedToken(firstRestricted, message);
2766                 }
2767                 if (this.context.strict && stricted) {
2768                     this.tolerateUnexpectedToken(stricted, message);
2769                 }
2770                 this.context.strict = previousStrict;
2771                 this.context.allowYield = previousAllowYield;
2772                 return this.finalize(node, new Node.FunctionExpression(id, params, body, isGenerator));
2773             };
2774             // ECMA-262 14.1.1 Directive Prologues
2775             Parser.prototype.parseDirective = function () {
2776                 var token = this.lookahead;
2777                 var directive = null;
2778                 var node = this.createNode();
2779                 var expr = this.parseExpression();
2780                 if (expr.type === syntax_1.Syntax.Literal) {
2781                     directive = this.getTokenRaw(token).slice(1, -1);
2782                 }
2783                 this.consumeSemicolon();
2784                 return this.finalize(node, directive ? new Node.Directive(expr, directive) :
2785                     new Node.ExpressionStatement(expr));
2786             };
2787             Parser.prototype.parseDirectivePrologues = function () {
2788                 var firstRestricted = null;
2789                 var body = [];
2790                 while (true) {
2791                     var token = this.lookahead;
2792                     if (token.type !== token_1.Token.StringLiteral) {
2793                         break;
2794                     }
2795                     var statement = this.parseDirective();
2796                     body.push(statement);
2797                     var directive = statement.directive;
2798                     if (typeof directive !== 'string') {
2799                         break;
2800                     }
2801                     if (directive === 'use strict') {
2802                         this.context.strict = true;
2803                         if (firstRestricted) {
2804                             this.tolerateUnexpectedToken(firstRestricted, messages_1.Messages.StrictOctalLiteral);
2805                         }
2806                     }
2807                     else {
2808                         if (!firstRestricted && token.octal) {
2809                             firstRestricted = token;
2810                         }
2811                     }
2812                 }
2813                 return body;
2814             };
2815             // ECMA-262 14.3 Method Definitions
2816             Parser.prototype.qualifiedPropertyName = function (token) {
2817                 switch (token.type) {
2818                     case token_1.Token.Identifier:
2819                     case token_1.Token.StringLiteral:
2820                     case token_1.Token.BooleanLiteral:
2821                     case token_1.Token.NullLiteral:
2822                     case token_1.Token.NumericLiteral:
2823                     case token_1.Token.Keyword:
2824                         return true;
2825                     case token_1.Token.Punctuator:
2826                         return token.value === '[';
2827                 }
2828                 return false;
2829             };
2830             Parser.prototype.parseGetterMethod = function () {
2831                 var node = this.createNode();
2832                 this.expect('(');
2833                 this.expect(')');
2834                 var isGenerator = false;
2835                 var params = {
2836                     params: [],
2837                     stricted: null,
2838                     firstRestricted: null,
2839                     message: null
2840                 };
2841                 var previousAllowYield = this.context.allowYield;
2842                 this.context.allowYield = false;
2843                 var method = this.parsePropertyMethod(params);
2844                 this.context.allowYield = previousAllowYield;
2845                 return this.finalize(node, new Node.FunctionExpression(null, params.params, method, isGenerator));
2846             };
2847             Parser.prototype.parseSetterMethod = function () {
2848                 var node = this.createNode();
2849                 var options = {
2850                     params: [],
2851                     firstRestricted: null,
2852                     paramSet: {}
2853                 };
2854                 var isGenerator = false;
2855                 var previousAllowYield = this.context.allowYield;
2856                 this.context.allowYield = false;
2857                 this.expect('(');
2858                 if (this.match(')')) {
2859                     this.tolerateUnexpectedToken(this.lookahead);
2860                 }
2861                 else {
2862                     this.parseFormalParameter(options);
2863                 }
2864                 this.expect(')');
2865                 var method = this.parsePropertyMethod(options);
2866                 this.context.allowYield = previousAllowYield;
2867                 return this.finalize(node, new Node.FunctionExpression(null, options.params, method, isGenerator));
2868             };
2869             Parser.prototype.parseGeneratorMethod = function () {
2870                 var node = this.createNode();
2871                 var isGenerator = true;
2872                 var previousAllowYield = this.context.allowYield;
2873                 this.context.allowYield = true;
2874                 var params = this.parseFormalParameters();
2875                 this.context.allowYield = false;
2876                 var method = this.parsePropertyMethod(params);
2877                 this.context.allowYield = previousAllowYield;
2878                 return this.finalize(node, new Node.FunctionExpression(null, params.params, method, isGenerator));
2879             };
2880             // ECMA-262 14.4 Generator Function Definitions
2881             Parser.prototype.isStartOfExpression = function () {
2882                 var start = true;
2883                 var value = this.lookahead.value;
2884                 switch (this.lookahead.type) {
2885                     case token_1.Token.Punctuator:
2886                         start = (value === '[') || (value === '(') || (value === '{') ||
2887                             (value === '+') || (value === '-') ||
2888                             (value === '!') || (value === '~') ||
2889                             (value === '++') || (value === '--') ||
2890                             (value === '/') || (value === '/='); // regular expression literal
2891                         break;
2892                     case token_1.Token.Keyword:
2893                         start = (value === 'class') || (value === 'delete') ||
2894                             (value === 'function') || (value === 'let') || (value === 'new') ||
2895                             (value === 'super') || (value === 'this') || (value === 'typeof') ||
2896                             (value === 'void') || (value === 'yield');
2897                         break;
2898                     default:
2899                         break;
2900                 }
2901                 return start;
2902             };
2903             Parser.prototype.parseYieldExpression = function () {
2904                 var node = this.createNode();
2905                 this.expectKeyword('yield');
2906                 var argument = null;
2907                 var delegate = false;
2908                 if (!this.hasLineTerminator) {
2909                     var previousAllowYield = this.context.allowYield;
2910                     this.context.allowYield = false;
2911                     delegate = this.match('*');
2912                     if (delegate) {
2913                         this.nextToken();
2914                         argument = this.parseAssignmentExpression();
2915                     }
2916                     else if (this.isStartOfExpression()) {
2917                         argument = this.parseAssignmentExpression();
2918                     }
2919                     this.context.allowYield = previousAllowYield;
2920                 }
2921                 return this.finalize(node, new Node.YieldExpression(argument, delegate));
2922             };
2923             // ECMA-262 14.5 Class Definitions
2924             Parser.prototype.parseClassElement = function (hasConstructor) {
2925                 var token = this.lookahead;
2926                 var node = this.createNode();
2927                 var kind;
2928                 var key;
2929                 var value;
2930                 var computed = false;
2931                 var method = false;
2932                 var isStatic = false;
2933                 if (this.match('*')) {
2934                     this.nextToken();
2935                 }
2936                 else {
2937                     computed = this.match('[');
2938                     key = this.parseObjectPropertyKey();
2939                     var id = key;
2940                     if (id.name === 'static' && (this.qualifiedPropertyName(this.lookahead) || this.match('*'))) {
2941                         token = this.lookahead;
2942                         isStatic = true;
2943                         computed = this.match('[');
2944                         if (this.match('*')) {
2945                             this.nextToken();
2946                         }
2947                         else {
2948                             key = this.parseObjectPropertyKey();
2949                         }
2950                     }
2951                 }
2952                 var lookaheadPropertyKey = this.qualifiedPropertyName(this.lookahead);
2953                 if (token.type === token_1.Token.Identifier) {
2954                     if (token.value === 'get' && lookaheadPropertyKey) {
2955                         kind = 'get';
2956                         computed = this.match('[');
2957                         key = this.parseObjectPropertyKey();
2958                         this.context.allowYield = false;
2959                         value = this.parseGetterMethod();
2960                     }
2961                     else if (token.value === 'set' && lookaheadPropertyKey) {
2962                         kind = 'set';
2963                         computed = this.match('[');
2964                         key = this.parseObjectPropertyKey();
2965                         value = this.parseSetterMethod();
2966                     }
2967                 }
2968                 else if (token.type === token_1.Token.Punctuator && token.value === '*' && lookaheadPropertyKey) {
2969                     kind = 'init';
2970                     computed = this.match('[');
2971                     key = this.parseObjectPropertyKey();
2972                     value = this.parseGeneratorMethod();
2973                     method = true;
2974                 }
2975                 if (!kind && key && this.match('(')) {
2976                     kind = 'init';
2977                     value = this.parsePropertyMethodFunction();
2978                     method = true;
2979                 }
2980                 if (!kind) {
2981                     this.throwUnexpectedToken(this.lookahead);
2982                 }
2983                 if (kind === 'init') {
2984                     kind = 'method';
2985                 }
2986                 if (!computed) {
2987                     if (isStatic && this.isPropertyKey(key, 'prototype')) {
2988                         this.throwUnexpectedToken(token, messages_1.Messages.StaticPrototype);
2989                     }
2990                     if (!isStatic && this.isPropertyKey(key, 'constructor')) {
2991                         if (kind !== 'method' || !method || value.generator) {
2992                             this.throwUnexpectedToken(token, messages_1.Messages.ConstructorSpecialMethod);
2993                         }
2994                         if (hasConstructor.value) {
2995                             this.throwUnexpectedToken(token, messages_1.Messages.DuplicateConstructor);
2996                         }
2997                         else {
2998                             hasConstructor.value = true;
2999                         }
3000                         kind = 'constructor';
3001                     }
3002                 }
3003                 return this.finalize(node, new Node.MethodDefinition(key, computed, value, kind, isStatic));
3004             };
3005             Parser.prototype.parseClassElementList = function () {
3006                 var body = [];
3007                 var hasConstructor = { value: false };
3008                 this.expect('{');
3009                 while (!this.match('}')) {
3010                     if (this.match(';')) {
3011                         this.nextToken();
3012                     }
3013                     else {
3014                         body.push(this.parseClassElement(hasConstructor));
3015                     }
3016                 }
3017                 this.expect('}');
3018                 return body;
3019             };
3020             Parser.prototype.parseClassBody = function () {
3021                 var node = this.createNode();
3022                 var elementList = this.parseClassElementList();
3023                 return this.finalize(node, new Node.ClassBody(elementList));
3024             };
3025             Parser.prototype.parseClassDeclaration = function (identifierIsOptional) {
3026                 var node = this.createNode();
3027                 var previousStrict = this.context.strict;
3028                 this.context.strict = true;
3029                 this.expectKeyword('class');
3030                 var id = (identifierIsOptional && (this.lookahead.type !== token_1.Token.Identifier)) ? null : this.parseVariableIdentifier();
3031                 var superClass = null;
3032                 if (this.matchKeyword('extends')) {
3033                     this.nextToken();
3034                     superClass = this.isolateCoverGrammar(this.parseLeftHandSideExpressionAllowCall);
3035                 }
3036                 var classBody = this.parseClassBody();
3037                 this.context.strict = previousStrict;
3038                 return this.finalize(node, new Node.ClassDeclaration(id, superClass, classBody));
3039             };
3040             Parser.prototype.parseClassExpression = function () {
3041                 var node = this.createNode();
3042                 var previousStrict = this.context.strict;
3043                 this.context.strict = true;
3044                 this.expectKeyword('class');
3045                 var id = (this.lookahead.type === token_1.Token.Identifier) ? this.parseVariableIdentifier() : null;
3046                 var superClass = null;
3047                 if (this.matchKeyword('extends')) {
3048                     this.nextToken();
3049                     superClass = this.isolateCoverGrammar(this.parseLeftHandSideExpressionAllowCall);
3050                 }
3051                 var classBody = this.parseClassBody();
3052                 this.context.strict = previousStrict;
3053                 return this.finalize(node, new Node.ClassExpression(id, superClass, classBody));
3054             };
3055             // ECMA-262 15.1 Scripts
3056             // ECMA-262 15.2 Modules
3057             Parser.prototype.parseProgram = function () {
3058                 var node = this.createNode();
3059                 var body = this.parseDirectivePrologues();
3060                 while (this.startMarker.index < this.scanner.length) {
3061                     body.push(this.parseStatementListItem());
3062                 }
3063                 return this.finalize(node, new Node.Program(body, this.sourceType));
3064             };
3065             // ECMA-262 15.2.2 Imports
3066             Parser.prototype.parseModuleSpecifier = function () {
3067                 var node = this.createNode();
3068                 if (this.lookahead.type !== token_1.Token.StringLiteral) {
3069                     this.throwError(messages_1.Messages.InvalidModuleSpecifier);
3070                 }
3071                 var token = this.nextToken();
3072                 var raw = this.getTokenRaw(token);
3073                 return this.finalize(node, new Node.Literal(token.value, raw));
3074             };
3075             // import {<foo as bar>} ...;
3076             Parser.prototype.parseImportSpecifier = function () {
3077                 var node = this.createNode();
3078                 var imported;
3079                 var local;
3080                 if (this.lookahead.type === token_1.Token.Identifier) {
3081                     imported = this.parseVariableIdentifier();
3082                     local = imported;
3083                     if (this.matchContextualKeyword('as')) {
3084                         this.nextToken();
3085                         local = this.parseVariableIdentifier();
3086                     }
3087                 }
3088                 else {
3089                     imported = this.parseIdentifierName();
3090                     local = imported;
3091                     if (this.matchContextualKeyword('as')) {
3092                         this.nextToken();
3093                         local = this.parseVariableIdentifier();
3094                     }
3095                     else {
3096                         this.throwUnexpectedToken(this.nextToken());
3097                     }
3098                 }
3099                 return this.finalize(node, new Node.ImportSpecifier(local, imported));
3100             };
3101             // {foo, bar as bas}
3102             Parser.prototype.parseNamedImports = function () {
3103                 this.expect('{');
3104                 var specifiers = [];
3105                 while (!this.match('}')) {
3106                     specifiers.push(this.parseImportSpecifier());
3107                     if (!this.match('}')) {
3108                         this.expect(',');
3109                     }
3110                 }
3111                 this.expect('}');
3112                 return specifiers;
3113             };
3114             // import <foo> ...;
3115             Parser.prototype.parseImportDefaultSpecifier = function () {
3116                 var node = this.createNode();
3117                 var local = this.parseIdentifierName();
3118                 return this.finalize(node, new Node.ImportDefaultSpecifier(local));
3119             };
3120             // import <* as foo> ...;
3121             Parser.prototype.parseImportNamespaceSpecifier = function () {
3122                 var node = this.createNode();
3123                 this.expect('*');
3124                 if (!this.matchContextualKeyword('as')) {
3125                     this.throwError(messages_1.Messages.NoAsAfterImportNamespace);
3126                 }
3127                 this.nextToken();
3128                 var local = this.parseIdentifierName();
3129                 return this.finalize(node, new Node.ImportNamespaceSpecifier(local));
3130             };
3131             Parser.prototype.parseImportDeclaration = function () {
3132                 if (this.context.inFunctionBody) {
3133                     this.throwError(messages_1.Messages.IllegalImportDeclaration);
3134                 }
3135                 var node = this.createNode();
3136                 this.expectKeyword('import');
3137                 var src;
3138                 var specifiers = [];
3139                 if (this.lookahead.type === token_1.Token.StringLiteral) {
3140                     // import 'foo';
3141                     src = this.parseModuleSpecifier();
3142                 }
3143                 else {
3144                     if (this.match('{')) {
3145                         // import {bar}
3146                         specifiers = specifiers.concat(this.parseNamedImports());
3147                     }
3148                     else if (this.match('*')) {
3149                         // import * as foo
3150                         specifiers.push(this.parseImportNamespaceSpecifier());
3151                     }
3152                     else if (this.isIdentifierName(this.lookahead) && !this.matchKeyword('default')) {
3153                         // import foo
3154                         specifiers.push(this.parseImportDefaultSpecifier());
3155                         if (this.match(',')) {
3156                             this.nextToken();
3157                             if (this.match('*')) {
3158                                 // import foo, * as foo
3159                                 specifiers.push(this.parseImportNamespaceSpecifier());
3160                             }
3161                             else if (this.match('{')) {
3162                                 // import foo, {bar}
3163                                 specifiers = specifiers.concat(this.parseNamedImports());
3164                             }
3165                             else {
3166                                 this.throwUnexpectedToken(this.lookahead);
3167                             }
3168                         }
3169                     }
3170                     else {
3171                         this.throwUnexpectedToken(this.nextToken());
3172                     }
3173                     if (!this.matchContextualKeyword('from')) {
3174                         var message = this.lookahead.value ? messages_1.Messages.UnexpectedToken : messages_1.Messages.MissingFromClause;
3175                         this.throwError(message, this.lookahead.value);
3176                     }
3177                     this.nextToken();
3178                     src = this.parseModuleSpecifier();
3179                 }
3180                 this.consumeSemicolon();
3181                 return this.finalize(node, new Node.ImportDeclaration(specifiers, src));
3182             };
3183             // ECMA-262 15.2.3 Exports
3184             Parser.prototype.parseExportSpecifier = function () {
3185                 var node = this.createNode();
3186                 var local = this.parseIdentifierName();
3187                 var exported = local;
3188                 if (this.matchContextualKeyword('as')) {
3189                     this.nextToken();
3190                     exported = this.parseIdentifierName();
3191                 }
3192                 return this.finalize(node, new Node.ExportSpecifier(local, exported));
3193             };
3194             Parser.prototype.parseExportDeclaration = function () {
3195                 if (this.context.inFunctionBody) {
3196                     this.throwError(messages_1.Messages.IllegalExportDeclaration);
3197                 }
3198                 var node = this.createNode();
3199                 this.expectKeyword('export');
3200                 var exportDeclaration;
3201                 if (this.matchKeyword('default')) {
3202                     // export default ...
3203                     this.nextToken();
3204                     if (this.matchKeyword('function')) {
3205                         // export default function foo () {}
3206                         // export default function () {}
3207                         var declaration = this.parseFunctionDeclaration(true);
3208                         exportDeclaration = this.finalize(node, new Node.ExportDefaultDeclaration(declaration));
3209                     }
3210                     else if (this.matchKeyword('class')) {
3211                         // export default class foo {}
3212                         var declaration = this.parseClassDeclaration(true);
3213                         exportDeclaration = this.finalize(node, new Node.ExportDefaultDeclaration(declaration));
3214                     }
3215                     else {
3216                         if (this.matchContextualKeyword('from')) {
3217                             this.throwError(messages_1.Messages.UnexpectedToken, this.lookahead.value);
3218                         }
3219                         // export default {};
3220                         // export default [];
3221                         // export default (1 + 2);
3222                         var declaration = this.match('{') ? this.parseObjectInitializer() :
3223                             this.match('[') ? this.parseArrayInitializer() : this.parseAssignmentExpression();
3224                         this.consumeSemicolon();
3225                         exportDeclaration = this.finalize(node, new Node.ExportDefaultDeclaration(declaration));
3226                     }
3227                 }
3228                 else if (this.match('*')) {
3229                     // export * from 'foo';
3230                     this.nextToken();
3231                     if (!this.matchContextualKeyword('from')) {
3232                         var message = this.lookahead.value ? messages_1.Messages.UnexpectedToken : messages_1.Messages.MissingFromClause;
3233                         this.throwError(message, this.lookahead.value);
3234                     }
3235                     this.nextToken();
3236                     var src = this.parseModuleSpecifier();
3237                     this.consumeSemicolon();
3238                     exportDeclaration = this.finalize(node, new Node.ExportAllDeclaration(src));
3239                 }
3240                 else if (this.lookahead.type === token_1.Token.Keyword) {
3241                     // export var f = 1;
3242                     var declaration = void 0;
3243                     switch (this.lookahead.value) {
3244                         case 'let':
3245                         case 'const':
3246                             declaration = this.parseLexicalDeclaration({ inFor: false });
3247                             break;
3248                         case 'var':
3249                         case 'class':
3250                         case 'function':
3251                             declaration = this.parseStatementListItem();
3252                             break;
3253                         default:
3254                             this.throwUnexpectedToken(this.lookahead);
3255                     }
3256                     exportDeclaration = this.finalize(node, new Node.ExportNamedDeclaration(declaration, [], null));
3257                 }
3258                 else {
3259                     var specifiers = [];
3260                     var source = null;
3261                     var isExportFromIdentifier = false;
3262                     this.expect('{');
3263                     while (!this.match('}')) {
3264                         isExportFromIdentifier = isExportFromIdentifier || this.matchKeyword('default');
3265                         specifiers.push(this.parseExportSpecifier());
3266                         if (!this.match('}')) {
3267                             this.expect(',');
3268                         }
3269                     }
3270                     this.expect('}');
3271                     if (this.matchContextualKeyword('from')) {
3272                         // export {default} from 'foo';
3273                         // export {foo} from 'foo';
3274                         this.nextToken();
3275                         source = this.parseModuleSpecifier();
3276                         this.consumeSemicolon();
3277                     }
3278                     else if (isExportFromIdentifier) {
3279                         // export {default}; // missing fromClause
3280                         var message = this.lookahead.value ? messages_1.Messages.UnexpectedToken : messages_1.Messages.MissingFromClause;
3281                         this.throwError(message, this.lookahead.value);
3282                     }
3283                     else {
3284                         // export {foo};
3285                         this.consumeSemicolon();
3286                     }
3287                     exportDeclaration = this.finalize(node, new Node.ExportNamedDeclaration(null, specifiers, source));
3288                 }
3289                 return exportDeclaration;
3290             };
3291             return Parser;
3292         }());
3293         exports.Parser = Parser;
3294
3295
3296 /***/ },
3297 /* 4 */
3298 /***/ function(module, exports) {
3299
3300         // Ensure the condition is true, otherwise throw an error.
3301         // This is only to have a better contract semantic, i.e. another safety net
3302         // to catch a logic error. The condition shall be fulfilled in normal case.
3303         // Do NOT use this to enforce a certain condition on any user input.
3304         "use strict";
3305         function assert(condition, message) {
3306             /* istanbul ignore if */
3307             if (!condition) {
3308                 throw new Error('ASSERT: ' + message);
3309             }
3310         }
3311         exports.assert = assert;
3312
3313
3314 /***/ },
3315 /* 5 */
3316 /***/ function(module, exports) {
3317
3318         "use strict";
3319         // Error messages should be identical to V8.
3320         exports.Messages = {
3321             UnexpectedToken: 'Unexpected token %0',
3322             UnexpectedTokenIllegal: 'Unexpected token ILLEGAL',
3323             UnexpectedNumber: 'Unexpected number',
3324             UnexpectedString: 'Unexpected string',
3325             UnexpectedIdentifier: 'Unexpected identifier',
3326             UnexpectedReserved: 'Unexpected reserved word',
3327             UnexpectedTemplate: 'Unexpected quasi %0',
3328             UnexpectedEOS: 'Unexpected end of input',
3329             NewlineAfterThrow: 'Illegal newline after throw',
3330             InvalidRegExp: 'Invalid regular expression',
3331             UnterminatedRegExp: 'Invalid regular expression: missing /',
3332             InvalidLHSInAssignment: 'Invalid left-hand side in assignment',
3333             InvalidLHSInForIn: 'Invalid left-hand side in for-in',
3334             InvalidLHSInForLoop: 'Invalid left-hand side in for-loop',
3335             MultipleDefaultsInSwitch: 'More than one default clause in switch statement',
3336             NoCatchOrFinally: 'Missing catch or finally after try',
3337             UnknownLabel: 'Undefined label \'%0\'',
3338             Redeclaration: '%0 \'%1\' has already been declared',
3339             IllegalContinue: 'Illegal continue statement',
3340             IllegalBreak: 'Illegal break statement',
3341             IllegalReturn: 'Illegal return statement',
3342             StrictModeWith: 'Strict mode code may not include a with statement',
3343             StrictCatchVariable: 'Catch variable may not be eval or arguments in strict mode',
3344             StrictVarName: 'Variable name may not be eval or arguments in strict mode',
3345             StrictParamName: 'Parameter name eval or arguments is not allowed in strict mode',
3346             StrictParamDupe: 'Strict mode function may not have duplicate parameter names',
3347             StrictFunctionName: 'Function name may not be eval or arguments in strict mode',
3348             StrictOctalLiteral: 'Octal literals are not allowed in strict mode.',
3349             StrictDelete: 'Delete of an unqualified identifier in strict mode.',
3350             StrictLHSAssignment: 'Assignment to eval or arguments is not allowed in strict mode',
3351             StrictLHSPostfix: 'Postfix increment/decrement may not have eval or arguments operand in strict mode',
3352             StrictLHSPrefix: 'Prefix increment/decrement may not have eval or arguments operand in strict mode',
3353             StrictReservedWord: 'Use of future reserved word in strict mode',
3354             TemplateOctalLiteral: 'Octal literals are not allowed in template strings.',
3355             ParameterAfterRestParameter: 'Rest parameter must be last formal parameter',
3356             DefaultRestParameter: 'Unexpected token =',
3357             DuplicateProtoProperty: 'Duplicate __proto__ fields are not allowed in object literals',
3358             ConstructorSpecialMethod: 'Class constructor may not be an accessor',
3359             DuplicateConstructor: 'A class may only have one constructor',
3360             StaticPrototype: 'Classes may not have static property named prototype',
3361             MissingFromClause: 'Unexpected token',
3362             NoAsAfterImportNamespace: 'Unexpected token',
3363             InvalidModuleSpecifier: 'Unexpected token',
3364             IllegalImportDeclaration: 'Unexpected token',
3365             IllegalExportDeclaration: 'Unexpected token',
3366             DuplicateBinding: 'Duplicate binding %0',
3367             ForInOfLoopInitializer: '%0 loop variable declaration may not have an initializer'
3368         };
3369
3370
3371 /***/ },
3372 /* 6 */
3373 /***/ function(module, exports) {
3374
3375         "use strict";
3376         var ErrorHandler = (function () {
3377             function ErrorHandler() {
3378                 this.errors = [];
3379                 this.tolerant = false;
3380             }
3381             ;
3382             ErrorHandler.prototype.recordError = function (error) {
3383                 this.errors.push(error);
3384             };
3385             ;
3386             ErrorHandler.prototype.tolerate = function (error) {
3387                 if (this.tolerant) {
3388                     this.recordError(error);
3389                 }
3390                 else {
3391                     throw error;
3392                 }
3393             };
3394             ;
3395             ErrorHandler.prototype.constructError = function (msg, column) {
3396                 var error = new Error(msg);
3397                 try {
3398                     throw error;
3399                 }
3400                 catch (base) {
3401                     /* istanbul ignore else */
3402                     if (Object.create && Object.defineProperty) {
3403                         error = Object.create(base);
3404                         Object.defineProperty(error, 'column', { value: column });
3405                     }
3406                 }
3407                 finally {
3408                     return error;
3409                 }
3410             };
3411             ;
3412             ErrorHandler.prototype.createError = function (index, line, col, description) {
3413                 var msg = 'Line ' + line + ': ' + description;
3414                 var error = this.constructError(msg, col);
3415                 error.index = index;
3416                 error.lineNumber = line;
3417                 error.description = description;
3418                 return error;
3419             };
3420             ;
3421             ErrorHandler.prototype.throwError = function (index, line, col, description) {
3422                 throw this.createError(index, line, col, description);
3423             };
3424             ;
3425             ErrorHandler.prototype.tolerateError = function (index, line, col, description) {
3426                 var error = this.createError(index, line, col, description);
3427                 if (this.tolerant) {
3428                     this.recordError(error);
3429                 }
3430                 else {
3431                     throw error;
3432                 }
3433             };
3434             ;
3435             return ErrorHandler;
3436         }());
3437         exports.ErrorHandler = ErrorHandler;
3438
3439
3440 /***/ },
3441 /* 7 */
3442 /***/ function(module, exports) {
3443
3444         "use strict";
3445         (function (Token) {
3446             Token[Token["BooleanLiteral"] = 1] = "BooleanLiteral";
3447             Token[Token["EOF"] = 2] = "EOF";
3448             Token[Token["Identifier"] = 3] = "Identifier";
3449             Token[Token["Keyword"] = 4] = "Keyword";
3450             Token[Token["NullLiteral"] = 5] = "NullLiteral";
3451             Token[Token["NumericLiteral"] = 6] = "NumericLiteral";
3452             Token[Token["Punctuator"] = 7] = "Punctuator";
3453             Token[Token["StringLiteral"] = 8] = "StringLiteral";
3454             Token[Token["RegularExpression"] = 9] = "RegularExpression";
3455             Token[Token["Template"] = 10] = "Template";
3456         })(exports.Token || (exports.Token = {}));
3457         var Token = exports.Token;
3458         ;
3459         exports.TokenName = {};
3460         exports.TokenName[Token.BooleanLiteral] = 'Boolean';
3461         exports.TokenName[Token.EOF] = '<end>';
3462         exports.TokenName[Token.Identifier] = 'Identifier';
3463         exports.TokenName[Token.Keyword] = 'Keyword';
3464         exports.TokenName[Token.NullLiteral] = 'Null';
3465         exports.TokenName[Token.NumericLiteral] = 'Numeric';
3466         exports.TokenName[Token.Punctuator] = 'Punctuator';
3467         exports.TokenName[Token.StringLiteral] = 'String';
3468         exports.TokenName[Token.RegularExpression] = 'RegularExpression';
3469         exports.TokenName[Token.Template] = 'Template';
3470
3471
3472 /***/ },
3473 /* 8 */
3474 /***/ function(module, exports, __webpack_require__) {
3475
3476         "use strict";
3477         var assert_1 = __webpack_require__(4);
3478         var messages_1 = __webpack_require__(5);
3479         var character_1 = __webpack_require__(9);
3480         var token_1 = __webpack_require__(7);
3481         function hexValue(ch) {
3482             return '0123456789abcdef'.indexOf(ch.toLowerCase());
3483         }
3484         function octalValue(ch) {
3485             return '01234567'.indexOf(ch);
3486         }
3487         var Scanner = (function () {
3488             function Scanner(code, handler) {
3489                 this.source = code;
3490                 this.errorHandler = handler;
3491                 this.trackComment = false;
3492                 this.length = code.length;
3493                 this.index = 0;
3494                 this.lineNumber = (code.length > 0) ? 1 : 0;
3495                 this.lineStart = 0;
3496                 this.curlyStack = [];
3497             }
3498             ;
3499             Scanner.prototype.eof = function () {
3500                 return this.index >= this.length;
3501             };
3502             ;
3503             Scanner.prototype.throwUnexpectedToken = function (message) {
3504                 if (message === void 0) { message = messages_1.Messages.UnexpectedTokenIllegal; }
3505                 this.errorHandler.throwError(this.index, this.lineNumber, this.index - this.lineStart + 1, message);
3506             };
3507             ;
3508             Scanner.prototype.tolerateUnexpectedToken = function () {
3509                 this.errorHandler.tolerateError(this.index, this.lineNumber, this.index - this.lineStart + 1, messages_1.Messages.UnexpectedTokenIllegal);
3510             };
3511             ;
3512             // ECMA-262 11.4 Comments
3513             Scanner.prototype.skipSingleLineComment = function (offset) {
3514                 var comments;
3515                 var start, loc;
3516                 if (this.trackComment) {
3517                     comments = [];
3518                     start = this.index - offset;
3519                     loc = {
3520                         start: {
3521                             line: this.lineNumber,
3522                             column: this.index - this.lineStart - offset
3523                         },
3524                         end: {}
3525                     };
3526                 }
3527                 while (!this.eof()) {
3528                     var ch = this.source.charCodeAt(this.index);
3529                     ++this.index;
3530                     if (character_1.Character.isLineTerminator(ch)) {
3531                         if (this.trackComment) {
3532                             loc.end = {
3533                                 line: this.lineNumber,
3534                                 column: this.index - this.lineStart - 1
3535                             };
3536                             var entry = {
3537                                 multiLine: false,
3538                                 slice: [start + offset, this.index - 1],
3539                                 range: [start, this.index - 1],
3540                                 loc: loc
3541                             };
3542                             comments.push(entry);
3543                         }
3544                         if (ch === 13 && this.source.charCodeAt(this.index) === 10) {
3545                             ++this.index;
3546                         }
3547                         ++this.lineNumber;
3548                         this.lineStart = this.index;
3549                         return comments;
3550                     }
3551                 }
3552                 if (this.trackComment) {
3553                     loc.end = {
3554                         line: this.lineNumber,
3555                         column: this.index - this.lineStart
3556                     };
3557                     var entry = {
3558                         multiLine: false,
3559                         slice: [start + offset, this.index],
3560                         range: [start, this.index],
3561                         loc: loc
3562                     };
3563                     comments.push(entry);
3564                 }
3565                 return comments;
3566             };
3567             ;
3568             Scanner.prototype.skipMultiLineComment = function () {
3569                 var comments;
3570                 var start, loc;
3571                 if (this.trackComment) {
3572                     comments = [];
3573                     start = this.index - 2;
3574                     loc = {
3575                         start: {
3576                             line: this.lineNumber,
3577                             column: this.index - this.lineStart - 2
3578                         },
3579                         end: {}
3580                     };
3581                 }
3582                 while (!this.eof()) {
3583                     var ch = this.source.charCodeAt(this.index);
3584                     if (character_1.Character.isLineTerminator(ch)) {
3585                         if (ch === 0x0D && this.source.charCodeAt(this.index + 1) === 0x0A) {
3586                             ++this.index;
3587                         }
3588                         ++this.lineNumber;
3589                         ++this.index;
3590                         this.lineStart = this.index;
3591                     }
3592                     else if (ch === 0x2A) {
3593                         // Block comment ends with '*/'.
3594                         if (this.source.charCodeAt(this.index + 1) === 0x2F) {
3595                             this.index += 2;
3596                             if (this.trackComment) {
3597                                 loc.end = {
3598                                     line: this.lineNumber,
3599                                     column: this.index - this.lineStart
3600                                 };
3601                                 var entry = {
3602                                     multiLine: true,
3603                                     slice: [start + 2, this.index - 2],
3604                                     range: [start, this.index],
3605                                     loc: loc
3606                                 };
3607                                 comments.push(entry);
3608                             }
3609                             return comments;
3610                         }
3611                         ++this.index;
3612                     }
3613                     else {
3614                         ++this.index;
3615                     }
3616                 }
3617                 // Ran off the end of the file - the whole thing is a comment
3618                 if (this.trackComment) {
3619                     loc.end = {
3620                         line: this.lineNumber,
3621                         column: this.index - this.lineStart
3622                     };
3623                     var entry = {
3624                         multiLine: true,
3625                         slice: [start + 2, this.index],
3626                         range: [start, this.index],
3627                         loc: loc
3628                     };
3629                     comments.push(entry);
3630                 }
3631                 this.tolerateUnexpectedToken();
3632                 return comments;
3633             };
3634             ;
3635             Scanner.prototype.scanComments = function () {
3636                 var comments;
3637                 if (this.trackComment) {
3638                     comments = [];
3639                 }
3640                 var start = (this.index === 0);
3641                 while (!this.eof()) {
3642                     var ch = this.source.charCodeAt(this.index);
3643                     if (character_1.Character.isWhiteSpace(ch)) {
3644                         ++this.index;
3645                     }
3646                     else if (character_1.Character.isLineTerminator(ch)) {
3647                         ++this.index;
3648                         if (ch === 0x0D && this.source.charCodeAt(this.index) === 0x0A) {
3649                             ++this.index;
3650                         }
3651                         ++this.lineNumber;
3652                         this.lineStart = this.index;
3653                         start = true;
3654                     }
3655                     else if (ch === 0x2F) {
3656                         ch = this.source.charCodeAt(this.index + 1);
3657                         if (ch === 0x2F) {
3658                             this.index += 2;
3659                             var comment = this.skipSingleLineComment(2);
3660                             if (this.trackComment) {
3661                                 comments = comments.concat(comment);
3662                             }
3663                             start = true;
3664                         }
3665                         else if (ch === 0x2A) {
3666                             this.index += 2;
3667                             var comment = this.skipMultiLineComment();
3668                             if (this.trackComment) {
3669                                 comments = comments.concat(comment);
3670                             }
3671                         }
3672                         else {
3673                             break;
3674                         }
3675                     }
3676                     else if (start && ch === 0x2D) {
3677                         // U+003E is '>'
3678                         if ((this.source.charCodeAt(this.index + 1) === 0x2D) && (this.source.charCodeAt(this.index + 2) === 0x3E)) {
3679                             // '-->' is a single-line comment
3680                             this.index += 3;
3681                             var comment = this.skipSingleLineComment(3);
3682                             if (this.trackComment) {
3683                                 comments = comments.concat(comment);
3684                             }
3685                         }
3686                         else {
3687                             break;
3688                         }
3689                     }
3690                     else if (ch === 0x3C) {
3691                         if (this.source.slice(this.index + 1, this.index + 4) === '!--') {
3692                             this.index += 4; // `<!--`
3693                             var comment = this.skipSingleLineComment(4);
3694                             if (this.trackComment) {
3695                                 comments = comments.concat(comment);
3696                             }
3697                         }
3698                         else {
3699                             break;
3700                         }
3701                     }
3702                     else {
3703                         break;
3704                     }
3705                 }
3706                 return comments;
3707             };
3708             ;
3709             // ECMA-262 11.6.2.2 Future Reserved Words
3710             Scanner.prototype.isFutureReservedWord = function (id) {
3711                 switch (id) {
3712                     case 'enum':
3713                     case 'export':
3714                     case 'import':
3715                     case 'super':
3716                         return true;
3717                     default:
3718                         return false;
3719                 }
3720             };
3721             ;
3722             Scanner.prototype.isStrictModeReservedWord = function (id) {
3723                 switch (id) {
3724                     case 'implements':
3725                     case 'interface':
3726                     case 'package':
3727                     case 'private':
3728                     case 'protected':
3729                     case 'public':
3730                     case 'static':
3731                     case 'yield':
3732                     case 'let':
3733                         return true;
3734                     default:
3735                         return false;
3736                 }
3737             };
3738             ;
3739             Scanner.prototype.isRestrictedWord = function (id) {
3740                 return id === 'eval' || id === 'arguments';
3741             };
3742             ;
3743             // ECMA-262 11.6.2.1 Keywords
3744             Scanner.prototype.isKeyword = function (id) {
3745                 switch (id.length) {
3746                     case 2:
3747                         return (id === 'if') || (id === 'in') || (id === 'do');
3748                     case 3:
3749                         return (id === 'var') || (id === 'for') || (id === 'new') ||
3750                             (id === 'try') || (id === 'let');
3751                     case 4:
3752                         return (id === 'this') || (id === 'else') || (id === 'case') ||
3753                             (id === 'void') || (id === 'with') || (id === 'enum');
3754                     case 5:
3755                         return (id === 'while') || (id === 'break') || (id === 'catch') ||
3756                             (id === 'throw') || (id === 'const') || (id === 'yield') ||
3757                             (id === 'class') || (id === 'super');
3758                     case 6:
3759                         return (id === 'return') || (id === 'typeof') || (id === 'delete') ||
3760                             (id === 'switch') || (id === 'export') || (id === 'import');
3761                     case 7:
3762                         return (id === 'default') || (id === 'finally') || (id === 'extends');
3763                     case 8:
3764                         return (id === 'function') || (id === 'continue') || (id === 'debugger');
3765                     case 10:
3766                         return (id === 'instanceof');
3767                     default:
3768                         return false;
3769                 }
3770             };
3771             ;
3772             Scanner.prototype.codePointAt = function (i) {
3773                 var cp = this.source.charCodeAt(i);
3774                 if (cp >= 0xD800 && cp <= 0xDBFF) {
3775                     var second = this.source.charCodeAt(i + 1);
3776                     if (second >= 0xDC00 && second <= 0xDFFF) {
3777                         var first = cp;
3778                         cp = (first - 0xD800) * 0x400 + second - 0xDC00 + 0x10000;
3779                     }
3780                 }
3781                 return cp;
3782             };
3783             ;
3784             Scanner.prototype.scanHexEscape = function (prefix) {
3785                 var len = (prefix === 'u') ? 4 : 2;
3786                 var code = 0;
3787                 for (var i = 0; i < len; ++i) {
3788                     if (!this.eof() && character_1.Character.isHexDigit(this.source.charCodeAt(this.index))) {
3789                         code = code * 16 + hexValue(this.source[this.index++]);
3790                     }
3791                     else {
3792                         return '';
3793                     }
3794                 }
3795                 return String.fromCharCode(code);
3796             };
3797             ;
3798             Scanner.prototype.scanUnicodeCodePointEscape = function () {
3799                 var ch = this.source[this.index];
3800                 var code = 0;
3801                 // At least, one hex digit is required.
3802                 if (ch === '}') {
3803                     this.throwUnexpectedToken();
3804                 }
3805                 while (!this.eof()) {
3806                     ch = this.source[this.index++];
3807                     if (!character_1.Character.isHexDigit(ch.charCodeAt(0))) {
3808                         break;
3809                     }
3810                     code = code * 16 + hexValue(ch);
3811                 }
3812                 if (code > 0x10FFFF || ch !== '}') {
3813                     this.throwUnexpectedToken();
3814                 }
3815                 return character_1.Character.fromCodePoint(code);
3816             };
3817             ;
3818             Scanner.prototype.getIdentifier = function () {
3819                 var start = this.index++;
3820                 while (!this.eof()) {
3821                     var ch = this.source.charCodeAt(this.index);
3822                     if (ch === 0x5C) {
3823                         // Blackslash (U+005C) marks Unicode escape sequence.
3824                         this.index = start;
3825                         return this.getComplexIdentifier();
3826                     }
3827                     else if (ch >= 0xD800 && ch < 0xDFFF) {
3828                         // Need to handle surrogate pairs.
3829                         this.index = start;
3830                         return this.getComplexIdentifier();
3831                     }
3832                     if (character_1.Character.isIdentifierPart(ch)) {
3833                         ++this.index;
3834                     }
3835                     else {
3836                         break;
3837                     }
3838                 }
3839                 return this.source.slice(start, this.index);
3840             };
3841             ;
3842             Scanner.prototype.getComplexIdentifier = function () {
3843                 var cp = this.codePointAt(this.index);
3844                 var id = character_1.Character.fromCodePoint(cp);
3845                 this.index += id.length;
3846                 // '\u' (U+005C, U+0075) denotes an escaped character.
3847                 var ch;
3848                 if (cp === 0x5C) {
3849                     if (this.source.charCodeAt(this.index) !== 0x75) {
3850                         this.throwUnexpectedToken();
3851                     }
3852                     ++this.index;
3853                     if (this.source[this.index] === '{') {
3854                         ++this.index;
3855                         ch = this.scanUnicodeCodePointEscape();
3856                     }
3857                     else {
3858                         ch = this.scanHexEscape('u');
3859                         cp = ch.charCodeAt(0);
3860                         if (!ch || ch === '\\' || !character_1.Character.isIdentifierStart(cp)) {
3861                             this.throwUnexpectedToken();
3862                         }
3863                     }
3864                     id = ch;
3865                 }
3866                 while (!this.eof()) {
3867                     cp = this.codePointAt(this.index);
3868                     if (!character_1.Character.isIdentifierPart(cp)) {
3869                         break;
3870                     }
3871                     ch = character_1.Character.fromCodePoint(cp);
3872                     id += ch;
3873                     this.index += ch.length;
3874                     // '\u' (U+005C, U+0075) denotes an escaped character.
3875                     if (cp === 0x5C) {
3876                         id = id.substr(0, id.length - 1);
3877                         if (this.source.charCodeAt(this.index) !== 0x75) {
3878                             this.throwUnexpectedToken();
3879                         }
3880                         ++this.index;
3881                         if (this.source[this.index] === '{') {
3882                             ++this.index;
3883                             ch = this.scanUnicodeCodePointEscape();
3884                         }
3885                         else {
3886                             ch = this.scanHexEscape('u');
3887                             cp = ch.charCodeAt(0);
3888                             if (!ch || ch === '\\' || !character_1.Character.isIdentifierPart(cp)) {
3889                                 this.throwUnexpectedToken();
3890                             }
3891                         }
3892                         id += ch;
3893                     }
3894                 }
3895                 return id;
3896             };
3897             ;
3898             Scanner.prototype.octalToDecimal = function (ch) {
3899                 // \0 is not octal escape sequence
3900                 var octal = (ch !== '0');
3901                 var code = octalValue(ch);
3902                 if (!this.eof() && character_1.Character.isOctalDigit(this.source.charCodeAt(this.index))) {
3903                     octal = true;
3904                     code = code * 8 + octalValue(this.source[this.index++]);
3905                     // 3 digits are only allowed when string starts
3906                     // with 0, 1, 2, 3
3907                     if ('0123'.indexOf(ch) >= 0 && !this.eof() && character_1.Character.isOctalDigit(this.source.charCodeAt(this.index))) {
3908                         code = code * 8 + octalValue(this.source[this.index++]);
3909                     }
3910                 }
3911                 return {
3912                     code: code,
3913                     octal: octal
3914                 };
3915             };
3916             ;
3917             // ECMA-262 11.6 Names and Keywords
3918             Scanner.prototype.scanIdentifier = function () {
3919                 var type;
3920                 var start = this.index;
3921                 // Backslash (U+005C) starts an escaped character.
3922                 var id = (this.source.charCodeAt(start) === 0x5C) ? this.getComplexIdentifier() : this.getIdentifier();
3923                 // There is no keyword or literal with only one character.
3924                 // Thus, it must be an identifier.
3925                 if (id.length === 1) {
3926                     type = token_1.Token.Identifier;
3927                 }
3928                 else if (this.isKeyword(id)) {
3929                     type = token_1.Token.Keyword;
3930                 }
3931                 else if (id === 'null') {
3932                     type = token_1.Token.NullLiteral;
3933                 }
3934                 else if (id === 'true' || id === 'false') {
3935                     type = token_1.Token.BooleanLiteral;
3936                 }
3937                 else {
3938                     type = token_1.Token.Identifier;
3939                 }
3940                 return {
3941                     type: type,
3942                     value: id,
3943                     lineNumber: this.lineNumber,
3944                     lineStart: this.lineStart,
3945                     start: start,
3946                     end: this.index
3947                 };
3948             };
3949             ;
3950             // ECMA-262 11.7 Punctuators
3951             Scanner.prototype.scanPunctuator = function () {
3952                 var token = {
3953                     type: token_1.Token.Punctuator,
3954                     value: '',
3955                     lineNumber: this.lineNumber,
3956                     lineStart: this.lineStart,
3957                     start: this.index,
3958                     end: this.index
3959                 };
3960                 // Check for most common single-character punctuators.
3961                 var str = this.source[this.index];
3962                 switch (str) {
3963                     case '(':
3964                     case '{':
3965                         if (str === '{') {
3966                             this.curlyStack.push('{');
3967                         }
3968                         ++this.index;
3969                         break;
3970                     case '.':
3971                         ++this.index;
3972                         if (this.source[this.index] === '.' && this.source[this.index + 1] === '.') {
3973                             // Spread operator: ...
3974                             this.index += 2;
3975                             str = '...';
3976                         }
3977                         break;
3978                     case '}':
3979                         ++this.index;
3980                         this.curlyStack.pop();
3981                         break;
3982                     case ')':
3983                     case ';':
3984                     case ',':
3985                     case '[':
3986                     case ']':
3987                     case ':':
3988                     case '?':
3989                     case '~':
3990                         ++this.index;
3991                         break;
3992                     default:
3993                         // 4-character punctuator.
3994                         str = this.source.substr(this.index, 4);
3995                         if (str === '>>>=') {
3996                             this.index += 4;
3997                         }
3998                         else {
3999                             // 3-character punctuators.
4000                             str = str.substr(0, 3);
4001                             if (str === '===' || str === '!==' || str === '>>>' ||
4002                                 str === '<<=' || str === '>>=' || str === '**=') {
4003                                 this.index += 3;
4004                             }
4005                             else {
4006                                 // 2-character punctuators.
4007                                 str = str.substr(0, 2);
4008                                 if (str === '&&' || str === '||' || str === '==' || str === '!=' ||
4009                                     str === '+=' || str === '-=' || str === '*=' || str === '/=' ||
4010                                     str === '++' || str === '--' || str === '<<' || str === '>>' ||
4011                                     str === '&=' || str === '|=' || str === '^=' || str === '%=' ||
4012                                     str === '<=' || str === '>=' || str === '=>' || str === '**') {
4013                                     this.index += 2;
4014                                 }
4015                                 else {
4016                                     // 1-character punctuators.
4017                                     str = this.source[this.index];
4018                                     if ('<>=!+-*%&|^/'.indexOf(str) >= 0) {
4019                                         ++this.index;
4020                                     }
4021                                 }
4022                             }
4023                         }
4024                 }
4025                 if (this.index === token.start) {
4026                     this.throwUnexpectedToken();
4027                 }
4028                 token.end = this.index;
4029                 token.value = str;
4030                 return token;
4031             };
4032             ;
4033             // ECMA-262 11.8.3 Numeric Literals
4034             Scanner.prototype.scanHexLiteral = function (start) {
4035                 var number = '';
4036                 while (!this.eof()) {
4037                     if (!character_1.Character.isHexDigit(this.source.charCodeAt(this.index))) {
4038                         break;
4039                     }
4040                     number += this.source[this.index++];
4041                 }
4042                 if (number.length === 0) {
4043                     this.throwUnexpectedToken();
4044                 }
4045                 if (character_1.Character.isIdentifierStart(this.source.charCodeAt(this.index))) {
4046                     this.throwUnexpectedToken();
4047                 }
4048                 return {
4049                     type: token_1.Token.NumericLiteral,
4050                     value: parseInt('0x' + number, 16),
4051                     lineNumber: this.lineNumber,
4052                     lineStart: this.lineStart,
4053                     start: start,
4054                     end: this.index
4055                 };
4056             };
4057             ;
4058             Scanner.prototype.scanBinaryLiteral = function (start) {
4059                 var number = '';
4060                 var ch;
4061                 while (!this.eof()) {
4062                     ch = this.source[this.index];
4063                     if (ch !== '0' && ch !== '1') {
4064                         break;
4065                     }
4066                     number += this.source[this.index++];
4067                 }
4068                 if (number.length === 0) {
4069                     // only 0b or 0B
4070                     this.throwUnexpectedToken();
4071                 }
4072                 if (!this.eof()) {
4073                     ch = this.source.charCodeAt(this.index);
4074                     /* istanbul ignore else */
4075                     if (character_1.Character.isIdentifierStart(ch) || character_1.Character.isDecimalDigit(ch)) {
4076                         this.throwUnexpectedToken();
4077                     }
4078                 }
4079                 return {
4080                     type: token_1.Token.NumericLiteral,
4081                     value: parseInt(number, 2),
4082                     lineNumber: this.lineNumber,
4083                     lineStart: this.lineStart,
4084                     start: start,
4085                     end: this.index
4086                 };
4087             };
4088             ;
4089             Scanner.prototype.scanOctalLiteral = function (prefix, start) {
4090                 var number = '';
4091                 var octal = false;
4092                 if (character_1.Character.isOctalDigit(prefix.charCodeAt(0))) {
4093                     octal = true;
4094                     number = '0' + this.source[this.index++];
4095                 }
4096                 else {
4097                     ++this.index;
4098                 }
4099                 while (!this.eof()) {
4100                     if (!character_1.Character.isOctalDigit(this.source.charCodeAt(this.index))) {
4101                         break;
4102                     }
4103                     number += this.source[this.index++];
4104                 }
4105                 if (!octal && number.length === 0) {
4106                     // only 0o or 0O
4107                     this.throwUnexpectedToken();
4108                 }
4109                 if (character_1.Character.isIdentifierStart(this.source.charCodeAt(this.index)) || character_1.Character.isDecimalDigit(this.source.charCodeAt(this.index))) {
4110                     this.throwUnexpectedToken();
4111                 }
4112                 return {
4113                     type: token_1.Token.NumericLiteral,
4114                     value: parseInt(number, 8),
4115                     octal: octal,
4116                     lineNumber: this.lineNumber,
4117                     lineStart: this.lineStart,
4118                     start: start,
4119                     end: this.index
4120                 };
4121             };
4122             ;
4123             Scanner.prototype.isImplicitOctalLiteral = function () {
4124                 // Implicit octal, unless there is a non-octal digit.
4125                 // (Annex B.1.1 on Numeric Literals)
4126                 for (var i = this.index + 1; i < this.length; ++i) {
4127                     var ch = this.source[i];
4128                     if (ch === '8' || ch === '9') {
4129                         return false;
4130                     }
4131                     if (!character_1.Character.isOctalDigit(ch.charCodeAt(0))) {
4132                         return true;
4133                     }
4134                 }
4135                 return true;
4136             };
4137             ;
4138             Scanner.prototype.scanNumericLiteral = function () {
4139                 var start = this.index;
4140                 var ch = this.source[start];
4141                 assert_1.assert(character_1.Character.isDecimalDigit(ch.charCodeAt(0)) || (ch === '.'), 'Numeric literal must start with a decimal digit or a decimal point');
4142                 var number = '';
4143                 if (ch !== '.') {
4144                     number = this.source[this.index++];
4145                     ch = this.source[this.index];
4146                     // Hex number starts with '0x'.
4147                     // Octal number starts with '0'.
4148                     // Octal number in ES6 starts with '0o'.
4149                     // Binary number in ES6 starts with '0b'.
4150                     if (number === '0') {
4151                         if (ch === 'x' || ch === 'X') {
4152                             ++this.index;
4153                             return this.scanHexLiteral(start);
4154                         }
4155                         if (ch === 'b' || ch === 'B') {
4156                             ++this.index;
4157                             return this.scanBinaryLiteral(start);
4158                         }
4159                         if (ch === 'o' || ch === 'O') {
4160                             return this.scanOctalLiteral(ch, start);
4161                         }
4162                         if (ch && character_1.Character.isOctalDigit(ch.charCodeAt(0))) {
4163                             if (this.isImplicitOctalLiteral()) {
4164                                 return this.scanOctalLiteral(ch, start);
4165                             }
4166                         }
4167                     }
4168                     while (character_1.Character.isDecimalDigit(this.source.charCodeAt(this.index))) {
4169                         number += this.source[this.index++];
4170                     }
4171                     ch = this.source[this.index];
4172                 }
4173                 if (ch === '.') {
4174                     number += this.source[this.index++];
4175                     while (character_1.Character.isDecimalDigit(this.source.charCodeAt(this.index))) {
4176                         number += this.source[this.index++];
4177                     }
4178                     ch = this.source[this.index];
4179                 }
4180                 if (ch === 'e' || ch === 'E') {
4181                     number += this.source[this.index++];
4182                     ch = this.source[this.index];
4183                     if (ch === '+' || ch === '-') {
4184                         number += this.source[this.index++];
4185                     }
4186                     if (character_1.Character.isDecimalDigit(this.source.charCodeAt(this.index))) {
4187                         while (character_1.Character.isDecimalDigit(this.source.charCodeAt(this.index))) {
4188                             number += this.source[this.index++];
4189                         }
4190                     }
4191                     else {
4192                         this.throwUnexpectedToken();
4193                     }
4194                 }
4195                 if (character_1.Character.isIdentifierStart(this.source.charCodeAt(this.index))) {
4196                     this.throwUnexpectedToken();
4197                 }
4198                 return {
4199                     type: token_1.Token.NumericLiteral,
4200                     value: parseFloat(number),
4201                     lineNumber: this.lineNumber,
4202                     lineStart: this.lineStart,
4203                     start: start,
4204                     end: this.index
4205                 };
4206             };
4207             ;
4208             // ECMA-262 11.8.4 String Literals
4209             Scanner.prototype.scanStringLiteral = function () {
4210                 var start = this.index;
4211                 var quote = this.source[start];
4212                 assert_1.assert((quote === '\'' || quote === '"'), 'String literal must starts with a quote');
4213                 ++this.index;
4214                 var octal = false;
4215                 var str = '';
4216                 while (!this.eof()) {
4217                     var ch = this.source[this.index++];
4218                     if (ch === quote) {
4219                         quote = '';
4220                         break;
4221                     }
4222                     else if (ch === '\\') {
4223                         ch = this.source[this.index++];
4224                         if (!ch || !character_1.Character.isLineTerminator(ch.charCodeAt(0))) {
4225                             switch (ch) {
4226                                 case 'u':
4227                                 case 'x':
4228                                     if (this.source[this.index] === '{') {
4229                                         ++this.index;
4230                                         str += this.scanUnicodeCodePointEscape();
4231                                     }
4232                                     else {
4233                                         var unescaped = this.scanHexEscape(ch);
4234                                         if (!unescaped) {
4235                                             this.throwUnexpectedToken();
4236                                         }
4237                                         str += unescaped;
4238                                     }
4239                                     break;
4240                                 case 'n':
4241                                     str += '\n';
4242                                     break;
4243                                 case 'r':
4244                                     str += '\r';
4245                                     break;
4246                                 case 't':
4247                                     str += '\t';
4248                                     break;
4249                                 case 'b':
4250                                     str += '\b';
4251                                     break;
4252                                 case 'f':
4253                                     str += '\f';
4254                                     break;
4255                                 case 'v':
4256                                     str += '\x0B';
4257                                     break;
4258                                 case '8':
4259                                 case '9':
4260                                     str += ch;
4261                                     this.tolerateUnexpectedToken();
4262                                     break;
4263                                 default:
4264                                     if (ch && character_1.Character.isOctalDigit(ch.charCodeAt(0))) {
4265                                         var octToDec = this.octalToDecimal(ch);
4266                                         octal = octToDec.octal || octal;
4267                                         str += String.fromCharCode(octToDec.code);
4268                                     }
4269                                     else {
4270                                         str += ch;
4271                                     }
4272                                     break;
4273                             }
4274                         }
4275                         else {
4276                             ++this.lineNumber;
4277                             if (ch === '\r' && this.source[this.index] === '\n') {
4278                                 ++this.index;
4279                             }
4280                             this.lineStart = this.index;
4281                         }
4282                     }
4283                     else if (character_1.Character.isLineTerminator(ch.charCodeAt(0))) {
4284                         break;
4285                     }
4286                     else {
4287                         str += ch;
4288                     }
4289                 }
4290                 if (quote !== '') {
4291                     this.index = start;
4292                     this.throwUnexpectedToken();
4293                 }
4294                 return {
4295                     type: token_1.Token.StringLiteral,
4296                     value: str,
4297                     octal: octal,
4298                     lineNumber: this.lineNumber,
4299                     lineStart: this.lineStart,
4300                     start: start,
4301                     end: this.index
4302                 };
4303             };
4304             ;
4305             // ECMA-262 11.8.6 Template Literal Lexical Components
4306             Scanner.prototype.scanTemplate = function () {
4307                 var cooked = '';
4308                 var terminated = false;
4309                 var start = this.index;
4310                 var head = (this.source[start] === '`');
4311                 var tail = false;
4312                 var rawOffset = 2;
4313                 ++this.index;
4314                 while (!this.eof()) {
4315                     var ch = this.source[this.index++];
4316                     if (ch === '`') {
4317                         rawOffset = 1;
4318                         tail = true;
4319                         terminated = true;
4320                         break;
4321                     }
4322                     else if (ch === '$') {
4323                         if (this.source[this.index] === '{') {
4324                             this.curlyStack.push('${');
4325                             ++this.index;
4326                             terminated = true;
4327                             break;
4328                         }
4329                         cooked += ch;
4330                     }
4331                     else if (ch === '\\') {
4332                         ch = this.source[this.index++];
4333                         if (!character_1.Character.isLineTerminator(ch.charCodeAt(0))) {
4334                             switch (ch) {
4335                                 case 'n':
4336                                     cooked += '\n';
4337                                     break;
4338                                 case 'r':
4339                                     cooked += '\r';
4340                                     break;
4341                                 case 't':
4342                                     cooked += '\t';
4343                                     break;
4344                                 case 'u':
4345                                 case 'x':
4346                                     if (this.source[this.index] === '{') {
4347                                         ++this.index;
4348                                         cooked += this.scanUnicodeCodePointEscape();
4349                                     }
4350                                     else {
4351                                         var restore = this.index;
4352                                         var unescaped = this.scanHexEscape(ch);
4353                                         if (unescaped) {
4354                                             cooked += unescaped;
4355                                         }
4356                                         else {
4357                                             this.index = restore;
4358                                             cooked += ch;
4359                                         }
4360                                     }
4361                                     break;
4362                                 case 'b':
4363                                     cooked += '\b';
4364                                     break;
4365                                 case 'f':
4366                                     cooked += '\f';
4367                                     break;
4368                                 case 'v':
4369                                     cooked += '\v';
4370                                     break;
4371                                 default:
4372                                     if (ch === '0') {
4373                                         if (character_1.Character.isDecimalDigit(this.source.charCodeAt(this.index))) {
4374                                             // Illegal: \01 \02 and so on
4375                                             this.throwUnexpectedToken(messages_1.Messages.TemplateOctalLiteral);
4376                                         }
4377                                         cooked += '\0';
4378                                     }
4379                                     else if (character_1.Character.isOctalDigit(ch.charCodeAt(0))) {
4380                                         // Illegal: \1 \2
4381                                         this.throwUnexpectedToken(messages_1.Messages.TemplateOctalLiteral);
4382                                     }
4383                                     else {
4384                                         cooked += ch;
4385                                     }
4386                                     break;
4387                             }
4388                         }
4389                         else {
4390                             ++this.lineNumber;
4391                             if (ch === '\r' && this.source[this.index] === '\n') {
4392                                 ++this.index;
4393                             }
4394                             this.lineStart = this.index;
4395                         }
4396                     }
4397                     else if (character_1.Character.isLineTerminator(ch.charCodeAt(0))) {
4398                         ++this.lineNumber;
4399                         if (ch === '\r' && this.source[this.index] === '\n') {
4400                             ++this.index;
4401                         }
4402                         this.lineStart = this.index;
4403                         cooked += '\n';
4404                     }
4405                     else {
4406                         cooked += ch;
4407                     }
4408                 }
4409                 if (!terminated) {
4410                     this.throwUnexpectedToken();
4411                 }
4412                 if (!head) {
4413                     this.curlyStack.pop();
4414                 }
4415                 return {
4416                     type: token_1.Token.Template,
4417                     value: {
4418                         cooked: cooked,
4419                         raw: this.source.slice(start + 1, this.index - rawOffset)
4420                     },
4421                     head: head,
4422                     tail: tail,
4423                     lineNumber: this.lineNumber,
4424                     lineStart: this.lineStart,
4425                     start: start,
4426                     end: this.index
4427                 };
4428             };
4429             ;
4430             // ECMA-262 11.8.5 Regular Expression Literals
4431             Scanner.prototype.testRegExp = function (pattern, flags) {
4432                 // The BMP character to use as a replacement for astral symbols when
4433                 // translating an ES6 "u"-flagged pattern to an ES5-compatible
4434                 // approximation.
4435                 // Note: replacing with '\uFFFF' enables false positives in unlikely
4436                 // scenarios. For example, `[\u{1044f}-\u{10440}]` is an invalid
4437                 // pattern that would not be detected by this substitution.
4438                 var astralSubstitute = '\uFFFF';
4439                 var tmp = pattern;
4440                 var self = this;
4441                 if (flags.indexOf('u') >= 0) {
4442                     tmp = tmp
4443                         .replace(/\\u\{([0-9a-fA-F]+)\}|\\u([a-fA-F0-9]{4})/g, function ($0, $1, $2) {
4444                         var codePoint = parseInt($1 || $2, 16);
4445                         if (codePoint > 0x10FFFF) {
4446                             self.throwUnexpectedToken(messages_1.Messages.InvalidRegExp);
4447                         }
4448                         if (codePoint <= 0xFFFF) {
4449                             return String.fromCharCode(codePoint);
4450                         }
4451                         return astralSubstitute;
4452                     })
4453                         .replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g, astralSubstitute);
4454                 }
4455                 // First, detect invalid regular expressions.
4456                 try {
4457                     RegExp(tmp);
4458                 }
4459                 catch (e) {
4460                     this.throwUnexpectedToken(messages_1.Messages.InvalidRegExp);
4461                 }
4462                 // Return a regular expression object for this pattern-flag pair, or
4463                 // `null` in case the current environment doesn't support the flags it
4464                 // uses.
4465                 try {
4466                     return new RegExp(pattern, flags);
4467                 }
4468                 catch (exception) {
4469                     /* istanbul ignore next */
4470                     return null;
4471                 }
4472             };
4473             ;
4474             Scanner.prototype.scanRegExpBody = function () {
4475                 var ch = this.source[this.index];
4476                 assert_1.assert(ch === '/', 'Regular expression literal must start with a slash');
4477                 var str = this.source[this.index++];
4478                 var classMarker = false;
4479                 var terminated = false;
4480                 while (!this.eof()) {
4481                     ch = this.source[this.index++];
4482                     str += ch;
4483                     if (ch === '\\') {
4484                         ch = this.source[this.index++];
4485                         // ECMA-262 7.8.5
4486                         if (character_1.Character.isLineTerminator(ch.charCodeAt(0))) {
4487                             this.throwUnexpectedToken(messages_1.Messages.UnterminatedRegExp);
4488                         }
4489                         str += ch;
4490                     }
4491                     else if (character_1.Character.isLineTerminator(ch.charCodeAt(0))) {
4492                         this.throwUnexpectedToken(messages_1.Messages.UnterminatedRegExp);
4493                     }
4494                     else if (classMarker) {
4495                         if (ch === ']') {
4496                             classMarker = false;
4497                         }
4498                     }
4499                     else {
4500                         if (ch === '/') {
4501                             terminated = true;
4502                             break;
4503                         }
4504                         else if (ch === '[') {
4505                             classMarker = true;
4506                         }
4507                     }
4508                 }
4509                 if (!terminated) {
4510                     this.throwUnexpectedToken(messages_1.Messages.UnterminatedRegExp);
4511                 }
4512                 // Exclude leading and trailing slash.
4513                 var body = str.substr(1, str.length - 2);
4514                 return {
4515                     value: body,
4516                     literal: str
4517                 };
4518             };
4519             ;
4520             Scanner.prototype.scanRegExpFlags = function () {
4521                 var str = '';
4522                 var flags = '';
4523                 while (!this.eof()) {
4524                     var ch = this.source[this.index];
4525                     if (!character_1.Character.isIdentifierPart(ch.charCodeAt(0))) {
4526                         break;
4527                     }
4528                     ++this.index;
4529                     if (ch === '\\' && !this.eof()) {
4530                         ch = this.source[this.index];
4531                         if (ch === 'u') {
4532                             ++this.index;
4533                             var restore = this.index;
4534                             ch = this.scanHexEscape('u');
4535                             if (ch) {
4536                                 flags += ch;
4537                                 for (str += '\\u'; restore < this.index; ++restore) {
4538                                     str += this.source[restore];
4539                                 }
4540                             }
4541                             else {
4542                                 this.index = restore;
4543                                 flags += 'u';
4544                                 str += '\\u';
4545                             }
4546                             this.tolerateUnexpectedToken();
4547                         }
4548                         else {
4549                             str += '\\';
4550                             this.tolerateUnexpectedToken();
4551                         }
4552                     }
4553                     else {
4554                         flags += ch;
4555                         str += ch;
4556                     }
4557                 }
4558                 return {
4559                     value: flags,
4560                     literal: str
4561                 };
4562             };
4563             ;
4564             Scanner.prototype.scanRegExp = function () {
4565                 var start = this.index;
4566                 var body = this.scanRegExpBody();
4567                 var flags = this.scanRegExpFlags();
4568                 var value = this.testRegExp(body.value, flags.value);
4569                 return {
4570                     type: token_1.Token.RegularExpression,
4571                     value: value,
4572                     literal: body.literal + flags.literal,
4573                     regex: {
4574                         pattern: body.value,
4575                         flags: flags.value
4576                     },
4577                     lineNumber: this.lineNumber,
4578                     lineStart: this.lineStart,
4579                     start: start,
4580                     end: this.index
4581                 };
4582             };
4583             ;
4584             Scanner.prototype.lex = function () {
4585                 if (this.eof()) {
4586                     return {
4587                         type: token_1.Token.EOF,
4588                         lineNumber: this.lineNumber,
4589                         lineStart: this.lineStart,
4590                         start: this.index,
4591                         end: this.index
4592                     };
4593                 }
4594                 var cp = this.source.charCodeAt(this.index);
4595                 if (character_1.Character.isIdentifierStart(cp)) {
4596                     return this.scanIdentifier();
4597                 }
4598                 // Very common: ( and ) and ;
4599                 if (cp === 0x28 || cp === 0x29 || cp === 0x3B) {
4600                     return this.scanPunctuator();
4601                 }
4602                 // String literal starts with single quote (U+0027) or double quote (U+0022).
4603                 if (cp === 0x27 || cp === 0x22) {
4604                     return this.scanStringLiteral();
4605                 }
4606                 // Dot (.) U+002E can also start a floating-point number, hence the need
4607                 // to check the next character.
4608                 if (cp === 0x2E) {
4609                     if (character_1.Character.isDecimalDigit(this.source.charCodeAt(this.index + 1))) {
4610                         return this.scanNumericLiteral();
4611                     }
4612                     return this.scanPunctuator();
4613                 }
4614                 if (character_1.Character.isDecimalDigit(cp)) {
4615                     return this.scanNumericLiteral();
4616                 }
4617                 // Template literals start with ` (U+0060) for template head
4618                 // or } (U+007D) for template middle or template tail.
4619                 if (cp === 0x60 || (cp === 0x7D && this.curlyStack[this.curlyStack.length - 1] === '${')) {
4620                     return this.scanTemplate();
4621                 }
4622                 // Possible identifier start in a surrogate pair.
4623                 if (cp >= 0xD800 && cp < 0xDFFF) {
4624                     if (character_1.Character.isIdentifierStart(this.codePointAt(this.index))) {
4625                         return this.scanIdentifier();
4626                     }
4627                 }
4628                 return this.scanPunctuator();
4629             };
4630             ;
4631             return Scanner;
4632         }());
4633         exports.Scanner = Scanner;
4634
4635
4636 /***/ },
4637 /* 9 */
4638 /***/ function(module, exports) {
4639
4640         "use strict";
4641         // See also tools/generate-unicode-regex.js.
4642         var Regex = {
4643             // Unicode v8.0.0 NonAsciiIdentifierStart:
4644             NonAsciiIdentifierStart: /[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0-\u08B4\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309B-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AD\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF30-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF19]|\uD806[\uDCA0-\uDCDF\uDCFF\uDEC0-\uDEF8]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50\uDF93-\uDF9F]|\uD82C[\uDC00\uDC01]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1]|\uD87E[\uDC00-\uDE1D]/,
4645             // Unicode v8.0.0 NonAsciiIdentifierPart:
4646             NonAsciiIdentifierPart: /[\xAA\xB5\xB7\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u08A0-\u08B4\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C81-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D01-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1369-\u1371\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19DA\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1CD0-\u1CD2\u1CD4-\u1CF6\u1CF8\u1CF9\u1D00-\u1DF5\u1DFC-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u200C\u200D\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AD\uA7B0-\uA7B7\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C4\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0\uDF00-\uDF1F\uDF30-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDCA-\uDDCC\uDDD0-\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE37\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3C-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF50\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDDD8-\uDDDD\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB7\uDEC0-\uDEC9\uDF00-\uDF19\uDF1D-\uDF2B\uDF30-\uDF39]|\uD806[\uDCA0-\uDCE9\uDCFF\uDEC0-\uDEF8]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50-\uDF7E\uDF8F-\uDF9F]|\uD82C[\uDC00\uDC01]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF]/
4647         };
4648         exports.Character = {
4649             fromCodePoint: function (cp) {
4650                 return (cp < 0x10000) ? String.fromCharCode(cp) :
4651                     String.fromCharCode(0xD800 + ((cp - 0x10000) >> 10)) +
4652                         String.fromCharCode(0xDC00 + ((cp - 0x10000) & 1023));
4653             },
4654             // ECMA-262 11.2 White Space
4655             isWhiteSpace: function (cp) {
4656                 return (cp === 0x20) || (cp === 0x09) || (cp === 0x0B) || (cp === 0x0C) || (cp === 0xA0) ||
4657                     (cp >= 0x1680 && [0x1680, 0x2000, 0x2001, 0x2002, 0x2003, 0x2004, 0x2005, 0x2006, 0x2007, 0x2008, 0x2009, 0x200A, 0x202F, 0x205F, 0x3000, 0xFEFF].indexOf(cp) >= 0);
4658             },
4659             // ECMA-262 11.3 Line Terminators
4660             isLineTerminator: function (cp) {
4661                 return (cp === 0x0A) || (cp === 0x0D) || (cp === 0x2028) || (cp === 0x2029);
4662             },
4663             // ECMA-262 11.6 Identifier Names and Identifiers
4664             isIdentifierStart: function (cp) {
4665                 return (cp === 0x24) || (cp === 0x5F) ||
4666                     (cp >= 0x41 && cp <= 0x5A) ||
4667                     (cp >= 0x61 && cp <= 0x7A) ||
4668                     (cp === 0x5C) ||
4669                     ((cp >= 0x80) && Regex.NonAsciiIdentifierStart.test(exports.Character.fromCodePoint(cp)));
4670             },
4671             isIdentifierPart: function (cp) {
4672                 return (cp === 0x24) || (cp === 0x5F) ||
4673                     (cp >= 0x41 && cp <= 0x5A) ||
4674                     (cp >= 0x61 && cp <= 0x7A) ||
4675                     (cp >= 0x30 && cp <= 0x39) ||
4676                     (cp === 0x5C) ||
4677                     ((cp >= 0x80) && Regex.NonAsciiIdentifierPart.test(exports.Character.fromCodePoint(cp)));
4678             },
4679             // ECMA-262 11.8.3 Numeric Literals
4680             isDecimalDigit: function (cp) {
4681                 return (cp >= 0x30 && cp <= 0x39); // 0..9
4682             },
4683             isHexDigit: function (cp) {
4684                 return (cp >= 0x30 && cp <= 0x39) ||
4685                     (cp >= 0x41 && cp <= 0x46) ||
4686                     (cp >= 0x61 && cp <= 0x66); // a..f
4687             },
4688             isOctalDigit: function (cp) {
4689                 return (cp >= 0x30 && cp <= 0x37); // 0..7
4690             }
4691         };
4692
4693
4694 /***/ },
4695 /* 10 */
4696 /***/ function(module, exports, __webpack_require__) {
4697
4698         "use strict";
4699         var syntax_1 = __webpack_require__(2);
4700         var ArrayExpression = (function () {
4701             function ArrayExpression(elements) {
4702                 this.type = syntax_1.Syntax.ArrayExpression;
4703                 this.elements = elements;
4704             }
4705             return ArrayExpression;
4706         }());
4707         exports.ArrayExpression = ArrayExpression;
4708         var ArrayPattern = (function () {
4709             function ArrayPattern(elements) {
4710                 this.type = syntax_1.Syntax.ArrayPattern;
4711                 this.elements = elements;
4712             }
4713             return ArrayPattern;
4714         }());
4715         exports.ArrayPattern = ArrayPattern;
4716         var ArrowFunctionExpression = (function () {
4717             function ArrowFunctionExpression(params, body, expression) {
4718                 this.type = syntax_1.Syntax.ArrowFunctionExpression;
4719                 this.id = null;
4720                 this.params = params;
4721                 this.body = body;
4722                 this.generator = false;
4723                 this.expression = expression;
4724             }
4725             return ArrowFunctionExpression;
4726         }());
4727         exports.ArrowFunctionExpression = ArrowFunctionExpression;
4728         var AssignmentExpression = (function () {
4729             function AssignmentExpression(operator, left, right) {
4730                 this.type = syntax_1.Syntax.AssignmentExpression;
4731                 this.operator = operator;
4732                 this.left = left;
4733                 this.right = right;
4734             }
4735             return AssignmentExpression;
4736         }());
4737         exports.AssignmentExpression = AssignmentExpression;
4738         var AssignmentPattern = (function () {
4739             function AssignmentPattern(left, right) {
4740                 this.type = syntax_1.Syntax.AssignmentPattern;
4741                 this.left = left;
4742                 this.right = right;
4743             }
4744             return AssignmentPattern;
4745         }());
4746         exports.AssignmentPattern = AssignmentPattern;
4747         var BinaryExpression = (function () {
4748             function BinaryExpression(operator, left, right) {
4749                 var logical = (operator === '||' || operator === '&&');
4750                 this.type = logical ? syntax_1.Syntax.LogicalExpression : syntax_1.Syntax.BinaryExpression;
4751                 this.operator = operator;
4752                 this.left = left;
4753                 this.right = right;
4754             }
4755             return BinaryExpression;
4756         }());
4757         exports.BinaryExpression = BinaryExpression;
4758         var BlockStatement = (function () {
4759             function BlockStatement(body) {
4760                 this.type = syntax_1.Syntax.BlockStatement;
4761                 this.body = body;
4762             }
4763             return BlockStatement;
4764         }());
4765         exports.BlockStatement = BlockStatement;
4766         var BreakStatement = (function () {
4767             function BreakStatement(label) {
4768                 this.type = syntax_1.Syntax.BreakStatement;
4769                 this.label = label;
4770             }
4771             return BreakStatement;
4772         }());
4773         exports.BreakStatement = BreakStatement;
4774         var CallExpression = (function () {
4775             function CallExpression(callee, args) {
4776                 this.type = syntax_1.Syntax.CallExpression;
4777                 this.callee = callee;
4778                 this.arguments = args;
4779             }
4780             return CallExpression;
4781         }());
4782         exports.CallExpression = CallExpression;
4783         var CatchClause = (function () {
4784             function CatchClause(param, body) {
4785                 this.type = syntax_1.Syntax.CatchClause;
4786                 this.param = param;
4787                 this.body = body;
4788             }
4789             return CatchClause;
4790         }());
4791         exports.CatchClause = CatchClause;
4792         var ClassBody = (function () {
4793             function ClassBody(body) {
4794                 this.type = syntax_1.Syntax.ClassBody;
4795                 this.body = body;
4796             }
4797             return ClassBody;
4798         }());
4799         exports.ClassBody = ClassBody;
4800         var ClassDeclaration = (function () {
4801             function ClassDeclaration(id, superClass, body) {
4802                 this.type = syntax_1.Syntax.ClassDeclaration;
4803                 this.id = id;
4804                 this.superClass = superClass;
4805                 this.body = body;
4806             }
4807             return ClassDeclaration;
4808         }());
4809         exports.ClassDeclaration = ClassDeclaration;
4810         var ClassExpression = (function () {
4811             function ClassExpression(id, superClass, body) {
4812                 this.type = syntax_1.Syntax.ClassExpression;
4813                 this.id = id;
4814                 this.superClass = superClass;
4815                 this.body = body;
4816             }
4817             return ClassExpression;
4818         }());
4819         exports.ClassExpression = ClassExpression;
4820         var ComputedMemberExpression = (function () {
4821             function ComputedMemberExpression(object, property) {
4822                 this.type = syntax_1.Syntax.MemberExpression;
4823                 this.computed = true;
4824                 this.object = object;
4825                 this.property = property;
4826             }
4827             return ComputedMemberExpression;
4828         }());
4829         exports.ComputedMemberExpression = ComputedMemberExpression;
4830         var ConditionalExpression = (function () {
4831             function ConditionalExpression(test, consequent, alternate) {
4832                 this.type = syntax_1.Syntax.ConditionalExpression;
4833                 this.test = test;
4834                 this.consequent = consequent;
4835                 this.alternate = alternate;
4836             }
4837             return ConditionalExpression;
4838         }());
4839         exports.ConditionalExpression = ConditionalExpression;
4840         var ContinueStatement = (function () {
4841             function ContinueStatement(label) {
4842                 this.type = syntax_1.Syntax.ContinueStatement;
4843                 this.label = label;
4844             }
4845             return ContinueStatement;
4846         }());
4847         exports.ContinueStatement = ContinueStatement;
4848         var DebuggerStatement = (function () {
4849             function DebuggerStatement() {
4850                 this.type = syntax_1.Syntax.DebuggerStatement;
4851             }
4852             return DebuggerStatement;
4853         }());
4854         exports.DebuggerStatement = DebuggerStatement;
4855         var Directive = (function () {
4856             function Directive(expression, directive) {
4857                 this.type = syntax_1.Syntax.ExpressionStatement;
4858                 this.expression = expression;
4859                 this.directive = directive;
4860             }
4861             return Directive;
4862         }());
4863         exports.Directive = Directive;
4864         var DoWhileStatement = (function () {
4865             function DoWhileStatement(body, test) {
4866                 this.type = syntax_1.Syntax.DoWhileStatement;
4867                 this.body = body;
4868                 this.test = test;
4869             }
4870             return DoWhileStatement;
4871         }());
4872         exports.DoWhileStatement = DoWhileStatement;
4873         var EmptyStatement = (function () {
4874             function EmptyStatement() {
4875                 this.type = syntax_1.Syntax.EmptyStatement;
4876             }
4877             return EmptyStatement;
4878         }());
4879         exports.EmptyStatement = EmptyStatement;
4880         var ExportAllDeclaration = (function () {
4881             function ExportAllDeclaration(source) {
4882                 this.type = syntax_1.Syntax.ExportAllDeclaration;
4883                 this.source = source;
4884             }
4885             return ExportAllDeclaration;
4886         }());
4887         exports.ExportAllDeclaration = ExportAllDeclaration;
4888         var ExportDefaultDeclaration = (function () {
4889             function ExportDefaultDeclaration(declaration) {
4890                 this.type = syntax_1.Syntax.ExportDefaultDeclaration;
4891                 this.declaration = declaration;
4892             }
4893             return ExportDefaultDeclaration;
4894         }());
4895         exports.ExportDefaultDeclaration = ExportDefaultDeclaration;
4896         var ExportNamedDeclaration = (function () {
4897             function ExportNamedDeclaration(declaration, specifiers, source) {
4898                 this.type = syntax_1.Syntax.ExportNamedDeclaration;
4899                 this.declaration = declaration;
4900                 this.specifiers = specifiers;
4901                 this.source = source;
4902             }
4903             return ExportNamedDeclaration;
4904         }());
4905         exports.ExportNamedDeclaration = ExportNamedDeclaration;
4906         var ExportSpecifier = (function () {
4907             function ExportSpecifier(local, exported) {
4908                 this.type = syntax_1.Syntax.ExportSpecifier;
4909                 this.exported = exported;
4910                 this.local = local;
4911             }
4912             return ExportSpecifier;
4913         }());
4914         exports.ExportSpecifier = ExportSpecifier;
4915         var ExpressionStatement = (function () {
4916             function ExpressionStatement(expression) {
4917                 this.type = syntax_1.Syntax.ExpressionStatement;
4918                 this.expression = expression;
4919             }
4920             return ExpressionStatement;
4921         }());
4922         exports.ExpressionStatement = ExpressionStatement;
4923         var ForInStatement = (function () {
4924             function ForInStatement(left, right, body) {
4925                 this.type = syntax_1.Syntax.ForInStatement;
4926                 this.left = left;
4927                 this.right = right;
4928                 this.body = body;
4929                 this.each = false;
4930             }
4931             return ForInStatement;
4932         }());
4933         exports.ForInStatement = ForInStatement;
4934         var ForOfStatement = (function () {
4935             function ForOfStatement(left, right, body) {
4936                 this.type = syntax_1.Syntax.ForOfStatement;
4937                 this.left = left;
4938                 this.right = right;
4939                 this.body = body;
4940             }
4941             return ForOfStatement;
4942         }());
4943         exports.ForOfStatement = ForOfStatement;
4944         var ForStatement = (function () {
4945             function ForStatement(init, test, update, body) {
4946                 this.type = syntax_1.Syntax.ForStatement;
4947                 this.init = init;
4948                 this.test = test;
4949                 this.update = update;
4950                 this.body = body;
4951             }
4952             return ForStatement;
4953         }());
4954         exports.ForStatement = ForStatement;
4955         var FunctionDeclaration = (function () {
4956             function FunctionDeclaration(id, params, body, generator) {
4957                 this.type = syntax_1.Syntax.FunctionDeclaration;
4958                 this.id = id;
4959                 this.params = params;
4960                 this.body = body;
4961                 this.generator = generator;
4962                 this.expression = false;
4963             }
4964             return FunctionDeclaration;
4965         }());
4966         exports.FunctionDeclaration = FunctionDeclaration;
4967         var FunctionExpression = (function () {
4968             function FunctionExpression(id, params, body, generator) {
4969                 this.type = syntax_1.Syntax.FunctionExpression;
4970                 this.id = id;
4971                 this.params = params;
4972                 this.body = body;
4973                 this.generator = generator;
4974                 this.expression = false;
4975             }
4976             return FunctionExpression;
4977         }());
4978         exports.FunctionExpression = FunctionExpression;
4979         var Identifier = (function () {
4980             function Identifier(name) {
4981                 this.type = syntax_1.Syntax.Identifier;
4982                 this.name = name;
4983             }
4984             return Identifier;
4985         }());
4986         exports.Identifier = Identifier;
4987         var IfStatement = (function () {
4988             function IfStatement(test, consequent, alternate) {
4989                 this.type = syntax_1.Syntax.IfStatement;
4990                 this.test = test;
4991                 this.consequent = consequent;
4992                 this.alternate = alternate;
4993             }
4994             return IfStatement;
4995         }());
4996         exports.IfStatement = IfStatement;
4997         var ImportDeclaration = (function () {
4998             function ImportDeclaration(specifiers, source) {
4999                 this.type = syntax_1.Syntax.ImportDeclaration;
5000                 this.specifiers = specifiers;
5001                 this.source = source;
5002             }
5003             return ImportDeclaration;
5004         }());
5005         exports.ImportDeclaration = ImportDeclaration;
5006         var ImportDefaultSpecifier = (function () {
5007             function ImportDefaultSpecifier(local) {
5008                 this.type = syntax_1.Syntax.ImportDefaultSpecifier;
5009                 this.local = local;
5010             }
5011             return ImportDefaultSpecifier;
5012         }());
5013         exports.ImportDefaultSpecifier = ImportDefaultSpecifier;
5014         var ImportNamespaceSpecifier = (function () {
5015             function ImportNamespaceSpecifier(local) {
5016                 this.type = syntax_1.Syntax.ImportNamespaceSpecifier;
5017                 this.local = local;
5018             }
5019             return ImportNamespaceSpecifier;
5020         }());
5021         exports.ImportNamespaceSpecifier = ImportNamespaceSpecifier;
5022         var ImportSpecifier = (function () {
5023             function ImportSpecifier(local, imported) {
5024                 this.type = syntax_1.Syntax.ImportSpecifier;
5025                 this.local = local;
5026                 this.imported = imported;
5027             }
5028             return ImportSpecifier;
5029         }());
5030         exports.ImportSpecifier = ImportSpecifier;
5031         var LabeledStatement = (function () {
5032             function LabeledStatement(label, body) {
5033                 this.type = syntax_1.Syntax.LabeledStatement;
5034                 this.label = label;
5035                 this.body = body;
5036             }
5037             return LabeledStatement;
5038         }());
5039         exports.LabeledStatement = LabeledStatement;
5040         var Literal = (function () {
5041             function Literal(value, raw) {
5042                 this.type = syntax_1.Syntax.Literal;
5043                 this.value = value;
5044                 this.raw = raw;
5045             }
5046             return Literal;
5047         }());
5048         exports.Literal = Literal;
5049         var MetaProperty = (function () {
5050             function MetaProperty(meta, property) {
5051                 this.type = syntax_1.Syntax.MetaProperty;
5052                 this.meta = meta;
5053                 this.property = property;
5054             }
5055             return MetaProperty;
5056         }());
5057         exports.MetaProperty = MetaProperty;
5058         var MethodDefinition = (function () {
5059             function MethodDefinition(key, computed, value, kind, isStatic) {
5060                 this.type = syntax_1.Syntax.MethodDefinition;
5061                 this.key = key;
5062                 this.computed = computed;
5063                 this.value = value;
5064                 this.kind = kind;
5065                 this.static = isStatic;
5066             }
5067             return MethodDefinition;
5068         }());
5069         exports.MethodDefinition = MethodDefinition;
5070         var NewExpression = (function () {
5071             function NewExpression(callee, args) {
5072                 this.type = syntax_1.Syntax.NewExpression;
5073                 this.callee = callee;
5074                 this.arguments = args;
5075             }
5076             return NewExpression;
5077         }());
5078         exports.NewExpression = NewExpression;
5079         var ObjectExpression = (function () {
5080             function ObjectExpression(properties) {
5081                 this.type = syntax_1.Syntax.ObjectExpression;
5082                 this.properties = properties;
5083             }
5084             return ObjectExpression;
5085         }());
5086         exports.ObjectExpression = ObjectExpression;
5087         var ObjectPattern = (function () {
5088             function ObjectPattern(properties) {
5089                 this.type = syntax_1.Syntax.ObjectPattern;
5090                 this.properties = properties;
5091             }
5092             return ObjectPattern;
5093         }());
5094         exports.ObjectPattern = ObjectPattern;
5095         var Program = (function () {
5096             function Program(body, sourceType) {
5097                 this.type = syntax_1.Syntax.Program;
5098                 this.body = body;
5099                 this.sourceType = sourceType;
5100             }
5101             return Program;
5102         }());
5103         exports.Program = Program;
5104         var Property = (function () {
5105             function Property(kind, key, computed, value, method, shorthand) {
5106                 this.type = syntax_1.Syntax.Property;
5107                 this.key = key;
5108                 this.computed = computed;
5109                 this.value = value;
5110                 this.kind = kind;
5111                 this.method = method;
5112                 this.shorthand = shorthand;
5113             }
5114             return Property;
5115         }());
5116         exports.Property = Property;
5117         var RegexLiteral = (function () {
5118             function RegexLiteral(value, raw, regex) {
5119                 this.type = syntax_1.Syntax.Literal;
5120                 this.value = value;
5121                 this.raw = raw;
5122                 this.regex = regex;
5123             }
5124             return RegexLiteral;
5125         }());
5126         exports.RegexLiteral = RegexLiteral;
5127         var RestElement = (function () {
5128             function RestElement(argument) {
5129                 this.type = syntax_1.Syntax.RestElement;
5130                 this.argument = argument;
5131             }
5132             return RestElement;
5133         }());
5134         exports.RestElement = RestElement;
5135         var ReturnStatement = (function () {
5136             function ReturnStatement(argument) {
5137                 this.type = syntax_1.Syntax.ReturnStatement;
5138                 this.argument = argument;
5139             }
5140             return ReturnStatement;
5141         }());
5142         exports.ReturnStatement = ReturnStatement;
5143         var SequenceExpression = (function () {
5144             function SequenceExpression(expressions) {
5145                 this.type = syntax_1.Syntax.SequenceExpression;
5146                 this.expressions = expressions;
5147             }
5148             return SequenceExpression;
5149         }());
5150         exports.SequenceExpression = SequenceExpression;
5151         var SpreadElement = (function () {
5152             function SpreadElement(argument) {
5153                 this.type = syntax_1.Syntax.SpreadElement;
5154                 this.argument = argument;
5155             }
5156             return SpreadElement;
5157         }());
5158         exports.SpreadElement = SpreadElement;
5159         var StaticMemberExpression = (function () {
5160             function StaticMemberExpression(object, property) {
5161                 this.type = syntax_1.Syntax.MemberExpression;
5162                 this.computed = false;
5163                 this.object = object;
5164                 this.property = property;
5165             }
5166             return StaticMemberExpression;
5167         }());
5168         exports.StaticMemberExpression = StaticMemberExpression;
5169         var Super = (function () {
5170             function Super() {
5171                 this.type = syntax_1.Syntax.Super;
5172             }
5173             return Super;
5174         }());
5175         exports.Super = Super;
5176         var SwitchCase = (function () {
5177             function SwitchCase(test, consequent) {
5178                 this.type = syntax_1.Syntax.SwitchCase;
5179                 this.test = test;
5180                 this.consequent = consequent;
5181             }
5182             return SwitchCase;
5183         }());
5184         exports.SwitchCase = SwitchCase;
5185         var SwitchStatement = (function () {
5186             function SwitchStatement(discriminant, cases) {
5187                 this.type = syntax_1.Syntax.SwitchStatement;
5188                 this.discriminant = discriminant;
5189                 this.cases = cases;
5190             }
5191             return SwitchStatement;
5192         }());
5193         exports.SwitchStatement = SwitchStatement;
5194         var TaggedTemplateExpression = (function () {
5195             function TaggedTemplateExpression(tag, quasi) {
5196                 this.type = syntax_1.Syntax.TaggedTemplateExpression;
5197                 this.tag = tag;
5198                 this.quasi = quasi;
5199             }
5200             return TaggedTemplateExpression;
5201         }());
5202         exports.TaggedTemplateExpression = TaggedTemplateExpression;
5203         var TemplateElement = (function () {
5204             function TemplateElement(value, tail) {
5205                 this.type = syntax_1.Syntax.TemplateElement;
5206                 this.value = value;
5207                 this.tail = tail;
5208             }
5209             return TemplateElement;
5210         }());
5211         exports.TemplateElement = TemplateElement;
5212         var TemplateLiteral = (function () {
5213             function TemplateLiteral(quasis, expressions) {
5214                 this.type = syntax_1.Syntax.TemplateLiteral;
5215                 this.quasis = quasis;
5216                 this.expressions = expressions;
5217             }
5218             return TemplateLiteral;
5219         }());
5220         exports.TemplateLiteral = TemplateLiteral;
5221         var ThisExpression = (function () {
5222             function ThisExpression() {
5223                 this.type = syntax_1.Syntax.ThisExpression;
5224             }
5225             return ThisExpression;
5226         }());
5227         exports.ThisExpression = ThisExpression;
5228         var ThrowStatement = (function () {
5229             function ThrowStatement(argument) {
5230                 this.type = syntax_1.Syntax.ThrowStatement;
5231                 this.argument = argument;
5232             }
5233             return ThrowStatement;
5234         }());
5235         exports.ThrowStatement = ThrowStatement;
5236         var TryStatement = (function () {
5237             function TryStatement(block, handler, finalizer) {
5238                 this.type = syntax_1.Syntax.TryStatement;
5239                 this.block = block;
5240                 this.handler = handler;
5241                 this.finalizer = finalizer;
5242             }
5243             return TryStatement;
5244         }());
5245         exports.TryStatement = TryStatement;
5246         var UnaryExpression = (function () {
5247             function UnaryExpression(operator, argument) {
5248                 this.type = syntax_1.Syntax.UnaryExpression;
5249                 this.operator = operator;
5250                 this.argument = argument;
5251                 this.prefix = true;
5252             }
5253             return UnaryExpression;
5254         }());
5255         exports.UnaryExpression = UnaryExpression;
5256         var UpdateExpression = (function () {
5257             function UpdateExpression(operator, argument, prefix) {
5258                 this.type = syntax_1.Syntax.UpdateExpression;
5259                 this.operator = operator;
5260                 this.argument = argument;
5261                 this.prefix = prefix;
5262             }
5263             return UpdateExpression;
5264         }());
5265         exports.UpdateExpression = UpdateExpression;
5266         var VariableDeclaration = (function () {
5267             function VariableDeclaration(declarations, kind) {
5268                 this.type = syntax_1.Syntax.VariableDeclaration;
5269                 this.declarations = declarations;
5270                 this.kind = kind;
5271             }
5272             return VariableDeclaration;
5273         }());
5274         exports.VariableDeclaration = VariableDeclaration;
5275         var VariableDeclarator = (function () {
5276             function VariableDeclarator(id, init) {
5277                 this.type = syntax_1.Syntax.VariableDeclarator;
5278                 this.id = id;
5279                 this.init = init;
5280             }
5281             return VariableDeclarator;
5282         }());
5283         exports.VariableDeclarator = VariableDeclarator;
5284         var WhileStatement = (function () {
5285             function WhileStatement(test, body) {
5286                 this.type = syntax_1.Syntax.WhileStatement;
5287                 this.test = test;
5288                 this.body = body;
5289             }
5290             return WhileStatement;
5291         }());
5292         exports.WhileStatement = WhileStatement;
5293         var WithStatement = (function () {
5294             function WithStatement(object, body) {
5295                 this.type = syntax_1.Syntax.WithStatement;
5296                 this.object = object;
5297                 this.body = body;
5298             }
5299             return WithStatement;
5300         }());
5301         exports.WithStatement = WithStatement;
5302         var YieldExpression = (function () {
5303             function YieldExpression(argument, delegate) {
5304                 this.type = syntax_1.Syntax.YieldExpression;
5305                 this.argument = argument;
5306                 this.delegate = delegate;
5307             }
5308             return YieldExpression;
5309         }());
5310         exports.YieldExpression = YieldExpression;
5311
5312
5313 /***/ },
5314 /* 11 */
5315 /***/ function(module, exports, __webpack_require__) {
5316
5317         "use strict";
5318 /* istanbul ignore next */
5319         var __extends = (this && this.__extends) || function (d, b) {
5320             for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
5321             function __() { this.constructor = d; }
5322             d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
5323         };
5324         var character_1 = __webpack_require__(9);
5325         var token_1 = __webpack_require__(7);
5326         var parser_1 = __webpack_require__(3);
5327         var xhtml_entities_1 = __webpack_require__(12);
5328         var jsx_syntax_1 = __webpack_require__(13);
5329         var Node = __webpack_require__(10);
5330         var JSXNode = __webpack_require__(14);
5331         var JSXToken;
5332         (function (JSXToken) {
5333             JSXToken[JSXToken["Identifier"] = 100] = "Identifier";
5334             JSXToken[JSXToken["Text"] = 101] = "Text";
5335         })(JSXToken || (JSXToken = {}));
5336         token_1.TokenName[JSXToken.Identifier] = 'JSXIdentifier';
5337         token_1.TokenName[JSXToken.Text] = 'JSXText';
5338         // Fully qualified element name, e.g. <svg:path> returns "svg:path"
5339         function getQualifiedElementName(elementName) {
5340             var qualifiedName;
5341             switch (elementName.type) {
5342                 case jsx_syntax_1.JSXSyntax.JSXIdentifier:
5343                     var id = (elementName);
5344                     qualifiedName = id.name;
5345                     break;
5346                 case jsx_syntax_1.JSXSyntax.JSXNamespacedName:
5347                     var ns = (elementName);
5348                     qualifiedName = getQualifiedElementName(ns.namespace) + ':' +
5349                         getQualifiedElementName(ns.name);
5350                     break;
5351                 case jsx_syntax_1.JSXSyntax.JSXMemberExpression:
5352                     var expr = (elementName);
5353                     qualifiedName = getQualifiedElementName(expr.object) + '.' +
5354                         getQualifiedElementName(expr.property);
5355                     break;
5356             }
5357             return qualifiedName;
5358         }
5359         var JSXParser = (function (_super) {
5360             __extends(JSXParser, _super);
5361             function JSXParser(code, options, delegate) {
5362                 _super.call(this, code, options, delegate);
5363             }
5364             JSXParser.prototype.parsePrimaryExpression = function () {
5365                 return this.match('<') ? this.parseJSXRoot() : _super.prototype.parsePrimaryExpression.call(this);
5366             };
5367             JSXParser.prototype.startJSX = function () {
5368                 // Unwind the scanner before the lookahead token.
5369                 this.scanner.index = this.startMarker.index;
5370                 this.scanner.lineNumber = this.startMarker.lineNumber;
5371                 this.scanner.lineStart = this.startMarker.lineStart;
5372             };
5373             JSXParser.prototype.finishJSX = function () {
5374                 // Prime the next lookahead.
5375                 this.nextToken();
5376             };
5377             JSXParser.prototype.reenterJSX = function () {
5378                 this.startJSX();
5379                 this.expectJSX('}');
5380                 // Pop the closing '}' added from the lookahead.
5381                 if (this.config.tokens) {
5382                     this.tokens.pop();
5383                 }
5384             };
5385             JSXParser.prototype.createJSXNode = function () {
5386                 this.collectComments();
5387                 return {
5388                     index: this.scanner.index,
5389                     line: this.scanner.lineNumber,
5390                     column: this.scanner.index - this.scanner.lineStart
5391                 };
5392             };
5393             JSXParser.prototype.createJSXChildNode = function () {
5394                 return {
5395                     index: this.scanner.index,
5396                     line: this.scanner.lineNumber,
5397                     column: this.scanner.index - this.scanner.lineStart
5398                 };
5399             };
5400             JSXParser.prototype.scanXHTMLEntity = function (quote) {
5401                 var result = '&';
5402                 var valid = true;
5403                 var terminated = false;
5404                 var numeric = false;
5405                 var hex = false;
5406                 while (!this.scanner.eof() && valid && !terminated) {
5407                     var ch = this.scanner.source[this.scanner.index];
5408                     if (ch === quote) {
5409                         break;
5410                     }
5411                     terminated = (ch === ';');
5412                     result += ch;
5413                     ++this.scanner.index;
5414                     if (!terminated) {
5415                         switch (result.length) {
5416                             case 2:
5417                                 // e.g. '&#123;'
5418                                 numeric = (ch === '#');
5419                                 break;
5420                             case 3:
5421                                 if (numeric) {
5422                                     // e.g. '&#x41;'
5423                                     hex = (ch === 'x');
5424                                     valid = hex || character_1.Character.isDecimalDigit(ch.charCodeAt(0));
5425                                     numeric = numeric && !hex;
5426                                 }
5427                                 break;
5428                             default:
5429                                 valid = valid && !(numeric && !character_1.Character.isDecimalDigit(ch.charCodeAt(0)));
5430                                 valid = valid && !(hex && !character_1.Character.isHexDigit(ch.charCodeAt(0)));
5431                                 break;
5432                         }
5433                     }
5434                 }
5435                 if (valid && terminated && result.length > 2) {
5436                     // e.g. '&#x41;' becomes just '#x41'
5437                     var str = result.substr(1, result.length - 2);
5438                     if (numeric && str.length > 1) {
5439                         result = String.fromCharCode(parseInt(str.substr(1), 10));
5440                     }
5441                     else if (hex && str.length > 2) {
5442                         result = String.fromCharCode(parseInt('0' + str.substr(1), 16));
5443                     }
5444                     else if (!numeric && !hex && xhtml_entities_1.XHTMLEntities[str]) {
5445                         result = xhtml_entities_1.XHTMLEntities[str];
5446                     }
5447                 }
5448                 return result;
5449             };
5450             // Scan the next JSX token. This replaces Scanner#lex when in JSX mode.
5451             JSXParser.prototype.lexJSX = function () {
5452                 var cp = this.scanner.source.charCodeAt(this.scanner.index);
5453                 // < > / : = { }
5454                 if (cp === 60 || cp === 62 || cp === 47 || cp === 58 || cp === 61 || cp === 123 || cp === 125) {
5455                     var value = this.scanner.source[this.scanner.index++];
5456                     return {
5457                         type: token_1.Token.Punctuator,
5458                         value: value,
5459                         lineNumber: this.scanner.lineNumber,
5460                         lineStart: this.scanner.lineStart,
5461                         start: this.scanner.index - 1,
5462                         end: this.scanner.index
5463                     };
5464                 }
5465                 // " '
5466                 if (cp === 34 || cp === 39) {
5467                     var start = this.scanner.index;
5468                     var quote = this.scanner.source[this.scanner.index++];
5469                     var str = '';
5470                     while (!this.scanner.eof()) {
5471                         var ch = this.scanner.source[this.scanner.index++];
5472                         if (ch === quote) {
5473                             break;
5474                         }
5475                         else if (ch === '&') {
5476                             str += this.scanXHTMLEntity(quote);
5477                         }
5478                         else {
5479                             str += ch;
5480                         }
5481                     }
5482                     return {
5483                         type: token_1.Token.StringLiteral,
5484                         value: str,
5485                         lineNumber: this.scanner.lineNumber,
5486                         lineStart: this.scanner.lineStart,
5487                         start: start,
5488                         end: this.scanner.index
5489                     };
5490                 }
5491                 // ... or .
5492                 if (cp === 46) {
5493                     var n1 = this.scanner.source.charCodeAt(this.scanner.index + 1);
5494                     var n2 = this.scanner.source.charCodeAt(this.scanner.index + 2);
5495                     var value = (n1 === 46 && n2 === 46) ? '...' : '.';
5496                     var start = this.scanner.index;
5497                     this.scanner.index += value.length;
5498                     return {
5499                         type: token_1.Token.Punctuator,
5500                         value: value,
5501                         lineNumber: this.scanner.lineNumber,
5502                         lineStart: this.scanner.lineStart,
5503                         start: start,
5504                         end: this.scanner.index
5505                     };
5506                 }
5507                 // `
5508                 if (cp === 96) {
5509                     // Only placeholder, since it will be rescanned as a real assignment expression.
5510                     return {
5511                         type: token_1.Token.Template,
5512                         lineNumber: this.scanner.lineNumber,
5513                         lineStart: this.scanner.lineStart,
5514                         start: this.scanner.index,
5515                         end: this.scanner.index
5516                     };
5517                 }
5518                 // Identifer can not contain backslash (char code 92).
5519                 if (character_1.Character.isIdentifierStart(cp) && (cp !== 92)) {
5520                     var start = this.scanner.index;
5521                     ++this.scanner.index;
5522                     while (!this.scanner.eof()) {
5523                         var ch = this.scanner.source.charCodeAt(this.scanner.index);
5524                         if (character_1.Character.isIdentifierPart(ch) && (ch !== 92)) {
5525                             ++this.scanner.index;
5526                         }
5527                         else if (ch === 45) {
5528                             // Hyphen (char code 45) can be part of an identifier.
5529                             ++this.scanner.index;
5530                         }
5531                         else {
5532                             break;
5533                         }
5534                     }
5535                     var id = this.scanner.source.slice(start, this.scanner.index);
5536                     return {
5537                         type: JSXToken.Identifier,
5538                         value: id,
5539                         lineNumber: this.scanner.lineNumber,
5540                         lineStart: this.scanner.lineStart,
5541                         start: start,
5542                         end: this.scanner.index
5543                     };
5544                 }
5545                 this.scanner.throwUnexpectedToken();
5546             };
5547             JSXParser.prototype.nextJSXToken = function () {
5548                 this.collectComments();
5549                 this.startMarker.index = this.scanner.index;
5550                 this.startMarker.lineNumber = this.scanner.lineNumber;
5551                 this.startMarker.lineStart = this.scanner.lineStart;
5552                 var token = this.lexJSX();
5553                 this.lastMarker.index = this.scanner.index;
5554                 this.lastMarker.lineNumber = this.scanner.lineNumber;
5555                 this.lastMarker.lineStart = this.scanner.lineStart;
5556                 if (this.config.tokens) {
5557                     this.tokens.push(this.convertToken(token));
5558                 }
5559                 return token;
5560             };
5561             JSXParser.prototype.nextJSXText = function () {
5562                 this.startMarker.index = this.scanner.index;
5563                 this.startMarker.lineNumber = this.scanner.lineNumber;
5564                 this.startMarker.lineStart = this.scanner.lineStart;
5565                 var start = this.scanner.index;
5566                 var text = '';
5567                 while (!this.scanner.eof()) {
5568                     var ch = this.scanner.source[this.scanner.index];
5569                     if (ch === '{' || ch === '<') {
5570                         break;
5571                     }
5572                     ++this.scanner.index;
5573                     text += ch;
5574                     if (character_1.Character.isLineTerminator(ch.charCodeAt(0))) {
5575                         ++this.scanner.lineNumber;
5576                         if (ch === '\r' && this.scanner.source[this.scanner.index] === '\n') {
5577                             ++this.scanner.index;
5578                         }
5579                         this.scanner.lineStart = this.scanner.index;
5580                     }
5581                 }
5582                 this.lastMarker.index = this.scanner.index;
5583                 this.lastMarker.lineNumber = this.scanner.lineNumber;
5584                 this.lastMarker.lineStart = this.scanner.lineStart;
5585                 var token = {
5586                     type: JSXToken.Text,
5587                     value: text,
5588                     lineNumber: this.scanner.lineNumber,
5589                     lineStart: this.scanner.lineStart,
5590                     start: start,
5591                     end: this.scanner.index
5592                 };
5593                 if ((text.length > 0) && this.config.tokens) {
5594                     this.tokens.push(this.convertToken(token));
5595                 }
5596                 return token;
5597             };
5598             JSXParser.prototype.peekJSXToken = function () {
5599                 var previousIndex = this.scanner.index;
5600                 var previousLineNumber = this.scanner.lineNumber;
5601                 var previousLineStart = this.scanner.lineStart;
5602                 this.scanner.scanComments();
5603                 var next = this.lexJSX();
5604                 this.scanner.index = previousIndex;
5605                 this.scanner.lineNumber = previousLineNumber;
5606                 this.scanner.lineStart = previousLineStart;
5607                 return next;
5608             };
5609             // Expect the next JSX token to match the specified punctuator.
5610             // If not, an exception will be thrown.
5611             JSXParser.prototype.expectJSX = function (value) {
5612                 var token = this.nextJSXToken();
5613                 if (token.type !== token_1.Token.Punctuator || token.value !== value) {
5614                     this.throwUnexpectedToken(token);
5615                 }
5616             };
5617             // Return true if the next JSX token matches the specified punctuator.
5618             JSXParser.prototype.matchJSX = function (value) {
5619                 var next = this.peekJSXToken();
5620                 return next.type === token_1.Token.Punctuator && next.value === value;
5621             };
5622             JSXParser.prototype.parseJSXIdentifier = function () {
5623                 var node = this.createJSXNode();
5624                 var token = this.nextJSXToken();
5625                 if (token.type !== JSXToken.Identifier) {
5626                     this.throwUnexpectedToken(token);
5627                 }
5628                 return this.finalize(node, new JSXNode.JSXIdentifier(token.value));
5629             };
5630             JSXParser.prototype.parseJSXElementName = function () {
5631                 var node = this.createJSXNode();
5632                 var elementName = this.parseJSXIdentifier();
5633                 if (this.matchJSX(':')) {
5634                     var namespace = elementName;
5635                     this.expectJSX(':');
5636                     var name_1 = this.parseJSXIdentifier();
5637                     elementName = this.finalize(node, new JSXNode.JSXNamespacedName(namespace, name_1));
5638                 }
5639                 else if (this.matchJSX('.')) {
5640                     while (this.matchJSX('.')) {
5641                         var object = elementName;
5642                         this.expectJSX('.');
5643                         var property = this.parseJSXIdentifier();
5644                         elementName = this.finalize(node, new JSXNode.JSXMemberExpression(object, property));
5645                     }
5646                 }
5647                 return elementName;
5648             };
5649             JSXParser.prototype.parseJSXAttributeName = function () {
5650                 var node = this.createJSXNode();
5651                 var attributeName;
5652                 var identifier = this.parseJSXIdentifier();
5653                 if (this.matchJSX(':')) {
5654                     var namespace = identifier;
5655                     this.expectJSX(':');
5656                     var name_2 = this.parseJSXIdentifier();
5657                     attributeName = this.finalize(node, new JSXNode.JSXNamespacedName(namespace, name_2));
5658                 }
5659                 else {
5660                     attributeName = identifier;
5661                 }
5662                 return attributeName;
5663             };
5664             JSXParser.prototype.parseJSXStringLiteralAttribute = function () {
5665                 var node = this.createJSXNode();
5666                 var token = this.nextJSXToken();
5667                 if (token.type !== token_1.Token.StringLiteral) {
5668                     this.throwUnexpectedToken(token);
5669                 }
5670                 var raw = this.getTokenRaw(token);
5671                 return this.finalize(node, new Node.Literal(token.value, raw));
5672             };
5673             JSXParser.prototype.parseJSXExpressionAttribute = function () {
5674                 var node = this.createJSXNode();
5675                 this.expectJSX('{');
5676                 this.finishJSX();
5677                 if (this.match('}')) {
5678                     this.tolerateError('JSX attributes must only be assigned a non-empty expression');
5679                 }
5680                 var expression = this.parseAssignmentExpression();
5681                 this.reenterJSX();
5682                 return this.finalize(node, new JSXNode.JSXExpressionContainer(expression));
5683             };
5684             JSXParser.prototype.parseJSXAttributeValue = function () {
5685                 return this.matchJSX('{') ? this.parseJSXExpressionAttribute() :
5686                     this.matchJSX('<') ? this.parseJSXElement() : this.parseJSXStringLiteralAttribute();
5687             };
5688             JSXParser.prototype.parseJSXNameValueAttribute = function () {
5689                 var node = this.createJSXNode();
5690                 var name = this.parseJSXAttributeName();
5691                 var value = null;
5692                 if (this.matchJSX('=')) {
5693                     this.expectJSX('=');
5694                     value = this.parseJSXAttributeValue();
5695                 }
5696                 return this.finalize(node, new JSXNode.JSXAttribute(name, value));
5697             };
5698             JSXParser.prototype.parseJSXSpreadAttribute = function () {
5699                 var node = this.createJSXNode();
5700                 this.expectJSX('{');
5701                 this.expectJSX('...');
5702                 this.finishJSX();
5703                 var argument = this.parseAssignmentExpression();
5704                 this.reenterJSX();
5705                 return this.finalize(node, new JSXNode.JSXSpreadAttribute(argument));
5706             };
5707             JSXParser.prototype.parseJSXAttributes = function () {
5708                 var attributes = [];
5709                 while (!this.matchJSX('/') && !this.matchJSX('>')) {
5710                     var attribute = this.matchJSX('{') ? this.parseJSXSpreadAttribute() :
5711                         this.parseJSXNameValueAttribute();
5712                     attributes.push(attribute);
5713                 }
5714                 return attributes;
5715             };
5716             JSXParser.prototype.parseJSXOpeningElement = function () {
5717                 var node = this.createJSXNode();
5718                 this.expectJSX('<');
5719                 var name = this.parseJSXElementName();
5720                 var attributes = this.parseJSXAttributes();
5721                 var selfClosing = this.matchJSX('/');
5722                 if (selfClosing) {
5723                     this.expectJSX('/');
5724                 }
5725                 this.expectJSX('>');
5726                 return this.finalize(node, new JSXNode.JSXOpeningElement(name, selfClosing, attributes));
5727             };
5728             JSXParser.prototype.parseJSXBoundaryElement = function () {
5729                 var node = this.createJSXNode();
5730                 this.expectJSX('<');
5731                 if (this.matchJSX('/')) {
5732                     this.expectJSX('/');
5733                     var name_3 = this.parseJSXElementName();
5734                     this.expectJSX('>');
5735                     return this.finalize(node, new JSXNode.JSXClosingElement(name_3));
5736                 }
5737                 var name = this.parseJSXElementName();
5738                 var attributes = this.parseJSXAttributes();
5739                 var selfClosing = this.matchJSX('/');
5740                 if (selfClosing) {
5741                     this.expectJSX('/');
5742                 }
5743                 this.expectJSX('>');
5744                 return this.finalize(node, new JSXNode.JSXOpeningElement(name, selfClosing, attributes));
5745             };
5746             JSXParser.prototype.parseJSXEmptyExpression = function () {
5747                 var node = this.createJSXChildNode();
5748                 this.collectComments();
5749                 this.lastMarker.index = this.scanner.index;
5750                 this.lastMarker.lineNumber = this.scanner.lineNumber;
5751                 this.lastMarker.lineStart = this.scanner.lineStart;
5752                 return this.finalize(node, new JSXNode.JSXEmptyExpression());
5753             };
5754             JSXParser.prototype.parseJSXExpressionContainer = function () {
5755                 var node = this.createJSXNode();
5756                 this.expectJSX('{');
5757                 var expression;
5758                 if (this.matchJSX('}')) {
5759                     expression = this.parseJSXEmptyExpression();
5760                     this.expectJSX('}');
5761                 }
5762                 else {
5763                     this.finishJSX();
5764                     expression = this.parseAssignmentExpression();
5765                     this.reenterJSX();
5766                 }
5767                 return this.finalize(node, new JSXNode.JSXExpressionContainer(expression));
5768             };
5769             JSXParser.prototype.parseJSXChildren = function () {
5770                 var children = [];
5771                 while (!this.scanner.eof()) {
5772                     var node = this.createJSXChildNode();
5773                     var token = this.nextJSXText();
5774                     if (token.start < token.end) {
5775                         var raw = this.getTokenRaw(token);
5776                         var child = this.finalize(node, new JSXNode.JSXText(token.value, raw));
5777                         children.push(child);
5778                     }
5779                     if (this.scanner.source[this.scanner.index] === '{') {
5780                         var container = this.parseJSXExpressionContainer();
5781                         children.push(container);
5782                     }
5783                     else {
5784                         break;
5785                     }
5786                 }
5787                 return children;
5788             };
5789             JSXParser.prototype.parseComplexJSXElement = function (el) {
5790                 var stack = [];
5791                 while (!this.scanner.eof()) {
5792                     el.children = el.children.concat(this.parseJSXChildren());
5793                     var node = this.createJSXChildNode();
5794                     var element = this.parseJSXBoundaryElement();
5795                     if (element.type === jsx_syntax_1.JSXSyntax.JSXOpeningElement) {
5796                         var opening = (element);
5797                         if (opening.selfClosing) {
5798                             var child = this.finalize(node, new JSXNode.JSXElement(opening, [], null));
5799                             el.children.push(child);
5800                         }
5801                         else {
5802                             stack.push(el);
5803                             el = { node: node, opening: opening, closing: null, children: [] };
5804                         }
5805                     }
5806                     if (element.type === jsx_syntax_1.JSXSyntax.JSXClosingElement) {
5807                         el.closing = (element);
5808                         var open_1 = getQualifiedElementName(el.opening.name);
5809                         var close_1 = getQualifiedElementName(el.closing.name);
5810                         if (open_1 !== close_1) {
5811                             this.tolerateError('Expected corresponding JSX closing tag for %0', open_1);
5812                         }
5813                         if (stack.length > 0) {
5814                             var child = this.finalize(el.node, new JSXNode.JSXElement(el.opening, el.children, el.closing));
5815                             el = stack.pop();
5816                             el.children.push(child);
5817                         }
5818                         else {
5819                             break;
5820                         }
5821                     }
5822                 }
5823                 return el;
5824             };
5825             JSXParser.prototype.parseJSXElement = function () {
5826                 var node = this.createJSXNode();
5827                 var opening = this.parseJSXOpeningElement();
5828                 var children = [];
5829                 var closing = null;
5830                 if (!opening.selfClosing) {
5831                     var el = this.parseComplexJSXElement({ node: node, opening: opening, closing: closing, children: children });
5832                     children = el.children;
5833                     closing = el.closing;
5834                 }
5835                 return this.finalize(node, new JSXNode.JSXElement(opening, children, closing));
5836             };
5837             JSXParser.prototype.parseJSXRoot = function () {
5838                 // Pop the opening '<' added from the lookahead.
5839                 if (this.config.tokens) {
5840                     this.tokens.pop();
5841                 }
5842                 this.startJSX();
5843                 var element = this.parseJSXElement();
5844                 this.finishJSX();
5845                 return element;
5846             };
5847             return JSXParser;
5848         }(parser_1.Parser));
5849         exports.JSXParser = JSXParser;
5850
5851
5852 /***/ },
5853 /* 12 */
5854 /***/ function(module, exports) {
5855
5856         // Generated by generate-xhtml-entities.js. DO NOT MODIFY!
5857         "use strict";
5858         exports.XHTMLEntities = {
5859             quot: '\u0022',
5860             amp: '\u0026',
5861             apos: '\u0027',
5862             gt: '\u003E',
5863             nbsp: '\u00A0',
5864             iexcl: '\u00A1',
5865             cent: '\u00A2',
5866             pound: '\u00A3',
5867             curren: '\u00A4',
5868             yen: '\u00A5',
5869             brvbar: '\u00A6',
5870             sect: '\u00A7',
5871             uml: '\u00A8',
5872             copy: '\u00A9',
5873             ordf: '\u00AA',
5874             laquo: '\u00AB',
5875             not: '\u00AC',
5876             shy: '\u00AD',
5877             reg: '\u00AE',
5878             macr: '\u00AF',
5879             deg: '\u00B0',
5880             plusmn: '\u00B1',
5881             sup2: '\u00B2',
5882             sup3: '\u00B3',
5883             acute: '\u00B4',
5884             micro: '\u00B5',
5885             para: '\u00B6',
5886             middot: '\u00B7',
5887             cedil: '\u00B8',
5888             sup1: '\u00B9',
5889             ordm: '\u00BA',
5890             raquo: '\u00BB',
5891             frac14: '\u00BC',
5892             frac12: '\u00BD',
5893             frac34: '\u00BE',
5894             iquest: '\u00BF',
5895             Agrave: '\u00C0',
5896             Aacute: '\u00C1',
5897             Acirc: '\u00C2',
5898             Atilde: '\u00C3',
5899             Auml: '\u00C4',
5900             Aring: '\u00C5',
5901             AElig: '\u00C6',
5902             Ccedil: '\u00C7',
5903             Egrave: '\u00C8',
5904             Eacute: '\u00C9',
5905             Ecirc: '\u00CA',
5906             Euml: '\u00CB',
5907             Igrave: '\u00CC',
5908             Iacute: '\u00CD',
5909             Icirc: '\u00CE',
5910             Iuml: '\u00CF',
5911             ETH: '\u00D0',
5912             Ntilde: '\u00D1',
5913             Ograve: '\u00D2',
5914             Oacute: '\u00D3',
5915             Ocirc: '\u00D4',
5916             Otilde: '\u00D5',
5917             Ouml: '\u00D6',
5918             times: '\u00D7',
5919             Oslash: '\u00D8',
5920             Ugrave: '\u00D9',
5921             Uacute: '\u00DA',
5922             Ucirc: '\u00DB',
5923             Uuml: '\u00DC',
5924             Yacute: '\u00DD',
5925             THORN: '\u00DE',
5926             szlig: '\u00DF',
5927             agrave: '\u00E0',
5928             aacute: '\u00E1',
5929             acirc: '\u00E2',
5930             atilde: '\u00E3',
5931             auml: '\u00E4',
5932             aring: '\u00E5',
5933             aelig: '\u00E6',
5934             ccedil: '\u00E7',
5935             egrave: '\u00E8',
5936             eacute: '\u00E9',
5937             ecirc: '\u00EA',
5938             euml: '\u00EB',
5939             igrave: '\u00EC',
5940             iacute: '\u00ED',
5941             icirc: '\u00EE',
5942             iuml: '\u00EF',
5943             eth: '\u00F0',
5944             ntilde: '\u00F1',
5945             ograve: '\u00F2',
5946             oacute: '\u00F3',
5947             ocirc: '\u00F4',
5948             otilde: '\u00F5',
5949             ouml: '\u00F6',
5950             divide: '\u00F7',
5951             oslash: '\u00F8',
5952             ugrave: '\u00F9',
5953             uacute: '\u00FA',
5954             ucirc: '\u00FB',
5955             uuml: '\u00FC',
5956             yacute: '\u00FD',
5957             thorn: '\u00FE',
5958             yuml: '\u00FF',
5959             OElig: '\u0152',
5960             oelig: '\u0153',
5961             Scaron: '\u0160',
5962             scaron: '\u0161',
5963             Yuml: '\u0178',
5964             fnof: '\u0192',
5965             circ: '\u02C6',
5966             tilde: '\u02DC',
5967             Alpha: '\u0391',
5968             Beta: '\u0392',
5969             Gamma: '\u0393',
5970             Delta: '\u0394',
5971             Epsilon: '\u0395',
5972             Zeta: '\u0396',
5973             Eta: '\u0397',
5974             Theta: '\u0398',
5975             Iota: '\u0399',
5976             Kappa: '\u039A',
5977             Lambda: '\u039B',
5978             Mu: '\u039C',
5979             Nu: '\u039D',
5980             Xi: '\u039E',
5981             Omicron: '\u039F',
5982             Pi: '\u03A0',
5983             Rho: '\u03A1',
5984             Sigma: '\u03A3',
5985             Tau: '\u03A4',
5986             Upsilon: '\u03A5',
5987             Phi: '\u03A6',
5988             Chi: '\u03A7',
5989             Psi: '\u03A8',
5990             Omega: '\u03A9',
5991             alpha: '\u03B1',
5992             beta: '\u03B2',
5993             gamma: '\u03B3',
5994             delta: '\u03B4',
5995             epsilon: '\u03B5',
5996             zeta: '\u03B6',
5997             eta: '\u03B7',
5998             theta: '\u03B8',
5999             iota: '\u03B9',
6000             kappa: '\u03BA',
6001             lambda: '\u03BB',
6002             mu: '\u03BC',
6003             nu: '\u03BD',
6004             xi: '\u03BE',
6005             omicron: '\u03BF',
6006             pi: '\u03C0',
6007             rho: '\u03C1',
6008             sigmaf: '\u03C2',
6009             sigma: '\u03C3',
6010             tau: '\u03C4',
6011             upsilon: '\u03C5',
6012             phi: '\u03C6',
6013             chi: '\u03C7',
6014             psi: '\u03C8',
6015             omega: '\u03C9',
6016             thetasym: '\u03D1',
6017             upsih: '\u03D2',
6018             piv: '\u03D6',
6019             ensp: '\u2002',
6020             emsp: '\u2003',
6021             thinsp: '\u2009',
6022             zwnj: '\u200C',
6023             zwj: '\u200D',
6024             lrm: '\u200E',
6025             rlm: '\u200F',
6026             ndash: '\u2013',
6027             mdash: '\u2014',
6028             lsquo: '\u2018',
6029             rsquo: '\u2019',
6030             sbquo: '\u201A',
6031             ldquo: '\u201C',
6032             rdquo: '\u201D',
6033             bdquo: '\u201E',
6034             dagger: '\u2020',
6035             Dagger: '\u2021',
6036             bull: '\u2022',
6037             hellip: '\u2026',
6038             permil: '\u2030',
6039             prime: '\u2032',
6040             Prime: '\u2033',
6041             lsaquo: '\u2039',
6042             rsaquo: '\u203A',
6043             oline: '\u203E',
6044             frasl: '\u2044',
6045             euro: '\u20AC',
6046             image: '\u2111',
6047             weierp: '\u2118',
6048             real: '\u211C',
6049             trade: '\u2122',
6050             alefsym: '\u2135',
6051             larr: '\u2190',
6052             uarr: '\u2191',
6053             rarr: '\u2192',
6054             darr: '\u2193',
6055             harr: '\u2194',
6056             crarr: '\u21B5',
6057             lArr: '\u21D0',
6058             uArr: '\u21D1',
6059             rArr: '\u21D2',
6060             dArr: '\u21D3',
6061             hArr: '\u21D4',
6062             forall: '\u2200',
6063             part: '\u2202',
6064             exist: '\u2203',
6065             empty: '\u2205',
6066             nabla: '\u2207',
6067             isin: '\u2208',
6068             notin: '\u2209',
6069             ni: '\u220B',
6070             prod: '\u220F',
6071             sum: '\u2211',
6072             minus: '\u2212',
6073             lowast: '\u2217',
6074             radic: '\u221A',
6075             prop: '\u221D',
6076             infin: '\u221E',
6077             ang: '\u2220',
6078             and: '\u2227',
6079             or: '\u2228',
6080             cap: '\u2229',
6081             cup: '\u222A',
6082             int: '\u222B',
6083             there4: '\u2234',
6084             sim: '\u223C',
6085             cong: '\u2245',
6086             asymp: '\u2248',
6087             ne: '\u2260',
6088             equiv: '\u2261',
6089             le: '\u2264',
6090             ge: '\u2265',
6091             sub: '\u2282',
6092             sup: '\u2283',
6093             nsub: '\u2284',
6094             sube: '\u2286',
6095             supe: '\u2287',
6096             oplus: '\u2295',
6097             otimes: '\u2297',
6098             perp: '\u22A5',
6099             sdot: '\u22C5',
6100             lceil: '\u2308',
6101             rceil: '\u2309',
6102             lfloor: '\u230A',
6103             rfloor: '\u230B',
6104             loz: '\u25CA',
6105             spades: '\u2660',
6106             clubs: '\u2663',
6107             hearts: '\u2665',
6108             diams: '\u2666',
6109             lang: '\u27E8',
6110             rang: '\u27E9'
6111         };
6112
6113
6114 /***/ },
6115 /* 13 */
6116 /***/ function(module, exports) {
6117
6118         "use strict";
6119         exports.JSXSyntax = {
6120             JSXAttribute: 'JSXAttribute',
6121             JSXClosingElement: 'JSXClosingElement',
6122             JSXElement: 'JSXElement',
6123             JSXEmptyExpression: 'JSXEmptyExpression',
6124             JSXExpressionContainer: 'JSXExpressionContainer',
6125             JSXIdentifier: 'JSXIdentifier',
6126             JSXMemberExpression: 'JSXMemberExpression',
6127             JSXNamespacedName: 'JSXNamespacedName',
6128             JSXOpeningElement: 'JSXOpeningElement',
6129             JSXSpreadAttribute: 'JSXSpreadAttribute',
6130             JSXText: 'JSXText'
6131         };
6132
6133
6134 /***/ },
6135 /* 14 */
6136 /***/ function(module, exports, __webpack_require__) {
6137
6138         "use strict";
6139         var jsx_syntax_1 = __webpack_require__(13);
6140         var JSXClosingElement = (function () {
6141             function JSXClosingElement(name) {
6142                 this.type = jsx_syntax_1.JSXSyntax.JSXClosingElement;
6143                 this.name = name;
6144             }
6145             return JSXClosingElement;
6146         }());
6147         exports.JSXClosingElement = JSXClosingElement;
6148         var JSXElement = (function () {
6149             function JSXElement(openingElement, children, closingElement) {
6150                 this.type = jsx_syntax_1.JSXSyntax.JSXElement;
6151                 this.openingElement = openingElement;
6152                 this.children = children;
6153                 this.closingElement = closingElement;
6154             }
6155             return JSXElement;
6156         }());
6157         exports.JSXElement = JSXElement;
6158         var JSXEmptyExpression = (function () {
6159             function JSXEmptyExpression() {
6160                 this.type = jsx_syntax_1.JSXSyntax.JSXEmptyExpression;
6161             }
6162             return JSXEmptyExpression;
6163         }());
6164         exports.JSXEmptyExpression = JSXEmptyExpression;
6165         var JSXExpressionContainer = (function () {
6166             function JSXExpressionContainer(expression) {
6167                 this.type = jsx_syntax_1.JSXSyntax.JSXExpressionContainer;
6168                 this.expression = expression;
6169             }
6170             return JSXExpressionContainer;
6171         }());
6172         exports.JSXExpressionContainer = JSXExpressionContainer;
6173         var JSXIdentifier = (function () {
6174             function JSXIdentifier(name) {
6175                 this.type = jsx_syntax_1.JSXSyntax.JSXIdentifier;
6176                 this.name = name;
6177             }
6178             return JSXIdentifier;
6179         }());
6180         exports.JSXIdentifier = JSXIdentifier;
6181         var JSXMemberExpression = (function () {
6182             function JSXMemberExpression(object, property) {
6183                 this.type = jsx_syntax_1.JSXSyntax.JSXMemberExpression;
6184                 this.object = object;
6185                 this.property = property;
6186             }
6187             return JSXMemberExpression;
6188         }());
6189         exports.JSXMemberExpression = JSXMemberExpression;
6190         var JSXAttribute = (function () {
6191             function JSXAttribute(name, value) {
6192                 this.type = jsx_syntax_1.JSXSyntax.JSXAttribute;
6193                 this.name = name;
6194                 this.value = value;
6195             }
6196             return JSXAttribute;
6197         }());
6198         exports.JSXAttribute = JSXAttribute;
6199         var JSXNamespacedName = (function () {
6200             function JSXNamespacedName(namespace, name) {
6201                 this.type = jsx_syntax_1.JSXSyntax.JSXNamespacedName;
6202                 this.namespace = namespace;
6203                 this.name = name;
6204             }
6205             return JSXNamespacedName;
6206         }());
6207         exports.JSXNamespacedName = JSXNamespacedName;
6208         var JSXOpeningElement = (function () {
6209             function JSXOpeningElement(name, selfClosing, attributes) {
6210                 this.type = jsx_syntax_1.JSXSyntax.JSXOpeningElement;
6211                 this.name = name;
6212                 this.selfClosing = selfClosing;
6213                 this.attributes = attributes;
6214             }
6215             return JSXOpeningElement;
6216         }());
6217         exports.JSXOpeningElement = JSXOpeningElement;
6218         var JSXSpreadAttribute = (function () {
6219             function JSXSpreadAttribute(argument) {
6220                 this.type = jsx_syntax_1.JSXSyntax.JSXSpreadAttribute;
6221                 this.argument = argument;
6222             }
6223             return JSXSpreadAttribute;
6224         }());
6225         exports.JSXSpreadAttribute = JSXSpreadAttribute;
6226         var JSXText = (function () {
6227             function JSXText(value, raw) {
6228                 this.type = jsx_syntax_1.JSXSyntax.JSXText;
6229                 this.value = value;
6230                 this.raw = raw;
6231             }
6232             return JSXText;
6233         }());
6234         exports.JSXText = JSXText;
6235
6236
6237 /***/ },
6238 /* 15 */
6239 /***/ function(module, exports, __webpack_require__) {
6240
6241         "use strict";
6242         var scanner_1 = __webpack_require__(8);
6243         var error_handler_1 = __webpack_require__(6);
6244         var token_1 = __webpack_require__(7);
6245         var Reader = (function () {
6246             function Reader() {
6247                 this.values = [];
6248                 this.curly = this.paren = -1;
6249             }
6250             ;
6251             // A function following one of those tokens is an expression.
6252             Reader.prototype.beforeFunctionExpression = function (t) {
6253                 return ['(', '{', '[', 'in', 'typeof', 'instanceof', 'new',
6254                     'return', 'case', 'delete', 'throw', 'void',
6255                     // assignment operators
6256                     '=', '+=', '-=', '*=', '**=', '/=', '%=', '<<=', '>>=', '>>>=',
6257                     '&=', '|=', '^=', ',',
6258                     // binary/unary operators
6259                     '+', '-', '*', '**', '/', '%', '++', '--', '<<', '>>', '>>>', '&',
6260                     '|', '^', '!', '~', '&&', '||', '?', ':', '===', '==', '>=',
6261                     '<=', '<', '>', '!=', '!=='].indexOf(t) >= 0;
6262             };
6263             ;
6264             // Determine if forward slash (/) is an operator or part of a regular expression
6265             // https://github.com/mozilla/sweet.js/wiki/design
6266             Reader.prototype.isRegexStart = function () {
6267                 var previous = this.values[this.values.length - 1];
6268                 var regex = (previous !== null);
6269                 switch (previous) {
6270                     case 'this':
6271                     case ']':
6272                         regex = false;
6273                         break;
6274                     case ')':
6275                         var check = this.values[this.paren - 1];
6276                         regex = (check === 'if' || check === 'while' || check === 'for' || check === 'with');
6277                         break;
6278                     case '}':
6279                         // Dividing a function by anything makes little sense,
6280                         // but we have to check for that.
6281                         regex = false;
6282                         if (this.values[this.curly - 3] === 'function') {
6283                             // Anonymous function, e.g. function(){} /42
6284                             var check_1 = this.values[this.curly - 4];
6285                             regex = check_1 ? !this.beforeFunctionExpression(check_1) : false;
6286                         }
6287                         else if (this.values[this.curly - 4] === 'function') {
6288                             // Named function, e.g. function f(){} /42/
6289                             var check_2 = this.values[this.curly - 5];
6290                             regex = check_2 ? !this.beforeFunctionExpression(check_2) : true;
6291                         }
6292                 }
6293                 return regex;
6294             };
6295             ;
6296             Reader.prototype.push = function (token) {
6297                 if (token.type === token_1.Token.Punctuator || token.type === token_1.Token.Keyword) {
6298                     if (token.value === '{') {
6299                         this.curly = this.values.length;
6300                     }
6301                     else if (token.value === '(') {
6302                         this.paren = this.values.length;
6303                     }
6304                     this.values.push(token.value);
6305                 }
6306                 else {
6307                     this.values.push(null);
6308                 }
6309             };
6310             ;
6311             return Reader;
6312         }());
6313         var Tokenizer = (function () {
6314             function Tokenizer(code, config) {
6315                 this.errorHandler = new error_handler_1.ErrorHandler();
6316                 this.errorHandler.tolerant = config ? (typeof config.tolerant === 'boolean' && config.tolerant) : false;
6317                 this.scanner = new scanner_1.Scanner(code, this.errorHandler);
6318                 this.scanner.trackComment = config ? (typeof config.comment === 'boolean' && config.comment) : false;
6319                 this.trackRange = config ? (typeof config.range === 'boolean' && config.range) : false;
6320                 this.trackLoc = config ? (typeof config.loc === 'boolean' && config.loc) : false;
6321                 this.buffer = [];
6322                 this.reader = new Reader();
6323             }
6324             ;
6325             Tokenizer.prototype.errors = function () {
6326                 return this.errorHandler.errors;
6327             };
6328             ;
6329             Tokenizer.prototype.getNextToken = function () {
6330                 if (this.buffer.length === 0) {
6331                     var comments = this.scanner.scanComments();
6332                     if (this.scanner.trackComment) {
6333                         for (var i = 0; i < comments.length; ++i) {
6334                             var e = comments[i];
6335                             var comment = void 0;
6336                             var value = this.scanner.source.slice(e.slice[0], e.slice[1]);
6337                             comment = {
6338                                 type: e.multiLine ? 'BlockComment' : 'LineComment',
6339                                 value: value
6340                             };
6341                             if (this.trackRange) {
6342                                 comment.range = e.range;
6343                             }
6344                             if (this.trackLoc) {
6345                                 comment.loc = e.loc;
6346                             }
6347                             this.buffer.push(comment);
6348                         }
6349                     }
6350                     if (!this.scanner.eof()) {
6351                         var loc = void 0;
6352                         if (this.trackLoc) {
6353                             loc = {
6354                                 start: {
6355                                     line: this.scanner.lineNumber,
6356                                     column: this.scanner.index - this.scanner.lineStart
6357                                 },
6358                                 end: {}
6359                             };
6360                         }
6361                         var token = void 0;
6362                         if (this.scanner.source[this.scanner.index] === '/') {
6363                             token = this.reader.isRegexStart() ? this.scanner.scanRegExp() : this.scanner.scanPunctuator();
6364                         }
6365                         else {
6366                             token = this.scanner.lex();
6367                         }
6368                         this.reader.push(token);
6369                         var entry = void 0;
6370                         entry = {
6371                             type: token_1.TokenName[token.type],
6372                             value: this.scanner.source.slice(token.start, token.end)
6373                         };
6374                         if (this.trackRange) {
6375                             entry.range = [token.start, token.end];
6376                         }
6377                         if (this.trackLoc) {
6378                             loc.end = {
6379                                 line: this.scanner.lineNumber,
6380                                 column: this.scanner.index - this.scanner.lineStart
6381                             };
6382                             entry.loc = loc;
6383                         }
6384                         if (token.regex) {
6385                             entry.regex = token.regex;
6386                         }
6387                         this.buffer.push(entry);
6388                     }
6389                 }
6390                 return this.buffer.shift();
6391             };
6392             ;
6393             return Tokenizer;
6394         }());
6395         exports.Tokenizer = Tokenizer;
6396
6397
6398 /***/ }
6399 /******/ ])
6400 });
6401 ;