[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

Search

title

Body

[close]

/wp-includes/js/codemirror/ -> esprima.js (source)

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


Generated : Mon Jun 15 08:20:09 2026 Cross-referenced by PHPXref